1 #ifndef ERF_SBM_REMAPPING_H_
2 #define ERF_SBM_REMAPPING_H_
6 #include <AMReX_Algorithm.H>
7 #include <AMReX_Array4.H>
8 #include <AMReX_GpuQualifiers.H>
9 #include <AMReX_Math.H>
10 #include <AMReX_REAL.H>
44 [[nodiscard]] PopulationRemapView
52 AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
55 if (population.population_id < 0 ||
59 population.nbins <= 0 || population.edges ==
nullptr ||
60 population.state_components < population.nbins || population.mass_offset < 0 ||
61 population.property_count < 0 ||
62 population.property_count > population.state_components / population.nbins ||
63 (population.property_count > 0 && population.property_component_offsets ==
nullptr)) {
66 if (population.mass_offset > population.state_components - population.nbins)
return false;
68 if (population.number_offset != -1 || population.pivots ==
nullptr)
return false;
69 }
else if (population.number_offset < 0 ||
70 population.number_offset > population.state_components - population.nbins) {
74 population.number_offset < population.mass_offset + population.nbins &&
75 population.mass_offset < population.number_offset + population.nbins) {
82 AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
86 for (
int edge = 0; edge <= population.nbins; ++edge) {
88 if (!amrex::Math::isfinite(value) || value <
amrex::Real(0.0) ||
89 (edge > 0 && !(population.edges[edge - 1] < value))) {
94 for (
int bin = 0; bin < population.nbins; ++bin) {
96 if (!amrex::Math::isfinite(pivot) || pivot <=
amrex::Real(0.0) ||
97 pivot < population.edges[bin] || pivot > population.edges[bin + 1] ||
98 (bin > 0 && !(population.pivots[bin - 1] < pivot))) {
103 for (
int property = 0;
property < population.property_count; ++property) {
104 const int offset = population.property_component_offsets[property];
105 if (offset < 0 || offset > population.state_components - population.nbins ||
106 (
offset < population.mass_offset + population.nbins &&
107 population.mass_offset <
offset + population.nbins)) {
111 offset < population.number_offset + population.nbins &&
112 population.number_offset <
offset + population.nbins) {
115 for (
int previous = 0; previous < property; ++previous) {
116 const int previous_offset = population.property_component_offsets[previous];
117 if (
offset < previous_offset + population.nbins &&
118 previous_offset <
offset + population.nbins) {
126 AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
130 return left.population_id == right.population_id &&
131 left.moment_mode == right.moment_mode &&
132 left.coordinate_kind == right.coordinate_kind &&
133 left.edges == right.edges && left.pivots == right.pivots &&
134 left.nbins == right.nbins && left.mass_offset == right.mass_offset &&
135 left.number_offset == right.number_offset &&
136 left.state_components == right.state_components &&
137 left.property_component_offsets == right.property_component_offsets &&
138 left.property_count == right.property_count;
159 namespace remap_detail {
164 AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
167 return amrex::Math::isfinite(value) && value >=
amrex::Real(0.0);
170 AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
175 result = left * right;
182 AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
189 result = numerator / denominator;
197 AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
204 AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
211 AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
219 AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
221 const bool lower_boundary) noexcept
224 -std::numeric_limits<amrex::Real>::infinity() :
225 std::numeric_limits<amrex::Real>::infinity();
227 for (
int step = 0; step < 4; ++step) {
228 allowance = std::nextafter(allowance, direction);
230 return lower_boundary ? value >= allowance : value <= allowance;
234 AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
240 !amrex::Math::isfinite(plan.packet_number) ||
241 !amrex::Math::isfinite(plan.packet_particle_mass) ||
243 plan.destination_count < 0 || plan.destination_count > 2 ||
245 plan.residual_number_weight >
amrex::Real(1.0))
return false;
248 return plan.status ==
RemapStatus::Ok && plan.destination_count == 0 &&
250 !plan.normalized_roundoff;
254 if (plan.packet_particle_mass ==
amrex::Real(0.0)) {
256 plan.destination_count == 0 &&
258 !plan.normalized_roundoff;
261 const amrex::Real top = population.edges[population.nbins];
262 int required_bin = -1;
263 amrex::Real expected_mass = plan.packet_particle_mass;
264 bool normalized =
false;
265 if (plan.packet_particle_mass < lower) {
268 expected_mass = lower;
270 }
else if (plan.packet_particle_mass > top) {
272 required_bin = population.nbins - 1;
278 plan.normalized_roundoff != normalized)
return false;
279 const auto& route = plan.destinations[0];
280 return (required_bin < 0 || route.bin == required_bin) &&
282 route.particle_mass == expected_mass && route.bin >= 0 &&
283 route.bin < population.nbins && expected_mass >= population.edges[route.bin] &&
284 (expected_mass < population.edges[route.bin + 1] ||
285 (route.bin == population.nbins - 1 &&
286 expected_mass <= population.edges[route.bin + 1]));
290 const amrex::Real last = population.pivots[population.nbins - 1];
291 if (plan.packet_particle_mass ==
amrex::Real(0.0)) {
293 plan.destination_count == 0 &&
295 !plan.normalized_roundoff;
297 if (plan.packet_particle_mass < first) {
302 plan.destination_count == 1 && plan.residual_number_weight ==
303 amrex::Real(1.0) - wet_weight && plan.destinations[0].bin == 0 &&
304 plan.destinations[0].number_weight == wet_weight &&
305 plan.destinations[0].particle_mass == first;
310 if (plan.destination_count == 1) {
311 const int pivot_bin = plan.destinations[0].bin;
312 if (pivot_bin < 0 || pivot_bin >= population.nbins)
return false;
314 plan.destination_count == 1 && plan.residual_number_weight ==
amrex::Real(0.0) &&
315 plan.packet_particle_mass == population.pivots[pivot_bin] &&
316 plan.destinations[0].bin == pivot_bin &&
317 plan.destinations[0].number_weight ==
amrex::Real(1.0) &&
318 plan.destinations[0].particle_mass == population.pivots[pivot_bin];
320 if (plan.destination_count != 2)
return false;
321 const int lower_bin = plan.destinations[0].bin;
322 if (lower_bin < 0 || lower_bin + 1 >= population.nbins ||
323 plan.destinations[1].bin != lower_bin + 1)
return false;
324 const amrex::Real lower = population.pivots[lower_bin];
325 const amrex::Real upper = population.pivots[lower_bin + 1];
326 if (!(plan.packet_particle_mass > lower && plan.packet_particle_mass < upper))
return false;
330 if (
checked_quotient(upper - plan.packet_particle_mass, width, lower_weight) !=
335 plan.destination_count == 2 && plan.residual_number_weight ==
amrex::Real(0.0) &&
336 plan.destinations[0].bin == lower_bin &&
337 plan.destinations[0].number_weight == lower_weight &&
338 plan.destinations[0].particle_mass == lower &&
339 plan.destinations[1].bin == lower_bin + 1 &&
340 plan.destinations[1].number_weight == upper_weight &&
341 plan.destinations[1].particle_mass == upper;
344 AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
357 const amrex::Real upper = population.edges[bin + 1];
358 return amrex::Math::isfinite(mean) && mean >= lower &&
359 (mean < upper || (bin == population.nbins - 1 && mean <= upper));
369 AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
377 template <
typename StateView>
378 AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
380 const int bin,
const StateView& state,
381 const int state_count) noexcept
384 state_count != population.state_components || bin < 0 || bin >= population.nbins ||
386 const amrex::Real mass = state[population.mass_offset + bin];
387 const amrex::Real number = state[population.number_offset + bin];
390 for (
int property = 0;
property < population.property_count; ++property) {
391 if (state[population.property_component_offsets[property] + bin] !=
amrex::Real(0.0)) {
396 for (
int property = 0;
property < population.property_count; ++property) {
397 const amrex::Real amount = state[population.property_component_offsets[property] + bin];
406 AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
409 const int state_count) noexcept
411 if (state ==
nullptr)
return false;
415 AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
419 const int state_count) noexcept
425 template <
typename StateView>
426 AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
428 const int bin,
const StateView& state,
429 const int state_count) noexcept
432 state_count != population.state_components || bin < 0 || bin >= population.nbins ||
434 const amrex::Real mass = state[population.mass_offset + bin];
440 for (
int property = 0;
property < population.property_count; ++property) {
441 const amrex::Real amount = state[population.property_component_offsets[property] + bin];
455 AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
458 const int state_count) noexcept
460 if (state ==
nullptr)
return false;
464 AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
468 const int state_count) noexcept
474 AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
477 const int state_count) noexcept
484 AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
488 const int state_count) noexcept
506 AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
516 !amrex::Math::isfinite(packet_number) || !amrex::Math::isfinite(particle_mass) ||
533 if (particle_mass < population.edges[0]) {
535 particle_mass, population.edges[0],
true)) {
545 if (particle_mass > population.edges[population.nbins]) {
547 particle_mass, population.edges[population.nbins],
false)) {
554 population.edges[population.nbins]};
558 const int bin = particle_mass == population.edges[population.nbins] ?
559 population.nbins - 1 :
560 amrex::bisect(population.edges, 0, population.nbins, particle_mass);
572 if (particle_mass < population.pivots[0]) {
575 particle_mass, population.pivots[0], wet_weight);
582 plan.
destinations[0] = {0, wet_weight, population.pivots[0]};
586 if (particle_mass > population.pivots[population.nbins - 1]) {
590 const int lower_bin = particle_mass == population.pivots[population.nbins - 1] ?
591 population.nbins - 1 :
592 amrex::bisect(population.pivots, 0, population.nbins - 1, particle_mass);
593 if (particle_mass == population.pivots[lower_bin]) {
599 if (lower_bin + 1 < population.nbins) {
600 const amrex::Real lower = population.pivots[lower_bin];
601 const amrex::Real upper = population.pivots[lower_bin + 1];
606 upper - particle_mass, width, lower_weight);
608 particle_mass - lower, width, upper_weight);
611 const auto quotient_status =
618 plan.
destinations[0] = {lower_bin, lower_weight, lower};
619 plan.
destinations[1] = {lower_bin + 1, upper_weight, upper};
639 AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
642 const amrex::Real* property_packet_amounts,
const int property_count,
643 amrex::Real* residual_properties,
const int residual_capacity,
644 amrex::Real* candidate_state,
const int state_count) noexcept
647 result.
status = plan.status;
653 !amrex::Math::isfinite(plan.packet_number) ||
654 !amrex::Math::isfinite(plan.packet_particle_mass) ||
656 property_count != population.property_count ||
657 (property_count > 0 && (property_packet_amounts ==
nullptr || residual_properties ==
nullptr)) ||
658 residual_capacity < property_count || candidate_state ==
nullptr ||
659 state_count != population.state_components || plan.destination_count < 0 ||
660 plan.destination_count > 2 || !amrex::Math::isfinite(plan.residual_number_weight) ||
670 for (
int property = 0;
property < property_count; ++property) {
677 for (
int property = 0;
property < property_count; ++property) {
678 if (property_packet_amounts[property] !=
amrex::Real(0.0)) {
684 amrex::Real weight_sum = plan.residual_number_weight;
685 for (
int destination = 0; destination < plan.destination_count; ++destination) {
686 const auto& route = plan.destinations[destination];
687 if (route.bin < 0 || route.bin >= population.nbins ||
688 !amrex::Math::isfinite(route.number_weight) || route.number_weight <
amrex::Real(0.0) ||
694 for (
int previous = 0; previous < destination; ++previous) {
695 if (plan.destinations[previous].bin == route.bin) {
700 weight_sum += route.number_weight;
705 if (!amrex::Math::isfinite(weight_sum) ||
706 std::abs(weight_sum -
amrex::Real(1.0)) > weight_tolerance ||
708 (plan.residual_number_weight >
amrex::Real(0.0)))) {
712 }
else if (plan.destination_count != 0 ||
720 plan.packet_number, plan.residual_number_weight, residual_number);
727 for (
int property = 0;
property < property_count; ++property) {
730 property_packet_amounts[property], plan.residual_number_weight, residual);
736 for (
int destination = 0; destination < plan.destination_count; ++destination) {
737 const auto& route = plan.destinations[destination];
740 const amrex::Real deposited_mass = route.particle_mass;
742 plan.packet_number, route.number_weight, number_increment);
745 number_increment, deposited_mass, mass_increment);
753 route.particle_mass - plan.packet_particle_mass;
754 if (!amrex::Math::isfinite(mass_delta) ||
760 -mass_delta : mass_delta;
763 plan.packet_number, mass_delta_magnitude, correction_magnitude);
769 -correction_magnitude : correction_magnitude;
770 if (!amrex::Math::isfinite(correction) ||
771 !amrex::Math::isfinite(roundoff_water_mass_correction + correction)) {
775 roundoff_water_mass_correction += correction;
777 const int mass_component = population.mass_offset + route.bin;
778 const amrex::Real old_mass = candidate_state[mass_component];
784 const amrex::Real next_mass = old_mass + mass_increment;
786 if (population.number_offset >= 0) {
787 const int number_component = population.number_offset + route.bin;
788 const amrex::Real old_number = candidate_state[number_component];
793 next_number = old_number + number_increment;
806 next_mass, next_number, mean);
812 population, route.bin, next_number, next_mass)) {
819 next_mass, population.pivots[route.bin], next_number);
825 for (
int property = 0;
property < property_count; ++property) {
827 const int component = population.property_component_offsets[property] + route.bin;
828 const amrex::Real old_value = candidate_state[component];
830 property_packet_amounts[property], route.number_weight, increment);
839 const amrex::Real next_value = old_value + increment;
852 next_value, next_number, per_particle);
861 for (
int destination = 0; destination < plan.destination_count; ++destination) {
862 const auto& route = plan.destinations[destination];
863 const amrex::Real number_increment = plan.packet_number * route.number_weight;
864 const amrex::Real deposited_mass = route.particle_mass;
865 candidate_state[population.mass_offset + route.bin] += number_increment * deposited_mass;
866 if (population.number_offset >= 0) {
867 candidate_state[population.number_offset + route.bin] += number_increment;
869 for (
int property = 0;
property < property_count; ++property) {
870 candidate_state[population.property_component_offsets[property] + route.bin] +=
871 property_packet_amounts[property] * route.number_weight;
874 for (
int property = 0;
property < property_count; ++property) {
875 residual_properties[property] =
876 property_packet_amounts[property] * plan.residual_number_weight;
897 AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
900 const amrex::Real* persisted_state,
const int state_count,
901 amrex::Real* property_per_particle,
const int property_capacity,
905 persisted_state ==
nullptr || state_count != population.state_components ||
906 property_capacity < population.property_count ||
907 (population.property_count > 0 && property_per_particle ==
nullptr)) {
911 population, bin, persisted_state, state_count)) {
914 const amrex::Real mass = persisted_state[population.mass_offset + bin];
928 const amrex::Real number = persisted_state[population.number_offset + bin];
931 population, bin, persisted_state, state_count)) {
935 const amrex::Real upper = population.edges[bin + 1];
954 for (
int property = 0;
property < population.property_count; ++property) {
956 population.property_component_offsets[property] + bin];
968 for (
int property = 0;
property < population.property_count; ++property) {
970 population.property_component_offsets[property] + bin];
972 property_per_particle[property] =
amrex::Real(0.0);
974 amount, next.
number, property_per_particle[property]) !=
979 reconstruction = next;
989 AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
992 const bool include_upper,
amrex::Real* attached_properties,
993 const int property_capacity,
996 if (!amrex::Math::isfinite(lower) || !amrex::Math::isfinite(upper) || !(lower < upper) ||
999 reconstruction.property_count < 0 || property_capacity < reconstruction.property_count ||
1000 (reconstruction.property_count > 0 &&
1001 (reconstruction.property_per_particle ==
nullptr || attached_properties ==
nullptr)) ||
1002 (!reconstruction.empty && reconstruction.number <=
amrex::Real(0.0)) ||
1003 (reconstruction.empty && (reconstruction.number !=
amrex::Real(0.0) ||
1004 reconstruction.particle_mass !=
amrex::Real(0.0)))) {
1007 for (
int property = 0;
property < reconstruction.property_count; ++property) {
1008 const amrex::Real value = reconstruction.property_per_particle[property];
1010 (reconstruction.empty && value !=
amrex::Real(0.0))) {
1014 const bool contains = !reconstruction.empty && reconstruction.particle_mass >= lower &&
1015 (reconstruction.particle_mass < upper ||
1016 (include_upper && reconstruction.particle_mass == upper));
1019 next.
number = reconstruction.number;
1021 reconstruction.particle_mass, next.
water_mass)) {
1024 for (
int property = 0;
property < reconstruction.property_count; ++property) {
1027 reconstruction.property_per_particle[property], amount)) {
1032 for (
int property = 0;
property < reconstruction.property_count; ++property) {
1035 reconstruction.property_per_particle[property], amount)) {
1038 attached_properties[property] = amount;
1045 AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
1049 const int state_count) noexcept
1053 reconstruction.bin < 0 || reconstruction.bin >= population.nbins ||
1054 candidate_state ==
nullptr || state_count != population.state_components ||
1055 reconstruction.property_count != population.property_count ||
1056 (reconstruction.property_count > 0 && reconstruction.property_per_particle ==
nullptr) ||
1059 (!reconstruction.empty && reconstruction.number <=
amrex::Real(0.0)) ||
1060 (reconstruction.empty && (reconstruction.number !=
amrex::Real(0.0) ||
1061 reconstruction.particle_mass !=
amrex::Real(0.0)))) {
1064 if (!reconstruction.empty) {
1066 if (reconstruction.particle_mass != population.pivots[reconstruction.bin])
return false;
1071 reconstruction.particle_mass, mass)) {
1074 amrex::Real projected_number = reconstruction.number;
1077 mass, population.pivots[reconstruction.bin], projected_number) !=
1080 population, reconstruction.bin, projected_number, mass)) {
1083 for (
int property = 0;
property < population.property_count; ++property) {
1084 const amrex::Real value = reconstruction.property_per_particle[property];
1087 (reconstruction.empty && value !=
amrex::Real(0.0)) ||
1096 amount, projected_number, per_particle) !=
1100 const int bin = reconstruction.bin;
1101 candidate_state[population.mass_offset + bin] = mass;
1102 if (population.number_offset >= 0) {
1103 candidate_state[population.number_offset + bin] = reconstruction.number;
1105 for (
int property = 0;
property < population.property_count; ++property) {
1106 candidate_state[population.property_component_offsets[property] + bin] =
1107 reconstruction.number * reconstruction.property_per_particle[property];
1126 const std::vector<amrex::Real>& property_packet_amounts,
1127 std::vector<amrex::Real>& candidate_state);
1141 const std::vector<amrex::Real>& persisted_state,
1158 std::vector<amrex::Real>& candidate_state);
AMREX_FORCE_INLINE IntVect offset(const int face_dir, const int normal)
Definition: ERF_ReadBndryPlanes.cpp:32
amrex::Real Real
Definition: ERF_ShocInterface.H:19
Definition: ERF_SBMLayout.H:94
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE bool canonical_two_moment_moments(const PopulationRemapView &population, const int bin, const amrex::Real number, const amrex::Real mass) noexcept
Definition: ERF_SBMRemapping.H:345
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE bool canonical_two_moment_bin_state(const PopulationRemapView &population, const int bin, const amrex::Real *state, const int state_count) noexcept
Definition: ERF_SBMRemapping.H:407
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE ProductStatus checked_product(const amrex::Real left, const amrex::Real right, amrex::Real &result) noexcept
Definition: ERF_SBMRemapping.H:171
ProductStatus
Definition: ERF_SBMRemapping.H:161
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE bool within_boundary_roundoff(const amrex::Real value, const amrex::Real endpoint, const bool lower_boundary) noexcept
Definition: ERF_SBMRemapping.H:220
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE bool canonical_one_moment_bin_state_view(const PopulationRemapView &population, const int bin, const StateView &state, const int state_count) noexcept
Definition: ERF_SBMRemapping.H:427
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE bool finite_nonnegative(const amrex::Real value) noexcept
Definition: ERF_SBMRemapping.H:165
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE RemapStatus remap_product_status(const ProductStatus status) noexcept
Definition: ERF_SBMRemapping.H:205
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE bool route_plan_is_consistent(const PopulationRemapView &population, const PacketRoutingPlan &plan) noexcept
Definition: ERF_SBMRemapping.H:235
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE bool canonical_persisted_bin_state(const PopulationRemapView &population, const int bin, const amrex::Real *state, const int state_count) noexcept
Definition: ERF_SBMRemapping.H:475
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE QuotientStatus checked_quotient(const amrex::Real numerator, const amrex::Real denominator, amrex::Real &result) noexcept
Definition: ERF_SBMRemapping.H:183
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE RemapStatus remap_quotient_status(const QuotientStatus status) noexcept
Definition: ERF_SBMRemapping.H:212
QuotientStatus
Definition: ERF_SBMRemapping.H:162
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE bool canonical_two_moment_bin_state_view(const PopulationRemapView &population, const int bin, const StateView &state, const int state_count) noexcept
Definition: ERF_SBMRemapping.H:379
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE bool finite_product(const amrex::Real left, const amrex::Real right, amrex::Real &result) noexcept
Definition: ERF_SBMRemapping.H:198
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE bool canonical_one_moment_bin_state(const PopulationRemapView &population, const int bin, const amrex::Real *state, const int state_count) noexcept
Definition: ERF_SBMRemapping.H:456
bool project_reconstruction_bin(const SBMLayout &layout, const ReconstructionDelta &reconstruction, std::vector< amrex::Real > &candidate_state)
Definition: ERF_SBMRemapping.cpp:125
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE bool project_reconstruction_bin_core(const PopulationRemapView population, const ReconstructionDeltaView reconstruction, amrex::Real *candidate_state, const int state_count) noexcept
Definition: ERF_SBMRemapping.H:1046
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE bool try_two_moment_to_endpoints(const amrex::Real C, const amrex::Real M, const amrex::Real lower, const amrex::Real upper, EndpointTransform &result) noexcept
Definition: ERF_SpectralGrid.H:48
bool integrate_interval(const ReconstructionDelta &reconstruction, const amrex::Real lower, const amrex::Real upper, const bool include_upper, IntegratedMoments &integral)
Definition: ERF_SBMRemapping.cpp:98
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE bool integrate_interval_core(const ReconstructionDeltaView reconstruction, const amrex::Real lower, const amrex::Real upper, const bool include_upper, amrex::Real *attached_properties, const int property_capacity, IntegratedMomentsCoreResult &integral) noexcept
Definition: ERF_SBMRemapping.H:990
RemapStatus
Definition: ERF_SBMRemapping.H:18
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE PacketRoutingPlan plan_packet_routing(const PopulationRemapView population, const amrex::Real packet_number, const amrex::Real particle_mass) noexcept
Definition: ERF_SBMRemapping.H:507
MomentMode
Definition: ERF_SpectralGrid.H:19
PacketApplicationResult apply_packet_routing(const SBMLayout &layout, const PacketRoutingPlan &plan, const std::vector< amrex::Real > &property_packet_amounts, std::vector< amrex::Real > &candidate_state)
Definition: ERF_SBMRemapping.cpp:40
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE bool same_population_context(const PopulationRemapView &left, const PopulationRemapView &right) noexcept
Definition: ERF_SBMRemapping.H:127
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE ReconstructionStatus reconstruct_bin_core(const PopulationRemapView population, const int bin, const amrex::Real *persisted_state, const int state_count, amrex::Real *property_per_particle, const int property_capacity, ReconstructionDeltaView &reconstruction) noexcept
Definition: ERF_SBMRemapping.H:898
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE bool valid_population_remap_context(const PopulationRemapView &population) noexcept
Definition: ERF_SBMRemapping.H:53
ReconstructionStatus reconstruct_bin(const SBMLayout &layout, const int population_id, const int bin, const std::vector< amrex::Real > &persisted_state, ReconstructionDelta &reconstruction)
Definition: ERF_SBMRemapping.cpp:72
CoordinateKind
Definition: ERF_SpectralGrid.H:18
PopulationRemapView population_remap_view(const SBMLayout &layout, const int population_id) noexcept
Definition: ERF_SBMRemapping.cpp:8
ReconstructionStatus
Definition: ERF_SBMRemapping.H:21
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE bool valid_population_remap_view(const PopulationRemapView &population) noexcept
Definition: ERF_SBMRemapping.H:83
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE PacketApplicationCoreResult apply_packet_routing_core(const PopulationRemapView population, const PacketRoutingPlan plan, const amrex::Real *property_packet_amounts, const int property_count, amrex::Real *residual_properties, const int residual_capacity, amrex::Real *candidate_state, const int state_count) noexcept
Definition: ERF_SBMRemapping.H:640
real(c_double), parameter epsilon
Definition: ERF_module_model_constants.F90:12
Definition: ERF_SBMRemapping.H:983
amrex::Real water_mass
Definition: ERF_SBMRemapping.H:985
amrex::Real number
Definition: ERF_SBMRemapping.H:984
Definition: ERF_SBMRemapping.H:1144
amrex::Real water_mass
Definition: ERF_SBMRemapping.H:1146
amrex::Real number
Definition: ERF_SBMRemapping.H:1145
std::vector< amrex::Real > attached_properties
Definition: ERF_SBMRemapping.H:1147
Definition: ERF_SBMRemapping.H:625
amrex::Real residual_number
Definition: ERF_SBMRemapping.H:627
RemapStatus status
Definition: ERF_SBMRemapping.H:626
amrex::Real roundoff_water_mass_correction
Definition: ERF_SBMRemapping.H:629
amrex::Real residual_water_mass
Definition: ERF_SBMRemapping.H:628
bool normalized_roundoff
Definition: ERF_SBMRemapping.H:630
Definition: ERF_SBMRemapping.H:1115
bool normalized_roundoff
Definition: ERF_SBMRemapping.H:1120
std::vector< amrex::Real > residual_properties
Definition: ERF_SBMRemapping.H:1121
amrex::Real residual_number
Definition: ERF_SBMRemapping.H:1117
amrex::Real residual_water_mass
Definition: ERF_SBMRemapping.H:1118
RemapStatus status
Definition: ERF_SBMRemapping.H:1116
amrex::Real roundoff_water_mass_correction
Definition: ERF_SBMRemapping.H:1119
Definition: ERF_SBMRemapping.H:148
amrex::Real packet_number
Definition: ERF_SBMRemapping.H:151
RemapStatus status
Definition: ERF_SBMRemapping.H:150
amrex::Real packet_particle_mass
Definition: ERF_SBMRemapping.H:152
RouteDestination destinations[2]
Definition: ERF_SBMRemapping.H:154
bool normalized_roundoff
Definition: ERF_SBMRemapping.H:156
amrex::Real residual_number_weight
Definition: ERF_SBMRemapping.H:155
int destination_count
Definition: ERF_SBMRemapping.H:153
PopulationRemapView population
Definition: ERF_SBMRemapping.H:149
Definition: ERF_SBMRemapping.H:29
int property_count
Definition: ERF_SBMRemapping.H:40
CoordinateKind coordinate_kind
Definition: ERF_SBMRemapping.H:32
MomentMode moment_mode
Definition: ERF_SBMRemapping.H:31
int state_components
Definition: ERF_SBMRemapping.H:38
int nbins
Definition: ERF_SBMRemapping.H:35
int number_offset
Definition: ERF_SBMRemapping.H:37
int population_id
Definition: ERF_SBMRemapping.H:30
const amrex::Real * pivots
Definition: ERF_SBMRemapping.H:34
int mass_offset
Definition: ERF_SBMRemapping.H:36
const int * property_component_offsets
Definition: ERF_SBMRemapping.H:39
const amrex::Real * edges
Definition: ERF_SBMRemapping.H:33
Definition: ERF_SBMRemapping.H:886
int bin
Definition: ERF_SBMRemapping.H:888
bool normalized_roundoff
Definition: ERF_SBMRemapping.H:890
bool empty
Definition: ERF_SBMRemapping.H:889
amrex::Real particle_mass
Definition: ERF_SBMRemapping.H:892
const amrex::Real * property_per_particle
Definition: ERF_SBMRemapping.H:893
PopulationRemapView population
Definition: ERF_SBMRemapping.H:887
amrex::Real number
Definition: ERF_SBMRemapping.H:891
int property_count
Definition: ERF_SBMRemapping.H:894
Definition: ERF_SBMRemapping.H:1129
std::vector< amrex::Real > property_per_particle
Definition: ERF_SBMRemapping.H:1136
bool normalized_roundoff
Definition: ERF_SBMRemapping.H:1133
int bin
Definition: ERF_SBMRemapping.H:1131
amrex::Real particle_mass
Definition: ERF_SBMRemapping.H:1135
int population_id
Definition: ERF_SBMRemapping.H:1130
bool empty
Definition: ERF_SBMRemapping.H:1132
amrex::Real number
Definition: ERF_SBMRemapping.H:1134
Definition: ERF_SBMRemapping.H:141
amrex::Real number_weight
Definition: ERF_SBMRemapping.H:143
amrex::Real particle_mass
Definition: ERF_SBMRemapping.H:144
int bin
Definition: ERF_SBMRemapping.H:142
Definition: ERF_SBMRemapping.H:363
amrex::Array4< const amrex::Real > values
Definition: ERF_SBMRemapping.H:364
int k
Definition: ERF_SBMRemapping.H:367
int j
Definition: ERF_SBMRemapping.H:366
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real operator[](const int component) const noexcept
Definition: ERF_SBMRemapping.H:370
int i
Definition: ERF_SBMRemapping.H:365