Skip to content

Commit

Permalink
Adding warm bubble no precip case
Browse files Browse the repository at this point in the history
  • Loading branch information
Mahesh Natarajan committed Dec 5, 2023
1 parent 3bb1f08 commit f4da5d9
Show file tree
Hide file tree
Showing 13 changed files with 2,171 additions and 3 deletions.
12 changes: 12 additions & 0 deletions Exec/WarmBubble/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
set(erf_exe_name squallline_2d)

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/WarmBubble/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/WarmBubble
include $(ERF_HOME)/Exec/Make.ERF
2 changes: 2 additions & 0 deletions Exec/WarmBubble/Make.package
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
CEXE_headers += prob.H
CEXE_sources += prob.cpp
2 changes: 2 additions & 0 deletions Exec/WarmBubble/README
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
This problem setup is the evolution of a supercell, which primarily tests the ability
of ERF to model moisture physics.
91 changes: 91 additions & 0 deletions Exec/WarmBubble/inputs_moisture
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
# ------------------ INPUTS TO MAIN PROGRAM -------------------
max_step = 1
stop_time = 90000.0

amrex.fpe_trap_invalid = 1

fabarray.mfiter_tile_size = 2048 1024 2048

# PROBLEM SIZE & GEOMETRY
geometry.prob_lo = 0. 0. 0.
geometry.prob_hi = 20000. 400. 10000.
amr.n_cell = 192 4 128 # 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
#xlo.type = "Outflow"
#xhi.type = "Outflow"
zlo.type = "SlipWall"
zhi.type = "Outflow"

erf.sponge_strength = 2.0
#erf.use_zhi_sponge_damping = true
erf.zhi_sponge_start = 12000.0

erf.sponge_density = 1.2
erf.sponge_x_velocity = 0.0
erf.sponge_y_velocity = 0.0
erf.sponge_z_velocity = 0.0

# 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.5 # fixed time step [s] -- Straka et al 1993
#erf.no_substepping = 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
amr.check_file = chk # root name of checkpoint file
amr.check_int = 1000 # number of timesteps between checkpoints
#amr.restart = chk09000

# PLOTFILES
erf.plot_file_1 = plt # root name of plotfile
erf.plot_int_1 = 100 # 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 scalar pert_dens

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

#erf.les_type = "Smagorinsky"
erf.Cs = 0.25
erf.les_type = "None"

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

erf.moisture_model = "Kessler"
erf.use_moist_background = true

erf.moistscal_horiz_adv_string = "Centered_2nd"
erf.moistscal_vert_adv_string = "Centered_2nd"

# PROBLEM PARAMETERS (optional)
prob.z_tr = 12000.0
prob.height = 1200.0
prob.theta_0 = 300.0
prob.theta_tr = 300.0
prob.T_tr = 213.0
prob.x_c = 10000.0
prob.z_c = 2000.0
prob.x_r = 2000.0
prob.z_r = 2000.0
prob.theta_c = 0.0
132 changes: 132 additions & 0 deletions Exec/WarmBubble/prob.H
Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@
#ifndef _PROB_H_
#define _PROB_H_

#include <string>

#include "AMReX_REAL.H"
#include "AMReX_ParmParse.H"
#include "AMReX_MultiFab.H"

#include "prob_common.H"
#include "EOS.H"
#include "IndexDefines.H"
#include "TileNoZ.H"

struct ProbParm : ProbParmDefaults {
amrex::Real z_tr = 12000.0;
amrex::Real height = 1200.0;
amrex::Real theta_0 = 300.0;
amrex::Real theta_tr = 343.0;
amrex::Real T_tr = 213.0;

amrex::Real x_c = 0.0;
amrex::Real z_c = 1.5e3;
amrex::Real x_r = 4.0e3;
amrex::Real z_r = 1.5e3;
amrex::Real theta_c = 3.0;

amrex::Real C_p = 1004.0;
amrex::Real Theta_0 = 300.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 erf_init_dens_hse_moist (amrex::MultiFab& rho_hse,
std::unique_ptr<amrex::MultiFab>& z_phys_nd,
amrex::Geometry const& geom) 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;

amrex::Real compute_theta (amrex::Real z);

amrex::Real compute_p_k (amrex::Real& p_k,
const amrex::Real p_k_minus_1,
amrex::Real& theta_k,
amrex::Real& rho_k,
amrex::Real& q_v_k,
amrex::Real& T_dp,
amrex::Real& T_b,
const amrex::Real dz,
const amrex::Real z,
const amrex::Real rho_k_minus_1);

amrex::Real compute_F (const amrex::Real& p_k,
const amrex::Real& p_k_minus_1,
amrex::Real &theta_k,
amrex::Real& rho_k,
amrex::Real& q_v_k,
amrex::Real& T_dp,
amrex::Real& T_b,
const amrex::Real& dz,
const amrex::Real& z,
const amrex::Real& rho_k_minus_1);

void compute_rho (const amrex::Real& z,
const amrex::Real& pressure,
amrex::Real &theta,
amrex::Real& rho,
amrex::Real& q_v,
amrex::Real& T_dp,
amrex::Real& T_b);

void init_isentropic_hse_no_terrain(amrex::Real *theta,
amrex::Real* r,
amrex::Real* p,
amrex::Real *q_v,
const amrex::Real& dz,
const amrex::Real& prob_lo_z,
const int& khi);

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

private:
ProbParm parms;
};

#endif
Loading

0 comments on commit f4da5d9

Please sign in to comment.