Skip to content

Commit

Permalink
Use prim scalar for AGN extent
Browse files Browse the repository at this point in the history
  • Loading branch information
pgrete committed Sep 20, 2023
1 parent 2bdf1f8 commit d4a3d19
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 10 deletions.
1 change: 0 additions & 1 deletion src/pgen/cluster.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,6 @@ void ProblemInitPackageData(ParameterInput *pin, parthenon::StateDescriptor *hyd
const Real agn_tracer_thresh =
pin->GetOrAddReal("problem/cluster/reductions", "agn_tracer_thresh", -1.0);
if (agn_tracer_thresh >= 0) {
auto mbar_over_kb = hydro_pkg->Param<Real>("mbar_over_kb");
PARTHENON_REQUIRE(
pin->GetOrAddBoolean("problem/cluster/agn_feedback", "enable_tracer", false),
"AGN Tracer must be enabled to reduce AGN tracer extent");
Expand Down
2 changes: 1 addition & 1 deletion src/pgen/cluster/cluster_reductions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ parthenon::Real LocalReduceAGNExtent(parthenon::MeshData<parthenon::Real> *md) {

const auto r2 = SQR(coords.Xc<1>(k, j, i)) + SQR(coords.Xc<2>(k, j, i)) +
SQR(coords.Xc<3>(k, j, i));
if (cons(nhydro, k, j, i) > tracer_thresh && r2 > max_r2) {
if (cons(nhydro, k, j, i) / cons(IDN, k, j, i) > tracer_thresh && r2 > max_r2) {
max_r2_team = r2;
}
},
Expand Down
16 changes: 9 additions & 7 deletions src/pgen/cluster/stellar_feedback.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,22 +41,24 @@ StellarFeedback::StellarFeedback(parthenon::ParameterInput *pin,
"number_density_threshold", 0.0)),
temperatue_threshold_(pin->GetOrAddReal("problem/cluster/stellar_feedback",
"temperature_threshold", 0.0)) {
if (stellar_radius_ == 0.0 && exclusion_radius_ == 0.0 && efficiency_ == 0.0 && number_density_threshold_ == 0.0 &&
temperatue_threshold_ == 0.0) {
if (stellar_radius_ == 0.0 && exclusion_radius_ == 0.0 && efficiency_ == 0.0 &&
number_density_threshold_ == 0.0 && temperatue_threshold_ == 0.0) {
disabled_ = true;
} else {
disabled_ = false;
}

if (!disabled_ && exclusion_radius_ == 0.0){
if (!disabled_ && exclusion_radius_ == 0.0) {
// If exclusion_radius_ is not specified, use AGN triggering accretion radius.
// If both are zero, the PARTHENON_REQUIRE will fail
exclusion_radius_ = pin->GetOrAddReal("problem/cluster/agn_triggering", "accretion_radius", 0);
exclusion_radius_ =
pin->GetOrAddReal("problem/cluster/agn_triggering", "accretion_radius", 0);
}

PARTHENON_REQUIRE(disabled_ || (stellar_radius_ != 0.0 && exclusion_radius_!= 0.0 && efficiency_ != 0.00 &&
number_density_threshold_ != 0.0 &&
temperatue_threshold_ != 0.0),
PARTHENON_REQUIRE(disabled_ ||
(stellar_radius_ != 0.0 && exclusion_radius_ != 0.0 &&
efficiency_ != 0.00 && number_density_threshold_ != 0.0 &&
temperatue_threshold_ != 0.0),
"Enabling stellar feedback requires setting all parameters.");

hydro_pkg->AddParam<StellarFeedback>("stellar_feedback", *this);
Expand Down
2 changes: 1 addition & 1 deletion src/pgen/cluster/stellar_feedback.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class StellarFeedback {
private:
// feedback parameters in code units
const parthenon::Real stellar_radius_; // length
parthenon::Real exclusion_radius_; // length
parthenon::Real exclusion_radius_; // length
const parthenon::Real efficiency_; // dimless
const parthenon::Real number_density_threshold_; // 1/(length^3)
const parthenon::Real temperatue_threshold_; // K
Expand Down

0 comments on commit d4a3d19

Please sign in to comment.