| 4 | using namespace amrex; |
| 5 | |
| 6 | void |
| 7 | apply_metric(const Box& bx, |
| 8 | Array4<Real> const& rhs, const Box& rbx, |
| 9 | Array4<Real> const& ecx, const Box& xbx, |
| 10 | #if AMREX_SPACEDIM >= 2 |
| 11 | Array4<Real> const& ecy, const Box& ybx, |
| 12 | #endif |
| 13 | const GpuArray<Real, AMREX_SPACEDIM>& problo, |
| 14 | const GpuArray<Real, AMREX_SPACEDIM>& dx, |
| 15 | const int coord_type) |
| 16 | { |
| 17 | // r-z |
| 18 | if (coord_type == 1) { |
| 19 | |
| 20 | amrex::ParallelFor(bx, |
| 21 | [=] AMREX_GPU_DEVICE (int i, int j, int k) noexcept |
| 22 | { |
| 23 | |
| 24 | IntVect idx(AMREX_D_DECL(i, j, k)); |
| 25 | |
| 26 | // at centers |
| 27 | if (rbx.contains(idx)) { |
| 28 | Real r = problo[0] + (static_cast<Real>(i) + 0.5_rt) * dx[0]; |
| 29 | rhs(i,j,k) *= r; |
| 30 | } |
| 31 | |
| 32 | // On x-edges |
| 33 | if (xbx.contains(idx)) { |
| 34 | Real r = problo[0] + static_cast<Real>(i) * dx[0]; |
| 35 | ecx(i,j,k) *= r; |
| 36 | } |
| 37 | |
| 38 | #if AMREX_SPACEDIM >= 2 |
| 39 | // On y-edges |
| 40 | if (ybx.contains(idx)) { |
| 41 | Real r = problo[0] + (static_cast<Real>(i) + 0.5_rt) * dx[0]; |
| 42 | ecy(i,j,k) *= r; |
| 43 | } |
| 44 | #endif |
| 45 | |
| 46 | }); |
| 47 | |
| 48 | } else { |
| 49 | amrex::Print() << "Bogus coord_type in apply_metric " << coord_type << std::endl; |
| 50 | amrex::Error("Error:: MGutils.cpp :: ca_apply_metric"); |
| 51 | } |
| 52 | } |