|
| 1 | +#include "ImplicitSolver.H" |
| 2 | +#include "WarpX.H" |
| 3 | + |
| 4 | +using namespace amrex; |
| 5 | + |
| 6 | +const Geometry& ImplicitSolver::GetGeometry (const int a_lvl) const |
| 7 | +{ |
| 8 | + AMREX_ASSERT((a_lvl >= 0) && (a_lvl < m_num_amr_levels)); |
| 9 | + return m_WarpX->Geom(a_lvl); |
| 10 | +} |
| 11 | + |
| 12 | +const Array<FieldBoundaryType,AMREX_SPACEDIM>& ImplicitSolver::GetFieldBoundaryLo () const |
| 13 | +{ |
| 14 | + return m_WarpX->GetFieldBoundaryLo(); |
| 15 | +} |
| 16 | + |
| 17 | +const Array<FieldBoundaryType,AMREX_SPACEDIM>& ImplicitSolver::GetFieldBoundaryHi () const |
| 18 | +{ |
| 19 | + return m_WarpX->GetFieldBoundaryHi(); |
| 20 | +} |
| 21 | + |
| 22 | +Array<LinOpBCType,AMREX_SPACEDIM> ImplicitSolver::GetLinOpBCLo () const |
| 23 | +{ |
| 24 | + return convertFieldBCToLinOpBC(m_WarpX->GetFieldBoundaryLo()); |
| 25 | +} |
| 26 | + |
| 27 | +Array<LinOpBCType,AMREX_SPACEDIM> ImplicitSolver::GetLinOpBCHi () const |
| 28 | +{ |
| 29 | + return convertFieldBCToLinOpBC(m_WarpX->GetFieldBoundaryHi()); |
| 30 | +} |
| 31 | + |
| 32 | +Array<LinOpBCType,AMREX_SPACEDIM> ImplicitSolver::convertFieldBCToLinOpBC (const Array<FieldBoundaryType,AMREX_SPACEDIM>& a_fbc) const |
| 33 | +{ |
| 34 | + Array<LinOpBCType, AMREX_SPACEDIM> lbc; |
| 35 | + for (auto& bc : lbc) { bc = LinOpBCType::interior; } |
| 36 | + for (int i = 0; i < AMREX_SPACEDIM; i++) { |
| 37 | + if (a_fbc[i] == FieldBoundaryType::PML) { |
| 38 | + WARPX_ABORT_WITH_MESSAGE("LinOpBCType not set for this FieldBoundaryType"); |
| 39 | + } else if (a_fbc[i] == FieldBoundaryType::Periodic) { |
| 40 | + lbc[i] = LinOpBCType::Periodic; |
| 41 | + } else if (a_fbc[i] == FieldBoundaryType::PEC) { |
| 42 | + WARPX_ABORT_WITH_MESSAGE("LinOpBCType not set for this FieldBoundaryType"); |
| 43 | + } else if (a_fbc[i] == FieldBoundaryType::PMC) { |
| 44 | + WARPX_ABORT_WITH_MESSAGE("LinOpBCType not set for this FieldBoundaryType"); |
| 45 | + } else if (a_fbc[i] == FieldBoundaryType::Damped) { |
| 46 | + WARPX_ABORT_WITH_MESSAGE("LinOpBCType not set for this FieldBoundaryType"); |
| 47 | + } else if (a_fbc[i] == FieldBoundaryType::Absorbing_SilverMueller) { |
| 48 | + WARPX_ABORT_WITH_MESSAGE("LinOpBCType not set for this FieldBoundaryType"); |
| 49 | + } else if (a_fbc[i] == FieldBoundaryType::Neumann) { |
| 50 | + lbc[i] = LinOpBCType::Neumann; |
| 51 | + } else if (a_fbc[i] == FieldBoundaryType::None) { |
| 52 | + WARPX_ABORT_WITH_MESSAGE("LinOpBCType not set for this FieldBoundaryType"); |
| 53 | + } else if (a_fbc[i] == FieldBoundaryType::Open) { |
| 54 | + WARPX_ABORT_WITH_MESSAGE("LinOpBCType not set for this FieldBoundaryType"); |
| 55 | + } else { |
| 56 | + WARPX_ABORT_WITH_MESSAGE("Invalid value for FieldBoundaryType"); |
| 57 | + } |
| 58 | + } |
| 59 | + return lbc; |
| 60 | +} |
0 commit comments