Skip to content

Commit

Permalink
add test case for radiation model (#1302)
Browse files Browse the repository at this point in the history
* add a radiation test case

* fix some issues during test

* fix white tab check

* Update Mam4_constituents.H

---------

Co-authored-by: Ann Almgren <[email protected]>
  • Loading branch information
xyuan and asalmgren authored Nov 16, 2023
1 parent 02b8e61 commit 00c1513
Show file tree
Hide file tree
Showing 12 changed files with 508 additions and 35 deletions.
1 change: 1 addition & 0 deletions Exec/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ if (ERF_ENABLE_MULTIBLOCK)
else ()
add_subdirectory(ABL)
add_subdirectory(SuperCell)
add_subdirectory(Radiation)
add_subdirectory(RegTests/Bubble)
add_subdirectory(RegTests/CouetteFlow)
add_subdirectory(RegTests/DensityCurrent)
Expand Down
12 changes: 12 additions & 0 deletions Exec/Radiation/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
set(erf_exe_name radiation)

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})
35 changes: 35 additions & 0 deletions Exec/Radiation/GNUmakefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# AMReX
COMP = gnu
PRECISION = DOUBLE

# Profiling
PROFILE = FALSE
TINY_PROFILE = FALSE
COMM_PROFILE = FALSE
TRACE_PROFILE = FALSE
MEM_PROFILE = FALSE
USE_GPROF = FALSE

# Performance
USE_MPI = TRUE
USE_OMP = FALSE

USE_CUDA = FALSE
USE_HIP = FALSE
USE_SYCL = FALSE

# Debugging
DEBUG = FALSE

TEST = TRUE
USE_ASSERTION = TRUE

USE_MOISTURE = TRUE
#USE_WARM_NO_PRECIP = TRUE

# GNU Make
Bpack := ./Make.package
Blocs := .
ERF_HOME := ../..
ERF_PROBLEM_DIR = $(ERF_HOME)/Exec/SuperCell
include $(ERF_HOME)/Exec/Make.ERF
2 changes: 2 additions & 0 deletions Exec/Radiation/Make.package
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
CEXE_headers += prob.H
CEXE_sources += prob.cpp
3 changes: 3 additions & 0 deletions Exec/Radiation/README
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
This problem setup is the evolution of a radiation, this case requires to build
ERF with moisture and radiation model. This case is used to test ERF moisture
and radiation physics.
62 changes: 62 additions & 0 deletions Exec/Radiation/inputs_radiation
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
# ------------------ INPUTS TO MAIN PROGRAM -------------------
max_step = 1000
stop_time = 90000.0

amrex.fpe_trap_invalid = 1

fabarray.mfiter_tile_size = 2048 1024 2048

# PROBLEM SIZE & GEOMETRY
geometry.prob_lo = -25600. 0. 0.
geometry.prob_hi = 25600. 400. 12800.
amr.n_cell = 128 4 32 # dx=dy=dz=100 m

# periodic in x to match WRF setup
# - as an alternative, could use symmetry at x=0 and outflow at x=25600
geometry.is_periodic = 1 1 0
zlo.type = "SlipWall"
zhi.type = "SlipWall"

# TIME STEP CONTROL
erf.use_native_mri = 1
erf.fixed_dt = 1.0 # fixed time step [s] -- Straka et al 1993
erf.fixed_fast_dt = 0.25 # fixed time step [s] -- Straka et al 1993

# 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
amr.check_file = chk # root name of checkpoint file
amr.check_int = 10000 # number of timesteps between checkpoints
#amr.restart = chk01000

# PLOTFILES
erf.plot_file_1 = plt # root name of plotfile
erf.plot_int_1 = 1 # number of timesteps between plotfiles
erf.plot_vars_1 = density rhotheta rhoQt rhoQp x_velocity y_velocity z_velocity pressure theta temp qt qp qv qc qi

# SOLVER CHOICE
erf.use_gravity = true
erf.use_coriolis = false
erf.use_rayleigh_damping = false

erf.les_type = "Deardorff"
#erf.les_type = "None"
#
# diffusion coefficient from Straka, K = 75 m^2/s
#
#erf.molec_diff_type = "ConstantAlpha"
erf.molec_diff_type = "None"
erf.rho0_trans = 1.0 # [kg/m^3], used to convert input diffusivities
erf.dynamicViscosity = 75.0 # [kg/(m-s)] ==> nu = 75.0 m^2/s
erf.alpha_T = 75.0 # [m^2/s]

# PROBLEM PARAMETERS (optional)
prob.T_0 = 300.0
prob.U_0 = 0
prob.T_pert = 3
77 changes: 77 additions & 0 deletions Exec/Radiation/prob.H
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
#ifndef _PROB_H_
#define _PROB_H_

#include <string>

#include "AMReX_REAL.H"

#include "prob_common.H"

struct ProbParm : ProbParmDefaults {
amrex::Real T_0 = 300.0; // surface temperature == mean potential temperature
amrex::Real U_0 = 10.0;
amrex::Real V_0 = 0.0;
amrex::Real x_c = 0.0; // center of thermal perturbation
amrex::Real z_c = 3200.0;
amrex::Real x_r = 1000.0;
amrex::Real z_r = 1000.0;
amrex::Real T_pert = 5.0; // perturbation temperature
// overridden physical constants
amrex::Real C_p = 1004.0;
}; // namespace ProbParm

class Problem : public ProblemBase
{
public:
Problem();

#include "Prob/init_density_hse_dry.H"

void init_custom_pert (
const amrex::Box& bx,
const amrex::Box& xbx,
const amrex::Box& ybx,
const amrex::Box& zbx,
amrex::Array4<amrex::Real > const& state,
amrex::Array4<amrex::Real > const& x_vel,
amrex::Array4<amrex::Real > const& y_vel,
amrex::Array4<amrex::Real > const& z_vel,
amrex::Array4<amrex::Real > const& r_hse,
amrex::Array4<amrex::Real > const& p_hse,
amrex::Array4<amrex::Real const> const& z_nd,
amrex::Array4<amrex::Real const> const& z_cc,
#if defined(ERF_USE_MOISTURE)
amrex::Array4<amrex::Real > const& qv,
amrex::Array4<amrex::Real > const& qc,
amrex::Array4<amrex::Real > const& qi,
#elif defined(ERF_USE_WARM_NO_PRECIP)
amrex::Array4<amrex::Real > const& qv,
amrex::Array4<amrex::Real > const& qc,
#endif
amrex::GeometryData const& geomdata,
amrex::Array4<amrex::Real const> const& mf_m,
amrex::Array4<amrex::Real const> const& mf_u,
amrex::Array4<amrex::Real const> const& mf_v,
const SolverChoice& sc) override;

void init_custom_terrain (
const amrex::Geometry& geom,
amrex::MultiFab& z_phys_nd,
const amrex::Real& time) override;

void erf_init_rayleigh (
amrex::Vector<amrex::Real>& tau,
amrex::Vector<amrex::Real>& ubar,
amrex::Vector<amrex::Real>& vbar,
amrex::Vector<amrex::Real>& wbar,
amrex::Vector<amrex::Real>& thetabar,
amrex::Geometry const& geom) override;

protected:
std::string name() override { return "Supercell"; }

private:
ProbParm parms;
};

#endif
Loading

0 comments on commit 00c1513

Please sign in to comment.