From 9f1507c74ed8338ceef05b389edbbfcdf1131437 Mon Sep 17 00:00:00 2001 From: mari2895 Date: Thu, 28 Mar 2024 16:23:59 -0400 Subject: [PATCH] bug in cooling function and potential bug in history.cpp --- src/analysis/history.cpp | 2 +- src/radiation/cooling_function.cpp | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/analysis/history.cpp b/src/analysis/history.cpp index 8f578dd0..70c589c6 100644 --- a/src/analysis/history.cpp +++ b/src/analysis/history.cpp @@ -318,7 +318,7 @@ Real CalculateMdot(MeshData *md, Real rc, bool gain) { const auto &coords = v.GetCoordinates(b); const Real vol = coords.CellVolume(k, j, i); - Real C[NDFULL]; + Real C[Geometry::NDFULL]; geom.Coords(CellLocation::Cent, b, k, j, i, C); Real r = std::sqrt(C[1] * C[1] + C[2] * C[2] + C[3] * C[3]); if (r <= rc) { diff --git a/src/radiation/cooling_function.cpp b/src/radiation/cooling_function.cpp index 06b39a26..c4e45d8c 100644 --- a/src/radiation/cooling_function.cpp +++ b/src/radiation/cooling_function.cpp @@ -12,6 +12,7 @@ // publicly, and to permit others to do so. #include "geometry/geometry.hpp" +#include "geometry/geometry_utils.hpp" #include "light_bulb_constants.hpp" #include "phoebus_utils/variables.hpp" #include "radiation.hpp" @@ -193,7 +194,9 @@ TaskStatus CoolingFunctionCalculateFourForce(MeshData *rc, const double dt nblocks - 1, kb.s, kb.e, jb.s, jb.e, ib.s, ib.e, KOKKOS_LAMBDA(const int b, const int k, const int j, const int i) { auto &coords = v.GetCoordinates(b); - const Real r = std::abs(coords.Xc<1>(k, j, i)); + Real A[Geometry::NDFULL]; + geom.Coords(CellLocation::Cent, b, k, j, i, A); + Real r = std::sqrt(A[1] * A[1] + A[2] * A[2] + A[3] * A[3]); const Real rho = v(b, p::density(), k, j, i) * density_conversion_factor; // Density in CGS const Real cdensity = v(b, c::density(), k, j, i); // conserved density