[FLASH-USERS] Guard cell filling only one variable

Klaus Weide klaus at flash.uchicago.edu
Wed Jul 18 10:23:47 EDT 2012


On Wed, 18 Jul 2012, Seyit Hocuk wrote:

> If I want to do a guardcell filling (Grid_fillGuardCells) of only one variable
> (for computational speed) how do I do that?

Hello Seyit,

For that purpose, use the 'mask' optional argument to Grid_fillGuardCells.
See below.

> Perhaps it isn't any faster anyway?

That's for you to determine, for your specific use.

Another advantage of masked guard cell filling that is sometimes more 
important: Paramesh does not have to allocate as much buffer space as
when communicating guard cells for all variables.

> To gain speed, I've already changed my line from
> call Grid_fillGuardCells(CENTER, ALLDIR)
> to
> call Grid_fillGuardCells(CENTER, ALLDIR, minLayers=1, selectBlockType=LEAF)

I am curious whether you noticed any speedup from this.

> Can you give an example on say DENS_VAR? And what is this WORK?

WORK is an array for additional block data, similar to 'unk' (which holds 
the usual CENTER variables) but with space only for 1 variable (at least 
by default). It is only available with Paramesh (not Uniform Grid). While 
you could copy your data (say, DENS_VAR) to the 'work' array, then do a 
guard cell fill on WORK, and then copy everything back to 'unk'.  But I 
wouldn't recommend that.  (WORK is mostly there to support older code that 
uses it; in particular our geometric Multigrid solvers, see code under 
GridSolvers.)

A simple example use of guard cell masking:

   logical, dimension(NUNK_VARS) :: gcMask
   ...
   gcMask(:) = .FALSE. 
   gcMask(DENS_VAR) = .TRUE.   ! Only DENS_VAR should be turned on
   call Grid_fillGuardCells(CENTER,ALLDIR,maskSize=NUNK_VARS, mask=gcMask)

**NOTE**

For masking to take any effect, the runtime parameter enableMaskedGCFill 
needs to be TRUE. Otherwise, Grid_fillGuardCells will act as if you had 
not specified any mask, i.e., guard cells for all variables will still be 
exchanged. 

I believe this RP is off by default in the released code. So you should put
  enableMaskedGCFill = .TRUE.
in your parfile.

Please let us know if this is useful, and if you find that this can 
speed up your simulation significantly!

Klaus



More information about the flash-users mailing list