Skip to content

Commit

Permalink
General P_over_rho in InitialData and PrimitiveRecovery
Browse files Browse the repository at this point in the history
  • Loading branch information
dinatraykova committed Mar 28, 2024
1 parent ee5bbb4 commit bc298f0
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 30 deletions.
3 changes: 1 addition & 2 deletions Examples/Fluid_Kerr/DefaultEoS.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@ class DefaultEoS
template <class data_t, template <typename> class vars_t>
void compute_eos(data_t &P_over_rho, const vars_t<data_t> &vars) const
{
// The pressure value in function of rho
P_over_rho = 1. / 3.;
P_over_rho = (1. + vars.eps) / 3.;
}
};

Expand Down
15 changes: 3 additions & 12 deletions Examples/Fluid_Kerr/EoS.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,25 +10,16 @@

class EoS
{
public:
struct params_t
{
double eos_w;
};

private:
params_t m_params;

public:
//! The constructor
EoS(params_t a_params) : m_params(a_params) {}
EoS() {}

//! Set the pressure of the perfect fluid here
template <class data_t, template <typename> class vars_t>
void compute_eos(data_t &P_over_rho, const vars_t<data_t> &vars) const
{
// The pressure value in function of rho
P_over_rho = m_params.eos_w * (1. + vars.eps);
// The pressure value as a function of rho
P_over_rho = (1. + vars.eps) / 3.;
}
};

Expand Down
5 changes: 1 addition & 4 deletions Examples/Fluid_Kerr/InitialFluidData.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
#include "simd.hpp"

//! Class which sets the initial fluid matter config
class InitialFluidData
class InitialFluidData : public EoS
{
public:
//! A structure for the input params for fluid properties and initial
Expand All @@ -33,9 +33,6 @@ class InitialFluidData

//! The constructor
InitialFluidData(params_t a_params, double a_dx);
// : m_dx(a_dx), m_params(a_params)
//{
//}

//! Function to compute the value of all the initial vars on the grid
//! The constructor
Expand Down
8 changes: 4 additions & 4 deletions Examples/Fluid_Kerr/InitialFluidData.impl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,10 @@ inline InitialFluidData::InitialFluidData(params_t a_params, double a_dx)
template <class data_t>
void InitialFluidData::compute(Cell<data_t> current_cell) const
{
// Set up EoS
// data_t P_over_rho = 0.;
// my_eos.compute_eos(P_over_rho, vars);
// load vars
FluidCCZ4RHS<PerfectFluid<>>::Vars<data_t> vars;
VarsTools::assign(vars, 0.);

// where am i?
Coordinates<data_t> coords(current_cell, m_dx, m_params.center);
data_t rr = coords.get_radius();
Expand All @@ -46,7 +44,9 @@ void InitialFluidData::compute(Cell<data_t> current_cell) const
data_t v2 = 0.;
FOR(i, j) v2 += vars.h[i][j] * vars.vi[i] * vars.vi[j] / chi_regularised;
vars.eps = 0.;
data_t P_over_rho = vars.rho * (1. + vars.eps) / 3.;
data_t P_over_rho = 0.;
EoS::compute_eos(P_over_rho, vars);

data_t WW = 1. / (1. - v2);
data_t hh = 1. + vars.eps + P_over_rho;

Expand Down
6 changes: 2 additions & 4 deletions Examples/Fluid_Kerr/PerfectFluidLevel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,6 @@ void PerfectFluidLevel::initialData()

// First set everything to zero then initial conditions for scalar field -
// here a Kerr BH and a scalar field profile
// EoS eos(m_p.eos_params);
// PerfectFluidEoS perfect_fluid(eos);
BoxLoops::loop(
make_compute_pack(SetValue(0.), KerrBH(m_p.kerr_params, m_dx),
InitialFluidData(m_p.initial_params, m_dx)),
Expand All @@ -73,7 +71,7 @@ void PerfectFluidLevel::initialData()
void PerfectFluidLevel::prePlotLevel()
{
fillAllGhosts();
EoS eos(m_p.eos_params);
EoS eos;
PerfectFluidEoS perfect_fluid(m_dx, m_p.lambda, eos);
BoxLoops::loop(MatterConstraints<PerfectFluidEoS>(perfect_fluid, m_dx,
m_p.G_Newton, c_Ham,
Expand All @@ -93,7 +91,7 @@ void PerfectFluidLevel::specificEvalRHS(GRLevelData &a_soln, GRLevelData &a_rhs,
a_soln, a_soln, INCLUDE_GHOST_CELLS, disable_simd());

// Calculate MatterCCZ4 right hand side with matter_t = ScalarField
EoS eos(m_p.eos_params);
EoS eos;
PerfectFluidEoS perfect_fluid(m_dx, m_p.lambda, eos);
if (m_p.max_spatial_derivative_order == 4)
{
Expand Down
5 changes: 3 additions & 2 deletions Examples/Fluid_Kerr/PrimitiveRecovery.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,14 @@
#include "CCZ4Geometry.hpp"
#include "Cell.hpp"
#include "DefaultEoS.hpp"
#include "EoS.hpp"
#include "Tensor.hpp"
#include "TensorAlgebra.hpp"
#include "UserVariables.hpp"
#include "VarsTools.hpp"

// template <class eos_t = DefaultEoS>
class PrimitiveRecovery
class PrimitiveRecovery : public EoS
{
public:
template <class data_t> struct Vars
Expand Down Expand Up @@ -50,7 +51,7 @@ class PrimitiveRecovery

vars.rho = vars.D / Wa;
vars.eps = -1. + xa / Wa * (1. - Wa * Wa) + Wa * (1. + q);
P_over_rho = (1. + vars.eps) / 3.;
EoS::compute_eos(P_over_rho, vars);

xn = Wa * (1. + vars.eps + P_over_rho);
diff = abs(xn - xa);
Expand Down
2 changes: 0 additions & 2 deletions Examples/Fluid_Kerr/SimulationParameters.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ class SimulationParameters : public SimulationParametersBase
pp.load("fluid_width", initial_params.awidth, 0.1);
pp.load("fluid_delta", initial_params.delta, 0.2);
pp.load("lambda", lambda, 1.); // eigenvalue for numerical flux
pp.load("eos_w", eos_params.eos_w, 1. / 3.);

// Initial Kerr data
pp.load("kerr_mass", kerr_params.mass);
Expand Down Expand Up @@ -67,7 +66,6 @@ class SimulationParameters : public SimulationParametersBase
double G_Newton;
double lambda;
InitialFluidData::params_t initial_params;
EoS::params_t eos_params;
KerrBH::params_t kerr_params;
};

Expand Down

0 comments on commit bc298f0

Please sign in to comment.