1 #ifndef ERF_INPUT_SPONGE_DATA_H_
2 #define ERF_INPUT_SPONGE_DATA_H_
7 #include <AMReX_ParmParse.H>
8 #include <AMReX_Print.H>
10 #include <AMReX_Geometry.H>
24 amrex::ParmParse
pp(
"erf");
29 const amrex::Vector<amrex::Real>& zlevels_stag)
32 const int khi = geom.Domain().bigEnd()[AMREX_SPACEDIM-1];
33 const int Nz = geom.Domain().size()[AMREX_SPACEDIM-1];
34 const amrex::Real dz = geom.CellSize()[AMREX_SPACEDIM-1];
36 const bool use_terrain = (zlevels_stag.size() > 0);
37 const amrex::Real zbot = (use_terrain) ? zlevels_stag[klo] : geom.ProbLo(AMREX_SPACEDIM-1);
38 const amrex::Real ztop = (use_terrain) ? zlevels_stag[khi+1] : geom.ProbHi(AMREX_SPACEDIM-1);
45 amrex::Print() <<
"input_sponge file location : " <<
input_sponge_file << std::endl;
47 if(!input_sponge_reader.is_open()) {
48 amrex::Error(
"Error opening the input_sponge file.\n");
52 amrex::Print() <<
"Successfully opened the input_sponge file. Now reading... " << std::endl;
57 amrex::Vector<amrex::Real> z_inp_sponge_tmp, U_inp_sponge_tmp, V_inp_sponge_tmp;
60 z_inp_sponge_tmp.push_back(zbot);
61 U_inp_sponge_tmp.push_back(0);
62 V_inp_sponge_tmp.push_back(0);
66 while(std::getline(input_sponge_reader, line)) {
67 std::istringstream iss_z(line);
70 U_inp_sponge_tmp[0] =
U;
71 V_inp_sponge_tmp[0] =
V;
73 AMREX_ALWAYS_ASSERT(
z > z_inp_sponge_tmp[z_inp_sponge_tmp.size()-1]);
74 z_inp_sponge_tmp.push_back(
z);
75 U_inp_sponge_tmp.push_back(
U);
76 V_inp_sponge_tmp.push_back(
V);
83 const int Ninp = z_inp_sponge_tmp.size();
87 for (
int k=0; k < Nz; ++k) {
88 z_inp_sponge[k+1] = (use_terrain) ? 0.5 * (zlevels_stag[k] + zlevels_stag[k+1])
89 : zbot + (k + 0.5) * dz;
98 amrex::Print() <<
"Successfully read the input_sponge file..." << std::endl;
99 input_sponge_reader.close();
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:219
@ U
Definition: ERF_IndexDefines.H:97
@ V
Definition: ERF_IndexDefines.H:98