Skip to content

Commit

Permalink
Merge branch 'development' into ysu-pbl-moreprog
Browse files Browse the repository at this point in the history
  • Loading branch information
baperry2 authored Jun 5, 2024
2 parents babf561 + 51a8eb0 commit 7d625df
Show file tree
Hide file tree
Showing 51 changed files with 1,735 additions and 1,866 deletions.
1 change: 1 addition & 0 deletions CMake/BuildERFExe.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,7 @@ function(build_erf_lib erf_lib_name)
${SRC_DIR}/TimeIntegration/ERF_advance_lsm.cpp
${SRC_DIR}/TimeIntegration/ERF_advance_radiation.cpp
${SRC_DIR}/TimeIntegration/ERF_make_fast_coeffs.cpp
${SRC_DIR}/TimeIntegration/ERF_make_tau_terms.cpp
${SRC_DIR}/TimeIntegration/ERF_slow_rhs_pre.cpp
${SRC_DIR}/TimeIntegration/ERF_slow_rhs_post.cpp
${SRC_DIR}/TimeIntegration/ERF_fast_rhs_N.cpp
Expand Down
57 changes: 38 additions & 19 deletions Docs/sphinx_doc/MeshRefinement.rst
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,13 @@ See the `Gridding`_ section of the AMReX documentation for details of how indivi
Static Mesh Refinement
----------------------

For static refinement, we control the placement of grids by specifying
the low and high extents (in physical space) of each box in the lateral
directions. ERF enforces that all refinement spans the entire vertical direction.
For static refinement, we can control the placement of grids by specifying
the low and high extents (in physical space or index space) of each box.

The following example demonstrates how to tag regions for static refinement.
In this first example, all cells in the region ((.15,.25,prob_lo_z)(.35,.45,prob_hi_z))
and in the region ((.65,.75,prob_lo_z)(.85,.95,prob_hi_z)) are tagged for
one level of refinement, where prob_lo_z and prob_hi_z are the vertical extents of the domain:
In this first example, all cells in the region ((.15,.25,0.)(.35,.45,1.))
and in the region ((.65,.75,0.0)(.85,.95,1.0)) are tagged for
one level of refinement.

::

Expand All @@ -39,13 +38,13 @@ one level of refinement, where prob_lo_z and prob_hi_z are the vertical extents

erf.refinement_indicators = box1 box2

erf.box1.in_box_lo = .15 .25
erf.box1.in_box_hi = .35 .45
erf.box1.in_box_lo = .15 .25 0.0
erf.box1.in_box_hi = .35 .45 1.0

erf.box2.in_box_lo = .65 .75
erf.box2.in_box_hi = .85 .95
erf.box2.in_box_lo = .65 .75 0.0
erf.box2.in_box_hi = .85 .95 1.0

In the example below, we refine the region ((.15,.25,prob_lo_z)(.35,.45,prob_hi_z))
In the example below, we refine the region ((.15,.25,0.)(.35,.45,.5))
by two levels of factor 3 refinement. In this case, the refined region at level 1 will
be sufficient to enclose the refined region at level 2.

Expand All @@ -56,11 +55,11 @@ be sufficient to enclose the refined region at level 2.

erf.refinement_indicators = box1

erf.box1.in_box_lo = .15 .25
erf.box1.in_box_hi = .35 .45
erf.box1.in_box_lo = .15 .25 0.0
erf.box1.in_box_hi = .35 .45 1.0

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))
And in this final example, the region ((.15,.25,0.)(.35,.45,1.))
will be refined by two levels of factor 3, but the larger region, ((.05,.05,0.)(.75,.75,1.))
will be refined by a single factor 3 refinement.

::
Expand All @@ -70,12 +69,30 @@ will be refined by a single factor 3 refinement.

erf.refinement_indicators = box1 box2

erf.box1.in_box_lo = .15 .25
erf.box1.in_box_hi = .35 .45
erf.box1.in_box_lo = .15 .25 0.0
erf.box1.in_box_hi = .35 .45 1.0

erf.box2.in_box_lo = .05 .05
erf.box2.in_box_hi = .75 .75
erf.box2.max_level = 1
erf.box2.in_box_lo = .05 .05 0.0
erf.box2.in_box_hi = .75 .75 1.0


We note that instead of specifying the physical extent enclosed, we can instead specify the indices of
the bounding box of the refined region in the index space of that fine level.
To do this we use
``in_box_lo_indices`` and ``in_box_hi_indices`` instead of ``in_box_lo`` and ``in_box_hi``.
If we want to refine the inner region (spanning half the width in each direction) by one level of
factor 2 refinement, and the domain has 32x64x8 cells at level 0 covering the domain, then we would set

::

amr.max_level = 1
amr.ref_ratio = 2

