Skip to content

Commit

Permalink
Merge pull request #1272 from ewquon/gabls1
Browse files Browse the repository at this point in the history
Add GABLS1 case
  • Loading branch information
ewquon authored Oct 26, 2023
2 parents af74dfd + 4f9f691 commit 4c792f9
Show file tree
Hide file tree
Showing 21 changed files with 533 additions and 17 deletions.
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
1 change: 1 addition & 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 Down
12 changes: 12 additions & 0 deletions Exec/RegTests/GABLS1/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
set(erf_exe_name erf_gabls1)

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

# Profiling
PROFILE = FALSE
TINY_PROFILE = TRUE
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

# Physics
USE_MOISTURE = FALSE

# Debugging
DEBUG = FALSE

TEST = TRUE
USE_ASSERTION = TRUE

#USE_POISSON_SOLVE = TRUE

# GNU Make
Bpack := ./Make.package
Blocs := .
ERF_HOME := ../..
ERF_PROBLEM_DIR = $(ERF_HOME)/Exec/RegTests/GABLS1
include $(ERF_HOME)/Exec/Make.ERF
2 changes: 2 additions & 0 deletions Exec/RegTests/GABLS1/Make.package
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
CEXE_headers += prob.H
CEXE_sources += prob.cpp
4 changes: 4 additions & 0 deletions Exec/RegTests/GABLS1/input_sounding_GABLS1
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
1013.2 265.0 0.0
0.0 265.0 0.0 8.0 0.0
100.0 265.0 0.0 8.0 0.0
400.0 268.0 0.0 8.0 0.0
77 changes: 77 additions & 0 deletions Exec/RegTests/GABLS1/inputs_gabls1_mynn25_smag
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
# ------------------ INPUTS TO MAIN PROGRAM -------------------
stop_time = 32400.0 # 540 min = 9 h (Cuxart et al. 2006)

amrex.fpe_trap_invalid = 1

fabarray.mfiter_tile_size = 1024 1024 1024

# PROBLEM SIZE & GEOMETRY (Cuxart et al. 2006)
geometry.prob_extent = 25 25 400
amr.n_cell = 4 4 64

geometry.is_periodic = 1 1 0

# MOST BOUNDARY (DEFAULT IS ADIABATIC FOR THETA)
zlo.type = "Most"
erf.most.z0 = 0.1 # from Cuxart et al. 2006
erf.most.zref = 3.125 # == dz/2
erf.most.surf_temp = 265.0 # initial value, should match input_sounding
erf.most.surf_heating_rate = -0.25 # [K/h] from Cuxart et al. 2006

zhi.type = "SlipWall"
zhi.theta_grad = 0.01 # [K/m] to match the input sounding

# INITIALIZATION (Cuxart et al. 2006)
erf.init_type = "input_sounding"
erf.init_sounding_ideal = 1
erf.input_sounding_file = "input_sounding_GABLS1"

# TIME STEP CONTROL
#erf.fixed_dt = 10.0 # fixed time step (Cuxart et al. 2006)
#erf.no_substepping = 1
erf.fixed_dt = 1.0 # largest stable low Mach dt
erf.fixed_mri_dt_ratio = 6

# 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 = 600 # number of timesteps between checkpoints

# PLOTFILES
erf.plot_file_1 = plt # prefix of plotfile name
erf.plot_int_1 = 600 # number of timesteps between plotfiles
erf.plot_vars_1 = density x_velocity y_velocity z_velocity pressure theta rhoQKE Kmv Khv


# SOLVER CHOICE
erf.dycore_vert_adv_type = "Upwind_3rd"

erf.molec_diff_type = "None"
#erf.alpha_T = 0.0
#erf.alpha_C = 1.0

erf.use_gravity = true

# Coriolis parameter f = 1.39e-4 s^-1 (Cuxart et al. 2006)
erf.use_coriolis = true
erf.latitude = 73.0
erf.rotational_time_period = 86455.2516813368

# Geostrophic wind (Cuxart et al. 2006)
erf.abl_driver_type = "GeostrophicWind"
erf.abl_geo_wind = 8.0 0.0 0.0

# Turbulence closure
erf.les_type = "Smagorinsky"
erf.Cs = 0.1
erf.rho0_trans = 1.3223 # from Cuxart et al. 2006
erf.theta_ref = 263.5 # from Cuxart et al. 2006

erf.pbl_type = "MYNN2.5"
86 changes: 86 additions & 0 deletions Exec/RegTests/GABLS1/prob.H
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
#ifndef _PROB_H_
#define _PROB_H_

#include <string>

#include "AMReX_REAL.H"

#include "prob_common.H"

struct ProbParm : ProbParmDefaults {
amrex::Real rho_0 = 0.0;
amrex::Real T_0 = 0.0;
amrex::Real A_0 = 1.0;
amrex::Real QKE_0 = 1e-12; // min value

amrex::Real U_0 = 0.0;
amrex::Real V_0 = 0.0;
amrex::Real W_0 = 0.0;

// random initial perturbations (legacy code)
amrex::Real U_0_Pert_Mag = 0.0;
amrex::Real V_0_Pert_Mag = 0.0;
amrex::Real W_0_Pert_Mag = 0.0;
amrex::Real T_0_Pert_Mag = 0.0; // perturbation to rho*Theta

// divergence-free initial perturbations
amrex::Real pert_deltaU = 0.0;
amrex::Real pert_deltaV = 0.0;
amrex::Real pert_periods_U = 5.0;
amrex::Real pert_periods_V = 5.0;
amrex::Real pert_ref_height = 100.0;

// rayleigh damping
amrex::Real dampcoef = 0.2; // inverse time scale [1/s]
amrex::Real zdamp = 500.0; // damping depth [m] from model top

// helper vars
amrex::Real aval;
amrex::Real bval;
amrex::Real ufac;
amrex::Real vfac;
}; // namespace ProbParm

class Problem : public ProblemBase
{
public:
Problem(const amrex::Real* problo, const amrex::Real* probhi);

#include "Prob/init_constant_density_hse.H"
#include "Prob/init_rayleigh_damping.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;

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

private:
ProbParm parms;
};

#endif
Loading

0 comments on commit 4c792f9

Please sign in to comment.