Skip to content

Commit

Permalink
Add bmag calc for cluster
Browse files Browse the repository at this point in the history
  • Loading branch information
pgrete committed Oct 17, 2023
1 parent fe532fd commit d83ef78
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/pgen/cluster.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
#include <string> // c_str()

// Parthenon headers
#include "Kokkos_MathematicalFunctions.hpp"
#include "kokkos_abstraction.hpp"
#include "mesh/domain.hpp"
#include "mesh/mesh.hpp"
Expand Down Expand Up @@ -80,7 +81,6 @@ void ClusterUnsplitSrcTerm(MeshData<Real> *md, const parthenon::SimTime &tm,

const auto &snia_feedback = hydro_pkg->Param<SNIAFeedback>("snia_feedback");
snia_feedback.FeedbackSrcTerm(md, beta_dt, tm);

};
void ClusterSplitSrcTerm(MeshData<Real> *md, const parthenon::SimTime &tm,
const Real dt) {
Expand Down Expand Up @@ -360,6 +360,9 @@ void ProblemInitPackageData(ParameterInput *pin, parthenon::StateDescriptor *hyd

// plasma beta
hydro_pkg->AddField("plasma_beta", m);

// plasma beta
hydro_pkg->AddField("B_mag", m);
}

/************************************************************
Expand Down Expand Up @@ -885,6 +888,7 @@ void UserWorkBeforeOutput(MeshBlock *pmb, ParameterInput *pin) {
if (pkg->Param<Fluid>("fluid") == Fluid::glmmhd) {
auto &plasma_beta = data->Get("plasma_beta").data;
auto &mach_alfven = data->Get("mach_alfven").data;
auto &b_mag = data->Get("B_mag").data;

pmb->par_for(
"Cluster::UserWorkBeforeOutput::MHD", kb.s, kb.e, jb.s, jb.e, ib.s, ib.e,
Expand All @@ -897,6 +901,8 @@ void UserWorkBeforeOutput(MeshBlock *pmb, ParameterInput *pin) {
const Real Bz = prim(IB3, k, j, i);
const Real B2 = (SQR(Bx) + SQR(By) + SQR(Bz));

b_mag(k, j, i) = Kokkos::sqrt(B2);

// compute Alfven mach number
const Real v_A = std::sqrt(B2 / rho);
const Real c_s = std::sqrt(gam * P / rho); // ideal gas EOS
Expand Down

0 comments on commit d83ef78

Please sign in to comment.