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

bug in cooling function and potential bug in history.cpp #214

Merged
merged 1 commit into from
Mar 28, 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/analysis/history.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ Real CalculateMdot(MeshData<Real> *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) {
Expand Down
5 changes: 4 additions & 1 deletion src/radiation/cooling_function.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -193,7 +194,9 @@ TaskStatus CoolingFunctionCalculateFourForce(MeshData<Real> *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]);
Comment on lines -196 to +199
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is definitely a bug. Thanks for the fix!

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
Expand Down
Loading