Skip to content

Commit 5704f33

Browse files
committed
[Ramses][AMR] Added more amr modes
1 parent f9423cc commit 5704f33

2 files changed

Lines changed: 82 additions & 1 deletion

File tree

src/shammodels/ramses/include/shammodels/ramses/SolverConfig.hpp

Lines changed: 44 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,12 +126,55 @@ namespace shammodels::basegodunov {
126126
Tscal crit_mass;
127127
};
128128

129-
using mode = std::variant<None, DensityBased>;
129+
struct PseudoGradientBased {
130+
Tscal error_min;
131+
Tscal error_max;
132+
};
133+
134+
struct SecondDerivativeBased {
135+
Tscal crit_refine;
136+
Tscal crit_coarsen;
137+
};
138+
139+
struct SlopeBased {
140+
Tscal smooth_detector_threshold;
141+
};
142+
143+
struct ShocksBased {
144+
Tscal pressure_threshold;
145+
Tscal energy_threshold;
146+
};
147+
148+
struct ShearBased {
149+
Tscal epsilon_shear;
150+
};
151+
152+
using mode = std::variant<
153+
None,
154+
DensityBased,
155+
PseudoGradientBased,
156+
SecondDerivativeBased,
157+
SlopeBased,
158+
ShocksBased,
159+
ShearBased>;
130160

131161
mode config = None{};
132162

133163
void set_refine_none() { config = None{}; }
134164
void set_refine_density_based(Tscal crit_mass) { config = DensityBased{crit_mass}; }
165+
void set_refine_pseudo_gradient_based(Tscal error_min, Tscal error_max) {
166+
config = PseudoGradientBased{error_min, error_max};
167+
}
168+
void set_refine_second_derivative_based(Tscal crit_refine, Tscal crit_coarsen) {
169+
config = SecondDerivativeBased{crit_refine, crit_coarsen};
170+
}
171+
void set_refine_slope_based(Tscal smooth_detector_threshold) {
172+
config = SlopeBased{smooth_detector_threshold};
173+
}
174+
void set_refine_shocks_based(Tscal pressure_threshold, Tscal energy_threshold) {
175+
config = ShocksBased{pressure_threshold, energy_threshold};
176+
}
177+
void set_refine_shear_based(Tscal epsilon_shear) { config = ShearBased{epsilon_shear}; }
135178
};
136179

137180
struct BCConfig {

src/shammodels/ramses/src/pyRamsesModel.cpp

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,44 @@ namespace shammodels::basegodunov {
185185
},
186186
py::kw_only(),
187187
py::arg("crit_mass"))
188+
.def(
189+
"set_amr_mode_pseudo_gradient_based",
190+
[](TConfig &self, Tscal error_min, Tscal error_max) {
191+
self.amr_mode.set_refine_pseudo_gradient_based(error_min, error_max);
192+
},
193+
py::kw_only(),
194+
py::arg("error_min"),
195+
py::arg("error_max"))
196+
.def(
197+
"set_amr_mode_pseudo_second_gradient_based",
198+
[](TConfig &self, Tscal crit_refine, Tscal crit_coarsen) {
199+
self.amr_mode.set_refine_second_derivative_based(crit_refine, crit_coarsen);
200+
},
201+
py::kw_only(),
202+
py::arg("crit_refine"),
203+
py::arg("crit_coarsen"))
204+
.def(
205+
"set_amr_mode_slope_based",
206+
[](TConfig &self, Tscal crit_smooth) {
207+
self.amr_mode.set_refine_slope_based(crit_smooth);
208+
},
209+
py::kw_only(),
210+
py::arg("crit_smooth"))
211+
.def(
212+
"set_amr_mode_shocks_based",
213+
[](TConfig &self, Tscal crit_pressure, Tscal crit_energy) {
214+
self.amr_mode.set_refine_shocks_based(crit_pressure, crit_energy);
215+
},
216+
py::kw_only(),
217+
py::arg("crit_pressure"),
218+
py::arg("crit_energy"))
219+
.def(
220+
"set_amr_mode_shear_based",
221+
[](TConfig &self, Tscal epsilon_shear) {
222+
self.amr_mode.set_refine_shear_based(epsilon_shear);
223+
},
224+
py::kw_only(),
225+
py::arg("epsilon_shear"))
188226
.def(
189227
"set_gravity_mode_no_gravity",
190228
[](TConfig &self) {

0 commit comments

Comments
 (0)