351 const std::string chkname1 =
m_filename + Concatenate(
"/bndry_output", t_step);
353 const std::string level_prefix =
"Level_";
356 const Box& domain =
m_geom.Domain();
358 DistributionMapping dm{ba};
360 GpuArray<GpuArray<Real, AMREX_SPACEDIM*2>, AMREX_SPACEDIM+
NBCVAR_max> l_bc_extdir_vals_d;
364 for (OrientationIter oit; oit !=
nullptr; ++oit) {
366 l_bc_extdir_vals_d[i][ori] = m_bc_extdir_vals[i][ori];
370 int n_for_density = -1;
373 if (
m_var_names[i] ==
"density") n_for_density = i;
379 for (OrientationIter oit; oit !=
nullptr; ++oit) {
381 if (ori.coordDir() < 2) {
382 FArrayBox& d = (*data_to_fill[ori])[lev];
383 const auto& bx = d.box();
384 Array4<Real> d_arr = d.array();
386 bx, ncomp_for_bc, [=] AMREX_GPU_DEVICE(
int i,
int j,
int k,
int n) noexcept {
393 std::string filenamer = MultiFabFileFullPrefix(lev, chkname1, level_prefix,
"density");
395 bndry_r.setVal(1.0e13);
396 for (OrientationIter oit; oit !=
nullptr; ++oit) {
398 if (ori.coordDir() < 2) {
399 std::string facenamer = Concatenate(filenamer +
'_', ori, 1);
400 bndry_r[ori].read(facenamer);
407 for (
int ivar = 0; ivar <
m_var_names.size(); ivar++)
411 std::string filename1 = MultiFabFileFullPrefix(lev, chkname1, level_prefix, var_name);
414 if (var_name ==
"velocity") {
415 ncomp = AMREX_SPACEDIM;
433 bndry.setVal(1.0e13);
438 for (OrientationIter oit; oit !=
nullptr; ++oit) {
440 if (ori.coordDir() < 2) {
442 std::string facename1 = Concatenate(filename1 +
'_', ori, 1);
443 bndry[ori].read(facename1);
445 int normal = ori.coordDir();
446 IntVect v_offset =
offset(ori.faceDir(), normal);
447 if (real_bcs) { v_offset = IntVect(0); }
449 const auto& bbx = (*data_to_fill[ori])[lev].box();
456 bndry[ori].boxArray(), bndry[ori].DistributionMap(),
459 for (MFIter mfi(bndryMF); mfi.isValid(); ++mfi) {
461 const auto& vbx = mfi.validbox();
462 const auto& bndry_read_arr = bndry[ori].array(mfi);
463 const auto& bndry_read_r_arr = bndry_r[ori].array(mfi);
464 const auto& bndry_mf_arr = bndryMF.array(mfi);
466 const auto& bx = bbx & vbx;
477 if (n_for_density >= 0) {
478 if (var_name ==
"temperature") {
480 bx, [=] AMREX_GPU_DEVICE(
int i,
int j,
int k) noexcept {
481 Real R1 = bndry_read_r_arr(i, j, k, 0);
482 Real R2 = bndry_read_r_arr(i+v_offset[0],j+v_offset[1],k+v_offset[2],0);
483 Real T1 = bndry_read_arr(i, j, k, 0);
484 Real T2 = bndry_read_arr(i+v_offset[0],j+v_offset[1],k+v_offset[2],0);
487 bndry_mf_arr(i, j, k, 0) = (real_bcs) ? bndry_read_arr(i, j, k, 0) :
488 0.5 * (R1*Th1 + R2*Th2);
490 }
else if (var_name ==
"theta" || var_name ==
"ke" || var_name ==
"scalar" ||
491 var_name ==
"qv" || var_name ==
"qc") {
493 bx, [=] AMREX_GPU_DEVICE(
int i,
int j,
int k) noexcept {
494 Real R1 = bndry_read_r_arr(i, j, k, 0);
495 Real R2 = bndry_read_r_arr(i+v_offset[0],j+v_offset[1],k+v_offset[2],0);
496 bndry_mf_arr(i, j, k, 0) = (real_bcs) ? bndry_read_arr(i, j, k, 0) :
497 0.5 * ( R1 * bndry_read_arr(i, j, k, 0) +
498 R2 * bndry_read_arr(i+v_offset[0],j+v_offset[1],k+v_offset[2], 0));
500 }
else if (var_name ==
"density") {
502 bx, [=] AMREX_GPU_DEVICE(
int i,
int j,
int k) noexcept {
503 bndry_mf_arr(i, j, k, 0) = (real_bcs) ? bndry_read_arr(i, j, k, 0) :
504 0.5 * ( bndry_read_arr(i, j, k, 0) +
505 bndry_read_arr(i+v_offset[0],j+v_offset[1],k+v_offset[2], 0));
509 if (var_name ==
"temperature") {
511 bx, [=] AMREX_GPU_DEVICE(
int i,
int j,
int k) noexcept {
514 Real T1 = bndry_read_arr(i, j, k, 0);
515 Real T2 = bndry_read_arr(i+v_offset[0],j+v_offset[1],k+v_offset[2], 0);
518 bndry_mf_arr(i, j, k, 0) = (real_bcs) ? bndry_read_arr(i, j, k, 0) :
519 0.5 * (R1*Th1 + R2*Th2);
521 }
else if (var_name ==
"theta" || var_name ==
"ke" || var_name ==
"scalar" ||
522 var_name ==
"qv" || var_name ==
"qc") {
524 bx, [=] AMREX_GPU_DEVICE(
int i,
int j,
int k) noexcept {
527 bndry_mf_arr(i, j, k, 0) = (real_bcs) ? bndry_read_arr(i, j, k, 0) :
528 0.5 * (R1 * bndry_read_arr(i, j, k, 0) +
529 R2 * bndry_read_arr(i+v_offset[0],j+v_offset[1],k+v_offset[2], 0));
535 if (var_name ==
"velocity") {
537 bx, ncomp, [=] AMREX_GPU_DEVICE(
int i,
int j,
int k,
int n) noexcept {
538 bndry_mf_arr(i, j, k, n) = (real_bcs) ? bndry_read_arr(i, j, k, n) :
539 0.5 * (bndry_read_arr(i, j, k, n) +
540 bndry_read_arr(i+v_offset[0],j+v_offset[1],k+v_offset[2], n));
545 bndryMF.copyTo((*data_to_fill[ori])[lev], 0, n_offset, ncomp);
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real getThgivenRandT(const amrex::Real rho, const amrex::Real T, const amrex::Real rdOcp, const amrex::Real qv=0.0)
Definition: ERF_EOS.H:64
#define NBCVAR_max
Definition: ERF_IndexDefines.H:29
const Real rdOcp
Definition: ERF_InitCustomPert_Bomex.H:16
ParallelFor(bx, [=] AMREX_GPU_DEVICE(int i, int j, int k) noexcept { const auto prob_lo=geomdata.ProbLo();const auto dx=geomdata.CellSize();const Real x=(prob_lo[0]+(i+0.5) *dx[0])/mf_m(i, j, 0);const Real z=z_cc(i, j, k);Real L=std::sqrt(std::pow((x - x_c)/x_r, 2)+std::pow((z - z_c)/z_r, 2));if(L<=1.0) { Real dT=T_pert *(std::cos(PI *L)+1.0)/2.0;Real Tbar_hse=p_hse(i, j, k)/(R_d *r_hse(i, j, k));Real theta_perturbed=(Tbar_hse+dT) *std::pow(p_0/p_hse(i, j, k), rdOcp);Real theta_0=(Tbar_hse) *std::pow(p_0/p_hse(i, j, k), rdOcp);if(const_rho) { state_pert(i, j, k, RhoTheta_comp)=r_hse(i, j, k) *(theta_perturbed - theta_0);} else { state_pert(i, j, k, Rho_comp)=getRhoThetagivenP(p_hse(i, j, k))/theta_perturbed - r_hse(i, j, k);} } })
AMREX_FORCE_INLINE IntVect offset(const int face_dir, const int normal)
Definition: ERF_ReadBndryPlanes.cpp:28
amrex::Real Real
Definition: ERF_ShocInterface.H:19
amrex::Vector< int > m_in_timesteps
Definition: ERF_ReadBndryPlanes.H:82
int ingested_density() const
Definition: ERF_ReadBndryPlanes.H:43
const int m_extent_rad
Definition: ERF_ReadBndryPlanes.H:90
@ RhoScalar_bc_comp
Definition: ERF_IndexDefines.H:80
@ RhoQ1_bc_comp
Definition: ERF_IndexDefines.H:81
@ RhoKE_bc_comp
Definition: ERF_IndexDefines.H:79
@ RhoTheta_bc_comp
Definition: ERF_IndexDefines.H:78
@ RhoQ2_bc_comp
Definition: ERF_IndexDefines.H:82
@ Rho_bc_comp
Definition: ERF_IndexDefines.H:77
@ xvel_bc
Definition: ERF_IndexDefines.H:87