[FLASH-USERS] Space-dependent boundary conditions

Klaus Weide klaus at flash.uchicago.edu
Tue Feb 25 10:35:08 EST 2014


On Tue, 25 Feb 2014, Magyar Norbert wrote:

> Dear all,
> 
> I encountered a problem for which I need space-dependent boundary
> conditions in 3D MHD simulations (with USM and AMR), e.g. a dipole-shaped
> perturbation in the velocity at some boundary. However, I found no
> reference to space-dependent boundaries in the user manual or this forum. I
> tried to figure it out myself, without success. (I tried using
> Grid_getcellCoords)
> Have you done something similar before in FLASH?

You should be using gr_extendedGetCellCoords (instead of 
Grid_getcellCoords) within your own implementation of 
Grid_bcApplyToRegionSpecialized.F90 or Grid_bcApplyToRegion.F90.

(As long as you are testing with only one MPI task, the difference between 
gr_extendedGetCellCoords and Grid_getcellCoords should not be relevant - 
except for the different argument list.)

To verify that you have got the arguments to gr_extendedGetCellCoords or
Grid_getcellCoords right - especially the array size - temporarily compile
those routines with DEBUG_GRID defined; see the top of the souce code of 
those two.

Here are some examples of code (included in recent releases) that may help 
you get the calls right:

 * source/Grid/GridBoundaryConditions/Flash3HSE/Grid_bcApplyToRegion.F90
 * source/Simulation/SimulationMain/HydroStatic/Grid_bcApplyToRegionSpecialized.F90
   (Code commented out with #if(0)...#endif; you may want to uncomment 
   this and try it.)


For USM you will have to be careful to initialize the magnetic fields 
correctly and consistently between blocks, but that should be a separate 
issue from the location-dependence - at least if your boundary conditions 
for magnetic fields are not directly space-dependent!

Klaus



More information about the flash-users mailing list