From d4a3d19edc9d2b1865370ce8cb3044b1d0541d1e Mon Sep 17 00:00:00 2001 From: Philipp Grete Date: Wed, 20 Sep 2023 11:00:46 +0200 Subject: [PATCH] Use prim scalar for AGN extent --- src/pgen/cluster.cpp | 1 - src/pgen/cluster/cluster_reductions.cpp | 2 +- src/pgen/cluster/stellar_feedback.cpp | 16 +++++++++------- src/pgen/cluster/stellar_feedback.hpp | 2 +- 4 files changed, 11 insertions(+), 10 deletions(-) diff --git a/src/pgen/cluster.cpp b/src/pgen/cluster.cpp index 96a781ba..a2b10f7e 100644 --- a/src/pgen/cluster.cpp +++ b/src/pgen/cluster.cpp @@ -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("mbar_over_kb"); PARTHENON_REQUIRE( pin->GetOrAddBoolean("problem/cluster/agn_feedback", "enable_tracer", false), "AGN Tracer must be enabled to reduce AGN tracer extent"); diff --git a/src/pgen/cluster/cluster_reductions.cpp b/src/pgen/cluster/cluster_reductions.cpp index 0e8c88ed..9e9edb4b 100644 --- a/src/pgen/cluster/cluster_reductions.cpp +++ b/src/pgen/cluster/cluster_reductions.cpp @@ -89,7 +89,7 @@ parthenon::Real LocalReduceAGNExtent(parthenon::MeshData *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; } }, diff --git a/src/pgen/cluster/stellar_feedback.cpp b/src/pgen/cluster/stellar_feedback.cpp index db5c6eae..aa130d65 100644 --- a/src/pgen/cluster/stellar_feedback.cpp +++ b/src/pgen/cluster/stellar_feedback.cpp @@ -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("stellar_feedback", *this); diff --git a/src/pgen/cluster/stellar_feedback.hpp b/src/pgen/cluster/stellar_feedback.hpp index 973716b4..e3d4b20c 100644 --- a/src/pgen/cluster/stellar_feedback.hpp +++ b/src/pgen/cluster/stellar_feedback.hpp @@ -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