[FLASH-USERS] No Default nDim setting?

Klaus Weide klaus at flash.uchicago.edu
Wed Aug 26 19:18:56 EDT 2015


On Wed, 26 Aug 2015, Ryan Farber wrote:

> I think I've found a bug but I'd like to see if someone else
> can reproduce it (or if it is actually intended behavior).
> 
> I have a Config file in
> "FLASH*/source/physics/Hydro/HydroMain/unsplit/MHD_StaggeredMesh_CosmicRays"
> which calls SETUPERROR if nDim == 1
> 
> 
> IF nDim == 1
> 
>   SETUPERROR This unit is presently incompatible with 1D because it
> requires a magnetic field to determine diffusivity direction.
> 
> ENDIF
> 
> 
> When I try to setup a problem that uses this Config file via
> 
> ./setup magnetoHD/CosRay -auto
> 
> it fails, complaining that nDim is not set.

The setup variable nDim will only be set if one of the setup flags 
-1d, -2d, or -3d is explicitly used. (This is somewhat inconsistent with 
other setup variables like maxBlocks or nxb, nyb, and nzb, which are 
always automatically defined, using default values if necessary.)


> If I include "-3d" in the ./setup command then setup succeeds.
> 
> 
> In the User's Guide
> <http://flash.uchicago.edu/site/flashcode/user_support/flash4_ug_4p3.pdf>,
> p. 44 (explaining -[123]d option) it says that
> 
> 
> By default, setup creates a makefile which produces a FLASH executable
> capable of solving two-dimensional problems (equivalent to -2d).
> 
> So I would think nDim should default to 2 rather than be unset.

The statement about the created makefile (i.e., Makefile.h) is correct.
A makefile for a 2D simulation will be created in either case, whether 
nDim is 2 or undefined. The difference between running setup with 
an explicit -2d flag and without any -<N>d flag appears only at the level 
of setup variables, namely in the definition of the nDim variable.

You should use a USESETUPVARS statement in your Config file, as in:

  USESETUPVARS nDim

After this, an undefined nDim will appear as an empty string, which will
prevent the setup failure in your case.


If you wanted to test for a 2D case instead of a 1D case, you should use

  IF nDim == '' or nDim == 2

instead.

Klaus



More information about the flash-users mailing list