aboutsummaryrefslogtreecommitdiff
path: root/Source/Utils
diff options
context:
space:
mode:
Diffstat (limited to 'Source/Utils')
-rw-r--r--Source/Utils/WarpXAlgorithmSelection.H3
-rw-r--r--Source/Utils/WarpXAlgorithmSelection.cpp12
-rw-r--r--Source/Utils/WarpXUtil.cpp19
3 files changed, 21 insertions, 13 deletions
diff --git a/Source/Utils/WarpXAlgorithmSelection.H b/Source/Utils/WarpXAlgorithmSelection.H
index ed3acfeba..c4d2be38a 100644
--- a/Source/Utils/WarpXAlgorithmSelection.H
+++ b/Source/Utils/WarpXAlgorithmSelection.H
@@ -38,7 +38,8 @@ struct MacroscopicSolverAlgo {
struct MaxwellSolverAlgo {
enum {
Yee = 0,
- CKC = 1
+ CKC = 1,
+ PSATD = 2
};
};
diff --git a/Source/Utils/WarpXAlgorithmSelection.cpp b/Source/Utils/WarpXAlgorithmSelection.cpp
index de7944a7f..869f3b462 100644
--- a/Source/Utils/WarpXAlgorithmSelection.cpp
+++ b/Source/Utils/WarpXAlgorithmSelection.cpp
@@ -6,6 +6,7 @@
*
* License: BSD-3-Clause-LBNL
*/
+#include "WarpX.H"
#include "WarpXAlgorithmSelection.H"
#include <algorithm>
@@ -18,9 +19,8 @@
const std::map<std::string, int> maxwell_solver_algo_to_int = {
{"yee", MaxwellSolverAlgo::Yee },
-#ifndef WARPX_DIM_RZ // Not available in RZ
{"ckc", MaxwellSolverAlgo::CKC },
-#endif
+ {"psatd", MaxwellSolverAlgo::PSATD },
{"default", MaxwellSolverAlgo::Yee }
};
@@ -42,11 +42,7 @@ const std::map<std::string, int> current_deposition_algo_to_int = {
{"esirkepov", CurrentDepositionAlgo::Esirkepov },
{"direct", CurrentDepositionAlgo::Direct },
{"vay", CurrentDepositionAlgo::Vay },
-#ifdef WARPX_USE_PSATD
- {"default", CurrentDepositionAlgo::Direct }
-#else
- {"default", CurrentDepositionAlgo::Esirkepov }
-#endif
+ {"default", CurrentDepositionAlgo::Esirkepov } // NOTE: overwritten for PSATD below
};
const std::map<std::string, int> charge_deposition_algo_to_int = {
@@ -97,6 +93,8 @@ GetAlgorithmInteger( amrex::ParmParse& pp, const char* pp_search_key ){
algo_to_int = particle_pusher_algo_to_int;
} else if (0 == std::strcmp(pp_search_key, "current_deposition")) {
algo_to_int = current_deposition_algo_to_int;
+ if (WarpX::maxwell_solver_id == MaxwellSolverAlgo::PSATD)
+ algo_to_int["default"] = CurrentDepositionAlgo::Direct;
} else if (0 == std::strcmp(pp_search_key, "charge_deposition")) {
algo_to_int = charge_deposition_algo_to_int;
} else if (0 == std::strcmp(pp_search_key, "field_gathering")) {
diff --git a/Source/Utils/WarpXUtil.cpp b/Source/Utils/WarpXUtil.cpp
index 7b66b416e..b7a046eb4 100644
--- a/Source/Utils/WarpXUtil.cpp
+++ b/Source/Utils/WarpXUtil.cpp
@@ -5,9 +5,10 @@
*
* License: BSD-3-Clause-LBNL
*/
-#include "WarpXUtil.H"
-#include "WarpXConst.H"
#include "WarpX.H"
+#include "WarpXAlgorithmSelection.H"
+#include "WarpXConst.H"
+#include "WarpXUtil.H"
#include <AMReX_ParmParse.H>
@@ -270,7 +271,17 @@ getWithParser (const amrex::ParmParse& a_pp, char const * const str, amrex::Real
*/
void CheckGriddingForRZSpectral ()
{
-#if (defined WARPX_DIM_RZ) && (defined WARPX_USE_PSATD)
+#ifndef WARPX_DIM_RZ
+ AMREX_ALWAYS_ASSERT_WITH_MESSAGE(false,
+ "CheckGriddingForRZSpectral: WarpX was not built with RZ geometry.");
+#endif
+
+ ParmParse pp("algo");
+ int maxwell_solver_id = GetAlgorithmInteger(pp, "maxwell_solver");
+
+ // only check for PSATD in RZ
+ if (maxwell_solver_id != MaxwellSolverAlgo::PSATD)
+ return;
int max_level;
Vector<int> n_cell(AMREX_SPACEDIM, -1);
@@ -336,8 +347,6 @@ void CheckGriddingForRZSpectral ()
mg[0] /= 2;
}
pp_amr.addarr("max_grid_size_y", mg);
-
-#endif
}
namespace WarpXUtilMsg{