35 bool space_charge =
false;
36 pp_algo.
queryAdd(
"space_charge", space_charge);
39 pp_amr.
query(
"max_level", max_level);
41 if (max_level > 1 && !space_charge)
42 throw std::runtime_error(
43 "Mesh-refinement (amr.max_level>=0) is only supported with "
44 "space charge modeling (algo.space_charge=1).");
48 prob_relative[0] = 3.0;
49 pp_geometry.
queryarr(
"prob_relative", prob_relative);
51 if (prob_relative[0] < 3.0 && space_charge)
53 "ImpactX::read_mr_prob_relative",
54 "Dynamic resizing of the mesh uses a geometry.prob_relative "
55 "padding of less than 3 for level 0. This might result in boundary "
56 "artifacts for space charge calculation. "
57 "There is no minimum good value for this parameter, consider "
58 "doing a convergence test.",
62 if (prob_relative[0] < 1.0)
63 throw std::runtime_error(
"geometry.prob_relative must be >= 1.0 (the beam size) on the coarsest level");
66 amrex::Real last_lev_rel = std::numeric_limits<amrex::Real>::max();
67 for (
int lev = 0; lev <= max_level; ++lev) {
68 amrex::Real
const prob_relative_lvl = prob_relative[lev];
69 if (prob_relative_lvl <= 0.0)
70 throw std::runtime_error(
"geometry.prob_relative must be strictly positive for all levels");
71 if (prob_relative_lvl > last_lev_rel)
72 throw std::runtime_error(
"geometry.prob_relative must be descending over refinement levels");
74 last_lev_rel = prob_relative_lvl;
int queryarr(const char *name, std::vector< int > &ref, int start_ix=FIRST, int num_val=ALL) const
int queryAdd(const char *name, T &ref)
int query(const char *name, bool &ref, int ival=FIRST) const
void WMRecordWarning(const std::string &topic, const std::string &text, const WarnPriority &priority=WarnPriority::medium)
Definition: AmrCoreData.cpp:18
amrex::Vector< amrex::Real > read_mr_prob_relative()
Definition: InitMeshRefinement.H:29