| 8 | using namespace amrex; |
| 9 | |
| 10 | void ca_statefill(Box const& bx, FArrayBox& data, |
| 11 | const int dcomp, const int numcomp, |
| 12 | Geometry const& geom, const Real time, |
| 13 | const Vector<BCRec>& bcr, const int bcomp, |
| 14 | const int scomp) |
| 15 | { |
| 16 | // Here dcomp is the component in the destination array that we |
| 17 | // are filling and bcr is a vector of length ncomp which are the |
| 18 | // BC values corresponding to components dcomp to dcomp + ncomp - |
| 19 | // 1 |
| 20 | |
| 21 | // First, fill all the BC data using the default routines. |
| 22 | // We replace inflow with outflow in the generic fill to ensure that |
| 23 | // valid data is always present. |
| 24 | |
| 25 | Vector<BCRec> bcr_noinflow{bcr}; |
| 26 | for (auto & bc : bcr_noinflow) { |
| 27 | for (int dir = 0; dir < AMREX_SPACEDIM; ++dir) { |
| 28 | if (bc.lo(dir) == amrex::BCType::ext_dir) { |
| 29 | bc.setLo(dir, amrex::BCType::foextrap); |
| 30 | } |
| 31 | if (bc.hi(dir) == amrex::BCType::ext_dir) { |
| 32 | bc.setHi(dir, amrex::BCType::foextrap); |
| 33 | } |
| 34 | } |
| 35 | } |
| 36 | |
| 37 | GpuBndryFuncFab<CastroGenericFill> gpu_bndry_func(CastroGenericFill{}); |
| 38 | gpu_bndry_func(bx, data, dcomp, numcomp, geom, time, bcr_noinflow, bcomp, scomp); |
| 39 | |
| 40 | // At this point, if we filling anything other than the full state (numcomp == NUM_STATE), |
| 41 | // we assume that we are doing a derive or some other routine which is not actually setting |
| 42 | // boundary conditions on the state data. So we immediately return. This means that the derive |
| 43 | // data may not be exactly what the user wants at the physical boundary, but the impact of that |
| 44 | // is usually negligible. |
| 45 | |
| 46 | if (numcomp != NUM_STATE) { |
| 47 | return; |
| 48 | } |
| 49 | |
| 50 | // Fill ambient BCs. |
| 51 | |
| 52 | ambient_fill(bx, data.array(dcomp), geom, bcr); |
| 53 | |
| 54 | // Now we consider external BCs (HSE). Note, if we are at a |
| 55 | // corner where two (or three) faces want to do HSE, we may run |
| 56 | // into a situation that the data is not valid in the corner where |
| 57 | // we start the integration. We'll abort, for now, if we run into |
| 58 | // this case. |
| 59 | // |
| 60 | // The future fix is to first call ext_fill on the ghost cells |
| 61 | // that are not corners and then call it a second time on just the |
| 62 | // corners. |
| 63 | |
| 64 | #if AMREX_SPACEDIM == 2 |
| 65 | if ((bcr[URHO].lo(0) == amrex::BCType::ext_dir && bcr[URHO].lo(1) == amrex::BCType::ext_dir) || |
| 66 | (bcr[URHO].lo(0) == amrex::BCType::ext_dir && bcr[URHO].hi(1) == amrex::BCType::ext_dir) || |
| 67 | (bcr[URHO].hi(0) == amrex::BCType::ext_dir && bcr[URHO].lo(1) == amrex::BCType::ext_dir) || |
nothing calls this directly
no test coverage detected