Skip to content

Commit

Permalink
Use hydro speeds in GRMHD HLL where magnetic field is zero
Browse files Browse the repository at this point in the history
  • Loading branch information
nilsdeppe committed Nov 26, 2024
1 parent eeafc0d commit 3e37f0d
Show file tree
Hide file tree
Showing 38 changed files with 1,383 additions and 241 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,13 @@ std::optional<std::string> ConstraintPreservingFreeOutflow::dg_ghost(
const gsl::not_null<Scalar<DataVector>*> gamma2,
const gsl::not_null<Scalar<DataVector>*> lapse,
const gsl::not_null<tnsr::I<DataVector, 3, Frame::Inertial>*> shift,
const gsl::not_null<tnsr::i<DataVector, 3, Frame::Inertial>*>
spatial_velocity_one_form,
const gsl::not_null<Scalar<DataVector>*> rest_mass_density,
const gsl::not_null<Scalar<DataVector>*> electron_fraction,
const gsl::not_null<Scalar<DataVector>*> temperature,
const gsl::not_null<tnsr::I<DataVector, 3, Frame::Inertial>*>
spatial_velocity,
const gsl::not_null<tnsr::II<DataVector, 3, Frame::Inertial>*>
inv_spatial_metric,

Expand All @@ -72,6 +79,7 @@ std::optional<std::string> ConstraintPreservingFreeOutflow::dg_ghost(
const tnsr::I<DataVector, 3, Frame::Inertial>& interior_magnetic_field,
const Scalar<DataVector>& interior_lorentz_factor,
const Scalar<DataVector>& interior_pressure,
const Scalar<DataVector>& interior_temperature,

const tnsr::I<DataVector, 3, Frame::Inertial>& /*coords*/,
const Scalar<DataVector>& interior_gamma1,
Expand Down Expand Up @@ -112,14 +120,16 @@ std::optional<std::string> ConstraintPreservingFreeOutflow::dg_ghost(
tilde_d_flux, tilde_ye_flux, tilde_tau_flux, tilde_s_flux,
tilde_b_flux, tilde_phi_flux,

lapse, shift, inv_spatial_metric,
lapse, shift, spatial_velocity_one_form, rest_mass_density,
electron_fraction, temperature, spatial_velocity,
inv_spatial_metric,

face_mesh_velocity, normal_covector, normal_vector,

interior_rest_mass_density, interior_electron_fraction,
interior_specific_internal_energy, interior_spatial_velocity,
interior_magnetic_field, interior_lorentz_factor,
interior_pressure,
interior_pressure, interior_temperature,

*shift, *lapse, *inv_spatial_metric);
}
Expand Down Expand Up @@ -153,6 +163,7 @@ std::optional<std::string> ConstraintPreservingFreeOutflow::dg_time_derivative(
const tnsr::I<DataVector, 3, Frame::Inertial>& /*interior_magnetic_field*/,
const Scalar<DataVector>& /*interior_lorentz_factor*/,
const Scalar<DataVector>& /*interior_pressure*/,
const Scalar<DataVector>& /*interior_temperature*/,

// c.f. dg_interior_temporary_tags
const tnsr::I<DataVector, 3, Frame::Inertial>& coords,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,8 @@ class ConstraintPreservingFreeOutflow final : public BoundaryCondition {
hydro::Tags::SpatialVelocity<DataVector, 3>,
hydro::Tags::MagneticField<DataVector, 3>,
hydro::Tags::LorentzFactor<DataVector>,
hydro::Tags::Pressure<DataVector>>;
hydro::Tags::Pressure<DataVector>,
hydro::Tags::Temperature<DataVector>>;
using dg_gridless_tags = tmpl::list<>;

static std::optional<std::string> dg_ghost(
Expand All @@ -119,6 +120,12 @@ class ConstraintPreservingFreeOutflow final : public BoundaryCondition {
gsl::not_null<Scalar<DataVector>*> gamma2,
gsl::not_null<Scalar<DataVector>*> lapse,
gsl::not_null<tnsr::I<DataVector, 3, Frame::Inertial>*> shift,
gsl::not_null<tnsr::i<DataVector, 3, Frame::Inertial>*>
spatial_velocity_one_form,
gsl::not_null<Scalar<DataVector>*> rest_mass_density,
gsl::not_null<Scalar<DataVector>*> electron_fraction,
gsl::not_null<Scalar<DataVector>*> temperature,
gsl::not_null<tnsr::I<DataVector, 3, Frame::Inertial>*> spatial_velocity,
gsl::not_null<tnsr::II<DataVector, 3, Frame::Inertial>*>
inv_spatial_metric,

Expand All @@ -138,6 +145,7 @@ class ConstraintPreservingFreeOutflow final : public BoundaryCondition {
const tnsr::I<DataVector, 3, Frame::Inertial>& interior_magnetic_field,
const Scalar<DataVector>& interior_lorentz_factor,
const Scalar<DataVector>& interior_pressure,
const Scalar<DataVector>& interior_temperature,

const tnsr::I<DataVector, 3, Frame::Inertial>& /*coords*/,
const Scalar<DataVector>& interior_gamma1,
Expand Down Expand Up @@ -208,6 +216,7 @@ class ConstraintPreservingFreeOutflow final : public BoundaryCondition {
Frame::Inertial>& /*interior_magnetic_field*/,
const Scalar<DataVector>& /*interior_lorentz_factor*/,
const Scalar<DataVector>& /*interior_pressure*/,
const Scalar<DataVector>& /*interior_temperature*/,

// c.f. dg_interior_temporary_tags
const tnsr::I<DataVector, 3, Frame::Inertial>& coords,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,13 @@ std::optional<std::string> DirichletAnalytic::dg_ghost(
const gsl::not_null<Scalar<DataVector>*> gamma2,
const gsl::not_null<Scalar<DataVector>*> lapse,
const gsl::not_null<tnsr::I<DataVector, 3, Frame::Inertial>*> shift,
const gsl::not_null<tnsr::i<DataVector, 3, Frame::Inertial>*>
spatial_velocity_one_form,
const gsl::not_null<Scalar<DataVector>*> rest_mass_density,
const gsl::not_null<Scalar<DataVector>*> electron_fraction,
const gsl::not_null<Scalar<DataVector>*> temperature,
const gsl::not_null<tnsr::I<DataVector, 3, Frame::Inertial>*>
spatial_velocity,
const gsl::not_null<tnsr::II<DataVector, 3, Frame::Inertial>*>
inv_spatial_metric,

Expand All @@ -129,6 +136,7 @@ std::optional<std::string> DirichletAnalytic::dg_ghost(
hydro::Tags::ElectronFraction<DataVector>,
hydro::Tags::SpecificInternalEnergy<DataVector>,
hydro::Tags::Pressure<DataVector>,
hydro::Tags::Temperature<DataVector>,
hydro::Tags::SpatialVelocity<DataVector, 3>,
hydro::Tags::LorentzFactor<DataVector>,
hydro::Tags::MagneticField<DataVector, 3>,
Expand All @@ -150,6 +158,7 @@ std::optional<std::string> DirichletAnalytic::dg_ghost(
hydro::Tags::ElectronFraction<DataVector>,
hydro::Tags::SpecificInternalEnergy<DataVector>,
hydro::Tags::Pressure<DataVector>,
hydro::Tags::Temperature<DataVector>,
hydro::Tags::SpatialVelocity<DataVector, 3>,
hydro::Tags::LorentzFactor<DataVector>,
hydro::Tags::MagneticField<DataVector, 3>,
Expand All @@ -176,6 +185,7 @@ std::optional<std::string> DirichletAnalytic::dg_ghost(
hydro::Tags::ElectronFraction<DataVector>,
hydro::Tags::SpecificInternalEnergy<DataVector>,
hydro::Tags::Pressure<DataVector>,
hydro::Tags::Temperature<DataVector>,
hydro::Tags::SpatialVelocity<DataVector, 3>,
hydro::Tags::LorentzFactor<DataVector>,
hydro::Tags::MagneticField<DataVector, 3>,
Expand All @@ -197,6 +207,17 @@ std::optional<std::string> DirichletAnalytic::dg_ghost(
*phi = get<::gh::Tags::Phi<DataVector, 3>>(boundary_values);
*lapse = get<gr::Tags::Lapse<DataVector>>(boundary_values);
*shift = get<gr::Tags::Shift<DataVector, 3>>(boundary_values);
*rest_mass_density =
get<hydro::Tags::RestMassDensity<DataVector>>(boundary_values);
*electron_fraction =
get<hydro::Tags::ElectronFraction<DataVector>>(boundary_values);
*temperature = get<hydro::Tags::Temperature<DataVector>>(boundary_values);
*spatial_velocity =
get<hydro::Tags::SpatialVelocity<DataVector, 3>>(boundary_values);
tenex::evaluate<ti::i>(
spatial_velocity_one_form,
(*spatial_velocity)(ti::J) * (get<gr::Tags::SpatialMetric<DataVector, 3>>(
boundary_values)(ti::i, ti::j)));
*inv_spatial_metric =
get<gr::Tags::InverseSpatialMetric<DataVector, 3>>(boundary_values);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,12 @@ class DirichletAnalytic final : public BoundaryCondition {
gsl::not_null<Scalar<DataVector>*> gamma2,
gsl::not_null<Scalar<DataVector>*> lapse,
gsl::not_null<tnsr::I<DataVector, 3, Frame::Inertial>*> shift,
gsl::not_null<tnsr::i<DataVector, 3, Frame::Inertial>*>
spatial_velocity_one_form,
gsl::not_null<Scalar<DataVector>*> rest_mass_density,
gsl::not_null<Scalar<DataVector>*> electron_fraction,
gsl::not_null<Scalar<DataVector>*> temperature,
gsl::not_null<tnsr::I<DataVector, 3, Frame::Inertial>*> spatial_velocity,
gsl::not_null<tnsr::II<DataVector, 3, Frame::Inertial>*>
inv_spatial_metric,

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,13 @@ std::optional<std::string> DirichletFreeOutflow::dg_ghost(
const gsl::not_null<Scalar<DataVector>*> gamma2,
const gsl::not_null<Scalar<DataVector>*> lapse,
const gsl::not_null<tnsr::I<DataVector, 3, Frame::Inertial>*> shift,
const gsl::not_null<tnsr::i<DataVector, 3, Frame::Inertial>*>
spatial_velocity_one_form,
const gsl::not_null<Scalar<DataVector>*> rest_mass_density,
const gsl::not_null<Scalar<DataVector>*> electron_fraction,
const gsl::not_null<Scalar<DataVector>*> temperature,
const gsl::not_null<tnsr::I<DataVector, 3, Frame::Inertial>*>
spatial_velocity,
const gsl::not_null<tnsr::II<DataVector, 3, Frame::Inertial>*>
inv_spatial_metric,

Expand All @@ -124,6 +131,7 @@ std::optional<std::string> DirichletFreeOutflow::dg_ghost(
const tnsr::I<DataVector, 3, Frame::Inertial>& interior_magnetic_field,
const Scalar<DataVector>& interior_lorentz_factor,
const Scalar<DataVector>& interior_pressure,
const Scalar<DataVector>& interior_temperature,

const tnsr::I<DataVector, 3, Frame::Inertial>& coords,
const Scalar<DataVector>& interior_gamma1,
Expand Down Expand Up @@ -178,14 +186,16 @@ std::optional<std::string> DirichletFreeOutflow::dg_ghost(
tilde_d_flux, tilde_ye_flux, tilde_tau_flux, tilde_s_flux,
tilde_b_flux, tilde_phi_flux,

lapse, shift, inv_spatial_metric,
lapse, shift, spatial_velocity_one_form, rest_mass_density,
electron_fraction, temperature, spatial_velocity,
inv_spatial_metric,

face_mesh_velocity, normal_covector, normal_vector,

interior_rest_mass_density, interior_electron_fraction,
interior_specific_internal_energy, interior_spatial_velocity,
interior_magnetic_field, interior_lorentz_factor,
interior_pressure,
interior_pressure, interior_temperature,

*shift, *lapse, *inv_spatial_metric);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,8 @@ class DirichletFreeOutflow final : public BoundaryCondition {
hydro::Tags::SpatialVelocity<DataVector, 3>,
hydro::Tags::MagneticField<DataVector, 3>,
hydro::Tags::LorentzFactor<DataVector>,
hydro::Tags::Pressure<DataVector>>;
hydro::Tags::Pressure<DataVector>,
hydro::Tags::Temperature<DataVector>>;
using dg_gridless_tags = tmpl::list<::Tags::Time>;
std::optional<std::string> dg_ghost(
gsl::not_null<tnsr::aa<DataVector, 3, Frame::Inertial>*> spacetime_metric,
Expand All @@ -134,6 +135,12 @@ class DirichletFreeOutflow final : public BoundaryCondition {
gsl::not_null<Scalar<DataVector>*> gamma2,
gsl::not_null<Scalar<DataVector>*> lapse,
gsl::not_null<tnsr::I<DataVector, 3, Frame::Inertial>*> shift,
gsl::not_null<tnsr::i<DataVector, 3, Frame::Inertial>*>
spatial_velocity_one_form,
gsl::not_null<Scalar<DataVector>*> rest_mass_density,
gsl::not_null<Scalar<DataVector>*> electron_fraction,
gsl::not_null<Scalar<DataVector>*> temperature,
gsl::not_null<tnsr::I<DataVector, 3, Frame::Inertial>*> spatial_velocity,
gsl::not_null<tnsr::II<DataVector, 3, Frame::Inertial>*>
inv_spatial_metric,

Expand All @@ -149,6 +156,7 @@ class DirichletFreeOutflow final : public BoundaryCondition {
const tnsr::I<DataVector, 3, Frame::Inertial>& interior_magnetic_field,
const Scalar<DataVector>& interior_lorentz_factor,
const Scalar<DataVector>& interior_pressure,
const Scalar<DataVector>& interior_temperature,

const tnsr::I<DataVector, 3, Frame::Inertial>& coords,
const Scalar<DataVector>& interior_gamma1,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
#include "Utilities/Gsl.hpp"
#include "Utilities/PrettyType.hpp"
#include "Utilities/Serialization/CharmPupable.hpp"
#include "Utilities/StdHelpers/RetrieveUniquePtr.hpp"
#include "Utilities/TMPL.hpp"

namespace grmhd::GhValenciaDivClean::BoundaryCorrections {
Expand Down Expand Up @@ -73,7 +74,9 @@ struct ProductOfCorrectionsImpl<
const std::optional<Scalar<DataVector>>& normal_dot_mesh_velocity,

const typename GhVolumeTags::type&... gh_volume_quantities,
const typename ValenciaVolumeTags::type&... valencia_volume_quantities,
decltype(StdHelpers::retrieve(
std::declval<typename ValenciaVolumeTags::
type>()))... valencia_volume_quantities,

const DerivedGhCorrection& gh_correction,
const DerivedValenciaCorrection& valencia_correction) {
Expand All @@ -94,7 +97,7 @@ struct ProductOfCorrectionsImpl<
shuffle_refs)...,
valencia_primitives..., normal_covector, normal_vector,
mesh_velocity, normal_dot_mesh_velocity,
valencia_volume_quantities...));
StdHelpers::retrieve(valencia_volume_quantities)...));
}

static void dg_boundary_terms(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,13 @@ std::optional<std::string> DirichletAnalytic::dg_ghost(

const gsl::not_null<Scalar<DataVector>*> lapse,
const gsl::not_null<tnsr::I<DataVector, 3, Frame::Inertial>*> shift,
const gsl::not_null<tnsr::i<DataVector, 3, Frame::Inertial>*>
spatial_velocity_one_form,
const gsl::not_null<Scalar<DataVector>*> rest_mass_density,
const gsl::not_null<Scalar<DataVector>*> electron_fraction,
const gsl::not_null<Scalar<DataVector>*> temperature,
const gsl::not_null<tnsr::I<DataVector, 3, Frame::Inertial>*>
spatial_velocity,
const gsl::not_null<tnsr::II<DataVector, 3, Frame::Inertial>*>
inv_spatial_metric,

Expand All @@ -116,6 +123,7 @@ std::optional<std::string> DirichletAnalytic::dg_ghost(
hydro::Tags::ElectronFraction<DataVector>,
hydro::Tags::SpecificInternalEnergy<DataVector>,
hydro::Tags::Pressure<DataVector>,
hydro::Tags::Temperature<DataVector>,
hydro::Tags::SpatialVelocity<DataVector, 3>,
hydro::Tags::LorentzFactor<DataVector>,
hydro::Tags::MagneticField<DataVector, 3>,
Expand All @@ -136,6 +144,7 @@ std::optional<std::string> DirichletAnalytic::dg_ghost(
hydro::Tags::ElectronFraction<DataVector>,
hydro::Tags::SpecificInternalEnergy<DataVector>,
hydro::Tags::Pressure<DataVector>,
hydro::Tags::Temperature<DataVector>,
hydro::Tags::SpatialVelocity<DataVector, 3>,
hydro::Tags::LorentzFactor<DataVector>,
hydro::Tags::MagneticField<DataVector, 3>,
Expand All @@ -154,6 +163,7 @@ std::optional<std::string> DirichletAnalytic::dg_ghost(
hydro::Tags::ElectronFraction<DataVector>,
hydro::Tags::SpecificInternalEnergy<DataVector>,
hydro::Tags::Pressure<DataVector>,
hydro::Tags::Temperature<DataVector>,
hydro::Tags::SpatialVelocity<DataVector, 3>,
hydro::Tags::LorentzFactor<DataVector>,
hydro::Tags::MagneticField<DataVector, 3>,
Expand All @@ -170,6 +180,17 @@ std::optional<std::string> DirichletAnalytic::dg_ghost(
*shift = get<gr::Tags::Shift<DataVector, 3>>(boundary_values);
*inv_spatial_metric =
get<gr::Tags::InverseSpatialMetric<DataVector, 3>>(boundary_values);
*rest_mass_density =
get<hydro::Tags::RestMassDensity<DataVector>>(boundary_values);
*electron_fraction =
get<hydro::Tags::ElectronFraction<DataVector>>(boundary_values);
*temperature = get<hydro::Tags::Temperature<DataVector>>(boundary_values);
*spatial_velocity =
get<hydro::Tags::SpatialVelocity<DataVector, 3>>(boundary_values);
tenex::evaluate<ti::i>(
spatial_velocity_one_form,
(*spatial_velocity)(ti::J) * (get<gr::Tags::SpatialMetric<DataVector, 3>>(
boundary_values)(ti::i, ti::j)));
// Recover the conservative variables from the primitives
ConservativeFromPrimitive::apply(
tilde_d, tilde_ye, tilde_tau, tilde_s, tilde_b, tilde_phi,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,13 @@ class DirichletAnalytic final : public BoundaryCondition {

gsl::not_null<Scalar<DataVector>*> lapse,
gsl::not_null<tnsr::I<DataVector, 3, Frame::Inertial>*> shift,
gsl::not_null<tnsr::i<DataVector, 3,
Frame::Inertial>*> /*spatial_velocity_one_form*/,
gsl::not_null<Scalar<DataVector>*> /*rest_mass_density*/,
gsl::not_null<Scalar<DataVector>*> /*electron_fraction*/,
gsl::not_null<Scalar<DataVector>*> /*temperature*/,
gsl::not_null<
tnsr::I<DataVector, 3, Frame::Inertial>*> /*spatial_velocity*/,
gsl::not_null<tnsr::II<DataVector, 3, Frame::Inertial>*>
inv_spatial_metric,

Expand Down
Loading

0 comments on commit 3e37f0d

Please sign in to comment.