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

Go to the source code of this file.

Functions

 AMREX_ALWAYS_ASSERT_WITH_MESSAGE (m_cloud_chamber_config.active, "Cloud Chamber: initializer reached without a parsed configuration")
 
 AMREX_ALWAYS_ASSERT_WITH_MESSAGE (sc.anelastic[lev]==1 &&sc.fixed_density[lev]==1, "Cloud Chamber: the selected level must use fixed-density anelastic dynamics")
 
 AMREX_ALWAYS_ASSERT_WITH_MESSAGE (sc.terrain_type==TerrainType::None &&sc.buildings_type==BuildingsType::None &&sc.mesh_type==MeshType::ConstantDz, "Cloud Chamber: terrain, buildings, and non-Cartesian mesh modes are unsupported")
 
 AMREX_ALWAYS_ASSERT_WITH_MESSAGE (erf_cloud_chamber::supports_moisture_model(sc.moisture_type), "Cloud Chamber: unsupported moisture model in custom initializer")
 
 AMREX_ALWAYS_ASSERT_WITH_MESSAGE (m_cloud_chamber_config.has_moisture==(sc.moisture_type !=MoistureType::None), "Cloud Chamber: moisture-model selection and chamber configuration disagree")
 
 ParallelFor (bx, [=] AMREX_GPU_DEVICE(int i, int j, int k) noexcept { const Real x=prob_lo[0]+(Real(i)+Real(0.5)) *dx[0];const Real y=prob_lo[1]+(Real(j)+Real(0.5)) *dx[1];const Real z=prob_lo[2]+(Real(k)+Real(0.5)) *dx[2];const Real rho=state(i, j, k, Rho_comp);const Real temperature=erf_cloud_chamber::linear_profile(config.initial_temperature_bottom, config.initial_temperature_top, z, config.prob_lo[2], config.prob_hi[2] - config.prob_lo[2])+erf_cloud_chamber::deterministic_perturbation(x, y, z, config.prob_lo, GpuArray< Real, AMREX_SPACEDIM >{ config.prob_hi[0] - config.prob_lo[0], config.prob_hi[1] - config.prob_lo[1], config.prob_hi[2] - config.prob_lo[2]}, config.temperature_perturbation_amplitude);const Real target_theta=config.physical_initialization ? temperature *std::pow(p_0/p_hse(i, j, k), rdOcp) :erf_cloud_chamber::theta_at(config, x, y, z);state_pert(i, j, k, RhoTheta_comp)=rho *target_theta - state(i, j, k, RhoTheta_comp);if(config.has_moisture) { const Real target_qv=config.physical_initialization ? erf_cloud_chamber::vapor_mixing_ratio_from_relative_humidity(temperature, p_hse(i, j, k), config.initial_relative_humidity) :erf_cloud_chamber::qv_at(config, z);state_pert(i, j, k, RhoQ1_comp)=rho *target_qv - state(i, j, k, RhoQ1_comp);state_pert(i, j, k, RhoQ2_comp)=-state(i, j, k, RhoQ2_comp);} })
 

Variables

const GpuArray< Real, AMREX_SPACEDIM > prob_lo
 
const GpuArray< Real, AMREX_SPACEDIM > dx
 
const auto config = m_cloud_chamber_config
 
const Real rdOcp = sc.rdOcp
 

Function Documentation

◆ AMREX_ALWAYS_ASSERT_WITH_MESSAGE() [1/5]

AMREX_ALWAYS_ASSERT_WITH_MESSAGE ( erf_cloud_chamber::supports_moisture_model(sc.moisture_type)  ,
"Cloud Chamber: unsupported moisture model in custom initializer"   
)

◆ AMREX_ALWAYS_ASSERT_WITH_MESSAGE() [2/5]

AMREX_ALWAYS_ASSERT_WITH_MESSAGE ( m_cloud_chamber_config.  active,
"Cloud Chamber: initializer reached without a parsed configuration"   
)

◆ AMREX_ALWAYS_ASSERT_WITH_MESSAGE() [3/5]

AMREX_ALWAYS_ASSERT_WITH_MESSAGE ( m_cloud_chamber_config.  has_moisture = =(sc.moisture_type !=MoistureType::None),
"Cloud Chamber: moisture-model selection and chamber configuration disagree"   
)

◆ AMREX_ALWAYS_ASSERT_WITH_MESSAGE() [4/5]

AMREX_ALWAYS_ASSERT_WITH_MESSAGE ( sc.  anelastic[lev] = =1 &&sc.fixed_density[lev]==1,
"Cloud Chamber: the selected level must use fixed-density anelastic dynamics"   
)

◆ AMREX_ALWAYS_ASSERT_WITH_MESSAGE() [5/5]

AMREX_ALWAYS_ASSERT_WITH_MESSAGE ( sc.  terrain_type = =TerrainType::None &&sc.buildings_type==BuildingsType::None &&sc.mesh_type==MeshType::ConstantDz,
"Cloud Chamber:  terrain,
buildings  ,
and non-Cartesian mesh modes are unsupported"   
)

◆ ParallelFor()

ParallelFor ( bx  ,
[=] AMREX_GPU_DEVICE(int i, int j, int k) noexcept { const Real x=prob_lo[0]+(Real(i)+Real(0.5)) *dx[0];const Real y=prob_lo[1]+(Real(j)+Real(0.5)) *dx[1];const Real z=prob_lo[2]+(Real(k)+Real(0.5)) *dx[2];const Real rho=state(i, j, k, Rho_comp);const Real temperature=erf_cloud_chamber::linear_profile(config.initial_temperature_bottom, config.initial_temperature_top, z, config.prob_lo[2], config.prob_hi[2] - config.prob_lo[2])+erf_cloud_chamber::deterministic_perturbation(x, y, z, config.prob_lo, GpuArray< Real, AMREX_SPACEDIM >{ config.prob_hi[0] - config.prob_lo[0], config.prob_hi[1] - config.prob_lo[1], config.prob_hi[2] - config.prob_lo[2]}, config.temperature_perturbation_amplitude);const Real target_theta=config.physical_initialization ? temperature *std::pow(p_0/p_hse(i, j, k), rdOcp) :erf_cloud_chamber::theta_at(config, x, y, z);state_pert(i, j, k, RhoTheta_comp)=rho *target_theta - state(i, j, k, RhoTheta_comp);if(config.has_moisture) { const Real target_qv=config.physical_initialization ? erf_cloud_chamber::vapor_mixing_ratio_from_relative_humidity(temperature, p_hse(i, j, k), config.initial_relative_humidity) :erf_cloud_chamber::qv_at(config, z);state_pert(i, j, k, RhoQ1_comp)=rho *target_qv - state(i, j, k, RhoQ1_comp);state_pert(i, j, k, RhoQ2_comp)=-state(i, j, k, RhoQ2_comp);} }   
)
Here is the call graph for this function:

Variable Documentation

◆ config

◆ dx

const GpuArray<Real, AMREX_SPACEDIM> dx
Initial value:
= {
geomdata.CellSize(0), geomdata.CellSize(1), geomdata.CellSize(2)}

Referenced by ParallelFor().

◆ prob_lo

◆ rdOcp

const Real rdOcp = sc.rdOcp

Referenced by ParallelFor().