122 BL_PROFILE_REGION(
"realbdy_compute_interior_ghost_RHS()");
130 if (width > set_width+1) width -= 1;
133 Real F1 = 1./(10.*delta_t);
134 Real F2 = 1./(50.*delta_t);
137 Real dT = bdy_time_interval;
138 Real time_since_start = time - start_bdy_time;
139 int n_time =
static_cast<int>( time_since_start / dT);
140 Real alpha = (time_since_start - n_time * dT) / dT;
141 AMREX_ALWAYS_ASSERT( alpha >= 0. && alpha <= 1.0);
142 Real oma = 1.0 - alpha;
150 FArrayBox U_xlo, U_xhi, U_ylo, U_yhi;
151 FArrayBox V_xlo, V_xhi, V_ylo, V_yhi;
152 FArrayBox T_xlo, T_xhi, T_ylo, T_yhi;
173 for (
int ivar(ivarU); ivar < BdyEnd; ivar++) {
174 int ivar_idx = var_map[ivar];
175 Box domain = geom.Domain();
176 auto ixtype = S_cur_data[ivar_idx].boxArray().ixType();
177 domain.convert(ixtype);
182 IntVect ng_vect{2,2,0};
183 Box gdom(domain); gdom.grow(ng_vect);
184 Box bx_xlo, bx_xhi, bx_ylo, bx_yhi;
192 U_xlo.resize(bx_xlo,1,The_Async_Arena()); U_xhi.resize(bx_xhi,1,The_Async_Arena());
193 U_ylo.resize(bx_ylo,1,The_Async_Arena()); U_yhi.resize(bx_yhi,1,The_Async_Arena());
194 }
else if (ivar == ivarV) {
195 V_xlo.resize(bx_xlo,1,The_Async_Arena()); V_xhi.resize(bx_xhi,1,The_Async_Arena());
196 V_ylo.resize(bx_ylo,1,The_Async_Arena()); V_yhi.resize(bx_yhi,1,The_Async_Arena());
197 }
else if (ivar == ivarT){
198 T_xlo.resize(bx_xlo,1,The_Async_Arena()); T_xhi.resize(bx_xhi,1,The_Async_Arena());
199 T_ylo.resize(bx_ylo,1,The_Async_Arena()); T_yhi.resize(bx_yhi,1,The_Async_Arena());
214 for (
int ivar(ivarU); ivar < BdyEnd; ivar++) {
215 int ivar_idx = var_map[ivar];
216 Box domain = geom.Domain();
217 auto ixtype = S_cur_data[ivar_idx].boxArray().ixType();
218 domain.convert(ixtype);
219 const auto& dom_lo = lbound(domain);
220 const auto& dom_hi = ubound(domain);
223 #pragma omp parallel if (Gpu::notInLaunchRegion())
225 for ( MFIter mfi(S_cur_data[ivar_idx],TilingIfNotGPU()); mfi.isValid(); ++mfi) {
228 IntVect ng_vect{2,2,0};
229 Box tbx = mfi.tilebox(ixtype.toIntVect(),ng_vect);
230 Box tbx_xlo, tbx_xhi, tbx_ylo, tbx_yhi;
236 Array4<Real> arr_xlo; Array4<Real> arr_xhi;
237 Array4<Real> arr_ylo; Array4<Real> arr_yhi;
239 arr_xlo = U_xlo.array(); arr_xhi = U_xhi.array();
240 arr_ylo = U_ylo.array(); arr_yhi = U_yhi.array();
241 }
else if (ivar == ivarV) {
242 arr_xlo = V_xlo.array(); arr_xhi = V_xhi.array();
243 arr_ylo = V_ylo.array(); arr_yhi = V_yhi.array();
244 }
else if (ivar == ivarT){
245 arr_xlo = T_xlo.array(); arr_xhi = T_xhi.array();
246 arr_ylo = T_ylo.array(); arr_yhi = T_yhi.array();
252 const auto& bdatxlo_n = bdy_data_xlo[n_time ][ivar].const_array();
253 const auto& bdatxlo_np1 = bdy_data_xlo[n_time+1][ivar].const_array();
254 const auto& bdatxhi_n = bdy_data_xhi[n_time ][ivar].const_array();
255 const auto& bdatxhi_np1 = bdy_data_xhi[n_time+1][ivar].const_array();
256 const auto& bdatylo_n = bdy_data_ylo[n_time ][ivar].const_array();
257 const auto& bdatylo_np1 = bdy_data_ylo[n_time+1][ivar].const_array();
258 const auto& bdatyhi_n = bdy_data_yhi[n_time ][ivar].const_array();
259 const auto& bdatyhi_np1 = bdy_data_yhi[n_time+1][ivar].const_array();
268 int offset = set_width - 1;
269 if (width > set_width)
offset = width;
272 ParallelFor(tbx_xlo, tbx_xhi,
273 [=] AMREX_GPU_DEVICE (
int i,
int j,
int k) noexcept
275 int ii = std::max(i , dom_lo.x);
276 ii = std::min(ii, dom_lo.x+
offset);
277 int jj = std::max(j , dom_lo.y);
278 jj = std::min(jj, dom_hi.y);
282 rho_interp = 0.5 * ( r_arr(i-1,j ,k) + r_arr(i,j,k) );
283 }
else if (ivar==ivarV) {
284 rho_interp = 0.5 * ( r_arr(i ,j-1,k) + r_arr(i,j,k) );
286 rho_interp = r_arr(i,j,k);
288 arr_xlo(i,j,k) = rho_interp * ( oma * bdatxlo_n (ii,jj,k,0)
289 + alpha * bdatxlo_np1(ii,jj,k,0) );
291 [=] AMREX_GPU_DEVICE (
int i,
int j,
int k) noexcept
293 int ii = std::max(i , dom_hi.x-
offset);
294 ii = std::min(ii, dom_hi.x);
295 int jj = std::max(j , dom_lo.y);
296 jj = std::min(jj, dom_hi.y);
300 rho_interp = 0.5 * ( r_arr(i-1,j ,k) + r_arr(i,j,k) );
301 }
else if (ivar==ivarV) {
302 rho_interp = 0.5 * ( r_arr(i ,j-1,k) + r_arr(i,j,k) );
304 rho_interp = r_arr(i,j,k);
306 arr_xhi(i,j,k) = rho_interp * ( oma * bdatxhi_n (ii,jj,k,0)
307 + alpha * bdatxhi_np1(ii,jj,k,0) );
310 ParallelFor(tbx_ylo, tbx_yhi,
311 [=] AMREX_GPU_DEVICE (
int i,
int j,
int k) noexcept
313 int ii = std::max(i , dom_lo.x);
314 ii = std::min(ii, dom_hi.x);
315 int jj = std::max(j , dom_lo.y);
316 jj = std::min(jj, dom_lo.y+
offset);
320 rho_interp = 0.5 * ( r_arr(i-1,j ,k) + r_arr(i,j,k) );
321 }
else if (ivar==ivarV) {
322 rho_interp = 0.5 * ( r_arr(i ,j-1,k) + r_arr(i,j,k) );
324 rho_interp = r_arr(i,j,k);
326 arr_ylo(i,j,k) = rho_interp * ( oma * bdatylo_n (ii,jj,k,0)
327 + alpha * bdatylo_np1(ii,jj,k,0) );
329 [=] AMREX_GPU_DEVICE (
int i,
int j,
int k) noexcept
331 int ii = std::max(i , dom_lo.x);
332 ii = std::min(ii, dom_hi.x);
333 int jj = std::max(j , dom_hi.y-
offset);
334 jj = std::min(jj, dom_hi.y);
338 rho_interp = 0.5 * ( r_arr(i-1,j ,k) + r_arr(i,j,k) );
339 }
else if (ivar==ivarV) {
340 rho_interp = 0.5 * ( r_arr(i ,j-1,k) + r_arr(i,j,k) );
342 rho_interp = r_arr(i,j,k);
344 arr_yhi(i,j,k) = rho_interp * ( oma * bdatyhi_n (ii,jj,k,0)
345 + alpha * bdatyhi_np1(ii,jj,k,0) );
357 for (
int ivar(ivarU); ivar < BdyEnd; ivar++) {
358 int ivar_idx = ivar_map[ivar];
359 int icomp = comp_map[ivar];
361 Box domain = geom.Domain();
362 domain.convert(S_old_data[ivar_idx].boxArray().ixType());
363 const auto& dom_hi = ubound(domain);
364 const auto& dom_lo = lbound(domain);
367 #pragma omp parallel if (Gpu::notInLaunchRegion())
369 for ( MFIter mfi(S_old_data[ivar_idx],TilingIfNotGPU()); mfi.isValid(); ++mfi) {
370 Box tbx = mfi.tilebox();
371 Box tbx_xlo, tbx_xhi, tbx_ylo, tbx_yhi;
376 Array4<Real> rhs_arr; Array4<Real> data_arr;
377 Array4<Real> arr_xlo; Array4<Real> arr_xhi;
378 Array4<Real> arr_ylo; Array4<Real> arr_yhi;
380 arr_xlo = U_xlo.array(); arr_xhi = U_xhi.array();
381 arr_ylo = U_ylo.array(); arr_yhi = U_yhi.array();
384 }
else if (ivar == ivarV) {
385 arr_xlo = V_xlo.array(); arr_xhi = V_xhi.array();
386 arr_ylo = V_ylo.array(); arr_yhi = V_yhi.array();
389 }
else if (ivar == ivarT){
390 arr_xlo = T_xlo.array(); arr_xhi = T_xhi.array();
391 arr_ylo = T_ylo.array(); arr_yhi = T_yhi.array();
399 width, set_width, dom_lo, dom_hi,
400 tbx_xlo, tbx_xhi, tbx_ylo, tbx_yhi,
401 arr_xlo, arr_xhi, arr_ylo, arr_yhi,
413 if (width > set_width) {
414 for (
int ivar(ivarU); ivar < BdyEnd; ivar++) {
415 int ivar_idx = ivar_map[ivar];
416 int icomp = comp_map[ivar];
418 Box domain = geom.Domain();
419 domain.convert(S_cur_data[ivar_idx].boxArray().ixType());
420 const auto& dom_hi = ubound(domain);
421 const auto& dom_lo = lbound(domain);
427 #pragma omp parallel if (Gpu::notInLaunchRegion())
429 for ( MFIter mfi(S_cur_data[ivar_idx],TilingIfNotGPU()); mfi.isValid(); ++mfi) {
430 Box tbx = mfi.tilebox();
431 Box tbx_xlo, tbx_xhi, tbx_ylo, tbx_yhi;
436 Array4<Real> rhs_arr; Array4<Real> data_arr;
437 Array4<Real> arr_xlo; Array4<Real> arr_xhi;
438 Array4<Real> arr_ylo; Array4<Real> arr_yhi;
440 arr_xlo = U_xlo.array(); arr_xhi = U_xhi.array();
441 arr_ylo = U_ylo.array(); arr_yhi = U_yhi.array();
444 }
else if (ivar == ivarV) {
445 arr_xlo = V_xlo.array(); arr_xhi = V_xhi.array();
446 arr_ylo = V_ylo.array(); arr_yhi = V_yhi.array();
449 }
else if (ivar == ivarT){
450 arr_xlo = T_xlo.array(); arr_xhi = T_xhi.array();
451 arr_ylo = T_ylo.array(); arr_yhi = T_yhi.array();
459 width2, set_width, dom_lo, dom_hi, F1, F2,
460 tbx_xlo, tbx_xhi, tbx_ylo, tbx_yhi,
461 arr_xlo, arr_xhi, arr_ylo, arr_yhi,
#define RhoTheta_comp
Definition: ERF_IndexDefines.H:37
void compute_interior_ghost_bxs_xy(const Box &bx, const Box &domain, const int &width, const int &set_width, Box &bx_xlo, Box &bx_xhi, Box &bx_ylo, Box &bx_yhi, const IntVect &ng_vect, const bool get_int_ng)
Definition: ERF_InteriorGhostCells.cpp:23
AMREX_FORCE_INLINE IntVect offset(const int face_dir, const int normal)
Definition: ERF_ReadBndryPlanes.cpp:28
AMREX_GPU_HOST AMREX_FORCE_INLINE void realbdy_set_rhs_in_spec_region(const amrex::Real &dt, const int &icomp, const int &num_var, const int &width, const int &set_width, const amrex::Dim3 &dom_lo, const amrex::Dim3 &dom_hi, const amrex::Box &bx_xlo, const amrex::Box &bx_xhi, const amrex::Box &bx_ylo, const amrex::Box &bx_yhi, const amrex::Array4< const amrex::Real > &arr_xlo, const amrex::Array4< const amrex::Real > &arr_xhi, const amrex::Array4< const amrex::Real > &arr_ylo, const amrex::Array4< const amrex::Real > &arr_yhi, const amrex::Array4< const amrex::Real > &data_arr, const amrex::Array4< amrex::Real > &rhs_arr)
Definition: ERF_Utils.H:148
AMREX_GPU_HOST AMREX_FORCE_INLINE void realbdy_compute_laplacian_relaxation(const int &icomp, const int &num_var, const int &width, const int &set_width, const amrex::Dim3 &dom_lo, const amrex::Dim3 &dom_hi, const amrex::Real &F1, const amrex::Real &F2, const amrex::Box &bx_xlo, const amrex::Box &bx_xhi, const amrex::Box &bx_ylo, const amrex::Box &bx_yhi, const amrex::Array4< const amrex::Real > &arr_xlo, const amrex::Array4< const amrex::Real > &arr_xhi, const amrex::Array4< const amrex::Real > &arr_ylo, const amrex::Array4< const amrex::Real > &arr_yhi, const amrex::Array4< const amrex::Real > &data_arr, const amrex::Array4< amrex::Real > &rhs_arr)
Definition: ERF_Utils.H:238
@ U
Definition: ERF_IndexDefines.H:97
@ NumTypes
Definition: ERF_IndexDefines.H:101
@ T
Definition: ERF_IndexDefines.H:99
@ V
Definition: ERF_IndexDefines.H:98
@ xvel
Definition: ERF_IndexDefines.H:130
@ cons
Definition: ERF_IndexDefines.H:129
@ yvel
Definition: ERF_IndexDefines.H:131