diff options
Diffstat (limited to '')
-rw-r--r-- | Source/FieldSolver/ElectrostaticSolver.cpp | 28 | ||||
-rw-r--r-- | Source/Utils/WarpXAlgorithmSelection.H | 3 | ||||
-rw-r--r-- | Source/Utils/WarpXAlgorithmSelection.cpp | 1 |
3 files changed, 20 insertions, 12 deletions
diff --git a/Source/FieldSolver/ElectrostaticSolver.cpp b/Source/FieldSolver/ElectrostaticSolver.cpp index 64158d3a1..103fff131 100644 --- a/Source/FieldSolver/ElectrostaticSolver.cpp +++ b/Source/FieldSolver/ElectrostaticSolver.cpp @@ -711,12 +711,12 @@ WarpX::computePhiTriDiagonal (const amrex::Vector<std::unique_ptr<amrex::MultiFa auto field_boundary_lo0 = WarpX::field_boundary_lo[0]; auto field_boundary_hi0 = WarpX::field_boundary_hi[0]; - if (field_boundary_lo0 == FieldBoundaryType::None || field_boundary_lo0 == FieldBoundaryType::Periodic) { + if (field_boundary_lo0 == FieldBoundaryType::Neumann || field_boundary_lo0 == FieldBoundaryType::Periodic) { // Neumann or periodic boundary condition // Solve for the point on the lower boundary nx_solve_min = 0; } - if (field_boundary_hi0 == FieldBoundaryType::None || field_boundary_hi0 == FieldBoundaryType::Periodic) { + if (field_boundary_hi0 == FieldBoundaryType::Neumann || field_boundary_hi0 == FieldBoundaryType::Periodic) { // Neumann or periodic boundary condition // Solve for the point on the upper boundary nx_solve_max = nx_full_domain; @@ -766,7 +766,7 @@ WarpX::computePhiTriDiagonal (const amrex::Vector<std::unique_ptr<amrex::MultiFa phi1d_arr(1,0,0) = (phi1d_arr(0,0,0) + rho1d_arr(1,0,0))/diag; - } else if (field_boundary_lo0 == FieldBoundaryType::None) { + } else if (field_boundary_lo0 == FieldBoundaryType::Neumann) { // Neumann boundary condition phi1d_arr(0,0,0) = rho1d_arr(0,0,0)/diag; @@ -803,7 +803,7 @@ WarpX::computePhiTriDiagonal (const amrex::Vector<std::unique_ptr<amrex::MultiFa diag = 2._rt - zwork1d_arr(imax,0,0); phi1d_arr(imax,0,0) = (phi1d_arr(imax+1,0,0) + rho1d_arr(imax,0,0) - (-1._rt)*phi1d_arr(imax-1,0,0))/diag; - } else if (field_boundary_hi0 == FieldBoundaryType::None) { + } else if (field_boundary_hi0 == FieldBoundaryType::Neumann) { // Neumann boundary condition zwork1d_arr(imax,0,0) = 1._rt/diag; @@ -851,13 +851,13 @@ WarpX::computePhiTriDiagonal (const amrex::Vector<std::unique_ptr<amrex::MultiFa // The periodic case is handled in the ParallelCopy below if (field_boundary_lo0 == FieldBoundaryType::PEC) { phi1d_arr(-1,0,0) = phi1d_arr(0,0,0); - } else if (field_boundary_lo0 == FieldBoundaryType::None) { + } else if (field_boundary_lo0 == FieldBoundaryType::Neumann) { phi1d_arr(-1,0,0) = phi1d_arr(1,0,0); } if (field_boundary_hi0 == FieldBoundaryType::PEC) { phi1d_arr(nx_full_domain+1,0,0) = phi1d_arr(nx_full_domain,0,0); - } else if (field_boundary_hi0 == FieldBoundaryType::None) { + } else if (field_boundary_hi0 == FieldBoundaryType::Neumann) { phi1d_arr(nx_full_domain+1,0,0) = phi1d_arr(nx_full_domain-1,0,0); } @@ -885,10 +885,16 @@ void ElectrostaticSolver::PoissonBoundaryHandler::definePhiBCs ( ) hibc[0] = LinOpBCType::Dirichlet; dirichlet_flag[1] = true; } - else if (WarpX::field_boundary_hi[0] == FieldBoundaryType::None) { + else if (WarpX::field_boundary_hi[0] == FieldBoundaryType::Neumann) { hibc[0] = LinOpBCType::Neumann; dirichlet_flag[1] = false; } + else { + WARPX_ALWAYS_ASSERT_WITH_MESSAGE(false, + "Field boundary condition at the outer radius must be either PEC or neumann " + "when using the electrostatic solver" + ); + } } #endif for (int idim=dim_start; idim<AMREX_SPACEDIM; idim++){ @@ -905,13 +911,13 @@ void ElectrostaticSolver::PoissonBoundaryHandler::definePhiBCs ( ) lobc[idim] = LinOpBCType::Dirichlet; dirichlet_flag[idim*2] = true; } - else if ( WarpX::field_boundary_lo[idim] == FieldBoundaryType::None ) { + else if ( WarpX::field_boundary_lo[idim] == FieldBoundaryType::Neumann ) { lobc[idim] = LinOpBCType::Neumann; dirichlet_flag[idim*2] = false; } else { WARPX_ALWAYS_ASSERT_WITH_MESSAGE(false, - "Field boundary conditions have to be either periodic, PEC or none " + "Field boundary conditions have to be either periodic, PEC or neumann " "when using the electrostatic solver" ); } @@ -920,13 +926,13 @@ void ElectrostaticSolver::PoissonBoundaryHandler::definePhiBCs ( ) hibc[idim] = LinOpBCType::Dirichlet; dirichlet_flag[idim*2+1] = true; } - else if ( WarpX::field_boundary_hi[idim] == FieldBoundaryType::None ) { + else if ( WarpX::field_boundary_hi[idim] == FieldBoundaryType::Neumann ) { hibc[idim] = LinOpBCType::Neumann; dirichlet_flag[idim*2+1] = false; } else { WARPX_ALWAYS_ASSERT_WITH_MESSAGE(false, - "Field boundary conditions have to be either periodic, PEC or none " + "Field boundary conditions have to be either periodic, PEC or neumann " "when using the electrostatic solver" ); } diff --git a/Source/Utils/WarpXAlgorithmSelection.H b/Source/Utils/WarpXAlgorithmSelection.H index 97dd3b89f..9346159ab 100644 --- a/Source/Utils/WarpXAlgorithmSelection.H +++ b/Source/Utils/WarpXAlgorithmSelection.H @@ -119,7 +119,8 @@ struct FieldBoundaryType { Damped = 4, // Fields in the guard cells are damped for PSATD //in the moving window direction Absorbing_SilverMueller = 5, // Silver-Mueller boundary condition - None = 6 // The fields values at the boundary are not updated. This is + Neumann = 6, // For electrostatic, the normal E is set to zero + None = 7 // The fields values at the boundary are not updated. This is // useful for RZ simulations, at r=0. }; }; diff --git a/Source/Utils/WarpXAlgorithmSelection.cpp b/Source/Utils/WarpXAlgorithmSelection.cpp index 088d5322f..1272c146a 100644 --- a/Source/Utils/WarpXAlgorithmSelection.cpp +++ b/Source/Utils/WarpXAlgorithmSelection.cpp @@ -100,6 +100,7 @@ const std::map<std::string, int> FieldBCType_algo_to_int = { {"pmc", FieldBoundaryType::PMC}, {"damped", FieldBoundaryType::Damped}, {"absorbing_silver_mueller", FieldBoundaryType::Absorbing_SilverMueller}, + {"neumann", FieldBoundaryType::Neumann}, {"none", FieldBoundaryType::None}, {"default", FieldBoundaryType::PML} }; |