Skip to content

Commit

Permalink
Corrections for symmetry factor feature in GRChombo
Browse files Browse the repository at this point in the history
Corrected the params files and any uses of AMRReductions in
both of the Examples, to account for the integral symmetry factor
feature in GRChombo (see GRChombo Issue No. 197). Specifically:

1. Added the symmetry_correction flag to the params files
(under the Boundary Condition parameters)
2. Provided the chombo parameter storing the symmetry factor
to every instance of the norm and sum AMRReductions functions,
in the specificPostTimeStep() function for each example.

Note that the symmetry factor is calculated entirely in the
ChomboParameters.h file of the main GRChombo repo.
  • Loading branch information
the-florist committed Aug 31, 2024
1 parent 495c0b0 commit 159c20e
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 6 deletions.
6 changes: 3 additions & 3 deletions Examples/BoostedBHComplexScalar/BoostedBHScalarLevel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,9 @@ void BoostedBHScalarLevel::specificPostTimeStep()
bool first_step = (m_time == m_dt);
// integrate the densities and write to a file
AMRReductions<VariableType::diagnostic> amr_reductions(m_gr_amr);
double rhoEnergy_sum = amr_reductions.sum(c_rhoEnergy);
double rhoLinMom_sum = amr_reductions.sum(c_rhoLinMom);
double sourceLinMom_sum = amr_reductions.sum(c_sourceLinMom);
double rhoEnergy_sum = amr_reductions.sum(c_rhoEnergy, m_p.symmetry_factor);
double rhoLinMom_sum = amr_reductions.sum(c_rhoLinMom, m_p.symmetry_factor);
double sourceLinMom_sum = amr_reductions.sum(c_sourceLinMom, m_p.symmetry_factor);

SmallDataIO integral_file(m_p.data_path + "EnergyIntegrals", m_dt,
m_time, m_restart_time,
Expand Down
5 changes: 5 additions & 0 deletions Examples/BoostedBHComplexScalar/params.txt
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,11 @@ vars_parity = 0 0 0 0 #phi and Pi (Re and Im)
vars_parity_diagnostic = 0 0 0 #chi, rhoLinMom and rhoEnergy
0 0 0 #fluxLinMom, fluxEnergy and sourceLinMom

# Additionally, if reflective boundaries selected,
# choose if symmetry factor will be applied to integrals.
# 0 = false (default), 1 = true
symmetry_correction = 1

# if sommerfeld boundaries selected, must select
# non zero asymptotic values
num_nonzero_asymptotic_vars = 0
Expand Down
4 changes: 2 additions & 2 deletions Examples/KerrBHScalarField/KerrBHScalarLevel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,8 @@ void KerrBHScalarLevel::specificPostTimeStep()
bool first_step = (m_time == m_dt);
// integrate the densities and write to a file
AMRReductions<VariableType::diagnostic> amr_reductions(m_gr_amr);
double rhoEnergy_sum = amr_reductions.sum(c_rhoEnergy);
double rhoAngMom_sum = amr_reductions.sum(c_rhoAngMom);
double rhoEnergy_sum = amr_reductions.sum(c_rhoEnergy, m_p.symmetry_factor);
double rhoAngMom_sum = amr_reductions.sum(c_rhoAngMom, m_p.symmetry_factor);

SmallDataIO integral_file(m_p.data_path + "EnergyIntegrals", m_dt,
m_time, m_restart_time,
Expand Down
7 changes: 6 additions & 1 deletion Examples/KerrBHScalarField/params.txt
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,12 @@ lo_boundary = 1 1 2
vars_parity = 0 0 0 0 #phi and Pi (Re and Im)
vars_parity_diagnostic = 0 0 0 #chi, rhoEnergy and rhoAngMom
0 0 0 #sourceAngMom, fluxAngMom and fluxEnergy


# Additionally, if reflective boundaries selected,
# choose if symmetry factor will be applied to integrals.
# 0 = false (default), 1 = true
symmetry_correction = 1

# if sommerfeld boundaries selected, must select
# non zero asymptotic values
num_nonzero_asymptotic_vars = 0
Expand Down

0 comments on commit 159c20e

Please sign in to comment.