erf.refinement_indicators = box1

erf.box1.in_box_lo_indices = 16 32 4
erf.box1.in_box_hi_indices = 47 95 11


Dynamic Mesh Refinement
Expand All @@ -84,6 +101,8 @@ Dynamic Mesh Refinement
Dynamically created tagging functions are based on runtime data specified in the inputs file.
These dynamically generated functions test on either state variables or derived variables
defined in ERF_derive.cpp and included in the derive_lst in Setup.cpp.
(We note that static refinement can also be achieved by using the refinement criteria as specified below
but setting ``erf.regrid_int`` to a number greater than the total number of steps that will be taken.)

Available tests include

Expand Down
6 changes: 4 additions & 2 deletions Exec/DevTests/Bomex/prob.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,8 @@ Problem::update_rhotheta_sources (const Real& /*time*/,
if (z_cc < parms.cutoff) {
src[k] = parms.advection_heating_rate;
} else if (z_cc < parms.cutoff+parms.cutoff_transition) {
src[k] = parms.advection_heating_rate * (z_cc-parms.cutoff)/parms.cutoff_transition;
Real slope = -parms.advection_heating_rate / parms.cutoff_transition;
src[k] = (z_cc-parms.cutoff) * slope + parms.advection_heating_rate;
} else {
src[k] = 0.0;
}
Expand Down Expand Up @@ -269,7 +270,8 @@ Problem::update_rhoqt_sources (const Real& /*time*/,
if (z_cc < parms.moisture_cutoff) {
qsrc[k] = parms.advection_moisture_rate;
} else if (z_cc < parms.moisture_cutoff+parms.moisture_cutoff_transition) {
qsrc[k] = parms.advection_moisture_rate * (z_cc-parms.moisture_cutoff)/parms.moisture_cutoff_transition;
Real slope = -parms.advection_moisture_rate / parms.moisture_cutoff_transition;
qsrc[k] = (z_cc-parms.moisture_cutoff) * slope + parms.advection_moisture_rate;
} else {
qsrc[k] = 0.0;
}
Expand Down
9 changes: 7 additions & 2 deletions Exec/Make.ERF
Original file line number Diff line number Diff line change
Expand Up @@ -141,10 +141,14 @@ INCLUDE_LOCATIONS += $(ERF_MOISTURE_KESSLER_DIR)
# at runtime from the inputs
ifeq ($(USE_WINDFARM), TRUE)
DEFINES += -DERF_USE_WINDFARM
ERF_WINDFARM_FITCH_DIR = $(ERF_SOURCE_DIR)/WindFarmParametrization/Fitch
ERF_WINDFARM_EWP_DIR = $(ERF_SOURCE_DIR)/WindFarmParametrization/EWP
ERF_WINDFARM_DIR = $(ERF_SOURCE_DIR)/WindFarmParametrization
ERF_WINDFARM_FITCH_DIR = $(ERF_WINDFARM_DIR)/Fitch
ERF_WINDFARM_EWP_DIR = $(ERF_WINDFARM_DIR)/EWP
include $(ERF_WINDFARM_DIR)/Make.package
include $(ERF_WINDFARM_FITCH_DIR)/Make.package
include $(ERF_WINDFARM_EWP_DIR)/Make.package
VPATH_LOCATIONS += $(ERF_WINDFARM_DIR)
INCLUDE_LOCATIONS += $(ERF_WINDFARM_DIR)
VPATH_LOCATIONS += $(ERF_WINDFARM_FITCH_DIR)
INCLUDE_LOCATIONS += $(ERF_WINDFARM_FITCH_DIR)
VPATH_LOCATIONS += $(ERF_WINDFARM_EWP_DIR)
Expand Down Expand Up @@ -177,6 +181,7 @@ endif

ifeq ($(USE_POISSON_SOLVE), TRUE)
DEFINES += -DERF_USE_POISSON_SOLVE
USERSuffix += .INC
endif

ifeq ($(USE_PARTICLES), TRUE)
Expand Down
81 changes: 81 additions & 0 deletions Exec/RegTests/Bubble/inputs_BF02_moist_bubble_Kessler
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
# ------------------ INPUTS TO MAIN PROGRAM -------------------
max_step = 2000
stop_time = 3600.0

amrex.fpe_trap_invalid = 1

fabarray.mfiter_tile_size = 1024 1024 1024

# PROBLEM SIZE & GEOMETRY
geometry.prob_extent = 20000.0 400.0 10000.0
amr.n_cell = 200 4 100
geometry.is_periodic = 0 1 0
xlo.type = "SlipWall"
xhi.type = "SlipWall"
zlo.type = "SlipWall"
zhi.type = "SlipWall"

# TIME STEP CONTROL
erf.fixed_dt = 0.5
erf.fixed_mri_dt_ratio = 4
#erf.no_substepping = 1
#erf.fixed_dt = 0.1

# DIAGNOSTICS & VERBOSITY
erf.sum_interval = 1 # timesteps between computing mass
erf.v = 1 # verbosity in ERF.cpp
amr.v = 1 # verbosity in Amr.cpp

# REFINEMENT / REGRIDDING
amr.max_level = 0 # maximum level number allowed

# CHECKPOINT FILES
erf.check_file = chk # root name of checkpoint file
erf.check_int = 100 # number of timesteps between checkpoints

# PLOTFILES
erf.plot_file_1 = plt # prefix of plotfile name
erf.plot_int_1 = 100 # number of timesteps between plotfiles
erf.plot_vars_1 = density rhotheta rhoQ1 rhoQ2 rhoadv_0 x_velocity y_velocity z_velocity pressure theta scalar temp pres_hse dens_hse pert_pres pert_dens eq_pot_temp qt qv qc qrain

# SOLVER CHOICES
erf.use_gravity = true
erf.use_coriolis = false

erf.dycore_horiz_adv_type = "Upwind_3rd"
erf.dycore_vert_adv_type = "Upwind_3rd"
erf.dryscal_horiz_adv_type = "Upwind_3rd"
erf.dryscal_vert_adv_type = "Upwind_3rd"
erf.moistscal_horiz_adv_type = "Upwind_3rd"
erf.moistscal_vert_adv_type = "Upwind_3rd"

# PHYSICS OPTIONS
erf.les_type = "None"
erf.pbl_type = "None"
erf.moisture_model = "Kessler"
erf.buoyancy_type = 1
erf.use_moist_background = true

erf.molec_diff_type = "ConstantAlpha"
erf.rho0_trans = 1.0 # [kg/m^3], used to convert input diffusivities
erf.dynamicViscosity = 0.0 # [kg/(m-s)] ==> nu = 75.0 m^2/s
erf.alpha_T = 0.0 # [m^2/s]
erf.alpha_C = 0.0

# INITIAL CONDITIONS
#erf.init_type = "input_sounding"
#erf.input_sounding_file = "BF02_moist_sounding"
#erf.init_sounding_ideal = true

# PROBLEM PARAMETERS (optional)
# warm bubble input
prob.x_c = 10000.0
prob.z_c = 2000.0
prob.x_r = 2000.0
prob.z_r = 2000.0
prob.T_0 = 300.0

prob.do_moist_bubble = true
prob.theta_pert = 2.0
prob.qt_init = 0.02
prob.eq_pot_temp = 320.0
81 changes: 81 additions & 0 deletions Exec/RegTests/Bubble/inputs_BF02_moist_bubble_SAM_NoIce
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
# ------------------ INPUTS TO MAIN PROGRAM -------------------
max_step = 2000
stop_time = 3600.0

amrex.fpe_trap_invalid = 1

fabarray.mfiter_tile_size = 1024 1024 1024

# PROBLEM SIZE & GEOMETRY
geometry.prob_extent = 20000.0 400.0 10000.0
amr.n_cell = 200 4 100
geometry.is_periodic = 0 1 0
xlo.type = "SlipWall"
xhi.type = "SlipWall"
zlo.type = "SlipWall"
zhi.type = "SlipWall"

# TIME STEP CONTROL
erf.fixed_dt = 0.5
erf.fixed_mri_dt_ratio = 4
#erf.no_substepping = 1
#erf.fixed_dt = 0.1

# DIAGNOSTICS & VERBOSITY
erf.sum_interval = 1 # timesteps between computing mass
erf.v = 1 # verbosity in ERF.cpp
amr.v = 1 # verbosity in Amr.cpp

# REFINEMENT / REGRIDDING
amr.max_level = 0 # maximum level number allowed

# CHECKPOINT FILES
erf.check_file = chk # root name of checkpoint file
erf.check_int = 100 # number of timesteps between checkpoints

# PLOTFILES
erf.plot_file_1 = plt # prefix of plotfile name
erf.plot_int_1 = 100 # number of timesteps between plotfiles
erf.plot_vars_1 = density rhotheta rhoQ1 rhoQ2 rhoadv_0 x_velocity y_velocity z_velocity pressure theta scalar temp pres_hse dens_hse pert_pres pert_dens eq_pot_temp qt qv qc qi qp qrain qsnow qgraup

# SOLVER CHOICES
erf.use_gravity = true
erf.use_coriolis = false

erf.dycore_horiz_adv_type = "Upwind_3rd"
erf.dycore_vert_adv_type = "Upwind_3rd"
erf.dryscal_horiz_adv_type = "Upwind_3rd"
erf.dryscal_vert_adv_type = "Upwind_3rd"
erf.moistscal_horiz_adv_type = "Upwind_3rd"
erf.moistscal_vert_adv_type = "Upwind_3rd"

# PHYSICS OPTIONS
erf.les_type = "None"
erf.pbl_type = "None"
erf.moisture_model = "SAM_NoIce"
erf.buoyancy_type = 1
erf.use_moist_background = true

erf.molec_diff_type = "ConstantAlpha"
erf.rho0_trans = 1.0 # [kg/m^3], used to convert input diffusivities
erf.dynamicViscosity = 0.0 # [kg/(m-s)] ==> nu = 75.0 m^2/s
erf.alpha_T = 0.0 # [m^2/s]
erf.alpha_C = 0.0

# INITIAL CONDITIONS
#erf.init_type = "input_sounding"
#erf.input_sounding_file = "BF02_moist_sounding"
#erf.init_sounding_ideal = true

# PROBLEM PARAMETERS (optional)
# warm bubble input
prob.x_c = 10000.0
prob.z_c = 2000.0
prob.x_r = 2000.0
prob.z_r = 2000.0
prob.T_0 = 300.0

prob.do_moist_bubble = true
prob.theta_pert = 2.0
prob.qt_init = 0.02
prob.eq_pot_temp = 320.0
81 changes: 81 additions & 0 deletions Exec/RegTests/Bubble/inputs_BF02_moist_bubble_SAM_NoPrecip_NoIce
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
# ------------------ INPUTS TO MAIN PROGRAM -------------------
max_step = 2000
stop_time = 3600.0

amrex.fpe_trap_invalid = 1

fabarray.mfiter_tile_size = 1024 1024 1024

# PROBLEM SIZE & GEOMETRY
geometry.prob_extent = 20000.0 400.0 10000.0
amr.n_cell = 200 4 100
geometry.is_periodic = 0 1 0
xlo.type = "SlipWall"
xhi.type = "SlipWall"
zlo.type = "SlipWall"
zhi.type = "SlipWall"

# TIME STEP CONTROL
erf.fixed_dt = 0.5
erf.fixed_mri_dt_ratio = 4
#erf.no_substepping = 1
#erf.fixed_dt = 0.1

# DIAGNOSTICS & VERBOSITY
erf.sum_interval = 1 # timesteps between computing mass
erf.v = 1 # verbosity in ERF.cpp
amr.v = 1 # verbosity in Amr.cpp

# REFINEMENT / REGRIDDING
amr.max_level = 0 # maximum level number allowed

# CHECKPOINT FILES
erf.check_file = chk # root name of checkpoint file
erf.check_int = 100 # number of timesteps between checkpoints

# PLOTFILES
erf.plot_file_1 = plt # prefix of plotfile name
erf.plot_int_1 = 100 # number of timesteps between plotfiles
erf.plot_vars_1 = density rhotheta rhoQ1 rhoQ2 rhoadv_0 x_velocity y_velocity z_velocity pressure theta scalar temp pres_hse dens_hse pert_pres pert_dens eq_pot_temp qt qv qc qi qrain qsnow qgraup

# SOLVER CHOICES
erf.use_gravity = true
erf.use_coriolis = false

erf.dycore_horiz_adv_type = "Upwind_3rd"
erf.dycore_vert_adv_type = "Upwind_3rd"
erf.dryscal_horiz_adv_type = "Upwind_3rd"
erf.dryscal_vert_adv_type = "Upwind_3rd"
erf.moistscal_horiz_adv_type = "Upwind_3rd"
erf.moistscal_vert_adv_type = "Upwind_3rd"

# PHYSICS OPTIONS
erf.les_type = "None"
erf.pbl_type = "None"
erf.moisture_model = "SAM_NoPrecip_NoIce"
erf.buoyancy_type = 1
erf.use_moist_background = true

erf.molec_diff_type = "ConstantAlpha"
erf.rho0_trans = 1.0 # [kg/m^3], used to convert input diffusivities
erf.dynamicViscosity = 0.0 # [kg/(m-s)] ==> nu = 75.0 m^2/s
erf.alpha_T = 0.0 # [m^2/s]
erf.alpha_C = 0.0

# INITIAL CONDITIONS
#erf.init_type = "input_sounding"
#erf.input_sounding_file = "BF02_moist_sounding"
#erf.init_sounding_ideal = true

# PROBLEM PARAMETERS (optional)
# warm bubble input
prob.x_c = 10000.0
prob.z_c = 2000.0
prob.x_r = 2000.0
prob.z_r = 2000.0
prob.T_0 = 300.0

prob.do_moist_bubble = true
prob.theta_pert = 2.0
prob.qt_init = 0.02
prob.eq_pot_temp = 320.0
Loading

0 comments on commit 7d625df

Please sign in to comment.