Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move enable_dust_gas_thermal_coupling_model to ISM_Traits #771

Merged
merged 3 commits into from
Oct 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/QuokkaSimulation.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1682,7 +1682,7 @@ void QuokkaSimulation<problem_t>::subcycleRadiationAtLevel(int lev, amrex::Real
amrex::Print() << "The average number of Newton-Raphson solvings per IMEX stage is " << global_solving_mean
<< ", (mean, max) number of Newton-Raphson iterations are " << global_iteration_mean << ", "
<< global_iteration_max << ".\n";
if constexpr (RadSystem_Traits<problem_t>::enable_dust_gas_thermal_coupling_model) {
if constexpr (ISM_Traits<problem_t>::enable_dust_gas_thermal_coupling_model) {
amrex::Print() << "The fraction of gas-dust interactions that are decoupled is "
<< global_decoupled_iteration_mean << "\n";
}
Expand Down
1 change: 0 additions & 1 deletion src/problems/RadBeam/test_radiation_beam.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ template <> struct RadSystem_Traits<BeamProblem> {
static constexpr double radiation_constant = radiation_constant_cgs_;
static constexpr double Erad_floor = 0.;
static constexpr int beta_order = 1;
static constexpr bool enable_dust_gas_thermal_coupling_model = false;
};

template <> struct Physics_Traits<BeamProblem> {
Expand Down
5 changes: 5 additions & 0 deletions src/problems/RadDust/test_rad_dust.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,12 @@ template <> struct RadSystem_Traits<DustProblem> {
static constexpr double radiation_constant = a_rad;
static constexpr double Erad_floor = erad_floor;
static constexpr int beta_order = beta_order_;
};

template <> struct ISM_Traits<DustProblem> {
static constexpr bool enable_dust_gas_thermal_coupling_model = true;
static constexpr double gas_dust_coupling_threshold = 1.0e-6;
static constexpr bool enable_photoelectric_heating = false;
};

template <> struct Physics_Traits<DustProblem> {
Expand Down
5 changes: 5 additions & 0 deletions src/problems/RadDustMG/test_rad_dust_MG.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,12 @@ template <> struct RadSystem_Traits<DustProblem> {
static constexpr amrex::GpuArray<double, Physics_Traits<DustProblem>::nGroups + 1> radBoundaries{1.0e-3, 0.1, 1.0, 10.0, 1.0e3};
// static constexpr OpacityModel opacity_model = OpacityModel::piecewise_constant_opacity;
static constexpr OpacityModel opacity_model = OpacityModel::PPL_opacity_fixed_slope_spectrum;
};

template <> struct ISM_Traits<DustProblem> {
static constexpr bool enable_dust_gas_thermal_coupling_model = true;
static constexpr double gas_dust_coupling_threshold = 1.0e-6;
static constexpr bool enable_photoelectric_heating = false;
};

template <>
Expand Down
1 change: 0 additions & 1 deletion src/problems/RadForce/test_radiation_force.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@ template <> struct RadSystem_Traits<TubeProblem> {
static constexpr double Erad_floor = 0.;
static constexpr double energy_unit = C::ev2erg;
static constexpr int beta_order = 1;
static constexpr bool enable_dust_gas_thermal_coupling_model = false;
};

template <> AMREX_GPU_HOST_DEVICE auto RadSystem<TubeProblem>::ComputePlanckOpacity(const double /*rho*/, const double /*Tgas*/) -> amrex::Real { return 0.; }
Expand Down
1 change: 0 additions & 1 deletion src/problems/RadMarshak/test_radiation_marshak.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ template <> struct RadSystem_Traits<SuOlsonProblem> {
static constexpr double radiation_constant = a_rad;
static constexpr double Erad_floor = 0.;
static constexpr int beta_order = 0;
static constexpr bool enable_dust_gas_thermal_coupling_model = false;
};

template <> struct Physics_Traits<SuOlsonProblem> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ template <> struct RadSystem_Traits<SuOlsonProblemCgs> {
static constexpr double radiation_constant = radiation_constant_cgs_;
static constexpr double Erad_floor = Erad_floor_;
static constexpr int beta_order = 0;
static constexpr bool enable_dust_gas_thermal_coupling_model = false;
};

template <> struct Physics_Traits<SuOlsonProblemCgs> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ template <> struct RadSystem_Traits<SuOlsonProblemCgs> {
static constexpr double radiation_constant = radiation_constant_cgs_;
static constexpr double Erad_floor = 0.;
static constexpr int beta_order = 1;
static constexpr bool enable_dust_gas_thermal_coupling_model = false;
};

template <> struct Physics_Traits<SuOlsonProblemCgs> {
Expand Down
5 changes: 3 additions & 2 deletions src/problems/RadMarshakDust/test_radiation_marshak_dust.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,15 +65,16 @@ template <> struct RadSystem_Traits<MarshakProblem> {
static constexpr double radiation_constant = a_rad;
static constexpr double Erad_floor = erad_floor;
static constexpr int beta_order = 0;
static constexpr bool enable_dust_gas_thermal_coupling_model = dust_on;
static constexpr double energy_unit = 1.0;
static constexpr amrex::GpuArray<double, n_group_ + 1> radBoundaries = radBoundaries_;
static constexpr OpacityModel opacity_model = opacity_model_;
};

template <> struct ISM_Traits<MarshakProblem> {
static constexpr double gas_dust_coupling_threshold = 1.0e-5;
static constexpr bool enable_dust_gas_thermal_coupling_model = true;
static constexpr bool enable_photoelectric_heating = false;
// 1.0e-5 is the minimum value allowed for this test; smaller values will result in negative T_d.
static constexpr double gas_dust_coupling_threshold = 1.0e-5;
markkrumholz marked this conversation as resolved.
Show resolved Hide resolved
};

template <> AMREX_GPU_HOST_DEVICE auto RadSystem<MarshakProblem>::ComputePlanckOpacity(const double /*rho*/, const double /*Tgas*/) -> amrex::Real
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,13 +62,13 @@ template <> struct RadSystem_Traits<MarshakProblem> {
static constexpr double radiation_constant = a_rad;
static constexpr double Erad_floor = erad_floor;
static constexpr int beta_order = 1;
static constexpr bool enable_dust_gas_thermal_coupling_model = dust_on;
static constexpr double energy_unit = 1.0;
static constexpr amrex::GpuArray<double, n_group_ + 1> radBoundaries = radBoundaries_;
static constexpr OpacityModel opacity_model = opacity_model_;
};

template <> struct ISM_Traits<MarshakProblem> {
static constexpr bool enable_dust_gas_thermal_coupling_model = dust_on;
static constexpr double gas_dust_coupling_threshold = gas_dust_coupling_threshold_;
static constexpr bool enable_photoelectric_heating = PE_on;
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,6 @@ template <> struct RadSystem_Traits<SuOlsonProblemCgs> {
static constexpr double energy_unit = C::hplanck; // set boundary unit to Hz
static constexpr amrex::GpuArray<double, n_groups_ + 1> radBoundaries = group_edges_;
static constexpr OpacityModel opacity_model = opacity_model_;
static constexpr bool enable_dust_gas_thermal_coupling_model = false;
};

template <>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ template <> struct RadSystem_Traits<CouplingProblem> {
static constexpr double radiation_constant = radiation_constant_cgs_;
static constexpr double Erad_floor = 0.;
static constexpr int beta_order = 1;
static constexpr bool enable_dust_gas_thermal_coupling_model = false;
};

template <> struct Physics_Traits<CouplingProblem> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ template <> struct RadSystem_Traits<CouplingProblem> {
static constexpr double radiation_constant = radiation_constant_cgs_;
static constexpr double Erad_floor = 0.;
static constexpr int beta_order = 1;
static constexpr bool enable_dust_gas_thermal_coupling_model = false;
};

template <> struct Physics_Traits<CouplingProblem> {
Expand Down
1 change: 0 additions & 1 deletion src/problems/RadPulse/test_radiation_pulse.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ template <> struct RadSystem_Traits<PulseProblem> {
static constexpr double radiation_constant = a_rad;
static constexpr double Erad_floor = erad_floor;
static constexpr int beta_order = 0;
static constexpr bool enable_dust_gas_thermal_coupling_model = false;
};

template <> struct Physics_Traits<PulseProblem> {
Expand Down
1 change: 0 additions & 1 deletion src/problems/RadShadow/test_radiation_shadow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ template <> struct RadSystem_Traits<ShadowProblem> {
static constexpr double radiation_constant = a_rad;
static constexpr double Erad_floor = 0.;
static constexpr int beta_order = 1;
static constexpr bool enable_dust_gas_thermal_coupling_model = false;
};

template <> struct Physics_Traits<ShadowProblem> {
Expand Down
1 change: 0 additions & 1 deletion src/problems/RadStreaming/test_radiation_streaming.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ template <> struct RadSystem_Traits<StreamingProblem> {
static constexpr double radiation_constant = 1.0;
static constexpr double Erad_floor = initial_Erad;
static constexpr int beta_order = 0;
static constexpr bool enable_dust_gas_thermal_coupling_model = false;
};

template <> AMREX_GPU_HOST_DEVICE auto RadSystem<StreamingProblem>::ComputePlanckOpacity(const double /*rho*/, const double /*Tgas*/) -> amrex::Real
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ template <> struct RadSystem_Traits<StreamingProblem> {
static constexpr double radiation_constant = 1.0;
static constexpr double Erad_floor = initial_Erad;
static constexpr int beta_order = 0;
static constexpr bool enable_dust_gas_thermal_coupling_model = false;
};

template <> AMREX_GPU_HOST_DEVICE auto RadSystem<StreamingProblem>::ComputePlanckOpacity(const double /*rho*/, const double /*Tgas*/) -> amrex::Real
Expand Down
1 change: 0 additions & 1 deletion src/problems/RadSuOlson/test_radiation_SuOlson.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ template <> struct RadSystem_Traits<MarshakProblem> {
static constexpr double gamma = 5. / 3.;
static constexpr double Erad_floor = 0.;
static constexpr int beta_order = 0;
static constexpr bool enable_dust_gas_thermal_coupling_model = false;
};

template <> struct quokka::EOS_Traits<MarshakProblem> {
Expand Down
1 change: 0 additions & 1 deletion src/problems/RadTophat/test_radiation_tophat.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ template <> struct RadSystem_Traits<TophatProblem> {
static constexpr double radiation_constant = radiation_constant_cgs_;
static constexpr double Erad_floor = 0.;
static constexpr int beta_order = 0;
static constexpr bool enable_dust_gas_thermal_coupling_model = false;
};

template <> struct Physics_Traits<TophatProblem> {
Expand Down
1 change: 0 additions & 1 deletion src/problems/RadTube/test_radiation_tube.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ template <> struct RadSystem_Traits<TubeProblem> {
// static constexpr OpacityModel opacity_model = OpacityModel::single_group;
static constexpr OpacityModel opacity_model = OpacityModel::piecewise_constant_opacity;
// static constexpr OpacityModel opacity_model = OpacityModel::PPL_opacity_fixed_slope_spectrum;
static constexpr bool enable_dust_gas_thermal_coupling_model = false;
};

template <>
Expand Down
1 change: 0 additions & 1 deletion src/problems/RadhydroBB/test_radhydro_bb.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,6 @@ template <> struct RadSystem_Traits<PulseProblem> {
static constexpr double energy_unit = nu_unit;
static constexpr amrex::GpuArray<double, n_groups_ + 1> radBoundaries = rad_boundaries_;
static constexpr OpacityModel opacity_model = OpacityModel::piecewise_constant_opacity;
static constexpr bool enable_dust_gas_thermal_coupling_model = false;
};

template <>
Expand Down
2 changes: 0 additions & 2 deletions src/problems/RadhydroPulse/test_radhydro_pulse.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,15 +49,13 @@ template <> struct RadSystem_Traits<PulseProblem> {
static constexpr double radiation_constant = a_rad;
static constexpr double Erad_floor = erad_floor;
static constexpr int beta_order = beta_order_;
static constexpr bool enable_dust_gas_thermal_coupling_model = false;
};
template <> struct RadSystem_Traits<AdvPulseProblem> {
static constexpr double c_light = c;
static constexpr double c_hat = chat;
static constexpr double radiation_constant = a_rad;
static constexpr double Erad_floor = erad_floor;
static constexpr int beta_order = beta_order_;
static constexpr bool enable_dust_gas_thermal_coupling_model = false;
};

template <> struct Physics_Traits<PulseProblem> {
Expand Down
2 changes: 0 additions & 2 deletions src/problems/RadhydroPulseDyn/test_radhydro_pulse_dyn.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,15 +50,13 @@ template <> struct RadSystem_Traits<PulseProblem> {
static constexpr double radiation_constant = a_rad;
static constexpr double Erad_floor = erad_floor;
static constexpr int beta_order = beta_order_;
static constexpr bool enable_dust_gas_thermal_coupling_model = false;
};
template <> struct RadSystem_Traits<AdvPulseProblem> {
static constexpr double c_light = c;
static constexpr double c_hat = chat;
static constexpr double radiation_constant = a_rad;
static constexpr double Erad_floor = erad_floor;
static constexpr int beta_order = beta_order_;
static constexpr bool enable_dust_gas_thermal_coupling_model = false;
};

template <> struct Physics_Traits<PulseProblem> {
Expand Down
2 changes: 0 additions & 2 deletions src/problems/RadhydroPulseGrey/test_radhydro_pulse_grey.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,15 +52,13 @@ template <> struct RadSystem_Traits<PulseProblem> {
static constexpr double radiation_constant = a_rad;
static constexpr double Erad_floor = erad_floor;
static constexpr int beta_order = 1;
static constexpr bool enable_dust_gas_thermal_coupling_model = false;
};
template <> struct RadSystem_Traits<AdvPulseProblem> {
static constexpr double c_light = c;
static constexpr double c_hat = chat;
static constexpr double radiation_constant = a_rad;
static constexpr double Erad_floor = erad_floor;
static constexpr int beta_order = 2;
static constexpr bool enable_dust_gas_thermal_coupling_model = false;
};

template <> struct Physics_Traits<PulseProblem> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,6 @@ template <> struct RadSystem_Traits<SGProblem> {
static constexpr double radiation_constant = a_rad;
static constexpr double Erad_floor = erad_floor;
static constexpr int beta_order = 1;
static constexpr bool enable_dust_gas_thermal_coupling_model = false;
};

template <> AMREX_GPU_HOST_DEVICE auto RadSystem<SGProblem>::ComputePlanckOpacity(const double /*rho*/, const double /*Tgas*/) -> amrex::Real { return kappa0; }
Expand Down Expand Up @@ -182,7 +181,6 @@ template <> struct RadSystem_Traits<MGproblem> {
// static constexpr OpacityModel opacity_model = OpacityModel::piecewise_constant_opacity;
static constexpr OpacityModel opacity_model = OpacityModel::PPL_opacity_fixed_slope_spectrum;
// static constexpr OpacityModel opacity_model = OpacityModel::PPL_opacity_full_spectrum;
static constexpr bool enable_dust_gas_thermal_coupling_model = false;
};

template <>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,6 @@ template <> struct RadSystem_Traits<MGProblem> {
static constexpr amrex::GpuArray<double, n_groups_ + 1> radBoundaries = rad_boundaries_;
static constexpr int beta_order = 1;
static constexpr OpacityModel opacity_model = opacity_model_;
static constexpr bool enable_dust_gas_thermal_coupling_model = false;
};
template <> struct RadSystem_Traits<ExactProblem> {
static constexpr double c_light = c;
Expand All @@ -142,7 +141,6 @@ template <> struct RadSystem_Traits<ExactProblem> {
static constexpr bool compute_v_over_c_terms = true;
static constexpr int beta_order = 1;
static constexpr OpacityModel opacity_model = OpacityModel::single_group;
static constexpr bool enable_dust_gas_thermal_coupling_model = false;
};

AMREX_GPU_HOST_DEVICE
Expand Down
1 change: 0 additions & 1 deletion src/problems/RadhydroShell/test_radhydro_shell.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ template <> struct RadSystem_Traits<ShellProblem> {
static constexpr double radiation_constant = a_rad;
static constexpr double Erad_floor = 0.;
static constexpr int beta_order = 1;
static constexpr bool enable_dust_gas_thermal_coupling_model = false;
};

template <> struct HydroSystem_Traits<ShellProblem> {
Expand Down
1 change: 0 additions & 1 deletion src/problems/RadhydroShock/test_radhydro_shock.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ template <> struct RadSystem_Traits<ShockProblem> {
static constexpr double radiation_constant = a_rad;
static constexpr double Erad_floor = 0.;
static constexpr int beta_order = 1;
static constexpr bool enable_dust_gas_thermal_coupling_model = false;
};

template <> struct quokka::EOS_Traits<ShockProblem> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ template <> struct RadSystem_Traits<ShockProblem> {
static constexpr double radiation_constant = a_rad;
static constexpr double Erad_floor = 0.;
static constexpr int beta_order = 1;
static constexpr bool enable_dust_gas_thermal_coupling_model = false;
};

template <> struct quokka::EOS_Traits<ShockProblem> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ template <> struct RadSystem_Traits<ShockProblem> {
// static constexpr OpacityModel opacity_model = OpacityModel::piecewise_constant_opacity;
static constexpr OpacityModel opacity_model = OpacityModel::PPL_opacity_fixed_slope_spectrum;
// static constexpr OpacityModel opacity_model = OpacityModel::PPL_opacity_full_spectrum;
static constexpr bool enable_dust_gas_thermal_coupling_model = false;
};

template <> struct quokka::EOS_Traits<ShockProblem> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ template <> struct RadSystem_Traits<PulseProblem> {
static constexpr double radiation_constant = a_rad;
static constexpr double Erad_floor = 0.0;
static constexpr int beta_order = beta_order_;
static constexpr bool enable_dust_gas_thermal_coupling_model = false;
};

template <> struct Physics_Traits<PulseProblem> {
Expand Down
5 changes: 3 additions & 2 deletions src/radiation/radiation_system.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,9 @@ template <typename problem_t> struct RadSystem_Traits {
// this struct is specialized by the user application code
//
template <typename problem_t> struct ISM_Traits {
static constexpr double gas_dust_coupling_threshold = 1.0e-6;
static constexpr bool enable_dust_gas_thermal_coupling_model = false;
static constexpr bool enable_photoelectric_heating = false;
static constexpr double gas_dust_coupling_threshold = 1.0e-6;
};

// A struct to hold the results of the ComputeRadPressure function.
Expand Down Expand Up @@ -193,7 +194,7 @@ template <typename problem_t> class RadSystem : public HyperbolicSystem<problem_

static constexpr int beta_order_ = RadSystem_Traits<problem_t>::beta_order;

static constexpr bool enable_dust_gas_thermal_coupling_model_ = RadSystem_Traits<problem_t>::enable_dust_gas_thermal_coupling_model;
static constexpr bool enable_dust_gas_thermal_coupling_model_ = ISM_Traits<problem_t>::enable_dust_gas_thermal_coupling_model;
static constexpr bool enable_photoelectric_heating_ = ISM_Traits<problem_t>::enable_photoelectric_heating;

static constexpr int nGroups_ = Physics_Traits<problem_t>::nGroups;
Expand Down
Loading