Skip to content

Commit

Permalink
update docs (#1162)
Browse files Browse the repository at this point in the history
* update docs

* clean up code and add more variables to tag on

* update amrex version
  • Loading branch information
asalmgren committed Jul 16, 2023
1 parent 2e02a88 commit 7891c17
Show file tree
Hide file tree
Showing 10 changed files with 60 additions and 45 deletions.
5 changes: 3 additions & 2 deletions Docs/sphinx_doc/Inputs.rst
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,9 @@ List of Parameters
| | subsequent | | |
| | levels | | |
+---------------------------+-----------------+-----------------+-------------+
| **amr.regrid_int** | how often to | Integer > 0 | must be set |
| | regrid | | |
| **amr.regrid_int** | how often to | Integer > 0 | -1 |
| | regrid | (if negative, | |
| | | no regridding) | |
+---------------------------+-----------------+-----------------+-------------+
| **amr.regrid_on_restart** | should we | 0 or 1 | 0 |
| | regrid | | |
Expand Down
56 changes: 28 additions & 28 deletions Docs/sphinx_doc/MeshRefinement.rst
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,13 @@ one level of refinement, where prob_lo_z and prob_hi_z are the vertical extents
amr.max_level = 1
amr.ref_ratio = 2

amr.refinement_indicators = box1 box2
erf.refinement_indicators = box1 box2

amr.box1.in_box_lo = .15 .25
amr.box1.in_box_hi = .35 .45
erf.box1.in_box_lo = .15 .25
erf.box1.in_box_hi = .35 .45

amr.box2.in_box_lo = .65 .75
amr.box2.in_box_hi = .85 .95
erf.box2.in_box_lo = .65 .75
erf.box2.in_box_hi = .85 .95

In the example below, we refine the region ((.15,.25,prob_lo_z)(.35,.45,prob_hi_z))
by two levels of factor 3 refinement. In this case, the refined region at level 1 will
Expand All @@ -51,10 +51,10 @@ be sufficient to enclose the refined region at level 2.
amr.max_level = 2
amr.ref_ratio = 3 3

amr.refinement_indicators = box1
erf.refinement_indicators = box1

amr.box1.in_box_lo = .15 .25
amr.box1.in_box_hi = .35 .45
erf.box1.in_box_lo = .15 .25
erf.box1.in_box_hi = .35 .45

And in this final example, the region ((.15,.25,prob_lo_z)(.35,.45,prob_hi_z))
will be refined by two levels of factor 3, but the larger region, ((.05,.05,prob_lo_z)(.75,.75,prob_hi_z))
Expand All @@ -65,14 +65,14 @@ will be refined by a single factor 3 refinement.
amr.max_level = 2
amr.ref_ratio = 3 3

amr.refinement_indicators = box1 box2
erf.refinement_indicators = box1 box2

amr.box1.in_box_lo = .15 .25
amr.box1.in_box_hi = .35 .45
erf.box1.in_box_lo = .15 .25
erf.box1.in_box_hi = .35 .45

amr.box2.in_box_lo = .05 .05
amr.box2.in_box_hi = .75 .75
amr.box2.max_level = 1
erf.box2.in_box_lo = .05 .05
erf.box2.in_box_hi = .75 .75
erf.box2.max_level = 1


Dynamic Mesh Refinement
Expand Down Expand Up @@ -102,23 +102,23 @@ computed by dividing the variable named rhotheta by the variable named density.

::

amr.refinement_indicators = hi_rho lo_theta advdiff
erf.refinement_indicators = hi_rho lo_theta advdiff

amr.hi_rho.max_level = 3
amr.hi_rho.value_greater = 1. 2.
amr.hi_rho.field_name = density
erf.hi_rho.max_level = 3
erf.hi_rho.value_greater = 1. 2.
erf.hi_rho.field_name = density

amr.lo_theta.max_level = 1
amr.lo_theta.value_less = 300
amr.lo_theta.field_name = rhotheta
amr.lo_theta.in_box_lo = .25 .25 .25
amr.lo_theta.in_box_hi = .75 .75 .75
erf.lo_theta.max_level = 1
erf.lo_theta.value_less = 300
erf.lo_theta.field_name = rhotheta
erf.lo_theta.in_box_lo = .25 .25 .25
erf.lo_theta.in_box_hi = .75 .75 .75

amr.advdiff.max_level = 2
amr.advdiff.adjacent_difference_greater = 0.01
amr.advdiff.field_name = rhoadv_0
amr.advdiff.start_time = 0.001
amr.advdiff.end_time = 0.002
erf.advdiff.max_level = 2
erf.advdiff.adjacent_difference_greater = 0.01
erf.advdiff.field_name = rhoadv_0
erf.advdiff.start_time = 0.001
erf.advdiff.end_time = 0.002

Coupling Types
--------------
Expand Down
6 changes: 3 additions & 3 deletions Exec/inputs.mesh_refinement
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ amr.regrid_int = 2 2 2 2 # how often to regrid
amr.n_error_buf = 2 2 2 2 # number of buffer cells in error est

# How to specify a region for static refinement
amr.refinement_indicators = box1
amr.box1.in_box_lo = .15 .25
amr.box1.in_box_hi = .55 .65
erf.refinement_indicators = box1
erf.box1.in_box_lo = .15 .25
erf.box1.in_box_hi = .55 .65
2 changes: 2 additions & 0 deletions Source/ERF.H
Original file line number Diff line number Diff line change
Expand Up @@ -203,8 +203,10 @@ public:
amrex::Real dt, amrex::Real time,
amrex::InterpFaceRegister* ifr);

