19 auto dx = geom.CellSizeArray();
20 auto ProbHiArr = geom.ProbHiArray();
21 auto ProbLoArr = geom.ProbLoArray();
30 if (!use_xlo_sponge_damping &&
31 !use_xhi_sponge_damping &&
32 !use_ylo_sponge_damping &&
33 !use_yhi_sponge_damping &&
34 !use_zlo_sponge_damping &&
35 !use_zhi_sponge_damping)
48 const bool use_base_density = (sponge_density_tmp <
zero);
49 const bool use_base_rhotheta = (sponge_rhotheta_tmp <
zero);
50 const bool use_base_rhomoist = (sponge_rhomoist_tmp <
zero);
53 const Box& domain = geom.Domain();
54 int domlo_x = domain.smallEnd(0);
55 int domhi_x = domain.bigEnd(0) + 1;
56 int domlo_y = domain.smallEnd(1);
57 int domhi_y = domain.bigEnd(1) + 1;
66 ParallelFor(bx, [=] AMREX_GPU_DEVICE(
int i,
int j,
int k) noexcept
68 int ii = amrex::min(amrex::max(i, domlo_x), domhi_x);
69 int jj = amrex::min(amrex::max(j, domlo_y), domhi_y);
73 Real z = z_phys_cc(i,j,k);
75 Real sponge_density = (use_base_density) ?
r0(i,j,k) : sponge_density_tmp;
76 Real sponge_rhotheta = (use_base_rhotheta) ?
r0(i,j,k)*th0(i,j,k) : sponge_rhotheta_tmp;
77 Real sponge_rhomoist = (use_base_rhomoist) ?
r0(i,j,k)*qv0(i,j,k) : sponge_rhomoist_tmp;
80 if(use_xlo_sponge_damping){
81 if (x < xlo_sponge_end) {
82 Real xi = (xlo_sponge_end -
x) / (xlo_sponge_end - ProbLoArr[0]);
83 cell_rhs(i, j, k, 0) -= sponge_strength * xi * xi * (cell_data(i, j, k, 0) - sponge_density);
84 cell_rhs(i, j, k, 1) -= sponge_strength * xi * xi * (cell_data(i, j, k, 1) - sponge_rhotheta);
86 cell_rhs(i, j, k,
RhoQ1_comp) -= sponge_strength * xi * xi * (cell_data(i, j, k,
RhoQ1_comp) - sponge_rhomoist);
88 cell_rhs(i, j, k, n) -= sponge_strength * xi * xi * cell_data(i, j, k, n);
94 if(use_xhi_sponge_damping){
95 if (x > xhi_sponge_start) {
96 Real xi = (
x - xhi_sponge_start) / (ProbHiArr[0] - xhi_sponge_start);
97 cell_rhs(i, j, k, 0) -= sponge_strength * xi * xi * (cell_data(i, j, k, 0) - sponge_density);
98 cell_rhs(i, j, k, 1) -= sponge_strength * xi * xi * (cell_data(i, j, k, 1) - sponge_rhotheta);
100 cell_rhs(i, j, k,
RhoQ1_comp) -= sponge_strength * xi * xi * (cell_data(i, j, k,
RhoQ1_comp) - sponge_rhomoist);
102 cell_rhs(i, j, k, n) -= sponge_strength * xi * xi * cell_data(i, j, k, n);
109 if(use_ylo_sponge_damping){
110 if (y < ylo_sponge_end) {
111 Real xi = (ylo_sponge_end -
y) / (ylo_sponge_end - ProbLoArr[1]);
112 cell_rhs(i, j, k, 0) -= sponge_strength * xi * xi * (cell_data(i, j, k, 0) - sponge_density);
113 cell_rhs(i, j, k, 1) -= sponge_strength * xi * xi * (cell_data(i, j, k, 1) - sponge_rhotheta);
115 cell_rhs(i, j, k,
RhoQ1_comp) -= sponge_strength * xi * xi * (cell_data(i, j, k,
RhoQ1_comp) - sponge_rhomoist);
117 cell_rhs(i, j, k, n) -= sponge_strength * xi * xi * cell_data(i, j, k, n);
123 if(use_yhi_sponge_damping){
124 if (y > yhi_sponge_start) {
125 Real xi = (
y - yhi_sponge_start) / (ProbHiArr[1] - yhi_sponge_start);
126 cell_rhs(i, j, k, 0) -= sponge_strength * xi * xi * (cell_data(i, j, k, 0) - sponge_density);
127 cell_rhs(i, j, k, 1) -= sponge_strength * xi * xi * (cell_data(i, j, k, 1) - sponge_rhotheta);
129 cell_rhs(i, j, k,
RhoQ1_comp) -= sponge_strength * xi * xi * (cell_data(i, j, k,
RhoQ1_comp) - sponge_rhomoist);
131 cell_rhs(i, j, k, n) -= sponge_strength * xi * xi * cell_data(i, j, k, n);
138 if(use_zlo_sponge_damping){
139 if (z < zlo_sponge_end) {
140 Real xi = (zlo_sponge_end -
z) / (zlo_sponge_end - ProbLoArr[2]);
141 cell_rhs(i, j, k, 0) -= sponge_strength * xi * xi * (cell_data(i, j, k, 0) - sponge_density);
142 cell_rhs(i, j, k, 1) -= sponge_strength * xi * xi * (cell_data(i, j, k, 1) - sponge_rhotheta);
144 cell_rhs(i, j, k,
RhoQ1_comp) -= sponge_strength * xi * xi * (cell_data(i, j, k,
RhoQ1_comp) - sponge_rhomoist);
146 cell_rhs(i, j, k, n) -= sponge_strength * xi * xi * cell_data(i, j, k, n);
152 if(use_zhi_sponge_damping){
153 if (z > zhi_sponge_start) {
154 Real xi = (
z - zhi_sponge_start) / (ProbHiArr[2] - zhi_sponge_start);
155 cell_rhs(i, j, k, 0) -= sponge_strength * xi * xi * (cell_data(i, j, k, 0) - sponge_density);
156 cell_rhs(i, j, k, 1) -= sponge_strength * xi * xi * (cell_data(i, j, k, 1) - sponge_rhotheta);
158 cell_rhs(i, j, k,
RhoQ1_comp) -= sponge_strength * xi * xi * (cell_data(i, j, k,
RhoQ1_comp) - sponge_rhomoist);
160 cell_rhs(i, j, k, n) -= sponge_strength * xi * xi * cell_data(i, j, k, n);
constexpr amrex::Real zero
Definition: ERF_Constants.H:6
constexpr amrex::Real myhalf
Definition: ERF_Constants.H:11
#define RhoQ2_comp
Definition: ERF_IndexDefines.H:43
#define RhoQ1_comp
Definition: ERF_IndexDefines.H:42
const Real dx
Definition: ERF_InitCustomPert_ABL.H:23
AMREX_ALWAYS_ASSERT(bx.length()[2]==khi+1)
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+myhalf) *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<=one) { Real dT=T_pert *(std::cos(PI *L)+one)/two;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::Real Real
Definition: ERF_ShocInterface.H:19
real(kind=kind_phys), parameter, private r0
Definition: ERF_module_mp_wsm6.F90:21
bool use_xlo_sponge_damping
Definition: ERF_SpongeStruct.H:52
amrex::Real xlo_sponge_end
Definition: ERF_SpongeStruct.H:62
amrex::Real zlo_sponge_end
Definition: ERF_SpongeStruct.H:64
bool use_zlo_sponge_damping
Definition: ERF_SpongeStruct.H:56
amrex::Real sponge_strength
Definition: ERF_SpongeStruct.H:59
bool use_ylo_sponge_damping
Definition: ERF_SpongeStruct.H:54
amrex::Real zhi_sponge_start
Definition: ERF_SpongeStruct.H:64
bool use_xhi_sponge_damping
Definition: ERF_SpongeStruct.H:53
bool use_zhi_sponge_damping
Definition: ERF_SpongeStruct.H:57
amrex::Real yhi_sponge_start
Definition: ERF_SpongeStruct.H:63
amrex::Real sponge_density
Definition: ERF_SpongeStruct.H:65
bool use_yhi_sponge_damping
Definition: ERF_SpongeStruct.H:55
amrex::Real xhi_sponge_start
Definition: ERF_SpongeStruct.H:62
amrex::Real sponge_rhomoist
Definition: ERF_SpongeStruct.H:67
amrex::Real ylo_sponge_end
Definition: ERF_SpongeStruct.H:63
amrex::Real sponge_rhotheta
Definition: ERF_SpongeStruct.H:66