ERF
Energy Research and Forecasting: An Atmospheric Modeling Code
ERF_InitCustomPert_Bubble.H File Reference

Go to the source code of this file.

Functions

ParmParse pp_prob ("prob")
 
pp_prob query ("T_0", T_0)
 
pp_prob query ("x_c", x_c)
 
pp_prob query ("y_c", y_c)
 
pp_prob query ("z_c", z_c)
 
pp_prob query ("x_r", x_r)
 
pp_prob query ("y_r", y_r)
 
pp_prob query ("z_r", z_r)
 
pp_prob query ("T_pert", T_pert)
 
pp_prob query ("T_pert_is_airtemp", T_pert_is_airtemp)
 
pp_prob query ("perturb_rho", perturb_rho)
 
pp_prob query ("do_moist_bubble", do_moist_bubble)
 
pp_prob query ("theta_pert", theta_pert)
 
 AMREX_ALWAYS_ASSERT (bx.length()[2]==khi+1)
 
 if (y_r > 0) rad+
 
 if (z_r > 0) rad+
 
 if (rad<=1.0)
 
 state_pert (i, j, k, RhoTheta_comp)
 
 state_pert (i, j, k, Rho_comp)
 
 state_pert (i, j, k, RhoScalar_comp)=0.0
 
 state_pert (i, j, k, RhoQ1_comp)
 
 state_pert (i, j, k, RhoQ2_comp)
 
 if (nstate==NVAR_max)
 

Variables

Real T_0 = 300.0
 
Real x_c = 0.0
 
Real y_c = 0.0
 
Real z_c = 0.0
 
Real x_r = 0.0
 
Real y_r = 0.0
 
Real z_r = 0.0
 
Real T_pert = -15.0
 
bool T_pert_is_airtemp = true
 
bool perturb_rho = true
 
bool do_moist_bubble = false
 
do_moist_bubble &Real theta_pert = 2.0
 
const int khi = geomdata.Domain().bigEnd()[2]
 
const Real dz = geomdata.CellSize()[2]
 
const Real rdOcp = sc.rdOcp
 