#if defined(ERF_USE_MOISTURE)
void advance_microphysics (int lev, amrex::MultiFab& cons_in,
const amrex::Real& dt_advance);
#endif

amrex::MultiFab& build_fine_mask (int lev);

Expand Down
23 changes: 19 additions & 4 deletions Source/ERF_Tagging.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,32 @@ ERF::ErrorEst (int level, TagBoxArray& tags, Real time, int /*ngrow*/)
{
std::unique_ptr<MultiFab> mf;

// This allows dynamic refinement based on the value of the scalar
if (ref_tags[j].Field() == "scalar") {
// This allows dynamic refinement based on the value of the density
if (ref_tags[j].Field() == "density")
{
mf = std::make_unique<MultiFab>(grids[level], dmap[level], 1, 0);
MultiFab::Copy(*mf,vars_new[level][Vars::cons],Rho_comp,0,1,0);

// This allows dynamic refinement based on the value of the scalar/pressure/theta
} else if ( (ref_tags[j].Field() == "scalar" ) ||
(ref_tags[j].Field() == "pressure") ||
(ref_tags[j].Field() == "theta" ) )
{
mf = std::make_unique<MultiFab>(grids[level], dmap[level], 1, 0);
for (MFIter mfi(*mf, TilingIfNotGPU()); mfi.isValid(); ++mfi)
{
const Box& bx = mfi.tilebox();
auto& dfab = (*mf)[mfi];
auto& sfab = vars_new[level][Vars::cons][mfi];
derived::erf_derscalar(bx, dfab, 0, 1, sfab, Geom(level), time, nullptr, level);
if (ref_tags[j].Field() == "scalar") {
derived::erf_derscalar(bx, dfab, 0, 1, sfab, Geom(level), time, nullptr, level);
} else if (ref_tags[j].Field() == "pressure") {
derived::erf_derpres(bx, dfab, 0, 1, sfab, Geom(level), time, nullptr, level);
} else if (ref_tags[j].Field() == "theta") {
derived::erf_dertheta(bx, dfab, 0, 1, sfab, Geom(level), time, nullptr, level);
}
} // mfi
} // scalar
}

// This is sufficient for static refinement (where we don't need mf filled first)
ref_tags[j](tags,mf.get(),clearval,tagval,time,level,geom[level]);
Expand Down
4 changes: 2 additions & 2 deletions Source/TimeIntegration/ERF_advance_microphysics.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

using namespace amrex;

#if defined(ERF_USE_MOISTURE)
void ERF::advance_microphysics(int lev,
MultiFab& cons,
const Real& dt_advance)
{
#if defined(ERF_USE_MOISTURE)
micro.Init(cons, qmoist[lev],
grids_to_evolve[lev],
Geom(lev),
Expand All @@ -19,5 +19,5 @@ void ERF::advance_microphysics(int lev,
micro.MicroPrecipFall();

micro.Update(cons, qmoist[lev]);
#endif
}
#endif
2 changes: 0 additions & 2 deletions Source/TimeIntegration/ERF_slow_rhs_post.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ using namespace amrex;
*
* @param[in] level level of resolution
* @param[in] dt slow time step
* @param[in] grids_to_evolve the region in the domain excluding the relaxation and specified zones
* @param[out] S_rhs RHS computed here
* @param[in] S_old solution at start of time step
* @param[in] S_new solution at end of current RK stage
Expand Down Expand Up @@ -48,7 +47,6 @@ using namespace amrex;

void erf_slow_rhs_post (int /*level*/,
Real dt,
BoxArray& grids_to_evolve,
Vector<MultiFab>& S_rhs,
Vector<MultiFab>& S_old,
Vector<MultiFab>& S_new,
Expand Down
1 change: 0 additions & 1 deletion Source/TimeIntegration/TI_headers.H
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ void erf_slow_rhs_pre (int level, int nrk,
*/
void erf_slow_rhs_post (int level,
amrex::Real dt,
amrex::BoxArray& grids_to_evolve,
amrex::Vector<amrex::MultiFab>& S_rhs,
amrex::Vector<amrex::MultiFab>& S_old,
amrex::Vector<amrex::MultiFab>& S_new,
Expand Down
4 changes: 2 additions & 2 deletions Source/TimeIntegration/TI_slow_rhs_fun.H
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@

// Moving terrain
if ( solverChoice.use_terrain && (solverChoice.terrain_type == 1) ) {
erf_slow_rhs_post(level, slow_dt, grids_to_evolve[level],
erf_slow_rhs_post(level, slow_dt,
S_rhs, S_old, S_new, S_data, S_prim, S_scratch,
xvel_new, yvel_new, zvel_new,
source, SmnSmn, eddyDiffs,
Expand All @@ -282,7 +282,7 @@
#endif
incompressible);
} else {
erf_slow_rhs_post(level, slow_dt, grids_to_evolve[level],
erf_slow_rhs_post(level, slow_dt,
S_rhs, S_old, S_new, S_data, S_prim, S_scratch,
xvel_new, yvel_new, zvel_new,
source, SmnSmn, eddyDiffs,
Expand Down
2 changes: 1 addition & 1 deletion Submodules/AMReX
Submodule AMReX updated 98 files
+1 −1 .github/workflows/ascent.yml
+1 −1 .github/workflows/clang.yml
+4 −4 .github/workflows/cleanup-cache.yml
+8 −5 .github/workflows/dependencies/dependencies_dpcpp.sh
+2 −2 .github/workflows/hip.yml
+7 −1 .gitignore
+40 −0 CHANGES
+36 −68 CONTRIBUTING.md
+1 −1 Docs/sphinx_documentation/source/AmrCore.rst
+168 −1 Docs/sphinx_documentation/source/EB.rst
+69 −0 Docs/sphinx_documentation/source/EB/areas_and_volumes.fig
+ Docs/sphinx_documentation/source/EB/areas_and_volumes.png
+38 −0 Docs/sphinx_documentation/source/EB/eb_fluxes.fig
+ Docs/sphinx_documentation/source/EB/eb_fluxes.png
+41 −0 Docs/sphinx_documentation/source/EB/redist.fig
+ Docs/sphinx_documentation/source/EB/redist.png
+34 −2 Docs/sphinx_documentation/source/LinearSolvers.rst
+2 −1 Src/Amr/AMReX_Amr.cpp
+9 −0 Src/Amr/AMReX_AmrLevel.H
+9 −0 Src/Amr/AMReX_AmrLevel.cpp
+2 −0 Src/AmrCore/AMReX_FillPatcher.H
+164 −160 Src/AmrCore/AMReX_Interpolater.H
+6 −6 Src/Base/AMReX.cpp
+1 −0 Src/Base/AMReX_Arena.H
+60 −0 Src/Base/AMReX_Arena.cpp
+0 −4 Src/Base/AMReX_FArrayBox.H
+1 −1 Src/Base/AMReX_FabArray.H
+0 −2 Src/Base/AMReX_FabArrayBase.H
+0 −19 Src/Base/AMReX_FabArrayBase.cpp
+10 −10 Src/Base/AMReX_FabArrayCommI.H
+15 −0 Src/Base/AMReX_GpuDevice.H
+2 −0 Src/Base/AMReX_GpuDevice.cpp
+3 −3 Src/Base/AMReX_MultiFabUtil.cpp
+4 −0 Src/Base/AMReX_NFiles.cpp
+1 −1 Src/Base/AMReX_NonLocalBC.cpp
+16 −1 Src/Base/AMReX_PODVector.H
+45 −0 Src/Base/AMReX_PODVector.cpp
+3 −2 Src/Base/AMReX_PhysBCFunct.H
+22 −8 Src/Base/AMReX_Reduce.H
+15 −0 Src/Base/AMReX_Scan.H
+427 −0 Src/Base/AMReX_Slopes_K.H
+2 −2 Src/Base/AMReX_VisMF.cpp
+3 −0 Src/Base/CMakeLists.txt
+6 −0 Src/Base/Make.package
+120 −27 Src/Boundary/AMReX_YAFluxRegister.H
+5 −1 Src/EB/AMReX_EB2.H
+10 −2 Src/EB/AMReX_EB2.cpp
+46 −0 Src/EB/AMReX_EB2_IndexSpaceI.H
+1 −0 Src/EB/AMReX_EB2_IndexSpace_STL.H
+6 −0 Src/EB/AMReX_EB2_IndexSpace_STL.cpp
+1 −0 Src/EB/AMReX_EB2_IndexSpace_chkpt_file.H
+6 −0 Src/EB/AMReX_EB2_IndexSpace_chkpt_file.cpp
+27 −1 Src/EB/AMReX_EB2_Level.H
+91 −1 Src/EB/AMReX_EB2_Level.cpp
+30 −13 Src/EB/AMReX_EBAmrUtil.cpp
+1 −1 Src/EB/AMReX_EBCellFlag.H
+5 −0 Src/EB/AMReX_EBDataCollection.H
+14 −0 Src/EB/AMReX_EBDataCollection.cpp
+2 −2 Src/EB/AMReX_EBFArrayBox.cpp
+6 −0 Src/EB/AMReX_EBFabFactory.H
+6 −0 Src/EB/AMReX_EBFabFactory.cpp
+26 −0 Src/EB/AMReX_EBFluxRegister.H
+153 −66 Src/EB/AMReX_EBFluxRegister.cpp
+1 −2 Src/EB/AMReX_EBFluxRegister_2D_C.H
+1 −2 Src/EB/AMReX_EBFluxRegister_3D_C.H
+1 −1 Src/EB/AMReX_EBInterpolater.cpp
+2 −2 Src/EB/AMReX_EBMultiFabUtil.cpp
+314 −0 Src/EB/AMReX_EB_FluxRedistribute.cpp
+170 −0 Src/EB/AMReX_EB_Redistribution.H
+111 −0 Src/EB/AMReX_EB_Redistribution.cpp
+325 −0 Src/EB/AMReX_EB_RedistributionApply.cpp
+886 −0 Src/EB/AMReX_EB_Slopes_2D_K.H
+1,125 −0 Src/EB/AMReX_EB_Slopes_3D_K.H
+10 −0 Src/EB/AMReX_EB_Slopes_K.H
+711 −0 Src/EB/AMReX_EB_StateRedistItracker.cpp
+93 −0 Src/EB/AMReX_EB_StateRedistSlopeLimiter_K.H
+206 −0 Src/EB/AMReX_EB_StateRedistUtils.cpp
+312 −0 Src/EB/AMReX_EB_StateRedistribute.cpp
+0 −34 Src/EB/AMReX_EB_utils.H
+0 −271 Src/EB/AMReX_EB_utils.cpp
+10 −0 Src/EB/CMakeLists.txt
+11 −0 Src/EB/Make.package
+2 −2 Src/Extern/amrdata/AMReX_DataServices.cpp
+31 −11 Src/LinearSolvers/MLMG/AMReX_MLMG.H
+73 −89 Tests/EB_CNS/Source/CNS.H
+9 −13 Tests/EB_CNS/Source/CNS.cpp
+9 −9 Tests/EB_CNS/Source/CNSBld.cpp
+29 −28 Tests/EB_CNS/Source/CNS_advance_box_eb.cpp
+4 −4 Tests/EB_CNS/Source/CNS_bcfill.cpp
+4 −4 Tests/EB_CNS/Source/CNS_derive.H
+2 −2 Tests/EB_CNS/Source/CNS_init_eb2.cpp
+1 −1 Tests/EB_CNS/Source/CNS_parm.cpp
+0 −1 Tests/EB_CNS/Source/Make.package
+0 −185 Tests/EB_CNS/Source/hydro/CNS_flux_redistribute.cpp
+1 −1 Tests/EB_CNS/Source/main.cpp
+2 −2 Tools/CMake/AMReXInstallHelpers.cmake
+6 −3 Tools/C_scripts/mmclt.py
+3 −0 Tools/GNUMake/comps/dpcpp.mak

0 comments on commit 7891c17

Please sign in to comment.