Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
mari2895 committed Mar 11, 2024
1 parent 039fdf5 commit 7f64429
Show file tree
Hide file tree
Showing 4 changed files with 1 addition and 44 deletions.
39 changes: 0 additions & 39 deletions src/analysis/history.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -238,45 +238,6 @@ Real ReduceMagneticFluxPhi(MeshData<Real> *md) {

// SN analysis

void ReduceCentralDensitySN(MeshData<Real> *md) {
const auto ib = md->GetBoundsI(IndexDomain::interior);
const auto jb = md->GetBoundsJ(IndexDomain::interior);
const auto kb = md->GetBoundsK(IndexDomain::interior);
namespace p = fluid_prim;
namespace diag = diagnostic_variables;
using parthenon::MakePackDescriptor;
auto *pmb = md->GetParentPointer();
Mesh *pmesh = md->GetMeshPointer();
auto &resolved_pkgs = pmesh->resolved_packages;
const int ndim = pmesh->ndim;

static auto desc =
MakePackDescriptor<p::density, diag::central_density>(resolved_pkgs.get());
auto v = desc.GetPack(md);
const int nblocks = v.GetNBlocks();
auto geom = Geometry::GetCoordinateSystem(md);

parthenon::par_for(
parthenon::LoopPatternMDRange(), "Central Density for SN", DevExecSpace(), 0,
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);
auto analysis = pmb->packages.Get("analysis").get();
const Real x[3] = {coords.Xc<1>(k, j, i), coords.Xc<2>(k, j, i),
coords.Xc<3>(k, j, i)};
const Real sigma = analysis->Param<Real>("sigma");
Real gam[3][3];
Real r2 = 0;
geom.Metric(CellLocation::Cent, 0, k, j, i, gam);
for (int n = 0; n < 3; ++n) {
for (int m = 0; m < 3; ++m) {
r2 += gam[n][m] * x[n] * x[m];
}
}
const Real rhoc = v(b, p::density(), k, j, i) * std::exp(-r2 / sigma / sigma);
v(b, diag::central_density(), k, j, i) = rhoc;
});
}
void ReduceLocalizationFunction(MeshData<Real> *md) {
const auto ib = md->GetBoundsI(IndexDomain::interior);
const auto jb = md->GetBoundsJ(IndexDomain::interior);
Expand Down
1 change: 0 additions & 1 deletion src/analysis/history.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ Real ReduceMassAccretionRate(MeshData<Real> *md);
Real ReduceJetEnergyFlux(MeshData<Real> *md);
Real ReduceJetMomentumFlux(MeshData<Real> *md);
Real ReduceMagneticFluxPhi(MeshData<Real> *md);
void ReduceCentralDensitySN(MeshData<Real> *md);
void ReduceLocalizationFunction(MeshData<Real> *md);

template <typename Reducer_t>
Expand Down
4 changes: 1 addition & 3 deletions src/fluid/fluid.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,6 @@ std::shared_ptr<StateDescriptor> Initialize(ParameterInput *pin) {
physics->AddField(p::entropy::name(), mprim_scalar);
physics->AddField(p::cs::name(), mprim_scalar);
physics->AddField(diag::ratio_divv_cs::name(), mprim_scalar);
physics->AddField(diag::central_density::name(), mprim_scalar);
physics->AddField(diag::localization_function::name(), mprim_scalar);
physics->AddField(diag::entropy_z_0::name(), mprim_scalar);
physics->AddField(p::gamma1::name(), mprim_scalar);
Expand Down Expand Up @@ -324,8 +323,7 @@ std::shared_ptr<StateDescriptor> Initialize(ParameterInput *pin) {
return ReduceOneVar<Kokkos::Sum<Real>>(md, fluid_cons::energy::name(), 0);
};
auto MaxDensitySN = [](MeshData<Real> *md) {
History::ReduceCentralDensitySN(md);
return ReduceOneVar<Kokkos::Max<Real>>(md, diag::central_density::name(), 0);
return ReduceOneVar<Kokkos::Max<Real>>(md, fluid_prim::density::name(), 0);
};
auto Mgain = [](MeshData<Real> *md) {
return ReduceInGain<Kokkos::Sum<Real, HostExecSpace>>(md, fluid_prim::density::name(),
Expand Down
1 change: 0 additions & 1 deletion src/phoebus_utils/variables.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,6 @@ namespace diagnostic_variables {
VARIABLE_NONS(divb);
VARIABLE_NONS(ratio_divv_cs);
VARIABLE_NONS(entropy_z_0);
VARIABLE_NONS(central_density);
VARIABLE_NONS(localization_function);
VARIABLE_CUSTOM(divf, flux_divergence);
VARIABLE_NONS(src_terms);
Expand Down

0 comments on commit 7f64429

Please sign in to comment.