background fields should have been initialized with erf init_type<< std::endl;} Real qt_init=0.02;pp_prob.query("qt_init", qt_init);Real eq_pot_temp=320.0;pp_prob.query("eq_pot_temp", eq_pot_temp);bool use_empirical=false;pp_prob.query("use_empircal_psat", use_empirical);if(do_moist_bubble) { Vector< Real > h_r(khi+2);Vector< Real > h_p(khi+2);Vector< Real > h_t(khi+2);Vector< Real > h_q_v(khi+2);Gpu::DeviceVector< Real > d_r(khi+2);Gpu::DeviceVector< Real > d_p(khi+2);Gpu::DeviceVector< Real > d_t(khi+2);Gpu::DeviceVector< Real > d_q_v(khi+2);HSEutils::init_isentropic_hse_no_terrain(h_t.data(), h_r.data(), h_p.data(), h_q_v.data(), dz, khi, qt_init, eq_pot_temp, use_empirical, false);Gpu::copyAsync(Gpu::hostToDevice, h_r.begin(), h_r.end(), d_r.begin());Gpu::copyAsync(Gpu::hostToDevice, h_p.begin(), h_p.end(), d_p.begin());Gpu::copyAsync(Gpu::hostToDevice, h_t.begin(), h_t.end(), d_t.begin());Gpu::copyAsync(Gpu::hostToDevice, h_q_v.begin(), h_q_v.end(), d_q_v.begin());Real *theta_back=d_t.data();Real *p_back=d_p.data();Real *q_v_back=d_q_v.data();int moisture_type=1;if(sc.moisture_type==MoistureType::SAM) { moisture_type=1;} else if(sc.moisture_type==MoistureType::SAM_NoIce||sc.moisture_type==MoistureType::SAM_NoPrecip_NoIce) { moisture_type=2;} ParallelFor(bx,[=] AMREX_GPU_DEVICE(int i, int j, int k) { const auto prob_lo=geomdata.ProbLo();const auto dx=geomdata.CellSize();const Real x=prob_lo[0]+(i+0.5) *dx[0];const Real y=prob_lo[1]+(j+0.5) *dx[1];const Real z=prob_lo[2]+(k+0.5) *dx[2];Real rad, delta_theta, theta_total, rho, RH;rad=0.0;if(x_rrad = std::pow((x - x_c)/x_r, 2)
 
 else
 
 theta_total = theta_back[k]*(delta_theta/300.0 + 1)
 
Real T = getTgivenPandTh(p_back[k], theta_total, (R_d/Cp_d))
 
 rho = p_back[k]/(R_d*T*(1.0 + (R_v/R_d)*q_v_back[k]))
 
 RH = compute_relative_humidity(use_empirical)
 
Real q_v_hot = vapor_mixing_ratio(p_back[k], T, RH)
 
Real T_back = getTgivenPandTh(p_back[k], theta_back[k], (R_d/Cp_d))
 
Real rho_back = p_back[k]/(R_d*T_back*(1.0 + (R_v/R_d)*q_v_back[k]))
 
int nstate = state_pert.nComp()
 

Function Documentation

◆ AMREX_ALWAYS_ASSERT()

AMREX_ALWAYS_ASSERT ( bx.  length()[2] = =khi+1)

Referenced by EWP::advance(), Fitch::advance(), GeneralAD::advance(), SimpleAD::advance(), MRISplitIntegrator< T >::advance(), AdvectionSrcForMom(), AdvectionSrcForMom_ConstantDz(), AdvectionSrcForMom_EB(), AdvectionSrcForMom_StretchedDz(), AdvectionSrcForMom_TF(), AdvectionSrcForOpenBC_Tangent_Cons(), AdvectionSrcForOpenBC_Tangent_Xmom(), AdvectionSrcForOpenBC_Tangent_Ymom(), AdvectionSrcForOpenBC_Tangent_Zmom(), ApplyBndryForcing_Forecast(), ApplySpongeZoneBCsForCC(), ApplySpongeZoneBCsForMom(), ApplySpongeZoneBCsForMom_ReadFromFile(), polygon_::area(), ERF::AverageDown(), ERF::AverageDownTo(), ERFFillPatcher::BuildMask(), closest_index(), compute_source_terms_Fn_Ft(), ComputeDiffusivityMRF(), ComputeDiffusivityMYJ(), ComputeDiffusivityMYNN25(), ComputeDiffusivityMYNNEDMF(), ComputeDiffusivityYSU(), ComputeTurbulentViscosity(), polygon_::define(), ERFFillPatcher::Define(), eb_aux_::define(), ForestDrag::define_drag_field(), polygon_::distance(), derived::erf_derenstrophysq(), derived::erf_dermagvel(), derived::erf_dermagvelsq(), derived::erf_dermoisttemp(), derived::erf_dersoundspeed(), derived::erf_dertemp(), derived::erf_dervortx(), derived::erf_dervorty(), derived::erf_dervortz(), erf_dtesati(), erf_esati(), erf_make_tau_terms(), erf_slow_rhs_post(), erf_slow_rhs_pre(), erf_substep_NS(), ERFFillPatcher::ERFFillPatcher(), ERF::ErrorEst(), expand_and_interpolate_1d(), ERFFillPatcher::Fill(), ERF::fill_from_bndryregs(), SurfaceLayer::fill_tsurf_with_sst_and_tsk(), ERF::FillIntermediatePatch(), ERF::FillPatchCrseLevel(), ERF::FillPatchFineLevel(), LineSampler::get_sample_data(), SDInitProperties::getDistribution(), SAM::IceFall(), ERFPhysBCFunct_w::impose_vertical_zvel_bcs(), ERF::init_bcs(), init_bx_scalars_from_input_sounding_hse(), ERF::init_Dirichlet_bc_data(), ERF::init_geo_wind_profile(), SolverChoice::init_params(), TurbulentPerturbation::init_tpi_type(), init_zlevels(), ERF::InitData_post(), ERF::initHSE(), ReadBndryPlanes::interp_in_time(), intersect_plane_edge(), PlaneAverage::line_average(), PlaneAverage::line_average_interpolated(), LineSampler::LineSampler(), MM5::Lsm_Data_Ptr(), NOAHMP::Lsm_Data_Ptr(), SLM::Lsm_Data_Ptr(), MM5::Lsm_DataName(), NOAHMP::Lsm_DataName(), SLM::Lsm_DataName(), MM5::Lsm_Flux_Ptr(), NOAHMP::Lsm_Flux_Ptr(), SLM::Lsm_Flux_Ptr(), NOAHMP::Lsm_FluxName(), make_buoyancy(), ERF::make_physbcs(), make_sources(), SurfaceLayer::make_SurfaceLayer_at_level(), ERF::MakeNewLevelFromCoarse(), ERF::MakeNewLevelFromScratch(), HSEutils::Newton_Raphson_hse(), ERF::ParameterSanityChecks(), PlaneAverage::PlaneAverage(), PlaneSampler::PlaneSampler(), SAM::PrecipFall(), SDInitProperties::printParameters(), ERF::project_momenta(), ERF::project_velocity_tb(), Kessler::Qmoist_Ptr(), Morrison::Qmoist_Ptr(), SAM::Qmoist_Ptr(), SatAdj::Qmoist_Ptr(), SurfaceLayer::read_custom_roughness(), ProblemBase::read_custom_terrain(), InputSpongeData::read_from_file(), InputSoundingData::read_from_file(), ReadBndryPlanes::read_input_files(), SolverChoice::read_int_string(), ReadNetCDFFile(), ERF::ReadParameters(), ReadTimeSliceFromNetCDFFile(), ERF::ReadVelsOnlyFromCheckpointFile(), realbdy_compute_interior_ghost_rhs(), realbdy_interior_bxs_xy(), ERF::refinement_criteria_setup(), ERFFillPatcher::RegisterCoarseData(), ERF::RemakeLevel(), MOSTAverage::set_k_indices_N(), InputSpongeData::size(), InputSoundingData::size(), ERF::sum_derived_quantities(), ERF::sum_energy_quantities(), ERF::Write3DPlotFile(), ERF::WriteGenericPlotfileHeaderWithTerrain(), and ERF::WriteMultiLevelPlotfileWithTerrain().

◆ if() [1/4]

if ( nstate  = NVAR_max)
127  {
128  Real omn;
129  if(moisture_type == 1) {
130  omn = std::max(0.0,std::min(1.0,(T-tbgmin)*a_bg));
131  } else if(moisture_type == 2) {
132  omn = 1.0;
133  } else {
134  omn = 0.0;
135  Abort("Invalid moisture type specified");
136  }
137  Real qn = state_pert(i, j, k, RhoQ2_comp);
138  state_pert(i, j, k, RhoQ2_comp) = qn * omn;
139  state_pert(i, j, k, RhoQ3_comp) = qn * (1.0-omn);
140  }
constexpr amrex::Real a_bg
Definition: ERF_Constants.H:77
constexpr amrex::Real tbgmin
Definition: ERF_Constants.H:31
#define RhoQ2_comp
Definition: ERF_IndexDefines.H:43
#define RhoQ3_comp
Definition: ERF_IndexDefines.H:44
state_pert(i, j, k, RhoTheta_comp)
Real T
Definition: ERF_InitCustomPert_Bubble.H:105
amrex::Real Real
Definition: ERF_ShocInterface.H:19
@ qn
Definition: ERF_Morrison.H:33
Here is the call graph for this function:

◆ if() [2/4]

if ( rad<=1.  0)
98  {
99  delta_theta = theta_pert*std::pow(cos(PI*rad/2.0),2);
100  } else {
constexpr amrex::Real PI
Definition: ERF_Constants.H:6
background fields should have been initialized with erf init_type<< std::endl;} Real qt_init=0.02;pp_prob.query("qt_init", qt_init);Real eq_pot_temp=320.0;pp_prob.query("eq_pot_temp", eq_pot_temp);bool use_empirical=false;pp_prob.query("use_empircal_psat", use_empirical);if(do_moist_bubble) { Vector< Real > h_r(khi+2);Vector< Real > h_p(khi+2);Vector< Real > h_t(khi+2);Vector< Real > h_q_v(khi+2);Gpu::DeviceVector< Real > d_r(khi+2);Gpu::DeviceVector< Real > d_p(khi+2);Gpu::DeviceVector< Real > d_t(khi+2);Gpu::DeviceVector< Real > d_q_v(khi+2);HSEutils::init_isentropic_hse_no_terrain(h_t.data(), h_r.data(), h_p.data(), h_q_v.data(), dz, khi, qt_init, eq_pot_temp, use_empirical, false);Gpu::copyAsync(Gpu::hostToDevice, h_r.begin(), h_r.end(), d_r.begin());Gpu::copyAsync(Gpu::hostToDevice, h_p.begin(), h_p.end(), d_p.begin());Gpu::copyAsync(Gpu::hostToDevice, h_t.begin(), h_t.end(), d_t.begin());Gpu::copyAsync(Gpu::hostToDevice, h_q_v.begin(), h_q_v.end(), d_q_v.begin());Real *theta_back=d_t.data();Real *p_back=d_p.data();Real *q_v_back=d_q_v.data();int moisture_type=1;if(sc.moisture_type==MoistureType::SAM) { moisture_type=1;} else if(sc.moisture_type==MoistureType::SAM_NoIce||sc.moisture_type==MoistureType::SAM_NoPrecip_NoIce) { moisture_type=2;} ParallelFor(bx,[=] AMREX_GPU_DEVICE(int i, int j, int k) { const auto prob_lo=geomdata.ProbLo();const auto dx=geomdata.CellSize();const Real x=prob_lo[0]+(i+0.5) *dx[0];const Real y=prob_lo[1]+(j+0.5) *dx[1];const Real z=prob_lo[2]+(k+0.5) *dx[2];Real rad, delta_theta, theta_total, rho, RH;rad=0.0;if(x_r > rad
Definition: ERF_InitCustomPert_Bubble.H:93
do_moist_bubble &Real theta_pert
Definition: ERF_InitCustomPert_Bubble.H:19

◆ if() [3/4]

if ( y_r  ,
 
)

◆ if() [4/4]

if ( z_r  ,
 
)

◆ pp_prob()

ParmParse pp_prob ( "prob"  )

◆ query() [1/12]

pp_prob query ( "do_moist_bubble"  ,
do_moist_bubble   
)

◆ query() [2/12]

pp_prob query ( "perturb_rho"  ,
perturb_rho   
)

◆ query() [3/12]

pp_prob query ( "T_0"  ,
T_0   
)

◆ query() [4/12]

pp_prob query ( "T_pert"  ,
T_pert   
)

◆ query() [5/12]

pp_prob query ( "T_pert_is_airtemp"  ,
T_pert_is_airtemp   
)

◆ query() [6/12]

pp_prob query ( "theta_pert"  ,
theta_pert   
)

◆ query() [7/12]

pp_prob query ( "x_c"  ,
x_c   
)

◆ query() [8/12]

pp_prob query ( "x_r"  ,
x_r   
)

◆ query() [9/12]

pp_prob query ( "y_c"  ,
y_c   
)

◆ query() [10/12]

pp_prob query ( "y_r"  ,
y_r   
)

◆ query() [11/12]

pp_prob query ( "z_c"  ,
z_c   
)

◆ query() [12/12]

pp_prob query ( "z_r"  ,
z_r   
)

◆ state_pert() [1/5]

state_pert ( ,
,
,
Rho_comp   
)

◆ state_pert() [2/5]

state_pert ( ,
,
,
RhoQ1_comp   
)

◆ state_pert() [3/5]

state_pert ( ,
,
,
RhoQ2_comp   
)

◆ state_pert() [4/5]

state_pert ( ,
,
,
RhoScalar_comp   
)
pure virtual

◆ state_pert() [5/5]

state_pert ( ,
,
,
RhoTheta_comp   
)

Referenced by if(), ParallelFor(), and ParallelForRNG().

Here is the caller graph for this function:

Variable Documentation

◆ do_moist_bubble

bool do_moist_bubble = false

◆ dz

const Real dz = geomdata.CellSize()[2]

Referenced by ApplySurfaceTreatment_BulkCoeff_CC(), ApplySurfaceTreatment_BulkCoeff_Mom(), InputSoundingData::calc_rho_p(), InputSoundingData::calc_rho_p_isentropic(), HSEutils::compute_F(), compute_gradp(), rrtmgp::compute_heating_rate(), HSEutils::compute_p_k(), ComputeDiffusivityMYJ(), ComputeDiffusivityMYNN25(), ComputeDiffusivityMYNNEDMF(), ComputeDiffusivityYSU(), ForestDrag::define_drag_field(), ERF::derive_diag_profiles(), DiffusionSrcForMom_EB(), erf_calc_slopes_eb_Dirichlet(), erf_calc_slopes_eb_Dirichlet_staggered(), erf_calc_slopes_eb_staggered(), erf_calc_slopes_eb_staggered_upwind(), derived::erf_derenstrophysq(), derived::erf_dervortx(), derived::erf_dervorty(), ERF::erf_enforce_hse(), erf_init_dens_hse(), erf_init_dens_hse_moist(), ERF::ERF_shared(), expand_and_interpolate_1d(), SurfaceLayer::fill_qsurf_with_qsat(), get_dzmin_terrain(), ERFPhysBCFunct_cons::impose_vertical_cons_bcs(), ERFPhysBCFunct_u::impose_vertical_xvel_bcs(), ERFPhysBCFunct_v::impose_vertical_yvel_bcs(), init_bx_scalars_from_input_sounding(), init_bx_scalars_from_input_sounding_hse(), init_bx_velocities_from_input_sounding(), init_default_zphys(), ERF::init_Dirichlet_bc_data(), ERF::init_geo_wind_profile(), HSEutils::init_isentropic_hse(), HSEutils::init_isentropic_hse_no_terrain(), init_zlevels(), SHOCInterface::initialize_impl(), interpolate_column_metgrid_linear(), interpolate_from_coarse(), make_sources(), SHOCInterface::mf_to_kokkos_buffers(), Radiation::mf_to_kokkos_buffers(), rrtmgp::mixing_ratio_to_cloud_mass(), HSEutils::Newton_Raphson_hse(), ERF::ReadCheckpointFile(), ERF::Write2DPlotFile(), and ERF::Write3DPlotFile().

◆ else

else
Initial value:
{
delta_theta = 0.0

◆ khi

◆ nstate

int nstate = state_pert.nComp()

◆ perturb_rho

bool perturb_rho = true

◆ q_v_hot

Real q_v_hot = vapor_mixing_ratio(p_back[k], T, RH)

Referenced by if(), and ParallelFor().

◆ rad

◆ rdOcp

const Real rdOcp = sc.rdOcp

◆ RH

◆ rho

rho = p_back[k]/(R_d*T*(1.0 + (R_v/R_d)*q_v_back[k]))

Referenced by ApplySurfaceTreatment_BulkCoeff_CC(), ERF::check_for_low_temp(), ERF::check_for_negative_theta(), rrtmgp::compute_heating_rate(), custom_flux::compute_q_flux(), rotate_flux::compute_q_flux(), bulk_coeff_flux::compute_q_flux(), rico_flux::compute_q_flux(), moeng_flux::compute_q_flux(), HSEutils::compute_rho(), compute_source_terms_Fn_Ft(), custom_flux::compute_t_flux(), rotate_flux::compute_t_flux(), donelan_flux::compute_t_flux(), bulk_coeff_flux::compute_t_flux(), rico_flux::compute_t_flux(), moeng_flux::compute_t_flux(), rotate_flux::compute_u_flux(), bulk_coeff_flux::compute_u_flux(), custom_flux::compute_u_flux(), rico_flux::compute_u_flux(), donelan_flux::compute_u_flux(), moeng_flux::compute_u_flux(), bulk_coeff_flux::compute_v_flux(), custom_flux::compute_v_flux(), rico_flux::compute_v_flux(), donelan_flux::compute_v_flux(), moeng_flux::compute_v_flux(), ComputeDiffusivityMRF(), ComputeDiffusivityMYJ(), ComputeDiffusivityMYNN25(), ComputeDiffusivityMYNNEDMF(), ComputeDiffusivityYSU(), ComputeN2(), ComputeN2_EB(), ComputeTurbulentViscosityLES(), ComputeTurbulentViscosityLES_EB(), derived::erf_dermoisttemp(), derived::erf_derrhodivide(), derived::erf_dersoundspeed(), derived::erf_dertemp(), ERF::estTimeStep(), getdPdRgivenConstantTheta(), getTgivenRandRTh(), getThgivenRandT(), SAM::IceFall(), if(), ERFPhysBCFunct_cons::impose_lateral_cons_bcs(), ERFPhysBCFunct_cons::impose_vertical_cons_bcs(), SurfaceLayer::init_tke_from_ustar(), IsSaturated(), rrtmgp::mixing_ratio_to_cloud_mass(), MomentumToVelocity(), ParallelFor(), ParallelForRNG(), SAM::PrecipFall(), term_vel_qp(), SurfaceLayer::update_fluxes(), VelocityToMomentum(), and ERF::Write3DPlotFile().

◆ rho_back

Real rho_back = p_back[k]/(R_d*T_back*(1.0 + (R_v/R_d)*q_v_back[k]))

Referenced by if(), and ParallelFor().

◆ T

◆ T_0

Real T_0 = 300.0

◆ T_back

Real T_back = getTgivenPandTh(p_back[k], theta_back[k], (R_d/Cp_d))

Referenced by if(), and ParallelFor().

◆ T_pert

Real T_pert = -15.0

◆ T_pert_is_airtemp

bool T_pert_is_airtemp = true

◆ theta_pert

do_moist_bubble& Real theta_pert = 2.0

Referenced by if().

◆ theta_total

theta_total = theta_back[k]*(delta_theta/300.0 + 1)

Referenced by if(), and ParallelFor().

◆ x_c

Real x_c = 0.0

◆ x_r

Real x_r = 0.0

◆ y_c

Real y_c = 0.0

◆ y_r

Real y_r = 0.0

◆ z_c

Real z_c = 0.0

◆ z_r

Real z_r = 0.0