1 #ifndef ERF_INPUT_SOUNDING_DATA_H_
2 #define ERF_INPUT_SOUNDING_DATA_H_
7 #include <AMReX_ParmParse.H>
8 #include <AMReX_Print.H>
10 #include <AMReX_Geometry.H>
26 amrex::ParmParse
pp(
"erf");
78 const amrex::Vector<amrex::Real>& zlevels_stag,
82 const int khi = geom.Domain().bigEnd()[AMREX_SPACEDIM-1];
83 const int Nz = geom.Domain().size()[AMREX_SPACEDIM-1];
95 amrex::Print() <<
"input_sounding file location : " <<
input_sounding_file[itime] << std::endl;
97 if(!input_sounding_reader.is_open()) {
98 amrex::Error(
"Error opening the input_sounding file\n");
102 amrex::Print() <<
"Successfully opened the input_sounding file. Now reading... " << std::endl;
107 amrex::Vector<amrex::Real> z_inp_sound_tmp, theta_inp_sound_tmp, qv_inp_sound_tmp,
108 U_inp_sound_tmp, V_inp_sound_tmp;
111 std::getline(input_sounding_reader, line);
112 std::istringstream iss(line);
118 z_inp_sound_tmp.push_back(zbot);
121 U_inp_sound_tmp.push_back(0);
122 V_inp_sound_tmp.push_back(0);
126 while(std::getline(input_sounding_reader, line)) {
127 std::istringstream iss_z(line);
130 AMREX_ALWAYS_ASSERT(
theta == theta_inp_sound_tmp[0]);
131 AMREX_ALWAYS_ASSERT(
qv*0.001 == qv_inp_sound_tmp[0]);
132 U_inp_sound_tmp[0] =
U;
133 V_inp_sound_tmp[0] =
V;
135 AMREX_ALWAYS_ASSERT(
z > z_inp_sound_tmp[z_inp_sound_tmp.size()-1]);
136 z_inp_sound_tmp.push_back(
z);
137 theta_inp_sound_tmp.push_back(
theta);
138 qv_inp_sound_tmp.push_back(
qv*0.001);
139 U_inp_sound_tmp.push_back(
U);
140 V_inp_sound_tmp.push_back(
V);
141 if (
z >= ztop)
break;
147 const int Ninp = z_inp_sound_tmp.size();
153 for (
int k=0; k < Nz; ++k) {
154 z_inp_sound[itime][k+1] = 0.5 * (zlevels_stag[k] + zlevels_stag[k+1]);
167 amrex::Print() <<
"Successfully read the " << itime <<
"th input_sounding file..." << std::endl;
168 input_sounding_reader.close();
181 const int Ninp =
size(itime);
192 amrex::Print() <<
"ideal sounding init: surface dry air density = "
193 << std::setprecision(15)
204 amrex::Print() <<
"z p_m rho_d theta qv U V" << std::endl;
218 for (
int k=1; k <
size(itime); ++k)
265 const int Ninp =
size(itime);
279 amrex::Print() <<
"isentropic sounding init: surface dry air density = "
280 << std::setprecision(15)
286 amrex::Print() <<
"z p_m rho_d theta qv U V" << std::endl;
299 for (
int k=1; k <
size(itime); ++k)
342 const int Ninp =
size(itime);
349 amrex::Gpu::copy(amrex::Gpu::hostToDevice,
352 amrex::Gpu::copy(amrex::Gpu::hostToDevice,
355 amrex::Gpu::copy(amrex::Gpu::hostToDevice,
358 amrex::Gpu::copy(amrex::Gpu::hostToDevice,
361 amrex::Gpu::copy(amrex::Gpu::hostToDevice,
370 amrex::Gpu::copy(amrex::Gpu::hostToDevice,
373 amrex::Gpu::copy(amrex::Gpu::hostToDevice,
constexpr amrex::Real R_v
Definition: ERF_Constants.H:11
constexpr amrex::Real Cp_d
Definition: ERF_Constants.H:12
constexpr amrex::Real p_0
Definition: ERF_Constants.H:18
constexpr amrex::Real CONST_GRAV
Definition: ERF_Constants.H:21
constexpr amrex::Real R_d
Definition: ERF_Constants.H:10
constexpr amrex::Real Gamma
Definition: ERF_Constants.H:19
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real getRhogivenThetaPress(const amrex::Real th, const amrex::Real p, const amrex::Real rdOcp, const amrex::Real qv=0.0)
Definition: ERF_EOS.H:96
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real interpolate_1d(const amrex::Real *alpha, const amrex::Real *beta, const amrex::Real alpha_interp, const int alpha_size)
Definition: ERF_Interpolation_1D.H:12
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real pp(amrex::Real y)
Definition: ERF_MicrophysicsUtils.H:233
amrex::Real Real
Definition: ERF_ShocInterface.H:19
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void Newton_Raphson_hse(const Real &m_tol, const Real &RdOCp, const Real &dz, const Real &g, const Real &C, const Real &T, const Real &qt, const Real &qv, Real &P, Real &rd, Real &F)
Definition: ERF_HSEUtils.H:35
@ theta
Definition: ERF_MM5.H:20
@ qv
Definition: ERF_Kessler.H:28
@ U
Definition: ERF_IndexDefines.H:108
@ V
Definition: ERF_IndexDefines.H:109