19REMORA::fill_from_bdyfiles (MultiFab& mf_to_fill,
const MultiFab& mf_mask,
const Real time,
const int bccomp,
const int bdy_var_type,
const int icomp_to_fill,
const int icomp_calc,
const MultiFab& mf_calc,
const Real dt_calc)
24 int ivar = bdy_var_type;
29 Box domain = geom[lev].Domain();
31 const auto& mf_index_type = mf_to_fill.boxArray().ixType();
32 domain.convert(mf_index_type);
34 const auto& dom_lo = amrex::lbound(domain);
35 const auto& dom_hi = amrex::ubound(domain);
50 const Real eps= 1.0e-20_rt;
51 const bool null_mf_calc = (!mf_calc.ok());
53 for (
int icomp = 0; icomp < ncomp; icomp++)
56 const auto& bdatxlo =
boundary_series[ivar+icomp]->xlo_dat_interp.const_array();
57 const auto& bdatxhi =
boundary_series[ivar+icomp]->xhi_dat_interp.const_array();
58 const auto& bdatylo =
boundary_series[ivar+icomp]->ylo_dat_interp.const_array();
59 const auto& bdatyhi =
boundary_series[ivar+icomp]->yhi_dat_interp.const_array();
61 const auto& bx_bdatxlo =
boundary_series[ivar+icomp]->xlo_dat_interp.box();
62 const auto& bx_bdatxhi =
boundary_series[ivar+icomp]->xhi_dat_interp.box();
63 const auto& bx_bdatylo =
boundary_series[ivar+icomp]->ylo_dat_interp.box();
64 const auto& bx_bdatyhi =
boundary_series[ivar+icomp]->yhi_dat_interp.box();
98 const bool cell_centered = (mf_index_type[0] == 0 and mf_index_type[1] == 0);
103#pragma omp parallel if (Gpu::notInLaunchRegion())
106 for (MFIter mfi(mf_to_fill,
false); mfi.isValid(); ++mfi)
108 Box mf_box(mf_to_fill[mfi.index()].box());
111 Box xlo = bx_bdatxlo & mf_box;
112 Box xhi = bx_bdatxhi & mf_box;
113 Box ylo = bx_bdatylo & mf_box;
114 Box yhi = bx_bdatyhi & mf_box;
116 xlo.setSmall(0,lbound(mf_box).
x);
117 xhi.setBig (0,ubound(mf_box).
x);
118 ylo.setSmall(1,lbound(mf_box).
y);
119 yhi.setBig (1,ubound(mf_box).
y);
121 Box xlo_ylo = xlo & ylo;
122 Box xlo_yhi = xlo & yhi;
123 Box xhi_ylo = xhi & ylo;
124 Box xhi_yhi = xhi & yhi;
126 Box xlo_edge = xlo; xlo_edge.setSmall(0,ubound(xlo).
x); xlo_edge.setBig(0,ubound(xlo).
x);
127 Box xhi_edge = xhi; xhi_edge.setSmall(0,lbound(xhi).
x); xhi_edge.setBig(0,lbound(xhi).
x);
128 Box ylo_edge = ylo; ylo_edge.setSmall(1,ubound(ylo).
y); ylo_edge.setBig(1,ubound(ylo).
y);
129 Box yhi_edge = yhi; yhi_edge.setSmall(1,lbound(yhi).
y); yhi_edge.setBig(1,lbound(yhi).
y);
131 Box xlo_ghost = xlo; xlo_ghost.setBig(0,ubound(xlo).
x-1);
132 Box xhi_ghost = xhi; xhi_ghost.setSmall(0,lbound(xhi).
x+1);
133 Box ylo_ghost = ylo; ylo_ghost.setBig(1,ubound(ylo).
y-1);
134 Box yhi_ghost = yhi; yhi_ghost.setSmall(1,lbound(yhi).
y+1);
136 const Array4<Real>& dest_arr = mf_to_fill.array(mfi);
137 const Array4<const Real>& mask_arr = mf_mask.array(mfi);
138 const Array4<const Real>& calc_arr = (!null_mf_calc) ? mf_calc.array(mfi) : Array4<amrex::Real>();
139 const Array4<const Real>& h_arr =
vec_h[lev]->const_array(mfi);
140 const Array4<const Real>& zeta_arr =
vec_zeta[lev]->const_array(mfi);
141 const Array4<const Real>& pm =
vec_pm[lev]->const_array(mfi);
142 const Array4<const Real>& pn =
vec_pn[lev]->const_array(mfi);
144 const Array4<const Real>& msku =
vec_msku[lev]->const_array(mfi);
145 const Array4<const Real>& mskv =
vec_mskv[lev]->const_array(mfi);
147 const Array4<const Real> nudg_coeff_out =
vec_nudg_coeff[bdy_var_type][lev]->const_array(mfi);
152 Vector<BCRec> bcrs(1);
153 amrex::setBC(mf_box, domain, bccomp+icomp, 0, 1,
domain_bcs_type, bcrs);
166 if (!xlo.isEmpty() && apply_west) {
167 ParallelFor(grow(xlo_edge,IntVect(0,-1,0)), [=] AMREX_GPU_DEVICE (
int i,
int j,
int k)
169 Real bry_val = bdatxlo(ubound(xlo).
x,j,k,0);
171 dest_arr(i,j,k,icomp+icomp_to_fill) = bry_val * mask_arr(i,j,0);
173 Real bry_val_zeta = bdatxlo_zeta(ubound(xlo).
x-1,j,k,0);
174 Real cff = 1.0_rt / (0.5_rt * (h_arr(dom_lo.x-1,j,0) + zeta_arr(dom_lo.x-1,j,0,icomp_calc)
175 + h_arr(dom_lo.x,j,0) + zeta_arr(dom_lo.x,j,0,icomp_calc)));
176 Real Cx = std::sqrt(
g * cff);
177 dest_arr(i,j,k,icomp+icomp_to_fill) = (bry_val
178 - Cx * (0.5_rt * (zeta_arr(dom_lo.x-1,j,0,icomp_calc) + zeta_arr(dom_lo.x,j,0,icomp_calc))
179 - bry_val_zeta)) * mask_arr(i,j,0);
181 Real cff = dt_calc * 0.5_rt * (pm(dom_lo.x,j-mf_index_type[1],0) + pm(dom_lo.x,j,0));
182 Real cff1 = std::sqrt(
g * 0.5_rt * (h_arr(dom_lo.x,j-mf_index_type[1],0)
183 + zeta_arr(dom_lo.x,j-mf_index_type[1],0,icomp_calc) + h_arr(dom_lo.x,j,0)
184 + zeta_arr(dom_lo.x,j,0,icomp_calc)));
185 Real Cx = cff * cff1;
186 Real cff2 = 1.0_rt / (1.0_rt + Cx);
187 dest_arr(i,j,k,icomp+icomp_to_fill) = cff2 * (dest_arr(dom_lo.x-1,j,k,icomp_calc)
188 + Cx * dest_arr(dom_lo.x,j,k,icomp+icomp_to_fill)) * mask_arr(i,j,0);
190 Real grad_lo_im1 = (calc_arr(dom_lo.x+mf_index_type[0]-1,j ,k,icomp+icomp_to_fill) - calc_arr(dom_lo.x-1+mf_index_type[0],j-1,k,icomp+icomp_to_fill));
191 Real grad_lo = (calc_arr(dom_lo.x+mf_index_type[0] ,j ,k,icomp+icomp_to_fill) - calc_arr(dom_lo.x +mf_index_type[0],j-1,k,icomp+icomp_to_fill));
192 Real grad_lo_imjp1 = (calc_arr(dom_lo.x+mf_index_type[0]-1,j+1,k,icomp+icomp_to_fill) - calc_arr(dom_lo.x-1+mf_index_type[0],j ,k,icomp+icomp_to_fill));
193 Real grad_lo_jp1 = (calc_arr(dom_lo.x+mf_index_type[0] ,j+1,k,icomp+icomp_to_fill) - calc_arr(dom_lo.x +mf_index_type[0],j ,k,icomp+icomp_to_fill));
195 grad_lo_im1 *= mskv(i,j,0);
196 grad_lo *= mskv(i,j,0);
197 grad_lo_imjp1 *= mskv(i,j,0);
198 grad_lo_jp1 *= mskv(i,j,0);
200 Real dTdt = calc_arr(dom_lo.x+mf_index_type[0],j,k,icomp+icomp_to_fill) - dest_arr(dom_lo.x+mf_index_type[0] ,j,k,icomp+icomp_to_fill);
201 Real dTdx = dest_arr(dom_lo.x+mf_index_type[0],j,k,icomp+icomp_to_fill) - dest_arr(dom_lo.x+mf_index_type[0]+1,j,k,icomp+icomp_to_fill);
203 Real nudg_coeff_out_local = (nudg_coeff_out(i-mf_index_type[0],j-mf_index_type[1],k) +
204 nudg_coeff_out(i,j,k)) * 0.5_rt;
205 if (dTdt*dTdx < 0.0_rt) {
206 tau = nudg_coeff_out_local * obcfac * dt_calc;
209 tau = nudg_coeff_out_local * dt_calc;
211 Real dTde = (dTdt * (grad_lo+grad_lo_jp1) > 0.0_rt) ? grad_lo : grad_lo_jp1;
212 Real cff = std::max(dTdx*dTdx+dTde*dTde,eps);
213 Real Cx = dTdt * dTdx;
214 dest_arr(i,j,k,icomp+icomp_to_fill) = (cff * calc_arr(dom_lo.x-1+mf_index_type[0],j,k,icomp+icomp_to_fill) + Cx * dest_arr(dom_lo.x+mf_index_type[0],j,k,icomp+icomp_to_fill)) / (cff+Cx);
215 dest_arr(i,j,k,icomp+icomp_to_fill) = mask_arr(i,j,0) * (dest_arr(dom_lo.x-1+mf_index_type[0],j,k,icomp+icomp_to_fill) + tau * (bry_val - calc_arr(dom_lo.x-1+mf_index_type[0],j,k,icomp+icomp_to_fill)));
218 ParallelFor(grow(xlo_ghost,IntVect(0,-1,0)), [=] AMREX_GPU_DEVICE (
int i,
int j,
int k)
220 dest_arr(i,j,k,icomp+icomp_to_fill) = dest_arr(ubound(xlo).
x,j,k,icomp+icomp_to_fill);
225 if (!xhi.isEmpty() && apply_east) {
226 ParallelFor(grow(xhi_edge,IntVect(0,-1,0)), [=] AMREX_GPU_DEVICE (
int i,
int j,
int k)
228 Real bry_val = bdatxhi(lbound(xhi).
x,j,k,0);
230 dest_arr(i,j,k,icomp+icomp_to_fill) = bry_val * mask_arr(i,j,0);
232 Real bry_val_zeta = bdatxhi_zeta(lbound(xhi).
x,j,k,0);
233 Real cff = 1.0_rt / (0.5_rt * (h_arr(dom_hi.x-1,j,0) + zeta_arr(dom_hi.x-1,j,0,icomp_calc)
234 + h_arr(dom_hi.x,j,0) + zeta_arr(dom_hi.x,j,0,icomp_calc)));
235 Real Cx = std::sqrt(
g * cff);
236 dest_arr(i,j,k,icomp+icomp_to_fill) = (bry_val
237 + Cx * (0.5_rt * (zeta_arr(dom_hi.x-1,j,0,icomp_calc) + zeta_arr(dom_hi.x,j,0,icomp_calc))
238 - bry_val_zeta)) * mask_arr(i,j,0);
240 Real cff = dt_calc * 0.5_rt * (pm(dom_hi.x,j-mf_index_type[1],0) + pm(dom_hi.x,j,0));
241 Real cff1 = std::sqrt(
g * 0.5_rt * (h_arr(dom_hi.x,j-mf_index_type[1],0)
242 + zeta_arr(dom_hi.x,j-mf_index_type[1],0,icomp_calc) + h_arr(dom_hi.x,j,0)
243 + zeta_arr(dom_hi.x,j,0,icomp_calc)));
244 Real Cx = cff * cff1;
245 Real cff2 = 1.0_rt / (1.0_rt + Cx);
246 dest_arr(i,j,k,icomp+icomp_to_fill) = cff2 * (dest_arr(dom_hi.x+1,j,k,icomp_calc)
247 + Cx * dest_arr(dom_hi.x,j,k,icomp+icomp_to_fill)) * mask_arr(i,j,0);
249 Real grad_hi = (calc_arr(dom_hi.x-mf_index_type[0] ,j ,k,icomp+icomp_to_fill) - calc_arr(dom_hi.x-mf_index_type[0] ,j-1,k,icomp+icomp_to_fill));
250 Real grad_hi_ip1 = (calc_arr(dom_hi.x-mf_index_type[0]+1,j ,k,icomp+icomp_to_fill) - calc_arr(dom_hi.x-mf_index_type[0]+1,j-1,k,icomp+icomp_to_fill));
251 Real grad_hi_jp1 = (calc_arr(dom_hi.x-mf_index_type[0] ,j+1,k,icomp+icomp_to_fill) - calc_arr(dom_hi.x-mf_index_type[0] ,j ,k,icomp+icomp_to_fill));
252 Real grad_hi_ijp1 = (calc_arr(dom_hi.x-mf_index_type[0]+1,j+1,k,icomp+icomp_to_fill) - calc_arr(dom_hi.x-mf_index_type[0]+1,j ,k,icomp+icomp_to_fill));
254 grad_hi *= mskv(i,j,0);
255 grad_hi_ip1 *= mskv(i,j,0);
256 grad_hi_jp1 *= mskv(i,j,0);
257 grad_hi_ijp1 *= mskv(i,j,0);
259 Real dTdt = calc_arr(dom_hi.x-mf_index_type[0],j,k,icomp+icomp_to_fill) - dest_arr(dom_hi.x-mf_index_type[0] ,j,k,icomp+icomp_to_fill);
260 Real dTdx = dest_arr(dom_hi.x-mf_index_type[0],j,k,icomp+icomp_to_fill) - dest_arr(dom_hi.x-mf_index_type[0]-1,j,k,icomp+icomp_to_fill);
262 Real nudg_coeff_out_local = (nudg_coeff_out(i-mf_index_type[0],j-mf_index_type[1],k) +
263 nudg_coeff_out(i,j,k)) * 0.5_rt;
264 if (dTdt*dTdx < 0.0_rt) {
265 tau = nudg_coeff_out_local * obcfac * dt_calc;
268 tau = nudg_coeff_out_local * dt_calc;
270 if (dTdt * dTdx < 0.0_rt) dTdt = 0.0_rt;
271 Real dTde = (dTdt * (grad_hi + grad_hi_jp1) > 0.0_rt) ? grad_hi : grad_hi_jp1;
272 Real cff = std::max(dTdx*dTdx + dTde*dTde,eps);
273 Real Cx = dTdt * dTdx;
274 dest_arr(i,j,k,icomp+icomp_to_fill) = (cff * calc_arr(dom_hi.x+1-mf_index_type[0],j,k,icomp+icomp_to_fill) + Cx * dest_arr(dom_hi.x-mf_index_type[0],j,k,icomp+icomp_to_fill)) * mask_arr(i,j,0) / (cff+Cx);
275 dest_arr(i,j,k,icomp+icomp_to_fill) = mask_arr(i,j,0) * (dest_arr(dom_hi.x+1-mf_index_type[0],j,k,icomp+icomp_to_fill) + tau * (bry_val - calc_arr(dom_hi.x+1-mf_index_type[0],j,k,icomp+icomp_to_fill)));
278 ParallelFor(grow(xhi_ghost,IntVect(0,-1,0)), [=] AMREX_GPU_DEVICE (
int i,
int j,
int k)
280 dest_arr(i,j,k,icomp+icomp_to_fill) = dest_arr(lbound(xhi).
x,j,k,icomp+icomp_to_fill);
285 if (!ylo.isEmpty() && apply_south) {
286 ParallelFor(grow(ylo_edge,IntVect(-1,0,0)), [=] AMREX_GPU_DEVICE (
int i,
int j,
int k)
288 Real bry_val = bdatylo(i,ubound(ylo).
y,k,0);
290 dest_arr(i,j,k,icomp+icomp_to_fill) = bry_val * mask_arr(i,j,0);
292 Real bry_val_zeta = bdatylo_zeta(i,ubound(ylo).
y-1,k,0);
293 Real cff = 1.0_rt / (0.5_rt * (h_arr(i,dom_lo.y-1,0) + zeta_arr(i,dom_lo.y-1,0,icomp_calc)
294 + h_arr(i,dom_lo.y,0) + zeta_arr(i,dom_lo.y,0,icomp_calc)));
295 Real Ce = std::sqrt(
g * cff);
296 dest_arr(i,j,k,icomp+icomp_to_fill) = (bry_val
297 - Ce * (0.5_rt * (zeta_arr(i,dom_lo.y-1,0,icomp_calc) + zeta_arr(i,dom_lo.y,0,icomp_calc))
298 - bry_val_zeta)) * mask_arr(i,j,0);
300 Real cff = dt_calc * 0.5_rt * (pn(i-mf_index_type[0],dom_lo.y,0) + pn(i,dom_lo.y,0));
301 Real cff1 = std::sqrt(
g * 0.5_rt * (h_arr(i-mf_index_type[0],dom_lo.y,0) +
302 zeta_arr(i-mf_index_type[0],dom_lo.y,0,icomp_calc) + h_arr(i,dom_lo.y,0)
303 + zeta_arr(i,dom_lo.y,0,icomp_calc)));
304 Real Ce = cff * cff1;
305 Real cff2 = 1.0_rt / (1.0_rt + Ce);
306 dest_arr(i,j,k,icomp+icomp_to_fill) = cff2 * (dest_arr(i,dom_lo.y-1,k,icomp_calc)
307 + Ce * dest_arr(i,dom_lo.y,k,icomp+icomp_to_fill)) * mask_arr(i,j,0);
309 Real grad_lo = (calc_arr(i ,dom_lo.y+mf_index_type[1], k,icomp+icomp_to_fill) - calc_arr(i-1,dom_lo.y+mf_index_type[1] ,k,icomp+icomp_to_fill));
310 Real grad_lo_jm1 = (calc_arr(i ,dom_lo.y+mf_index_type[1]-1,k,icomp+icomp_to_fill) - calc_arr(i-1,dom_lo.y+mf_index_type[1]-1,k,icomp+icomp_to_fill));
311 Real grad_lo_ip1 = (calc_arr(i+1,dom_lo.y+mf_index_type[1] ,k,icomp+icomp_to_fill) - calc_arr(i ,dom_lo.y+mf_index_type[1] ,k,icomp+icomp_to_fill));
312 Real grad_lo_ipjm1 = (calc_arr(i+1,dom_lo.y+mf_index_type[1]-1,k,icomp+icomp_to_fill) - calc_arr(i ,dom_lo.y+mf_index_type[1]-1,k,icomp+icomp_to_fill));
314 grad_lo *= msku(i,j,0);
315 grad_lo_jm1 *= msku(i,j,0);
316 grad_lo_ip1 *= msku(i,j,0);
317 grad_lo_ipjm1 *= msku(i,j,0);
319 Real dTdt = calc_arr(i,dom_lo.y+mf_index_type[1],k,icomp+icomp_to_fill) - dest_arr(i,dom_lo.y +mf_index_type[1],k,icomp+icomp_to_fill);
320 Real dTde = dest_arr(i,dom_lo.y+mf_index_type[1],k,icomp+icomp_to_fill) - dest_arr(i,dom_lo.y+1+mf_index_type[1],k,icomp+icomp_to_fill);
322 Real nudg_coeff_out_local = (nudg_coeff_out(i-mf_index_type[0],j-mf_index_type[1],k) +
323 nudg_coeff_out(i,j,k)) * 0.5_rt;
324 if (dTdt*dTde < 0.0_rt) {
325 tau = nudg_coeff_out_local * obcfac * dt_calc;
328 tau = nudg_coeff_out_local * dt_calc;
330 if (dTdt * dTde < 0.0_rt) dTdt = 0.0_rt;
331 Real dTdx = (dTdt * (grad_lo + grad_lo_ip1) > 0.0_rt) ? grad_lo : grad_lo_ip1;
332 Real cff = std::max(dTdx*dTdx + dTde*dTde, eps);
334 dest_arr(i,j,k,icomp+icomp_to_fill) = (cff * calc_arr(i,dom_lo.y-1+mf_index_type[1],k,icomp+icomp_to_fill) + Ce * dest_arr(i,dom_lo.y+mf_index_type[1],k,icomp+icomp_to_fill)) / (cff+Ce);
335 dest_arr(i,j,k,icomp+icomp_to_fill) = mask_arr(i,j,0) * (dest_arr(i,dom_lo.y-1+mf_index_type[1],k,icomp+icomp_to_fill) + tau * (bry_val - calc_arr(i,dom_lo.y-1+mf_index_type[1],k,icomp+icomp_to_fill)));
338 ParallelFor(grow(ylo_ghost,IntVect(-1,0,0)), [=] AMREX_GPU_DEVICE (
int i,
int j,
int k)
340 dest_arr(i,j,k,icomp+icomp_to_fill) = dest_arr(i,ubound(ylo).
y,k,icomp+icomp_to_fill);
345 if (!yhi.isEmpty() && apply_north) {
346 ParallelFor(grow(yhi_edge,IntVect(-1,0,0)), [=] AMREX_GPU_DEVICE (
int i,
int j,
int k)
348 Real bry_val = bdatyhi(i,lbound(yhi).
y,k,0);
350 dest_arr(i,j,k,icomp+icomp_to_fill) = bry_val * mask_arr(i,j,0);
352 Real bry_val_zeta = bdatyhi_zeta(i,lbound(yhi).
y,k,0);
353 Real cff = 1.0_rt / (0.5_rt * (h_arr(i,dom_hi.y-1,0) + zeta_arr(i,dom_hi.y-1,0,icomp_calc)
354 + h_arr(i,dom_hi.y,0) + zeta_arr(i,dom_hi.y,0,icomp_calc)));
355 Real Ce = std::sqrt(
g * cff);
356 dest_arr(i,j,k,icomp+icomp_to_fill) = (bry_val
357 + Ce * (0.5_rt * (zeta_arr(i,dom_hi.y-1,0,icomp_calc) + zeta_arr(i,dom_hi.y,0,icomp_calc))
358 - bry_val_zeta)) * mask_arr(i,j,0);
360 Real cff = dt_calc * 0.5_rt * (pn(i-mf_index_type[0],dom_hi.y,0) + pn(i,dom_hi.y,0));
361 Real cff1 = std::sqrt(
g * 0.5_rt * (h_arr(i-mf_index_type[0],dom_hi.y,0)
362 + zeta_arr(i-mf_index_type[0],dom_hi.y,0,icomp_calc) +
363 h_arr(i,dom_hi.y,0) + zeta_arr(i,dom_hi.y,0,icomp_calc)));
364 Real Ce = cff * cff1;
365 Real cff2 = 1.0_rt / (1.0_rt + Ce);
366 dest_arr(i,j,k,icomp+icomp_to_fill) = cff2 * (dest_arr(i,dom_hi.y+1,k,icomp_calc)
367 + Ce * dest_arr(i,dom_hi.y,k,icomp+icomp_to_fill)) * mask_arr(i,j,0);
369 Real grad_hi = calc_arr(i ,dom_hi.y-mf_index_type[1] ,k,icomp+icomp_to_fill) - calc_arr(i-1,dom_hi.y-mf_index_type[1] ,k,icomp+icomp_to_fill);
370 Real grad_hi_jp1 = calc_arr(i ,dom_hi.y-mf_index_type[1]+1,k,icomp+icomp_to_fill) - calc_arr(i-1,dom_hi.y-mf_index_type[1]+1,k,icomp+icomp_to_fill);
371 Real grad_hi_ip1 = calc_arr(i+1,dom_hi.y-mf_index_type[1] ,k,icomp+icomp_to_fill) - calc_arr(i ,dom_hi.y-mf_index_type[1] ,k,icomp+icomp_to_fill);
372 Real grad_hi_ijp1 = calc_arr(i+1,dom_hi.y-mf_index_type[1]+1,k,icomp+icomp_to_fill) - calc_arr(i ,dom_hi.y-mf_index_type[1]+1,k,icomp+icomp_to_fill);
374 grad_hi *= msku(i,j,0);
375 grad_hi_jp1 *= msku(i,j,0);
376 grad_hi_ip1 *= msku(i,j,0);
377 grad_hi_ijp1 *= msku(i,j,0);
379 Real dTdt = calc_arr(i,dom_hi.y-mf_index_type[1],k,icomp+icomp_to_fill) - dest_arr(i,dom_hi.y -mf_index_type[1],k,icomp+icomp_to_fill);
380 Real dTde = dest_arr(i,dom_hi.y-mf_index_type[1],k,icomp+icomp_to_fill) - dest_arr(i,dom_hi.y-1-mf_index_type[1],k,icomp+icomp_to_fill);
382 Real nudg_coeff_out_local = (nudg_coeff_out(i-mf_index_type[0],j-mf_index_type[1],k) +
383 nudg_coeff_out(i,j,k)) * 0.5_rt;
384 if (dTdt*dTde < 0.0_rt) {
385 tau = nudg_coeff_out_local * obcfac * dt_calc;
388 tau = nudg_coeff_out_local * dt_calc;
390 if (dTdt * dTde < 0.0_rt) dTdt = 0.0_rt;
391 Real dTdx = (dTdt * (grad_hi + grad_hi_ip1) > 0.0_rt) ? grad_hi : grad_hi_ip1;
392 Real cff = std::max(dTdx*dTdx + dTde*dTde, eps);
394 dest_arr(i,j,k,icomp+icomp_to_fill) = (cff*calc_arr(i,dom_hi.y+1-mf_index_type[1],k,icomp+icomp_to_fill) + Ce*dest_arr(i,dom_hi.y-mf_index_type[1],k,icomp+icomp_to_fill)) * mask_arr(i,j,0) / (cff+Ce);
395 dest_arr(i,j,k,icomp+icomp_to_fill) = mask_arr(i,j,0) * (dest_arr(i,dom_hi.y+1-mf_index_type[1],k,icomp+icomp_to_fill) + tau * (bry_val - calc_arr(i,dom_hi.y+1-mf_index_type[1],k,icomp+icomp_to_fill)));
398 ParallelFor(grow(yhi_ghost,IntVect(-1,0,0)), [=] AMREX_GPU_DEVICE (
int i,
int j,
int k)
400 dest_arr(i,j,k,icomp+icomp_to_fill) = dest_arr(i,lbound(yhi).
y,k,icomp+icomp_to_fill);
405 if (!xlo_ylo.isEmpty() && (apply_west || apply_south)) {
406 ParallelFor(xlo_ylo, [=] AMREX_GPU_DEVICE (
int i,
int j,
int k)
408 dest_arr(i,j,k,icomp+icomp_to_fill) = 0.5 * (dest_arr(i,dom_lo.y+mf_index_type[1],k,icomp+icomp_to_fill)
409 + dest_arr(dom_lo.x+mf_index_type[0],j,k,icomp+icomp_to_fill));
412 if (!xlo_yhi.isEmpty() && (apply_west || apply_north)) {
413 ParallelFor(xlo_yhi, [=] AMREX_GPU_DEVICE (
int i,
int j,
int k)
415 dest_arr(i,j,k,icomp+icomp_to_fill) = 0.5 * (dest_arr(i,dom_hi.y-mf_index_type[1],k,icomp+icomp_to_fill)
416 + dest_arr(dom_lo.x+mf_index_type[0],j,k,icomp+icomp_to_fill));
419 if (!xhi_ylo.isEmpty() && (apply_east || apply_south)) {
420 ParallelFor(xhi_ylo, [=] AMREX_GPU_DEVICE (
int i,
int j,
int k)
422 dest_arr(i,j,k,icomp+icomp_to_fill) = 0.5 * (dest_arr(i,dom_lo.y+mf_index_type[1],k,icomp+icomp_to_fill)
423 + dest_arr(dom_hi.x-mf_index_type[0],j,k,icomp+icomp_to_fill));
426 if (!xhi_yhi.isEmpty() && (apply_east || apply_north)) {
427 ParallelFor(xhi_yhi, [=] AMREX_GPU_DEVICE (
int i,
int j,
int k)
429 dest_arr(i,j,k,icomp+icomp_to_fill) = 0.5 * (dest_arr(i,dom_hi.y-mf_index_type[1],k,icomp+icomp_to_fill)
430 + dest_arr(dom_hi.x-mf_index_type[0],j,k,icomp+icomp_to_fill));