-
Notifications
You must be signed in to change notification settings - Fork 118
SMR and AMR
Static Mesh Refinement means that some regions of the computational domain are covered by finer grids but they are fixed and not adaptive. This is not as flexible as AMR, but this is faster (and easier to analyze) than AMR and is often useful enough in some problems in astrophysics. So we recommend to use SMR instead of AMR if the regions of interest are known in advance. For the details of the grid structure, see Static Mesh Refinement.
Let us go back to the blast wave test in Cartesian coordinate again, and say we want to resolve the region near the center of the explosion (note: this is just an example and not physically motivated - you probably want to resolve the shock front, and see below for such applications with AMR).
First, because SMR involves complicated grid structure, the HDF5 output is recommended. To configure the code with HDF5,
> python configure.py --prob blast --flux hlld -b -hdf5
This configuration includes magnetic fields. To enable MPI parallelization, simply add "-m" option. Note that no additional option is required for SMR and AMR.
In the previous example, the root grid was 64^3, and the explosion happens at the center of the grid. Let us place grids near the center. First, you have to set refinement flag to static in the input file. Then the computational domain must be decomposed into smaller MeshBlocks, because a MeshBlock is the unit of refinement. As smaller MeshBlocks are more flexible but computationally inefficient, the size of Meshblocks must be set carefully. The following example produces MeshBlocks with 16^3 cells:
<mesh>
...
refinement = static
<meshblock>
nx1 = 16
nx2 = 16
nx3 = 16
Then we have to specify regions to be refined. In order to get twice higher resolution near the center, add the following block:
<refinement1>
x1min=-0.5
x1max= 0.5
x2min=-0.5
x2max= 0.5
x3min=-0.5
x3max= 0.5
level=1
You can add more blocks like refinement2, refinement3... It is OK even if the refinement regions overlap each other - the code generates the minimum set of the grid satisfying all the conditions. If you want to get even higher resolution, simply set a higher level.
Before actually running the simulation, it is highly recommended to check the grid structure by running the code with -m option.
> ~/athena/bin/athena -i athinput.example -m 1
Root grid = 4 x 4 x 4 MeshBlocks
Total number of MeshBlocks = 120
Number of physical refinement levels = 1
Number of logical refinement levels = 3
Physical level = 0 (logical level = 2): 56 MeshBlocks, cost = 56
Physical level = 1 (logical level = 3): 64 MeshBlocks, cost = 64
Number of parallel ranks = 1
Rank = 0: 120 MeshBlocks, cost = 120
Load Balancing:
Minimum cost = 1, Maximum cost = 1, Average cost = 1
See the 'mesh_structure.dat' file for a complete list of MeshBlocks.
Use 'python ../vis/python/plot_mesh.py' or gnuplot to visualize mesh structure.
This outputs the list of MeshBlocks created, as well as load balance if you specify the number of processes you want to use with the "-m" option. This option also generates "mesh_structure.dat", which can be read using gnuplot.
> gnuplot
> splot "mesh_structure.dat" w l
Getting Started
User Guide
- Configuring
- Compiling
- The Input File
- Problem Generators
- Boundary Conditions
- Coordinate Systems and Meshes
- Running the Code
- Outputs
- Using MPI and OpenMP
- Static Mesh Refinement
- Adaptive Mesh Refinement
- Load Balancing
- Special Relativity
- General Relativity
- Passive Scalars
- Shearing Box
- Diffusion Processes
- General Equation of State
- FFT
- High-Order Methods
- Super-Time-Stepping
- Orbital Advection
- Rotating System
- Reading Data from External Files
Programmer Guide