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;
168 int domlo_z = domain.smallEnd(2);
169 int domhi_z = domain.bigEnd(2) + 1;
171 if(use_xlo_sponge_damping)AMREX_ALWAYS_ASSERT(xlo_sponge_end > ProbLoArr[0]);
172 if(use_xhi_sponge_damping)AMREX_ALWAYS_ASSERT(xhi_sponge_start < ProbHiArr[0]);
173 if(use_ylo_sponge_damping)AMREX_ALWAYS_ASSERT(ylo_sponge_end > ProbLoArr[1]);
174 if(use_yhi_sponge_damping)AMREX_ALWAYS_ASSERT(yhi_sponge_start < ProbHiArr[1]);
175 if(use_zlo_sponge_damping)AMREX_ALWAYS_ASSERT(zlo_sponge_end > ProbLoArr[2]);
176 if(use_zhi_sponge_damping)AMREX_ALWAYS_ASSERT(zhi_sponge_start < ProbHiArr[2]);
178 ParallelFor(tbx, [=] AMREX_GPU_DEVICE(
int i,
int j,
int k)
180 int ii = amrex::min(amrex::max(i, domlo_x), domhi_x);
181 int jj = amrex::min(amrex::max(j, domlo_y), domhi_y);
182 int kk = amrex::min(amrex::max(k, domlo_z), domhi_z);
184 Real
x = ProbLoArr[0] + ii * dx[0];
185 Real
y = ProbLoArr[1] + (jj+0.5) * dx[1];
186 Real
z = ProbLoArr[2] + (kk+0.5) * dx[2];
189 if(use_xlo_sponge_damping){
190 if (x < xlo_sponge_end) {
191 Real xi = (xlo_sponge_end -
x) / (xlo_sponge_end - ProbLoArr[0]);
192 rho_u_rhs(i, j, k) -= sponge_strength * xi * xi * (rho_u(i, j, k) - sponge_density*sponge_x_velocity);
196 if(use_xhi_sponge_damping){
197 if (x > xhi_sponge_start) {
198 Real xi = (
x - xhi_sponge_start) / (ProbHiArr[0] - xhi_sponge_start);
199 rho_u_rhs(i, j, k) -= sponge_strength * xi * xi * (rho_u(i, j, k) - sponge_density*sponge_x_velocity);
204 if(use_ylo_sponge_damping){
205 if (y < ylo_sponge_end) {
206 Real xi = (ylo_sponge_end -
y) / (ylo_sponge_end - ProbLoArr[1]);
207 rho_u_rhs(i, j, k) -= sponge_strength * xi * xi * (rho_u(i, j, k) - sponge_density*sponge_x_velocity);
211 if(use_yhi_sponge_damping){
212 if (y > yhi_sponge_start) {
213 Real xi = (
y - yhi_sponge_start) / (ProbHiArr[1] - yhi_sponge_start);
214 rho_u_rhs(i, j, k) -= sponge_strength * xi * xi * (rho_u(i, j, k) - sponge_density*sponge_x_velocity);
219 if(use_zlo_sponge_damping){
220 if (z < zlo_sponge_end) {
221 Real xi = (zlo_sponge_end -
z) / (zlo_sponge_end - ProbLoArr[2]);
222 rho_u_rhs(i, j, k) -= sponge_strength * xi * xi * (rho_u(i, j, k) - sponge_density*sponge_x_velocity);
228 if(use_zhi_sponge_damping){
229 if (z > zhi_sponge_start) {
230 Real xi = (
z - zhi_sponge_start) / (ProbHiArr[2] - zhi_sponge_start);
231 rho_u_rhs(i, j, k) -= sponge_strength * xi * xi * (rho_u(i, j, k) - sponge_density*sponge_x_velocity);
237 ParallelFor(tby, [=] AMREX_GPU_DEVICE(
int i,
int j,
int k)
239 int ii = amrex::min(amrex::max(i, domlo_x), domhi_x);
240 int jj = amrex::min(amrex::max(j, domlo_y), domhi_y);
241 int kk = amrex::min(amrex::max(k, domlo_z), domhi_z);
243 Real
x = ProbLoArr[0] + (ii+0.5) * dx[0];
244 Real
y = ProbLoArr[1] + jj * dx[1];
245 Real
z = ProbLoArr[2] + (kk+0.5) * dx[2];
248 if(use_xlo_sponge_damping){
249 if (x < xlo_sponge_end) {
250 Real xi = (xlo_sponge_end -
x) / (xlo_sponge_end - ProbLoArr[0]);
251 rho_v_rhs(i, j, k) -= sponge_strength * xi * xi * (rho_v(i, j, k) - sponge_density*sponge_y_velocity);
255 if(use_xhi_sponge_damping){
256 if (x > xhi_sponge_start) {
257 Real xi = (
x - xhi_sponge_start) / (ProbHiArr[0] - xhi_sponge_start);
258 rho_v_rhs(i, j, k) -= sponge_strength * xi * xi * (rho_v(i, j, k) - sponge_density*sponge_y_velocity);
263 if(use_ylo_sponge_damping){
264 if (y < ylo_sponge_end) {
265 Real xi = (ylo_sponge_end -
y) / (ylo_sponge_end - ProbLoArr[1]);
266 rho_v_rhs(i, j, k) -= sponge_strength * xi * xi * (rho_v(i, j, k) - sponge_density*sponge_y_velocity);
270 if(use_yhi_sponge_damping){
271 if (y > yhi_sponge_start) {
272 Real xi = (
y - yhi_sponge_start) / (ProbHiArr[1] - yhi_sponge_start);
273 rho_v_rhs(i, j, k) -= sponge_strength * xi * xi * (rho_v(i, j, k) - sponge_density*sponge_y_velocity);
278 if(use_zlo_sponge_damping){
279 if (z < zlo_sponge_end) {
280 Real xi = (zlo_sponge_end -
z) / (zlo_sponge_end - ProbLoArr[2]);
281 rho_v_rhs(i, j, k) -= sponge_strength * xi * xi * (rho_v(i, j, k) - sponge_density*sponge_y_velocity);
287 if(use_zhi_sponge_damping){
288 if (z > zhi_sponge_start) {
289 Real xi = (
z - zhi_sponge_start) / (ProbHiArr[2] - zhi_sponge_start);
290 rho_v_rhs(i, j, k) -= sponge_strength * xi * xi * (rho_v(i, j, k) - sponge_density*sponge_y_velocity);
296 ParallelFor(tbz, [=] AMREX_GPU_DEVICE(
int i,
int j,
int k)
298 int ii = amrex::min(amrex::max(i, domlo_x), domhi_x);
299 int jj = amrex::min(amrex::max(j, domlo_y), domhi_y);
300 int kk = amrex::min(amrex::max(k, domlo_z), domhi_z);
302 Real
x = ProbLoArr[0] + (ii+0.5) * dx[0];
303 Real
y = ProbLoArr[1] + (jj+0.5) * dx[1];
304 Real
z = ProbLoArr[2] + kk * dx[2];
307 if(use_xlo_sponge_damping){
308 if (x < xlo_sponge_end) {
309 Real xi = (xlo_sponge_end -
x) / (xlo_sponge_end - ProbLoArr[0]);
310 rho_w_rhs(i, j, k) -= sponge_strength * xi * xi * (rho_w(i, j, k) - sponge_density*sponge_z_velocity);
314 if(use_xhi_sponge_damping){
315 if (x > xhi_sponge_start) {
316 Real xi = (
x - xhi_sponge_start) / (ProbHiArr[0] - xhi_sponge_start);
317 rho_w_rhs(i, j, k) -= sponge_strength * xi * xi * (rho_w(i, j, k) - sponge_density*sponge_z_velocity);
322 if(use_ylo_sponge_damping){
323 if (y < ylo_sponge_end) {
324 Real xi = (ylo_sponge_end -
y) / (ylo_sponge_end - ProbLoArr[1]);
325 rho_w_rhs(i, j, k) -= sponge_strength * xi * xi * (rho_w(i, j, k) - sponge_density*sponge_z_velocity);
329 if(use_yhi_sponge_damping){
330 if (y > yhi_sponge_start) {
331 Real xi = (
y - yhi_sponge_start) / (ProbHiArr[1] - yhi_sponge_start);
332 rho_w_rhs(i, j, k) -= sponge_strength * xi * xi * (rho_w(i, j, k) - sponge_density*sponge_z_velocity);
337 if(use_zlo_sponge_damping){
338 if (z < zlo_sponge_end) {
339 Real xi = (zlo_sponge_end -
z) / (zlo_sponge_end - ProbLoArr[2]);
340 rho_w_rhs(i, j, k) -= sponge_strength * xi * xi * (rho_w(i, j, k) - sponge_density*sponge_z_velocity);
346 if(use_zhi_sponge_damping){
347 if (z > zhi_sponge_start) {
348 Real xi = (
z - zhi_sponge_start) / (ProbHiArr[2] - zhi_sponge_start);
349 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:66
amrex::Real sponge_z_velocity
Definition: ERF_SpongeStruct.H:66
amrex::Real sponge_x_velocity
Definition: ERF_SpongeStruct.H:66