Skip to content

Commit

Permalink
Reset time and nsteps (#402)
Browse files Browse the repository at this point in the history
* Added capability to not reset time and nsteps to 0 after restarting from a plot file

* Corrected formatting

* Corrected formatting

* Added submodule pelephysics

* Added submodule

* Bruce's suggestions

* Bruce's suggestions

* minor fix in docs

---------

Co-authored-by: Bruce Perry <[email protected]>
  • Loading branch information
SreejithNREL and baperry2 authored Aug 5, 2024
1 parent e79f505 commit 40501b5
Show file tree
Hide file tree
Showing 8 changed files with 44 additions and 35 deletions.
61 changes: 31 additions & 30 deletions Docs/sphinx/manual/LMeXControls.rst
Original file line number Diff line number Diff line change
Expand Up @@ -121,9 +121,11 @@ IO parameters

amr.restart = chk00100 # [OPT, DEF=""] Checkpoint from which to restart the simulation
amr.initDataPlt = plt01000 # [OPT, DEF=""] Provide a plotfile from which to extract initial data
peleLM.initDataPlt_reset_time = 1 # [OPT, DEF=1] Resets time and nsteps to 0 after restarting from a plot file. (Warning: plot file will be rewritten if not renamed and argument value = 0)
peleLM.initDataPlt_patch_flow_variables = false # [OPT, DEF=false] Enable user-defined flow variable patching after reading a plot solution file
amr.regrid_on_restart = 1 # [OPT, DEF="0"] Trigger a regrid after the data from checkpoint are loaded
amr.n_files = 64 # [OPT, DEF="min(256,NProcs)"] Number of files to write per level

Refinement controls
-------------------

Expand Down Expand Up @@ -255,7 +257,6 @@ PeleLMeX algorithm
peleLM.deltaT_iterMax = 5 # [OPT, DEF=10] Maximum number of deltaT iterations
peleLM.deltaT_tol = 1e-10 # [OPT, DEF=1.e-10] Tolerance of the deltaT solve
peleLM.evaluate_vars =... # [OPT, DEF=""] In evaluate mode, list unitTest: diffTerm, divU, instRR, transportCC
peleLM.do_patch_flow_variables = false # [OPT, DEF=false] Enable user-defined flow variable patching after reading a plot solution file

Transport coefficients and LES
------------------------------
Expand Down Expand Up @@ -453,41 +454,41 @@ to activate `temporal` diagnostics performing these reductions at given interval
peleLM.do_species_balance = 1 # [OPT, DEF=0] Compute species mass balance, if temporals activated
peleLM.do_patch_mfr=1 # [OPT, DEF=0] Activate patch based species flux diagbostics
peleLM.bpatch.patchnames= <patch_name1 patch_name2 ..> # List of patchnames
bpatch.patch_name1.patchtype=full-boundary # patchtype one of "full-boundary", "circle, "rectangle", "circle-annular" or "rectangle-annular"
bpatch.patch_name1.boundary_direction=2 # patch normal direction
bpatch.patch_name1.boundary_lo_or_hi=0 # patch in low or high side of boundary

bpatch.patch_name1.patchtype=full-boundary # patchtype one of "full-boundary", "circle, "rectangle", "circle-annular" or "rectangle-annular"
bpatch.patch_name1.boundary_direction=2 # patch normal direction
bpatch.patch_name1.boundary_lo_or_hi=0 # patch in low or high side of boundary
bpatch.patch_name1.species= O2 N2 # list of species names
bpatch.patch_name2.patchtype=circle # patchtype one of "full-boundary", "circle, "rectangle", "circle-annular" or "rectangle-annular"
bpatch.patch_name2.boundary_direction=2 # patch normal direction
bpatch.patch_name2.boundary_lo_or_hi=0 # patch in low or high side of boundary

bpatch.patch_name2.patchtype=circle # patchtype one of "full-boundary", "circle, "rectangle", "circle-annular" or "rectangle-annular"
bpatch.patch_name2.boundary_direction=2 # patch normal direction
bpatch.patch_name2.boundary_lo_or_hi=0 # patch in low or high side of boundary
bpatch.patch_name2.patch_circle_radius=0.1 # radius of the patch
bpatch.patch_name2.patch_circle_center=0.0 0.0 0.0 # coordinates of patch center
bpatch.patch_name2.patch_circle_center=0.0 0.0 0.0 # coordinates of patch center
bpatch.patch_name2.species= O2 N2 # list of species names
bpatch.patch_name3.patchtype=rectangle
bpatch.patch_name3.boundary_direction=2 # patch normal direction
bpatch.patch_name3.boundary_lo_or_hi=0 # patch in low or high side of boundary

bpatch.patch_name3.patchtype=rectangle
bpatch.patch_name3.boundary_direction=2 # patch normal direction
bpatch.patch_name3.boundary_lo_or_hi=0 # patch in low or high side of boundary
bpatch.patch_name3.patch_rectangle_lo=0.0 0.0 0.0 # coordinates of low corner of rectangle
bpatch.patch_name3.patch_rectangle_hi=1.0 1.0 1.0 # coordinates of high corner of rectangle
bpatch.patch_name3.species= O2 N2 # list of species names
bpatch.patch_name4.patchtype=circle-annular
bpatch.patch_name4.boundary_direction=2 # patch normal direction
bpatch.patch_name4.boundary_lo_or_hi=0 # patch in low or high side of boundary

bpatch.patch_name4.patchtype=circle-annular
bpatch.patch_name4.boundary_direction=2 # patch normal direction
bpatch.patch_name4.boundary_lo_or_hi=0 # patch in low or high side of boundary
bpatch.patch_name4.patch_circ_ann_center= 0.0 0.0 0.0 # center of annular circle
bpatch.patch_name4.patch_circ_ann_inner_radius=0.1 # coordinates of patch center
bpatch.patch_name4.patch_circ_ann_outer_radius=0.2 # coordinates of patch center
bpatch.patch_name4.patch_circ_ann_outer_radius=0.2 # coordinates of patch center
bpatch.patch_name4.species= O2 N2 # list of species names
bpatch.patch_name5.patchtype=rectangle-annular
bpatch.patch_name5.boundary_direction=2 # patch normal direction
bpatch.patch_name5.boundary_lo_or_hi=0 # patch in low or high side of boundary
bpatch.patch_name5.patch_rect_ann_outer_lo = -1.0 -1.0 -1.0 # coordinates of low corner of outer rectangle
bpatch.patch_name5.patch_rect_ann_outer_hi = 1.0 1.0 1.0 # coordinates of high corner of outer rectangle
bpatch.patch_name5.patch_rect_ann_inner_lo = -0.5 -0.5 -0.5 # coordinates of low corner of inner rectangle
bpatch.patch_name5.patch_rect_ann_inner_hi = 0.5 0.5 0.5 # coordinates of high corner of inner rectangle

bpatch.patch_name5.patchtype=rectangle-annular
bpatch.patch_name5.boundary_direction=2 # patch normal direction
bpatch.patch_name5.boundary_lo_or_hi=0 # patch in low or high side of boundary
bpatch.patch_name5.patch_rect_ann_outer_lo = -1.0 -1.0 -1.0 # coordinates of low corner of outer rectangle
bpatch.patch_name5.patch_rect_ann_outer_hi = 1.0 1.0 1.0 # coordinates of high corner of outer rectangle
bpatch.patch_name5.patch_rect_ann_inner_lo = -0.5 -0.5 -0.5 # coordinates of low corner of inner rectangle
bpatch.patch_name5.patch_rect_ann_inner_hi = 0.5 0.5 0.5 # coordinates of high corner of inner rectangle
bpatch.patch_name5.species= O2 N2 # list of species names

The `do_temporal` flag will trigger the creation of a `temporals` folder in your run directory and the following entries
Expand All @@ -499,8 +500,8 @@ the balance (dMdt - sum of fluxes), and species balance (stored in `temporals/te
advective \& diffusive fluxes across the domain boundaries, consumption rate integral and the error (dMdt - sum of fluxes - reaction).
Users can also monitor species advective fluxes through specific regions of the domain boundaries (called as boundary patches).
Patches can be defined on the low or high sides of non-embedded boundaries through the use of pre-defined shapes such as `circle`,
`rectangle`,`circle-annular`, `rectangle-annular` and `full-boundary`. The zero AMR level, advective fluxes of each of the user-specified species will be
reported in the ASCII `temppatchmfr` file in the temporals folder.
`rectangle`,`circle-annular`, `rectangle-annular` and `full-boundary`. The zero AMR level, advective fluxes of each of the user-specified species will be
reported in the ASCII `temppatchmfr` file in the temporals folder.

Combustion diagnostics often involve the use of a mixture fraction and/or a progress variable, both of which can be defined
at run time and added to the derived variables included in the plotfile. If `mixture_fraction` or `progress_variable` is
Expand Down
2 changes: 1 addition & 1 deletion Docs/sphinx/manual/Tutorials_BFSFlame.rst
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ The initial solution consists of a premixed methane/air mixture in the upper par
and pure hot air in the wake of the step. The default parameters provided above are overwritten
using AMReX ParmParse in ``pelelmex_prob.cpp`` and the initial/boundary conditions implemented in
``pelelmex_prob.H``. Alternatively, the user can write a custom function to enforce an ignition kernel through the ``patchFlowVariables`` function in the problem-specific ``PeleLMeX_PatchFlowVariables.cpp`` file.
It should be kept in mind that the ``patchFlowVariables`` function can be used if the user wants to patch certain flow variables after reading an existing solution from a plot file ( ``peleLM.do_patch_flow_variables`` should be set to true).
It should be kept in mind that the ``patchFlowVariables`` function can be used if the user wants to patch certain flow variables after reading an existing solution from a plot file ( ``peleLM.initDataPlt_patch_flow_variables`` should be set to true).

In addition to these three C++ files, an extra header is needed in the present case compared to
:doc:`Tutorials_FlameSheet` : ``EBUserDefined.H``. This file is necessary to specify more complex EB
Expand Down
2 changes: 1 addition & 1 deletion Exec/RegTests/EB_BackwardStepFlame/input.2d
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ peleLM.use_wbar = 1 # Include Wbar term in species diffu
peleLM.sdc_iterMax = 2 # Number of SDC iterations
peleLM.num_init_iter = 3 # Number of initial iterations
peleLM.floor_species = 0 # Enforce species positivity (non-conservative !)
peleLM.do_patch_flow_variables = false # Enable flow variable patching after reading a plot solution file
peleLM.initDataPlt_patch_flow_variables = false # Enable flow variable patching after reading a plot solution file
#---------------------- Temporal CONTROL -------------------------
peleLM.do_temporals = 1 # Turn temporals ON/OFF
peleLM.temporal_int = 10 # Frequency of temporals
Expand Down
1 change: 1 addition & 0 deletions Source/PeleLMeX.H
Original file line number Diff line number Diff line change
Expand Up @@ -1812,6 +1812,7 @@ public:

int m_regrid_int = -1;
int m_regrid_on_restart = 0;
int m_do_reset_time = 1;

// Switch Evolve/Evaluate
std::string m_run_mode = "normal";
Expand Down
4 changes: 3 additions & 1 deletion Source/PeleLMeX_Init.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,9 @@ PeleLM::initData()
// Do initial pressure iterations
initialIterations();

m_nstep = 0;
if (m_do_reset_time != 0) {
m_nstep = 0;
}

if (m_do_temporals != 0) {
writeTemporals();
Expand Down
4 changes: 4 additions & 0 deletions Source/PeleLMeX_Plot.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -802,6 +802,10 @@ PeleLM::initLevelDataFromPlt(int a_lev, const std::string& a_dataPltFile)
// Use PelePhysics PltFileManager
pele::physics::pltfilemanager::PltFileManager pltData(a_dataPltFile);
Vector<std::string> plt_vars = pltData.getVariableList();
if (m_do_reset_time == 0) {
m_cur_time = pltData.getTime();
m_nstep = pltData.getNsteps();
}

// Find required data in pltfile
Vector<std::string> spec_names;
Expand Down
3 changes: 2 additions & 1 deletion Source/PeleLMeX_Setup.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -418,7 +418,8 @@ PeleLM::readParameters()
pp.query("num_divu_iter", m_numDivuIter);
pp.query("do_init_proj", m_do_init_proj);
pp.query("num_init_iter", m_init_iter);
pp.query("do_patch_flow_variables", m_do_patch_flow_variables);
pp.query("initDataPlt_patch_flow_variables", m_do_patch_flow_variables);
pp.query("initDataPlt_reset_time", m_do_reset_time);

// -----------------------------------------
// advance
Expand Down
2 changes: 1 addition & 1 deletion Submodules/PelePhysics
Submodule PelePhysics updated 47 files
+1 −9 Mechanisms/Aromatic_KrNara/Make.package
+1 −9 Mechanisms/BurkeDryer/Make.package
+1 −9 Mechanisms/C1-C2-NO/Make.package
+1 −9 Mechanisms/C1-C2-NO_qss/Make.package
+1 −9 Mechanisms/CH4_lean/Make.package
+1 −9 Mechanisms/CH4_lean_qss/Make.package
+1 −9 Mechanisms/Davis/Make.package
+1 −9 Mechanisms/FFCM1_Red/Make.package
+1 −9 Mechanisms/H2-CO-CO2-3spec/Make.package
+1 −9 Mechanisms/HP_DME/Make.package
+1 −9 Mechanisms/IonizedAir/Make.package
+1 −9 Mechanisms/JL4/Make.package
+1 −9 Mechanisms/Kolla/Make.package
+1 −9 Mechanisms/LiDryer/Make.package
+1 −9 Mechanisms/LuDME/Make.package
+1 −9 Mechanisms/LuEthylene/Make.package
+1 −9 Mechanisms/LuEthylene_qss/Make.package
+1 −9 Mechanisms/NUIGalway/Make.package
+1 −9 Mechanisms/Null/Make.package
+1 −9 Mechanisms/SootReaction/Make.package
+1 −9 Mechanisms/air/Make.package
+1 −9 Mechanisms/alzeta/Make.package
+1 −9 Mechanisms/chem-CH4-2step/Make.package
+1 −9 Mechanisms/chem-H/Make.package
+1 −9 Mechanisms/decane_3sp/Make.package
+1 −9 Mechanisms/dodecane_lu/Make.package
+1 −9 Mechanisms/dodecane_lu_qss/Make.package
+1 −9 Mechanisms/dodecane_wang/Make.package
+1 −9 Mechanisms/dodmethair_4sp/Make.package
+1 −9 Mechanisms/drm19/Make.package
+1 −9 Mechanisms/ethylene_af/Make.package
+1 −9 Mechanisms/grimech12/Make.package
+1 −9 Mechanisms/grimech30-noArN/Make.package
+1 −9 Mechanisms/grimech30/Make.package
+1 −9 Mechanisms/heptane_3sp/Make.package
+1 −9 Mechanisms/heptane_fc/Make.package
+1 −9 Mechanisms/heptane_lu_88sk/Make.package
+1 −9 Mechanisms/heptane_lu_qss/Make.package
+1 −9 Mechanisms/isooctane_lu/Make.package
+1 −9 Mechanisms/methaneIons_diRenzo/Make.package
+1 −9 Mechanisms/ndodecane_35/Make.package
+1 −9 Mechanisms/nitrogens/Make.package
+1 −9 Mechanisms/propane_fc/Make.package
+1 −9 Mechanisms/sCO2/Make.package
+2 −1 Source/Utility/BlackBoxFunction/Table.H
+2 −0 Source/Utility/PltFileManager/PltFileManager.H
+1 −1 Source/Utility/PltFileManager/PltFileManager.cpp

0 comments on commit 40501b5

Please sign in to comment.