27 ParmParse pp_erf(
"erf");
30 pp.add(
"refine_grid_layout_x",1);
31 pp.add(
"refine_grid_layout_y",1);
32 pp.add(
"refine_grid_layout_z",0);
42 int max_grid_size = 2048;
43 pp.queryAdd(
"max_grid_size",max_grid_size);
47 int blocking_factor = 1;
48 pp.queryAdd(
"blocking_factor",blocking_factor);
51 pp.queryAdd(
"n_error_buf",n_error_buf);
53 amrex::Vector<int> legacy_n_cell;
54 amrex::Vector<int> erf_n_cell;
55 const bool has_legacy_n_cell =
pp.queryarr(
"n_cell", legacy_n_cell);
56 const bool has_erf_n_cell = pp_erf.queryarr(
"n_cell", erf_n_cell);
57 if (has_erf_n_cell && has_legacy_n_cell) {
58 amrex::Abort(
"erf.n_cell and amr.n_cell are both specified. Please use only one!");
61 pp.addarr(
"n_cell", erf_n_cell);
64 ParmParse pp_geometry(
"geometry");
65 amrex::Vector<amrex::Real> legacy_prob_lo;
66 amrex::Vector<amrex::Real> legacy_prob_hi;
67 amrex::Vector<amrex::Real> legacy_prob_extent;
68 amrex::Vector<int> legacy_is_periodic;
69 amrex::Vector<amrex::Real> erf_prob_lo;
70 amrex::Vector<amrex::Real> erf_prob_hi;
71 amrex::Vector<amrex::Real> erf_prob_extent;
72 amrex::Vector<int> erf_is_periodic;
74 const bool has_legacy_prob_lo = pp_geometry.queryarr(
"prob_lo", legacy_prob_lo);
75 const bool has_legacy_prob_hi = pp_geometry.queryarr(
"prob_hi", legacy_prob_hi);
76 const bool has_legacy_prob_extent = pp_geometry.queryarr(
"prob_extent", legacy_prob_extent);
77 const bool has_legacy_is_periodic = pp_geometry.queryarr(
"is_periodic", legacy_is_periodic);
79 const bool has_erf_prob_lo = pp_erf.queryarr(
"prob_lo", erf_prob_lo);
80 const bool has_erf_prob_hi = pp_erf.queryarr(
"prob_hi", erf_prob_hi);
81 const bool has_erf_prob_extent = pp_erf.queryarr(
"prob_extent", erf_prob_extent);
82 const bool has_erf_is_periodic = pp_erf.queryarr(
"is_periodic", erf_is_periodic);
84 if (has_erf_prob_lo && has_legacy_prob_lo) {
85 amrex::Abort(
"erf.prob_lo and geometry.prob_lo are both specified. Please use only one!");
87 if ((has_erf_prob_hi || has_erf_prob_extent) && !has_erf_prob_lo) {
88 amrex::Abort(
"ERF prefixed geometry requires erf.prob_lo together with erf.prob_hi or erf.prob_extent.");
90 if (has_erf_is_periodic && has_legacy_is_periodic) {
91 amrex::Abort(
"erf.is_periodic and geometry.is_periodic are both specified. Please use only one!");
93 if (has_erf_prob_hi && has_legacy_prob_hi) {
94 amrex::Abort(
"erf.prob_hi and geometry.prob_hi are both specified. Please use only one!");
96 if (has_erf_prob_extent && has_legacy_prob_extent) {
97 amrex::Abort(
"erf.prob_extent and geometry.prob_extent are both specified. Please use only one!");
99 if (has_erf_prob_hi || has_erf_prob_extent) {
100 if (has_legacy_prob_hi || has_legacy_prob_extent) {
101 amrex::Abort(
"ERF prefixed geometry and legacy geometry.prob_hi/prob_extent are both specified. Please use only one form.");
104 if (has_erf_prob_hi && has_erf_prob_extent) {
105 amrex::Vector<amrex::Real> derived_prob_hi(erf_prob_extent.size(), 0.0);
106 for (
int i = 0; i < static_cast<int>(erf_prob_extent.size()); ++i) {
107 derived_prob_hi[i] = (i < static_cast<int>(erf_prob_lo.size()) ? erf_prob_lo[i] : 0.0) + erf_prob_extent[i];
109 AMREX_ALWAYS_ASSERT_WITH_MESSAGE(
110 derived_prob_hi.size() == erf_prob_hi.size(),
111 "erf.prob_hi and erf.prob_extent have inconsistent lengths.");
112 for (
int i = 0; i < static_cast<int>(erf_prob_hi.size()); ++i) {
113 if (derived_prob_hi[i] != erf_prob_hi[i]) {
114 amrex::Abort(
"erf.prob_hi and erf.prob_extent are both specified but inconsistent.");
119 if (has_erf_prob_lo) {
120 pp_geometry.addarr(
"prob_lo", erf_prob_lo);
122 if (has_erf_prob_hi) {
123 pp_geometry.addarr(
"prob_hi", erf_prob_hi);
124 }
else if (has_erf_prob_extent) {
125 amrex::Vector<amrex::Real> derived_prob_hi(erf_prob_extent.size(), 0.0);
126 for (
int i = 0; i < static_cast<int>(erf_prob_extent.size()); ++i) {
127 derived_prob_hi[i] = (i < static_cast<int>(erf_prob_lo.size()) ? erf_prob_lo[i] : 0.0) + erf_prob_extent[i];
129 pp_geometry.addarr(
"prob_hi", derived_prob_hi);
131 if (has_erf_is_periodic) {
132 pp_geometry.addarr(
"is_periodic", erf_is_periodic);