parrsm question

Questions and remarks about code_saturne usage
Forum rules
Please read the forum usage recommendations before posting.
Post Reply
FannyD
Posts: 7
Joined: Thu Jan 07, 2016 8:51 am

parrsm question

Post by FannyD »

Hello,

I’m doing a classical simulation of the buoyancy driven mixing of two fluids in a sloping channel.
The simulation gives good results, but I’m having some worries with the computation of front velocity when running parallel simulation.

I’m working with a 2D rectangular and uniform mesh, x being the horizontal direction and z the vertical one.
Basically, I want to integrate the density over the z direction for all x values.
I'm working with version 3.0.7 .

Here is the problematic part of my code:

Code: Select all

double precision, allocatable, dimension(:) :: hauteurfx 
double precision dx, dz
integer nb_mesh_x, nb_mesh_z, ii, jj
…
nb_mesh_x = 1500  ! number of cells in the horizontal direction
nb_mesh_z = 250  ! number of cells in the vertical direction
dx = 20 / float(nb_mesh_x)  
dz = 1.0 / float(nb_mesh_z)

! Integration of the density in each x abscissa 
allocate(hauteurfx(nb_mesh_x))
hauteurfx = hauteurfx*0.d0 ! initialisation for security
do ii=1,ncel
  !calculation of the absciss
  jj = int(floor(xyzcen(1,ii)/dx))+1
  hauteurfx(jj) = hauteurfx(jj) + propce(ii,irom) * dz
 ! hauteurfx(jj) = 1.0
enddo
  ! sum over all procs
  if (irangp.ge.0) then
    call parrsm(nb_mesh_x, hauteurfx)
When running this code on one time step, the array hauteurfx had reasonably good values except for a few points, where I get a NaN result.

I check the code with a single process, all work fine.
In order to understand the way parrsm work, I try to replace ‘hauteurfx(jj) = 1.0’, expecting to get a result between 1 and 16 (number of procs I’m using). Instead, I get strange values, seeming to follow the law
hauteurfx(x) = n_procs(x) * nb_mesh_x + 1
nprocs(x) being the number of procs ‘encountered’ at the x abscissa…

I’ve to admit I’m completely lost here. If someone could help me, I’ll be more than grateful!

Thank in advance for helping.

Fanny
Yvan Fournier
Posts: 4208
Joined: Mon Feb 20, 2012 3:25 pm

Re: parrsm question

Post by Yvan Fournier »

Hello,

I'm not sure the problem is due to parrsm:

When you initialize hauteurfx:
hauteurfx = hauteurfx*0.d0 ! initialisation for security
you multiply something that might contain NaN's by zero.

Simply using:
hauteurfx = 0.d0 ! initialisation for security
would seem safer.

Regards,

Yvan
FannyD
Posts: 7
Joined: Thu Jan 07, 2016 8:51 am

Re: parrsm question

Post by FannyD »

I thought I had to intialise an array either with a loop over is components, either by multiplying it by an array of the same size.

With your correction, it works just fine.
I'm still wondering why it worked on one proc, the error was (once again) a silly one. But whatever.

Thank you for your help.
Post Reply