You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: Docs/sphinx_documentation/source/AmrCore.rst
+38-39Lines changed: 38 additions & 39 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -25,7 +25,7 @@
25
25
26
26
.. _fig:Adv:
27
27
28
-
.. table:: Time sequence (:math:`t=0,0.5,1,1.5,2` s) of advection of a Gaussian profile using the SingleVortex tutorial. The analytic velocity field distorts the profile, and then restores the profile to the original configuration. The red, green, and blue boxes indicate grids at AMR levels :math:`\ell=0,1`, and :math:`2`.
28
+
.. table:: Time sequence (:math:`t=0,0.5, 1, 1.5,2` s) of advection of a Gaussian profile using the SingleVortex tutorial. The analytic velocity field distorts the profile, and then restores the profile to its original configuration. The red, green, and blue boxes indicate grids at AMR levels :math:`\ell=0,1`, and :math:`2`.
29
29
:align: center
30
30
31
31
+-----+-----+-----+-----+-----+
@@ -85,7 +85,7 @@ The protected data members are:
85
85
Vector<BoxArray> grids;
86
86
87
87
The following parameters are frequently set via the inputs file or the command line.
88
-
Their usage is described in the section on :ref:`sec:grid_creation`
88
+
Their usage is described in the section on :ref:`sec:grid_creation`.
89
89
90
90
.. raw:: latex
91
91
@@ -127,9 +127,9 @@ have any data members, just additional member functions, some of which override
127
127
the base class AmrMesh.
128
128
129
129
There are no pure virtual functions in :cpp:`AmrMesh`, but
130
-
there are 5 pure virtual functions in the :cpp:`AmrCore` class. Any applications
130
+
there are five pure virtual functions in the :cpp:`AmrCore` class. Any applications
131
131
you create must implement these functions. The tutorial code
132
-
Amr/Advection_AmrCore provides sample implementation in the derived
132
+
Amr/Advection_AmrCore provides a sample implementation in the derived
133
133
class :cpp:`AmrCoreAdv`.
134
134
135
135
.. highlight:: c++
@@ -162,8 +162,8 @@ Refer to the :cpp:`AmrCoreAdv` class in the
These classes are used in the grid generation process.
169
169
The :cpp:`TagBox` class is essentially a data structure that marks which
@@ -193,15 +193,15 @@ FillPatchUtil and Interpolater
193
193
:cpp:`operator()` that fills domain boundaries for a :cpp:`MultiFab`.
194
194
195
195
Many codes, including the Advection_AmrCore example, contain an array of MultiFabs
196
-
(one for each level of refinement), and then use "fillpatch" operations to fill temporary
197
-
MultiFabs that may include a different number of ghost cells. Fillpatch operations fill
198
-
all cells, valid and ghost, from actual valid data at that level, space-time interpolated data
196
+
(one for each level of refinement), and then use FillPatch operations to fill temporary
197
+
MultiFabs that may include a different number of ghost cells. FillPatch operations fill
198
+
all cells, valid and ghost, using actual valid data at that level, space-time interpolated data
199
199
from the next-coarser level, neighboring grids at the same level, and domain
200
200
boundary conditions (for examples that have non-periodic boundary conditions).
201
201
Note that at the coarsest level,
202
-
the interior and domain boundary (which can be periodic or prescribed based on physical considerations)
203
-
need to be filled. At the non-coarsest level, the ghost cells can also be interior or domain,
204
-
but can also be at coarse-fine interfaces away from the domain boundary.
202
+
interior cells and domain boundaries (which can be periodic or prescribed based on physical considerations)
203
+
need to be filled. At non-coarsest levels, the ghost cells can also be interior or on the domain boundary,
204
+
but they can also be at coarse-fine interfaces away from the domain boundary.
205
205
:cpp:`AMReX_FillPatchUtil.cpp/H` contains two primary functions of interest.
206
206
207
207
#. :cpp:`FillPatchSingleLevel()` fills a :cpp:`MultiFab` and its ghost region at a single level of
@@ -218,11 +218,11 @@ to fill interior, periodic, and physical boundary ghost cells. In principle, yo
218
218
write a single-level application that calls :cpp:`FillPatchSingleLevel()` instead
219
219
of using :cpp:`MultiFab::FillBoundary` and :cpp:`FillDomainBoundary()`.
220
220
221
-
A:cpp:`FillPatchUtil` uses an :cpp:`Interpolator`. This is largely hidden from application codes.
221
+
The:cpp:`FillPatchUtil` routines use an :cpp:`Interpolator`. This is largely hidden from application codes.
222
222
AMReX_Interpolater.cpp/H contains the virtual base class :cpp:`Interpolater`, which provides
223
223
an interface for coarse-to-fine spatial interpolation operators. The fillpatch routines described
224
-
above require an Interpolater for FillPatchTwoLevels().
225
-
Within AMReX_Interpolater.cpp/H are the derived classes:
224
+
above require an :cpp:`Interpolater` for :cpp:`FillPatchTwoLevels()`.
225
+
Within AMReX_Interpolater.cpp/H, the derived classes are:
226
226
227
227
- :cpp:`NodeBilinear`
228
228
@@ -240,7 +240,7 @@ Within AMReX_Interpolater.cpp/H are the derived classes:
240
240
241
241
- :cpp:`FaceLinear`
242
242
243
-
- :cpp:`FaceDivFree`: This is more accurately a divergence-preserving interpolation on facecentered data, i.e., it ensures the divergence of the fine ghost cells match the value of the divergence of the underlying coarse cell. All fine cells overlying a given coarse cell will have the same divergence, even when the coarse grid divergence is spatially varying. Note that when using this with :cpp:`FillPatch` for time sub-cycling, the coarse grid times may not match the fine grid time, in which case :cpp:`FillPatch` will create coarse values at the fine time before calling this interpolation and the result of the :cpp:`FillPatch` is *not* guaranteed to preserve the original divergence.
243
+
- :cpp:`FaceDivFree`: This is more accurately a divergence-preserving interpolation on face-centered data, i.e., it ensures the divergence of the fine ghost cells matches the value of the divergence of the underlying coarse cell. All fine cells overlying a given coarse cell will have the same divergence, even when the coarse grid divergence is spatially varying. Note that when using this with :cpp:`FillPatch` for time sub-cycling, the coarse grid times may not match the fine grid time, in which case :cpp:`FillPatch` will create coarse values at the fine time before calling this interpolation and the result of the :cpp:`FillPatch` is *not* guaranteed to preserve the original divergence.
244
244
245
245
These Interpolaters can be executed on CPU or GPU, with certain limitations:
246
246
@@ -283,12 +283,12 @@ the coarse grid flux must be compared to the area *and* time-weighted fine grid
283
283
fluxes. A :cpp:`FluxRegister` accumulates and ultimately stores the net
284
284
difference in fluxes between the coarse grid and fine grid advance over each
285
285
face over a given coarse time step. The simplest possible synchronization step
286
-
is to modify the coarse grid solution in coarse cells immediately adjacent to
287
-
the coarse-fine interface are updated to account for the mismatch stored in the
286
+
is to modify the coarse grid solution in the coarse cells immediately adjacent to
287
+
the coarse-fine interface to account for the mismatch stored in the
288
288
FluxRegister. This can be done "simply" by taking the coarse-level divergence of
289
289
the data in the FluxRegister using the :cpp:`reflux` function.
290
290
291
-
The Fortran routines that perform the actual floatingpoint work associated with
291
+
The Fortran routines that perform the actual floating-point work associated with
292
292
incrementing data in a :cpp:`FluxRegister` are contained in the files
293
293
AMReX_FLUXREG_F.H and AMReX_FLUXREG_xD.F.
294
294
@@ -358,8 +358,7 @@ easily be thought of as a recursive algorithm in which, to advance level :math:`
358
358
359
359
\end{center}
360
360
361
-
Specifically, for a 3-level simulation, depicted graphically in the figure
362
-
showing the :ref:`fig:subcycling` above:
361
+
Specifically, for a 3-level simulation, as depicted in :ref:`fig:subcycling`:
363
362
364
363
#. Integrate :math:`\ell=0` over :math:`\Delta t`.
365
364
@@ -415,28 +414,28 @@ Code Structure
415
414
Source code tree for the AmrAdvection_AmrCore example.
416
415
417
416
418
-
The figure shows the :ref:`fig:AmrAdvection_AmrCore_flowchart`
417
+
The figure above shows the source tree for the example.
419
418
420
419
421
-
- amrex/Src/
420
+
- ``amrex/Src/``
422
421
423
-
- Base/ Base amrex library.
422
+
- ``Base/`` Base AMReX library.
424
423
425
-
- Boundary/ An assortment of classes for handling boundary data.
424
+
- ``Boundary/`` An assortment of classes for handling boundary data.
426
425
427
-
- AmrCore/ AMR data management classes, described in more detail above.
426
+
- ``AmrCore/`` AMR data management classes, described in more detail above.
428
427
429
428
430
-
- ``Advection_AmrCore/Src`` Source code specific to this example. Most notably
431
-
is the :cpp:`AmrCoreAdv` class, which is derived from :cpp:`AmrCore`. The subdirectories ``Src_2d``
432
-
and ``Src_3d`` contain dimensionspecific routines. ``Src_nd`` contains dimension-independent routines.
429
+
- ``Advection_AmrCore/Src`` contains source code specific to this example. Most notably,
430
+
it includes the :cpp:`AmrCoreAdv` class, which is derived from :cpp:`AmrCore`. The subdirectories ``Src_2d``
431
+
and ``Src_3d`` contain dimension-specific routines. ``Src_nd`` contains dimension-independent routines.
433
432
434
433
435
-
- Exec Contains a makefile so a user can write other examples besides SingleVortex.
434
+
- ``Exec`` contains a makefile so that users can write other examples besides ``SingleVortex``.
436
435
437
436
438
-
- SingleVortex Build the code here by editing the GNUmakefile and running make. There
439
-
is also problem-specific source code here used for initialization or specifying the velocity field used in this
437
+
- ``SingleVortex`` builds the code by editing the ``GNUmakefile`` and running ``make``. There
438
+
is also problem-specific source code here for initialization and for specifying the velocity field used in this
440
439
simulation.
441
440
442
441
Here is a high-level pseudo-code of the flow of the program:
@@ -448,7 +447,7 @@ Here is a high-level pseudo-code of the flow of the program:
448
447
/* Advection_AmrCore Pseudocode */
449
448
main()
450
449
AmrCoreAdv amr_core_adv; // build an AmrCoreAdv object
451
-
amr_core_adv.InitData() // initialize data all all levels
450
+
amr_core_adv.InitData() // initialize data on all levels
452
451
AmrCore::InitFromScratch()
453
452
AmrMesh::MakeNewGrids()
454
453
AmrMesh::MakeBaseGrids() // define level 0 grids
@@ -547,12 +546,12 @@ Regridding
547
546
----------
548
547
549
548
The regrid function belongs to the :cpp:`AmrCore` class (it is virtual -- in this
550
-
tutorial we use the instance in :cpp:`AmrCore`).
549
+
tutorial we use the implementation in :cpp:`AmrCore`).
551
550
552
551
At the beginning of each time step, we check whether we need to regrid.
553
-
In this example, we use a :cpp:`regrid_int` and keep track of how many times each level
554
-
has been advanced. When any given particular level :math:`\ell<\ell_{\rm max}` has been
555
-
advanced a multiple of :cpp:`regrid_int`, we call the :cpp:`regrid` function.
552
+
In this example, we use :cpp:`regrid_int` and keep track of how many times each level
553
+
has been advanced. When any given level :math:`\ell<\ell_{\rm max}` has been
554
+
advanced a number of times equal to a multiple of :cpp:`regrid_int`, we call the :cpp:`regrid` function.
556
555
557
556
.. highlight:: c++
558
557
@@ -568,7 +567,7 @@ advanced a multiple of :cpp:`regrid_int`, we call the :cpp:`regrid` function.
568
567
{
569
568
if (istep[lev] % regrid_int == 0)
570
569
{
571
-
// regrid could add newly refine levels
570
+
// regrid could add newly refined levels
572
571
// (if finest_level < max_level)
573
572
// so we save the previous finest level index
574
573
int old_finest = finest_level;
@@ -582,7 +581,7 @@ advanced a multiple of :cpp:`regrid_int`, we call the :cpp:`regrid` function.
582
581
}
583
582
}
584
583
585
-
Central to the regridding process is the concept of "tagging" which cells need refinement.
584
+
Central to the regridding process is the concept of "tagging" cells that need refinement.
586
585
:cpp:`ErrorEst` is a pure virtual function of :cpp:`AmrCore`, so each application code must
587
586
contain an implementation. In AmrCoreAdv.cpp the ErrorEst function is essentially an
588
587
interface to a Fortran routine that tags cells (in this case, :fortran:`state_error` in
0 commit comments