Skip to content

Commit

Permalink
Merge branch 'development' into pbl-doc-update
Browse files Browse the repository at this point in the history
  • Loading branch information
asalmgren authored Nov 10, 2023
2 parents cb7f1f9 + fa25dc6 commit cedc211
Show file tree
Hide file tree
Showing 140 changed files with 5,255 additions and 3,506 deletions.
13 changes: 13 additions & 0 deletions CHANGES
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
#23.11

-- AMReX submodule set to 23.11 release hash (ae7b64b)

-- Bug fix with vertical grid stretching and MOST (#1275)

-- Bug fix with negative K_turb below surface and MYNN2.5 PBL model (#1271)

-- Correction to equation of state with moisture (#1263)

-- Generalized multi-level sponge zones. This allows for nudging of fine solution
towards coarse solution with complex box arrays. (#1233)

# 23.10

-- First release since JOSS paper. Too many key ERF PRs to summarize.
Expand Down
4 changes: 3 additions & 1 deletion CMake/BuildERFExe.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ function(build_erf_lib erf_lib_name)

if(ERF_ENABLE_NETCDF)
target_sources(${erf_lib_name} PRIVATE
${SRC_DIR}/IO/NCBuildFABs.cpp
${SRC_DIR}/IO/NCInterface.cpp
${SRC_DIR}/IO/NCPlotFile.cpp
${SRC_DIR}/IO/NCCheckpoint.cpp
Expand Down Expand Up @@ -79,6 +78,7 @@ function(build_erf_lib erf_lib_name)
${SRC_DIR}/Radiation/Aero_rad_props.cpp
${SRC_DIR}/Radiation/Optics.cpp
${SRC_DIR}/Radiation/Radiation.cpp
${SRC_DIR}/Radiation/Albedo.cpp
${CMAKE_SOURCE_DIR}/Submodules/RRTMGP/cpp/examples/mo_load_coefficients.cpp
${CMAKE_SOURCE_DIR}/Submodules/RRTMGP/cpp/extensions/fluxes_byband/mo_fluxes_byband_kernels.cpp
)
Expand Down Expand Up @@ -113,6 +113,7 @@ function(build_erf_lib erf_lib_name)
${SRC_DIR}/BoundaryConditions/BoundaryConditions_zvel.cpp
${SRC_DIR}/BoundaryConditions/BoundaryConditions_bndryreg.cpp
${SRC_DIR}/BoundaryConditions/BoundaryConditions_wrfbdy.cpp
${SRC_DIR}/BoundaryConditions/BoundaryConditions_metgrid.cpp
${SRC_DIR}/BoundaryConditions/ERF_FillPatch.cpp
${SRC_DIR}/BoundaryConditions/ERF_FillPatcher.cpp
${SRC_DIR}/BoundaryConditions/ERF_PhysBCFunct.cpp
Expand Down Expand Up @@ -146,6 +147,7 @@ function(build_erf_lib erf_lib_name)
${SRC_DIR}/TimeIntegration/ERF_TimeStep.cpp
${SRC_DIR}/TimeIntegration/ERF_advance_dycore.cpp
${SRC_DIR}/TimeIntegration/ERF_advance_microphysics.cpp
${SRC_DIR}/TimeIntegration/ERF_advance_radiation.cpp
${SRC_DIR}/TimeIntegration/ERF_make_buoyancy.cpp
${SRC_DIR}/TimeIntegration/ERF_make_condensation_source.cpp
${SRC_DIR}/TimeIntegration/ERF_make_fast_coeffs.cpp
Expand Down
57 changes: 56 additions & 1 deletion Docs/sphinx_doc/Inputs.rst
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,61 @@ Examples of Usage
level-1 grids will be created every 2 level-0 time steps, and new
level-2 grids will be created every 2 level-1 time steps.

Grid Stretching
===============

This automatically activates **erf.use_terrain**. By default, the
problem-specific terrain is initialized to be flat at an elevation of z=0.
These inputs are used to automatically generate the staggered z levels used to
calculate the grid metric transformation. Alternatively, arbitrary z levels may
be specified with the **erf.terrain_z_levels** parameter.

.. _list-of-parameters-3:

List of Parameters
------------------

+-------------------------------+-----------------+-----------------+-------------+
| Parameter | Definition | Acceptable | Default |
| | | Values | |
+===============================+=================+=================+=============+
| **erf.grid_stretching_ratio** | scaling factor | Real > 0 | 0 (no grid |
| | applied to | | stretching) |
| | delta z at each | | |
| | level | | |
+-------------------------------+-----------------+-----------------+-------------+
| **erf.initial_dz** | vertical grid | Real > 0 | must be set |
| | spacing for the | | if grid |
| | cell above the | | stretching |
| | bottom surface | | ratio is set|
+-------------------------------+-----------------+-----------------+-------------+
| **erf.terrain_z_levels** | nominal | List of Real | NONE |
| | staggered | | |
| | z levels | | |
+-------------------------------+-----------------+-----------------+-------------+

.. _notes-3:

Notes
-----

- If both **erf.terrain_z_levels** and **erf.grid_stretching_ratio** are
specified, the simple grid stretching will be ignored.
- The number of input **erf.terrain_z_levels** must be equal **amr.n_cell** in
the z direction + 1.

.. _examples-of-usage-3:

Examples of Usage
-----------------

- **erf.grid_stretching_ratio** = 1.025

- | **erf.initial_dz** = 5.0
| the first cell center would be at z=2.5

Regridding
==========

Expand Down Expand Up @@ -805,7 +860,7 @@ List of Parameters
| **erf.use_terrain** | use terrain-fitted | true / false | false |
| | coordinates? | | |
+-----------------------------+--------------------+--------------------+------------+
| **erf.terrain_type** | static or moving? | 0 / 1 | 0 |
| **erf.terrain_type** | static or moving? | Static / Moving | Static |
+-----------------------------+--------------------+--------------------+------------+
| **erf.terrain_smoothing** | specify terrain | 0, | 0 |
| | following | 1, | |
Expand Down
16 changes: 16 additions & 0 deletions Docs/sphinx_doc/Plotfiles.rst
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,22 @@ Output Options
| | |
| | |
+-----------------------------+------------------+
| **Kmv** | Vertical |
| | Eddy Diffusivity |
| | of Momentum |
+-----------------------------+------------------+
| **Kmh** | Horizontal |
| | Eddy Diffusivity |
| | of Momentum |
+-----------------------------+------------------+
| **Khv** | Vertical |
| | Eddy Diffusivity |
| | of Heat |
+-----------------------------+------------------+
| **Khh** | Horizontal |
| | Eddy Diffusivity |
| | of Heat |
+-----------------------------+------------------+
| **qt** | Nonprecipitating |
| | water (qv + qc + |
| | qi) |
Expand Down
2 changes: 1 addition & 1 deletion Docs/sphinx_doc/RegressionTests.rst
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ The following problems are currently tested in the CI:
| DensityCurrent_detJ2_MT | 256 4 64 | Symmetry | Periodic | SlipWall | None | use_terrain = true |
| | | Outflow | | SlipWall | | uses zlevels |
| | | Outflow | | SlipWall | | detJ = 2 everywhere |
| | | | | | | terrain_type = 1 |
| | | | | | | terrain_type = Moving |
+-------------------------------+----------+----------+----------+------------+-------+-----------------------+
| EkmanSpiral | 4 4 400 | Periodic | Periodic | NoSlipWall | Geo | +Coriolis |
| | | | | SlipWall | | +gravity |
Expand Down
2 changes: 1 addition & 1 deletion Docs/sphinx_doc/theory/WetEquations.rst
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ The governing equations for this model are
\frac{\partial \rho_d}{\partial t} &= - \nabla \cdot (\rho_d \mathbf{u})
\frac{\partial (\rho_d \mathbf{u})}{\partial t} &= - \nabla \cdot (\rho_d \mathbf{u} \mathbf{u}) -
\frac{1}{1 + q_v + q_c} \nabla p^\prime - \nabla \cdot \tau + \mathbf{F} + \delta_{i,3}\mathbf{B}
\frac{1}{1 + q_v + q_c} ( \nabla p^\prime + \delta_{i,3}\mathbf{B} ) - \nabla \cdot \tau + \mathbf{F}
\frac{\partial (\rho_d \theta_d)}{\partial t} &= - \nabla \cdot (\rho_d \mathbf{u} \theta_d)
+ \nabla \cdot ( \rho_d \alpha_{T}\ \nabla \theta_d) + \frac{\theta_d L_v}{T_d C_{pd}} f_{cond}
Expand Down
65 changes: 65 additions & 0 deletions Exec/ABL/inputs_most_pbl
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
# ------------------ INPUTS TO MAIN PROGRAM -------------------
max_step = 3000

amrex.fpe_trap_invalid = 1

fabarray.mfiter_tile_size = 1024 1024 1024

# PROBLEM SIZE & GEOMETRY
geometry.prob_extent = 1024 1024 1024
amr.n_cell = 4 4 64

#erf.grid_stretching_ratio = 1.025
#erf.initial_dz = 16.0

geometry.is_periodic = 1 1 0

# MOST BOUNDARY (DEFAULT IS ADIABATIC FOR THETA)
zlo.type = "Most"
erf.most.z0 = 0.1
erf.most.zref = 8.0

zhi.type = "SlipWall"

# TIME STEP CONTROL
erf.fixed_dt = 0.1 # fixed time step depending on grid resolution

# 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 = -1 # 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 rhoadv_0 x_velocity y_velocity z_velocity pressure temp theta

# SOLVER CHOICE
erf.alpha_T = 0.0
erf.alpha_C = 1.0
erf.use_gravity = false

erf.molec_diff_type = "None"
erf.les_type = "Smagorinsky"
erf.Cs = 0.1

erf.pbl_type = "MYNN2.5"

erf.init_type = "uniform"

# PROBLEM PARAMETERS
prob.rho_0 = 1.0
prob.A_0 = 1.0

prob.U_0 = 10.0
prob.V_0 = 0.0
prob.W_0 = 0.0
prob.T_0 = 300.0

2 changes: 2 additions & 0 deletions Exec/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ else ()
add_subdirectory(RegTests/EkmanSpiral_custom)
add_subdirectory(RegTests/EkmanSpiral_ideal)
add_subdirectory(RegTests/EkmanSpiral_input_sounding)
add_subdirectory(RegTests/GABLS1)
add_subdirectory(RegTests/IsentropicVortex)
add_subdirectory(RegTests/PoiseuilleFlow)
add_subdirectory(RegTests/ScalarAdvDiff)
Expand All @@ -23,4 +24,5 @@ else ()
add_subdirectory(DevTests/MovingTerrain)
add_subdirectory(DevTests/ParticlesOverWoA)
add_subdirectory(DevTests/MiguelDev)
add_subdirectory(DevTests/MetGrid)
endif()
12 changes: 12 additions & 0 deletions Exec/DevTests/MetGrid/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
set(erf_exe_name erf_metgrid_dev)

add_executable(${erf_exe_name} "")
target_sources(${erf_exe_name}
PRIVATE
prob.cpp
)

target_include_directories(${erf_exe_name} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})

include(${CMAKE_SOURCE_DIR}/CMake/BuildERFExe.cmake)
build_erf_exe(${erf_exe_name})
7 changes: 6 additions & 1 deletion Exec/DevTests/MetGrid/GNUmakefile
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,19 @@ USE_HIP = FALSE
USE_SYCL = FALSE

# Debugging
DEBUG = FALSE
#DEBUG = FALSE
DEBUG = TRUE

TEST = TRUE
USE_ASSERTION = TRUE

USE_NETCDF = TRUE

#USE_MOISTURE = FALSE
USE_MOISTURE = TRUE

#USE_WARM_NO_PRECIP = TRUE

# GNU Make
Bpack := ./Make.package
Blocs := .
Expand Down
27 changes: 17 additions & 10 deletions Exec/DevTests/MetGrid/inputs
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
# ------------------ INPUTS TO MAIN PROGRAM -------------------
max_step = 1
max_step = 100

amrex.fpe_trap_invalid = 1
amrex.fpe_trap_zero = 1
amrex.fpe_trap_overflow = 1

# PROBLEM SIZE & GEOMETRY
geometry.prob_extent = 10600 5000 5000
amr.n_cell = 140 80 60
geometry.prob_extent = 28000 16000 8000
amr.n_cell = 140 80 100

geometry.is_periodic = 0 0 0

Expand All @@ -17,9 +19,10 @@ zlo.type = "NoSlipWall"
zhi.type = "SlipWall"

# TIME STEP CONTROL
erf.fixed_dt = 0.1 # fixed time step depending on grid resolution
erf.fixed_dt = 1.0 # fixed time step depending on grid resolution

erf.use_terrain = true
erf.terrain_smoothing = 2

# DIAGNOSTICS & VERBOSITY
erf.sum_interval = -1 # timesteps between computing mass
Expand All @@ -36,22 +39,26 @@ erf.check_int = 100 # number of timesteps between checkpoints

# PLOTFILES
erf.plot_file_1 = plt # prefix of plotfile name
erf.plot_int_1 = 10 # number of timesteps between plotfiles
erf.plot_vars_1 = density rhoadv_0 x_velocity y_velocity z_velocity pressure temp theta z_phys
erf.plot_int_1 = 1 # number of timesteps between plotfiles
erf.plot_vars_1 = qv Rhoqv density dens_hse rhoadv_0 x_velocity y_velocity z_velocity pressure temp theta z_phys mapfac pres_hse pert_pres KE QKE

# SOLVER CHOICE
erf.alpha_T = 0.0
erf.alpha_T = 1.0
erf.alpha_C = 1.0
erf.use_gravity = true

erf.molec_diff_type = "None"
erf.les_type = "Smagorinsky"
#erf.les_type = "Deardorff"
erf.Cs = 0.1

#erf.terrain_z_levels = 0 130 354 583 816 1054 1549 2068 2615 3193 3803 4450 5142 5892 6709 7603 8591 9702 10967 12442 14230 16610 18711 20752 22133 23960 26579 28493 31236 33699 36068 40000

# INITIALIZATION WITH ATM DATA
erf.init_type = "metgrid"
erf.nc_init_file_0 = "met_em_d01.nc"
#erf.nc_bdy_file = ""
erf.metgrid_bdy_width = 5
erf.metgrid_bdy_set_width = 1
erf.init_type = "metgrid"
erf.nc_init_file_0 = "met_em.d01.2022-06-18_00:00:00.nc" "met_em.d01.2022-06-18_06:00:00.nc" "met_em.d01.2022-06-18_12:00:00.nc" "met_em.d01.2022-06-18_18:00:00.nc"

#There will be no OpenMP tiling
fabarray.mfiter_tile_size = 1024 1024 1024
2 changes: 1 addition & 1 deletion Exec/DevTests/MetGrid/prob.H
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ struct ProbParm : ProbParmDefaults {
class Problem : public ProblemBase
{
public:
Problem();
Problem(const amrex::Real* problo, const amrex::Real* probhi);

protected:
std::string name() override { return "Metgrid"; }
Expand Down
2 changes: 1 addition & 1 deletion Exec/DevTests/MetGrid/prob.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@ amrex_probinit(const amrex_real* problo, const amrex_real* probhi)
return std::make_unique<Problem>(problo, probhi);
}

Problem::Problem()
Problem::Problem(const amrex::Real* problo, const amrex::Real* probhi)
{}
3 changes: 2 additions & 1 deletion Exec/DevTests/MiguelDev/inputs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ zlo.type = "Most" # "Most" # "NoSlipWall"
#erf.most.time_average = false
erf.most.z0 = 0.001
erf.most.zref = 15.0 # >=dz/2
erf.most.surf_temp_flux = 0.05
#erf.most.surf_temp = 303.0
zhi.type = "SlipWall"

Expand All @@ -38,7 +39,7 @@ erf.check_file = chk # root name of checkpoint file
erf.check_int =-100 # number of timesteps between checkpoints

# PLOTFILES
erf.plotfile_type = netcdf
#erf.plotfile_type = netcdf
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 rhoQKE x_velocity y_velocity z_velocity pressure temp theta QKE pres_hse
Expand Down
4 changes: 2 additions & 2 deletions Exec/DevTests/MovingTerrain/inputs
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ zlo.type = "SlipWall"
zhi.type = "SlipWall"

# TERRRAIN GRID TYPE
erf.use_terrain = 1 # enable terrain stencils
erf.terrain_type = 1 # moving terrain
erf.use_terrain = true # enable terrain stencils
erf.terrain_type = Moving # moving terrain
erf.terrain_smoothing = 2 # Sullivan 2004 approach

# FOR NO SUBSTEPPING
Expand Down
2 changes: 1 addition & 1 deletion Exec/LLJ/GNUmakefile
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ TEST = TRUE
USE_ASSERTION = TRUE

USE_NETCDF = TRUE
USE_HDF5 = TRUE
#USE_HDF5 = TRUE

# GNU Make
Bpack := ./Make.package
Expand Down
Loading

0 comments on commit cedc211

Please sign in to comment.