[FLASH-USERS] Hydrostatic BC, etc: How to make it work in FLASH 3.0
Klaus Weide
klaus at flash.uchicago.edu
Wed Jul 16 15:58:50 EDT 2008
Summarizing from recent exchanges with Mateusz <mateuszr at umich.edu>:
1) To make the hydrostatic boundary conditions included with FLASH3 (or
any user-supplied alternative implementation) work correctly, the
following should be added to a simulations's flash.par file:
enableMaskedGCFill = .FALSE.
This was an oversight; this flag probably should default to FALSE anyway.
Background:
The runtime parameter enableMaskedGCFill turns "masked guard cell filling"
on, for improved performance (not all variables need to have guard cells
filled all the time when Grid_fillGuardCells is called). We have tested
the masked guard cell filling before the FLASH3 release quite thoroughly,
and don't know of any problems with it except in connection with
hydrostatic BCs.
The Grid unit includes logic that determines the set of variables for
which guard cells need to be communicated (based on requirements specified
by the caller of Grid_fillGuardCells). This logic does not take into
account that some variables are always required as input for hydrostatic
BC implementations (in particular, pressure).
This will be fixed in a future FLASH release, by making enableMaskedGCFill
default to .FALSE. and/or by considering such requirements in the guard
cell masking logic.
2) To make hydrostatic boundary conditions work with the staggered mesh
MHD solver - or, more generally, with any setup that uses face variables
[FACEVAR keyword in a Config file]:
Handling for some overlooked cases (filling of guard cells for face
variables) needs to be added to the code. Probably the simples way
is the following:
In source/Grid/GridBoundaryConditions/OneRow/Grid_applyBCEdge.F90,
in order to have guard cells for a face variable at domain boundaries
of type "hydrostatic+nvrefl" filled as if this was a "reflecting"
boundary, change
case(REFLECTING)
to
case(REFLECTING,HYDROSTATIC_F2_NVREFL)
Similarly, to have guard cells for a face variable at domain boundaries
of type "hydrostatic+nvout" filled as if this was an "outflow"
boundary, change
case(OUTFLOW)
to
case(OUTFLOW,HYDROSTATIC_F2_NVOUT)
and to have guard cells for a face variable at domain boundaries
of type "hydrostatic+nvdiode" filled as if this was a "diode"
boundary, change
case(DIODE)
to
case(DIODE,HYDROSTATIC_F2_NVDIODE)
Background:
For simple boundary conditions like "outflow", "reflecting", and "diode",
guard cells for face variables are generally filled at domain boundaries
by using the same rules as for cell-centered variables: by copying values
from the last interior cell for "outflow", or copying values from the last
few cell layers for "reflecting" (with some special handling for
velocities), etc. The above changes let the code handle face variables
for hydrostatic-variant BCs in similar ways. Whether this handling
is appropriate depends on the problem, of course.
The staggered mesh MHD implementation uses face variables for
divergence-free magnetic fields.
3) Finally, Mateusz found some errors in the code that actually implements
the FLASH2-style hydrostatic boundary conditions, in
../source/Grid/GridBoundaryConditions/Flash2HSE/gr_applyFlash2HSEBC.F90.
The errors will eventually be corrected, but they are in code that can
only be enabled by editing the source file. Basically, be warned if
you are editing gr_applyFlash2HSEBC.F90, don't assume that the code
that is disabled is correct.
Klaus Weide
More information about the flash-users
mailing list