[FLASH-USERS] Divergence free boundary conditions

Klaus Weide klaus at flash.uchicago.edu
Mon Nov 9 16:14:26 EST 2020


On Mon, 9 Nov 2020, abi sahade wrote:

> Now, I am trying to write an outflow for MAGY_VAR and determine MAGX_VAR 
> to enforce divB=0 in guard cells. Basically, I want to try: 
> [Bx(i+1)-Bx(i)]/Dx + [By(i+1)-By(i)]/Dy = 0. The problem is with faces, if 
> I am in case gridDataStruct == FACEX, can I call By field in FACEY? I have 
> not found how.

> I would appreciate any idea about this or other way to solve this problem, thanks in advance!

Hi Abril,

I will not discuss whether your approach is likely to solve your problem - 
maybe others can jump in. However, I want to point you to some code that 
exists in FLASH and that will allow you to experiment with the kind of 
boundary condition that you are describing. Activating this code may not be 
completely trivial, so I hope you are comfortable with making some code 
changes and trying things out.

See the file 
  Grid/GridBoundaryConditions/Grid_bcApplyToRegionMixedGds.F90.forUSM .
If enabled, the subroutine Grid_bcApplyToRegionMixedGds should be called 
(for each guard cell region at a boundary) as an additional pass, AFTER
guard cells for CENTER, FACEX, FACEY, etc. have already been modified
according to the usual Grid_bcApplyToRegion and/or 
Grid_bcApplyToRegionSpecialized methods. Grid_bcApplyToRegion*MixedGds*
will be passed pointers to cell-centered, normal face-centered, AND 
transverse face-centered region data in each invocation. The 
implementation can modify any of the variables in the guard cell portion of 
any of those data structures.

By default only a stub implementation is called (if any), which does not 
do anything. To try the code in Grid_bcApplyToRegionMixedGds.F90.forUSM,
copy it into your simulation directory (without the extra '.forUSM' 
suffix). That code may already implement what you want (see the different 
cases of 'divbBcEnforcement'), or more likely you will want to modify it 
for your purpose.

Disclaimers: To my knowledge, this mechanism has not been tested well and 
has not been used in applications. The documentation at the top of source
files, in particular Grid_bcApplyToRegionMixedGds.F90, is not complete and 
may be misleading.


Klaus



More information about the flash-users mailing list