1 #ifndef ERF_ADV_STRUCT_H_
2 #define ERF_ADV_STRUCT_H_
7 #include <AMReX_ParmParse.H>
8 #include <AMReX_Print.H>
10 #include <AMReX_Geometry.H>
23 amrex::ParmParse
pp(pp_prefix);
27 std::string dycore_horiz_adv_string =
"" ; std::string dycore_vert_adv_string =
"";
28 std::string dryscal_horiz_adv_string =
"" ; std::string dryscal_vert_adv_string =
"";
29 pp.query(
"dycore_horiz_adv_type" , dycore_horiz_adv_string);
30 pp.query(
"dycore_vert_adv_type" , dycore_vert_adv_string);
31 pp.query(
"dryscal_horiz_adv_type" , dryscal_horiz_adv_string);
32 pp.query(
"dryscal_vert_adv_type" , dryscal_vert_adv_string);
34 std::string moistscal_horiz_adv_string =
""; std::string moistscal_vert_adv_string =
"";
35 pp.query(
"moistscal_horiz_adv_type", moistscal_horiz_adv_string);
36 pp.query(
"moistscal_vert_adv_type" , moistscal_vert_adv_string);
39 amrex::Print() <<
"Using efficient advection scheme" << std::endl;
42 if ( (dycore_horiz_adv_string ==
"Blended_3rd4th") ||
43 (dycore_horiz_adv_string ==
"Blended_5th6th") )
47 "The dycore horizontal upwinding fraction must be between 0 and 1");
50 if ( (dycore_vert_adv_string ==
"Blended_3rd4th") ||
51 (dycore_vert_adv_string ==
"Blended_5th6th") )
55 "The dycore vertical upwinding fraction must be between 0 and 1");
58 if ( (dryscal_horiz_adv_string ==
"Blended_3rd4th") ||
59 (dryscal_horiz_adv_string ==
"Blended_5th6th") )
63 "The dry scalar horizontal upwinding fraction must be between 0 and 1");
66 if ( (dryscal_vert_adv_string ==
"Blended_3rd4th") ||
67 (dryscal_vert_adv_string ==
"Blended_5th6th") )
71 "The dry scalar vertical upwinding fraction must be between 0 and 1");
74 if ( (moistscal_horiz_adv_string ==
"Blended_3rd4th") ||
75 (moistscal_horiz_adv_string ==
"Blended_5th6th") )
79 "The moist scalar horizontal upwinding fraction must be between 0 and 1");
82 if ( (moistscal_vert_adv_string ==
"Blended_3rd4th") ||
83 (moistscal_vert_adv_string ==
"Blended_5th6th") )
87 "The moist scalar vertical upwinding fraction must be between 0 and 1");
90 if (dycore_horiz_adv_string !=
"") {
91 if ( (dycore_horiz_adv_string ==
"Centered_2nd") ||
92 (dycore_horiz_adv_string ==
"Upwind_3rd" ) ||
93 (dycore_horiz_adv_string ==
"Blended_3rd4th") ||
94 (dycore_horiz_adv_string ==
"Centered_4th") ||
95 (dycore_horiz_adv_string ==
"Upwind_5th" ) ||
96 (dycore_horiz_adv_string ==
"Blended_5th6th") ||
97 (dycore_horiz_adv_string ==
"Centered_6th") ||
98 (dycore_horiz_adv_string ==
"WENO3" ) ||
99 (dycore_horiz_adv_string ==
"WENOZ3" ) ||
100 (dycore_horiz_adv_string ==
"WENO5" ) ||
101 (dycore_horiz_adv_string ==
"WENOZ5" ) ||
102 (dycore_horiz_adv_string ==
"WENO7" ) ||
103 (dycore_horiz_adv_string ==
"WENOZ7" ))
107 amrex::Error(
"Don't know this dycore_horiz_adv_string");
111 if (dycore_vert_adv_string !=
"") {
112 if ( (dycore_vert_adv_string ==
"Centered_2nd") ||
113 (dycore_vert_adv_string ==
"Upwind_3rd" ) ||
114 (dycore_vert_adv_string ==
"Blended_3rd4th") ||
115 (dycore_vert_adv_string ==
"Centered_4th") ||
116 (dycore_vert_adv_string ==
"Upwind_5th" ) ||
117 (dycore_vert_adv_string ==
"Blended_5th6th") ||
118 (dycore_vert_adv_string ==
"Centered_6th") ||
119 (dycore_vert_adv_string ==
"WENO3" ) ||
120 (dycore_vert_adv_string ==
"WENOZ3" ) ||
121 (dycore_vert_adv_string ==
"WENO5" ) ||
122 (dycore_vert_adv_string ==
"WENOZ5" ) ||
123 (dycore_vert_adv_string ==
"WENO7" ) ||
124 (dycore_vert_adv_string ==
"WENOZ7" ))
128 amrex::Error(
"Don't know this dycore_vert_adv_string");
132 if (dryscal_horiz_adv_string !=
"") {
133 if ( (dryscal_horiz_adv_string ==
"Centered_2nd") ||
134 (dryscal_horiz_adv_string ==
"Upwind_3rd" ) ||
135 (dryscal_horiz_adv_string ==
"Upwind_3rd_SL") ||
136 (dryscal_horiz_adv_string ==
"Blended_3rd4th") ||
137 (dryscal_horiz_adv_string ==
"Centered_4th") ||
138 (dryscal_horiz_adv_string ==
"Upwind_5th" ) ||
139 (dryscal_horiz_adv_string ==
"Blended_5th6th") ||
140 (dryscal_horiz_adv_string ==
"Centered_6th") ||
141 (dryscal_horiz_adv_string ==
"WENO3" ) ||
142 (dryscal_horiz_adv_string ==
"WENOZ3" ) ||
143 (dryscal_horiz_adv_string ==
"WENOMZQ3" ) ||
144 (dryscal_horiz_adv_string ==
"WENO5" ) ||
145 (dryscal_horiz_adv_string ==
"WENOZ5" ) ||
146 (dryscal_horiz_adv_string ==
"WENO7" ) ||
147 (dryscal_horiz_adv_string ==
"WENOZ7" ) )
151 amrex::Error(
"Don't know this dryscal_horiz_adv_string");
155 if (dryscal_vert_adv_string !=
"") {
156 if ( (dryscal_vert_adv_string ==
"Centered_2nd") ||
157 (dryscal_vert_adv_string ==
"Upwind_3rd" ) ||
158 (dryscal_vert_adv_string ==
"Upwind_3rd_SL") ||
159 (dryscal_vert_adv_string ==
"Blended_3rd4th") ||
160 (dryscal_vert_adv_string ==
"Centered_4th") ||
161 (dryscal_vert_adv_string ==
"Upwind_5th" ) ||
162 (dryscal_vert_adv_string ==
"Blended_5th6th") ||
163 (dryscal_vert_adv_string ==
"Centered_6th") ||
164 (dryscal_vert_adv_string ==
"WENO3" ) ||
165 (dryscal_vert_adv_string ==
"WENOZ3" ) ||
166 (dryscal_vert_adv_string ==
"WENOMZQ3" ) ||
167 (dryscal_vert_adv_string ==
"WENO5" ) ||
168 (dryscal_vert_adv_string ==
"WENOZ5" ) ||
169 (dryscal_vert_adv_string ==
"WENO7" ) ||
170 (dryscal_vert_adv_string ==
"WENOZ7" ))
174 amrex::Error(
"Don't know this dryscal_vert_adv_string");
178 if (moistscal_horiz_adv_string !=
"") {
179 if ( (moistscal_horiz_adv_string ==
"Centered_2nd") ||
180 (moistscal_horiz_adv_string ==
"Upwind_3rd" ) ||
181 (moistscal_horiz_adv_string ==
"Upwind_3rd_SL" ) ||
182 (moistscal_horiz_adv_string ==
"Blended_3rd4th") ||
183 (moistscal_horiz_adv_string ==
"Centered_4th") ||
184 (moistscal_horiz_adv_string ==
"Upwind_5th" ) ||
185 (moistscal_horiz_adv_string ==
"Blended_5th6th") ||
186 (moistscal_horiz_adv_string ==
"Centered_6th") ||
187 (moistscal_horiz_adv_string ==
"WENO3" ) ||
188 (moistscal_horiz_adv_string ==
"WENOZ3" ) ||
189 (moistscal_horiz_adv_string ==
"WENOMZQ3" ) ||
190 (moistscal_horiz_adv_string ==
"WENO5" ) ||
191 (moistscal_horiz_adv_string ==
"WENOZ5" ) ||
192 (moistscal_horiz_adv_string ==
"WENO7" ) ||
193 (moistscal_horiz_adv_string ==
"WENOZ7" ))
197 amrex::Error(
"Don't know this moistscal_horiz_adv_string");
201 if (moistscal_vert_adv_string !=
"") {
202 if ( (moistscal_vert_adv_string ==
"Centered_2nd") ||
203 (moistscal_vert_adv_string ==
"Upwind_3rd" ) ||
204 (moistscal_vert_adv_string ==
"Upwind_3rd_SL" ) ||
205 (moistscal_vert_adv_string ==
"Blended_3rd4th") ||
206 (moistscal_vert_adv_string ==
"Centered_4th") ||
207 (moistscal_vert_adv_string ==
"Upwind_5th" ) ||
208 (moistscal_vert_adv_string ==
"Blended_5th6th") ||
209 (moistscal_vert_adv_string ==
"Centered_6th") ||
210 (moistscal_vert_adv_string ==
"WENO3" ) ||
211 (moistscal_vert_adv_string ==
"WENOZ3" ) ||
212 (moistscal_vert_adv_string ==
"WENOMZQ3" ) ||
213 (moistscal_vert_adv_string ==
"WENO5" ) ||
214 (moistscal_vert_adv_string ==
"WENOZ5" ) ||
215 (moistscal_vert_adv_string ==
"WENO7" ) ||
216 (moistscal_vert_adv_string ==
"WENOZ7" ))
220 amrex::Error(
"Don't know this moistscal_vert_adv_string");
225 std::string terrain_type;
226 pp.query(
"terrain_type", terrain_type);
237 amrex::Print() <<
"Advection Choices: " << std::endl;
240 amrex::ParmParse
pp(pp_prefix);
241 std::string dycore_horiz_adv_string =
"" ; std::string dycore_vert_adv_string =
"";
242 std::string dryscal_horiz_adv_string =
"" ; std::string dryscal_vert_adv_string =
"";
243 pp.query(
"dycore_horiz_adv_type" , dycore_horiz_adv_string);
244 pp.query(
"dycore_vert_adv_type" , dycore_vert_adv_string);
245 pp.query(
"dryscal_horiz_adv_type" , dryscal_horiz_adv_string);
246 pp.query(
"dryscal_vert_adv_type" , dryscal_vert_adv_string);
247 std::string moistscal_horiz_adv_string =
""; std::string moistscal_vert_adv_string =
"";
248 pp.query(
"moistscal_horiz_adv_type", moistscal_horiz_adv_string);
249 pp.query(
"moistscal_vert_adv_type" , moistscal_vert_adv_string);
251 if (dycore_horiz_adv_string !=
"") {
252 amrex::Print() <<
" dycore_horiz_adv_type : " << dycore_horiz_adv_string;
256 if ( (dycore_horiz_adv_string ==
"Blended_3rd4th") ||
257 (dycore_horiz_adv_string ==
"Blended_5th6th") ) {
260 amrex::Print() << std::endl;
262 if (dycore_vert_adv_string !=
"") {
263 amrex::Print() <<
" dycore_vert_adv_type : " << dycore_vert_adv_string;
267 if ( (dycore_vert_adv_string ==
"Blended_3rd4th") ||
268 (dycore_vert_adv_string ==
"Blended_5th6th") ) {
271 amrex::Print() << std::endl;
273 if (dryscal_horiz_adv_string !=
"") {
274 amrex::Print() <<
" dryscal_horiz_adv_type : " << dryscal_horiz_adv_string;
278 if ( (dryscal_horiz_adv_string ==
"Blended_3rd4th") ||
279 (dryscal_horiz_adv_string ==
"Blended_5th6th") ) {
282 amrex::Print() << std::endl;
284 if (dryscal_vert_adv_string !=
"") {
285 amrex::Print() <<
" dryscal_vert_adv_type : " << dryscal_vert_adv_string;
289 if ( (dryscal_vert_adv_string ==
"Blended_3rd4th") ||
290 (dryscal_vert_adv_string ==
"Blended_5th6th") ) {
293 amrex::Print() << std::endl;
295 if (moistscal_horiz_adv_string !=
"") {
296 amrex::Print() <<
" moistscal_horiz_adv_type : " << moistscal_horiz_adv_string;
300 if ( (moistscal_horiz_adv_string ==
"Blended_3rd4th") ||
301 (moistscal_horiz_adv_string ==
"Blended_5th6th") ) {
304 amrex::Print() << std::endl;
306 if (moistscal_vert_adv_string !=
"") {
307 amrex::Print() <<
" moistscal_vert_adv_type : " << moistscal_vert_adv_string;
311 if ( (moistscal_vert_adv_string ==
"Blended_3rd4th") ||
312 (moistscal_vert_adv_string ==
"Blended_5th6th") ) {
315 amrex::Print() << std::endl;
322 return "Centered_2nd";
326 return "Upwind_3rd_SL";
328 return "Centered_4th";
332 return "Centered_6th";
354 if (adv_string ==
"Centered_2nd") {
356 }
else if ((adv_string ==
"Upwind_3rd") || (adv_string ==
"Blended_3rd4th")) {
358 }
else if (adv_string ==
"Upwind_3rd_SL") {
360 }
else if (adv_string ==
"Centered_4th") {
362 }
else if (adv_string ==
"Upwind_5th" || (adv_string ==
"Blended_5th6th")) {
364 }
else if (adv_string ==
"Centered_6th") {
366 }
else if (adv_string ==
"WENO3") {
368 }
else if (adv_string ==
"WENOZ3") {
370 }
else if (adv_string ==
"WENO5") {
372 }
else if (adv_string ==
"WENOZ5") {
374 }
else if (adv_string ==
"WENOMZQ3") {
376 }
else if (adv_string ==
"WENO7") {
378 }
else if (adv_string ==
"WENOZ7") {
388 bool using_weno_momentum =
405 amrex::ignore_unused(use_embedded_boundary, using_weno_momentum);
406 AMREX_ASSERT_WITH_MESSAGE(!using_weno_momentum || !use_embedded_boundary,
407 "WENO momentum advection schemes are not yet implemented for embedded boundaries. "
408 "Please use traditional momentum advection schemes when using embedded boundaries:\n"
AdvType
Definition: ERF_IndexDefines.H:221
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
Definition: ERF_AdvStruct.H:19
void display(std::string &pp_prefix)
Definition: ERF_AdvStruct.H:235
void init_params(std::string pp_prefix)
Definition: ERF_AdvStruct.H:21
amrex::Vector< amrex::IntVect > zero_yflux
Definition: ERF_AdvStruct.H:438
void validate_weno_momentum_compatibility(bool use_embedded_boundary)
Definition: ERF_AdvStruct.H:385
AdvType adv_type_convert_string_to_advtype(std::string adv_string)
Definition: ERF_AdvStruct.H:352
amrex::Real dryscal_vert_upw_frac
Definition: ERF_AdvStruct.H:432
AdvType moistscal_horiz_adv_type
Definition: ERF_AdvStruct.H:423
AdvType dycore_vert_adv_type
Definition: ERF_AdvStruct.H:420
AdvType moistscal_vert_adv_type
Definition: ERF_AdvStruct.H:424
amrex::Real moistscal_vert_upw_frac
Definition: ERF_AdvStruct.H:434
amrex::Real dycore_vert_upw_frac
Definition: ERF_AdvStruct.H:430
bool use_efficient_advection
Definition: ERF_AdvStruct.H:418
amrex::Real moistscal_horiz_upw_frac
Definition: ERF_AdvStruct.H:433
AdvType dryscal_horiz_adv_type
Definition: ERF_AdvStruct.H:421
amrex::Vector< amrex::IntVect > zero_xflux
Definition: ERF_AdvStruct.H:437
amrex::Vector< amrex::IntVect > zero_zflux
Definition: ERF_AdvStruct.H:439
AdvType dycore_horiz_adv_type
Definition: ERF_AdvStruct.H:419
bool have_zero_flux_faces
Definition: ERF_AdvStruct.H:440
amrex::Real dycore_horiz_upw_frac
Definition: ERF_AdvStruct.H:429
std::string adv_type_convert_int_to_string(AdvType adv_int)
Definition: ERF_AdvStruct.H:319
AdvType dryscal_vert_adv_type
Definition: ERF_AdvStruct.H:422
amrex::Real dryscal_horiz_upw_frac
Definition: ERF_AdvStruct.H:431