131 auto dx = geom.CellSizeArray();
132 auto ProbHiArr = geom.ProbHiArray();
133 auto ProbLoArr = geom.ProbLoArray();
142 if (!use_xlo_sponge_damping &&
143 !use_xhi_sponge_damping &&
144 !use_ylo_sponge_damping &&
145 !use_yhi_sponge_damping &&
146 !use_zlo_sponge_damping &&
147 !use_zhi_sponge_damping)
163 const Box& domain = geom.Domain();
164 int domlo_x = domain.smallEnd(0);
165 int domhi_x = domain.bigEnd(0) + 1;
166 int domlo_y = domain.smallEnd(1);
167 int domhi_y = domain.bigEnd(1) + 1;
169 if(use_xlo_sponge_damping)AMREX_ALWAYS_ASSERT(xlo_sponge_end > ProbLoArr[0]);
170 if(use_xhi_sponge_damping)AMREX_ALWAYS_ASSERT(xhi_sponge_start < ProbHiArr[0]);
171 if(use_ylo_sponge_damping)AMREX_ALWAYS_ASSERT(ylo_sponge_end > ProbLoArr[1]);
172 if(use_yhi_sponge_damping)AMREX_ALWAYS_ASSERT(yhi_sponge_start < ProbHiArr[1]);
173 if(use_zlo_sponge_damping)AMREX_ALWAYS_ASSERT(zlo_sponge_end > ProbLoArr[2]);
174 if(use_zhi_sponge_damping)AMREX_ALWAYS_ASSERT(zhi_sponge_start < ProbHiArr[2]);
176 ParallelFor(tbx, [=] AMREX_GPU_DEVICE(
int i,
int j,
int k)
178 int ii = amrex::min(amrex::max(i, domlo_x), domhi_x);
179 int jj = amrex::min(amrex::max(j, domlo_y), domhi_y);
181 Real
x = ProbLoArr[0] + ii * dx[0];
182 Real
y = ProbLoArr[1] + (jj+0.5) * dx[1];
183 Real
z = z_phys_cc(i,j,k);
186 if(use_xlo_sponge_damping){
187 if (x < xlo_sponge_end) {
188 Real xi = (xlo_sponge_end -
x) / (xlo_sponge_end - ProbLoArr[0]);
189 rho_u_rhs(i, j, k) -= sponge_strength * xi * xi * (rho_u(i, j, k) - sponge_density*sponge_x_velocity);
193 if(use_xhi_sponge_damping){
194 if (x > xhi_sponge_start) {
195 Real xi = (
x - xhi_sponge_start) / (ProbHiArr[0] - xhi_sponge_start);
196 rho_u_rhs(i, j, k) -= sponge_strength * xi * xi * (rho_u(i, j, k) - sponge_density*sponge_x_velocity);
201 if(use_ylo_sponge_damping){
202 if (y < ylo_sponge_end) {
203 Real xi = (ylo_sponge_end -
y) / (ylo_sponge_end - ProbLoArr[1]);
204 rho_u_rhs(i, j, k) -= sponge_strength * xi * xi * (rho_u(i, j, k) - sponge_density*sponge_x_velocity);
208 if(use_yhi_sponge_damping){
209 if (y > yhi_sponge_start) {
210 Real xi = (
y - yhi_sponge_start) / (ProbHiArr[1] - yhi_sponge_start);
211 rho_u_rhs(i, j, k) -= sponge_strength * xi * xi * (rho_u(i, j, k) - sponge_density*sponge_x_velocity);
216 if(use_zlo_sponge_damping){
217 if (z < zlo_sponge_end) {
218 Real xi = (zlo_sponge_end -
z) / (zlo_sponge_end - ProbLoArr[2]);
219 rho_u_rhs(i, j, k) -= sponge_strength * xi * xi * (rho_u(i, j, k) - sponge_density*sponge_x_velocity);
225 if(use_zhi_sponge_damping){
226 if (z > zhi_sponge_start) {
227 Real xi = (
z - zhi_sponge_start) / (ProbHiArr[2] - zhi_sponge_start);
228 rho_u_rhs(i, j, k) -= sponge_strength * xi * xi * (rho_u(i, j, k) - sponge_density*sponge_x_velocity);
234 ParallelFor(tby, [=] AMREX_GPU_DEVICE(
int i,
int j,
int k)
236 int ii = amrex::min(amrex::max(i, domlo_x), domhi_x);
237 int jj = amrex::min(amrex::max(j, domlo_y), domhi_y);
239 Real
x = ProbLoArr[0] + (ii+0.5) * dx[0];
240 Real
y = ProbLoArr[1] + jj * dx[1];
241 Real
z = z_phys_cc(i,j,k);
244 if(use_xlo_sponge_damping){
245 if (x < xlo_sponge_end) {
246 Real xi = (xlo_sponge_end -
x) / (xlo_sponge_end - ProbLoArr[0]);
247 rho_v_rhs(i, j, k) -= sponge_strength * xi * xi * (rho_v(i, j, k) - sponge_density*sponge_y_velocity);
251 if(use_xhi_sponge_damping){
252 if (x > xhi_sponge_start) {
253 Real xi = (
x - xhi_sponge_start) / (ProbHiArr[0] - xhi_sponge_start);
254 rho_v_rhs(i, j, k) -= sponge_strength * xi * xi * (rho_v(i, j, k) - sponge_density*sponge_y_velocity);
259 if(use_ylo_sponge_damping){
260 if (y < ylo_sponge_end) {
261 Real xi = (ylo_sponge_end -
y) / (ylo_sponge_end - ProbLoArr[1]);
262 rho_v_rhs(i, j, k) -= sponge_strength * xi * xi * (rho_v(i, j, k) - sponge_density*sponge_y_velocity);
266 if(use_yhi_sponge_damping){
267 if (y > yhi_sponge_start) {
268 Real xi = (
y - yhi_sponge_start) / (ProbHiArr[1] - yhi_sponge_start);
269 rho_v_rhs(i, j, k) -= sponge_strength * xi * xi * (rho_v(i, j, k) - sponge_density*sponge_y_velocity);
274 if(use_zlo_sponge_damping){
275 if (z < zlo_sponge_end) {
276 Real xi = (zlo_sponge_end -
z) / (zlo_sponge_end - ProbLoArr[2]);
277 rho_v_rhs(i, j, k) -= sponge_strength * xi * xi * (rho_v(i, j, k) - sponge_density*sponge_y_velocity);
283 if(use_zhi_sponge_damping){
284 if (z > zhi_sponge_start) {
285 Real xi = (
z - zhi_sponge_start) / (ProbHiArr[2] - zhi_sponge_start);
286 rho_v_rhs(i, j, k) -= sponge_strength * xi * xi * (rho_v(i, j, k) - sponge_density*sponge_y_velocity);
292 ParallelFor(tbz, [=] AMREX_GPU_DEVICE(
int i,
int j,
int k)
294 int ii = amrex::min(amrex::max(i, domlo_x), domhi_x);
295 int jj = amrex::min(amrex::max(j, domlo_y), domhi_y);
297 Real
x = ProbLoArr[0] + (ii+0.5) * dx[0];
298 Real
y = ProbLoArr[1] + (jj+0.5) * dx[1];
299 Real
z = z_phys_nd(i,j,k);
302 if(use_xlo_sponge_damping){
303 if (x < xlo_sponge_end) {
304 Real xi = (xlo_sponge_end -
x) / (xlo_sponge_end - ProbLoArr[0]);
305 rho_w_rhs(i, j, k) -= sponge_strength * xi * xi * (rho_w(i, j, k) - sponge_density*sponge_z_velocity);
309 if(use_xhi_sponge_damping){
310 if (x > xhi_sponge_start) {
311 Real xi = (
x - xhi_sponge_start) / (ProbHiArr[0] - xhi_sponge_start);
312 rho_w_rhs(i, j, k) -= sponge_strength * xi * xi * (rho_w(i, j, k) - sponge_density*sponge_z_velocity);
317 if(use_ylo_sponge_damping){
318 if (y < ylo_sponge_end) {
319 Real xi = (ylo_sponge_end -
y) / (ylo_sponge_end - ProbLoArr[1]);
320 rho_w_rhs(i, j, k) -= sponge_strength * xi * xi * (rho_w(i, j, k) - sponge_density*sponge_z_velocity);
324 if(use_yhi_sponge_damping){
325 if (y > yhi_sponge_start) {
326 Real xi = (
y - yhi_sponge_start) / (ProbHiArr[1] - yhi_sponge_start);
327 rho_w_rhs(i, j, k) -= sponge_strength * xi * xi * (rho_w(i, j, k) - sponge_density*sponge_z_velocity);
332 if(use_zlo_sponge_damping){
333 if (z < zlo_sponge_end) {
334 Real xi = (zlo_sponge_end -
z) / (zlo_sponge_end - ProbLoArr[2]);
335 rho_w_rhs(i, j, k) -= sponge_strength * xi * xi * (rho_w(i, j, k) - sponge_density*sponge_z_velocity);
341 if(use_zhi_sponge_damping){
342 if (z > zhi_sponge_start) {
343 Real xi = (
z - zhi_sponge_start) / (ProbHiArr[2] - zhi_sponge_start);
344 rho_w_rhs(i, j, k) -= sponge_strength * xi * xi * (rho_w(i, j, k) - sponge_density*sponge_z_velocity);
amrex::Real sponge_y_velocity
Definition: ERF_SpongeStruct.H:63
amrex::Real sponge_z_velocity
Definition: ERF_SpongeStruct.H:63
amrex::Real sponge_x_velocity
Definition: ERF_SpongeStruct.H:63