Skip to content

Commit

Permalink
Fixed Katy's comments on PR
Browse files Browse the repository at this point in the history
1. Removed symmetry_correction flag, making the symmetry factor
   calculation automatic.
2. Moved application of symmetry factor in AMRReductions::norm function
   into the logic block controlled by the a_normalize_by_volume flag, so
that only when normalising by the volume will the symmetry factor be
applied.
3. Changed get_symm() function names to get_symmetry_factor() (coding
   convention).
4. Removed file path in params_very_cheap.txt in BinarBH example.
  • Loading branch information
the-florist committed Oct 14, 2024
1 parent 0bee0fa commit 634240c
Show file tree
Hide file tree
Showing 10 changed files with 14 additions and 48 deletions.
5 changes: 0 additions & 5 deletions Examples/BinaryBH/params.txt
Original file line number Diff line number Diff line change
Expand Up @@ -108,11 +108,6 @@ vars_parity = 0 0 4 6 0 5 0 #chi and hij
vars_parity_diagnostic = 0 1 2 3 #Ham and Mom
0 7 #Weyl

# 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
# asymptotic values
num_nonzero_asymptotic_vars = 5
Expand Down
5 changes: 0 additions & 5 deletions Examples/BinaryBH/params_two_punctures.txt
Original file line number Diff line number Diff line change
Expand Up @@ -108,11 +108,6 @@ vars_parity = 0 0 4 6 0 5 0 #chi and hij
vars_parity_diagnostic = 0 1 2 3 #Ham and Mom
0 7 #Weyl

# 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
# asymptotic values
num_nonzero_asymptotic_vars = 5
Expand Down
7 changes: 1 addition & 6 deletions Examples/BinaryBH/params_very_cheap.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
verbosity = 0

# location / naming of output files
output_path = "/nfs/st01/hpc-gr-epss/eaf49/PR-dump" # Main path for all files. Must exist!
# output_path = "" # Main path for all files. Must exist!
chk_prefix = BinaryBHChk_
plot_prefix = BinaryBHPlot_
# restart_file = BinaryBHChk_000360.3d.hdf5
Expand Down Expand Up @@ -108,11 +108,6 @@ vars_parity = 0 0 4 6 0 5 0 #chi and hij
vars_parity_diagnostic = 0 1 2 3 #Ham and Mom
0 7 #Weyl

# 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 = 5
Expand Down
5 changes: 0 additions & 5 deletions Examples/KerrBH/params.txt
Original file line number Diff line number Diff line change
Expand Up @@ -96,11 +96,6 @@ vars_parity = 0 0 4 6 0 5 0 #chi and hij
0 1 2 3 1 2 3 #lapse shift and B
vars_parity_diagnostic = 0 1 2 3 #Ham and Mom

# 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 = 5
Expand Down
5 changes: 0 additions & 5 deletions Examples/KerrBH/params_cheap.txt
Original file line number Diff line number Diff line change
Expand Up @@ -97,11 +97,6 @@ vars_parity = 0 0 4 6 0 5 0 #chi and hij
0 1 2 3 1 2 3 #lapse shift and B
vars_parity_diagnostic = 0 1 2 3 #Ham and Mom

# 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 = 5
Expand Down
5 changes: 0 additions & 5 deletions Examples/ScalarField/params.txt
Original file line number Diff line number Diff line change
Expand Up @@ -114,11 +114,6 @@ vars_parity = 0 0 4 6 0 5 0 #chi and hij
0 0 #phi and Pi
vars_parity_diagnostic = 0 1 2 3 #Ham and Mom

# 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 = 5
Expand Down
5 changes: 3 additions & 2 deletions Source/BoxUtils/AMRReductions.impl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ AMRReductions<var_t>::AMRReductions(const GRAMR &a_gramr,
const int a_base_level)
: m_base_level(a_base_level),
m_coarsest_dx(a_gramr.get_gramrlevels()[0]->get_dx()),
m_symmetry_factor(a_gramr.get_gramrlevels()[0]->get_symm())
m_symmetry_factor(a_gramr.get_gramrlevels()[0]->get_symmetry_factor())
{
set_level_data_vect(a_gramr);
set_ref_ratios_vect(a_gramr);
Expand Down Expand Up @@ -108,9 +108,10 @@ Real AMRReductions<var_t>::norm(const Interval &a_vars,
{
norm /=
pow(m_domain_volume, 1.0 / static_cast<double>(a_norm_exponent));
norm *= static_cast<double>(m_symmetry_factor);
}

return norm * static_cast<double>(m_symmetry_factor);
return norm;
}

template <VariableType var_t>
Expand Down
19 changes: 7 additions & 12 deletions Source/GRChomboCore/BoundaryConditions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -142,20 +142,15 @@ void BoundaryConditions::params_t::read_params(GRParmParse &pp)

if (reflective_boundaries_exist)
{
int symmetry_correction = 0;
pp.load("symmetry_correction", symmetry_correction, 0);
if (symmetry_correction != 0)
for (int d = 0; d < CH_SPACEDIM; d++)
{
for (int d = 0; d < CH_SPACEDIM; d++)
if (lo_boundary[d] == 2)
{
if (lo_boundary[d] == 2)
{
symmetry_factor *= 2;
}
else if (hi_boundary[d] == 2)
{
symmetry_factor *= 2;
}
symmetry_factor *= 2;
}
else if (hi_boundary[d] == 2)
{
symmetry_factor *= 2;
}
}

Expand Down
2 changes: 1 addition & 1 deletion Source/GRChomboCore/BoundaryConditions.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ class BoundaryConditions
/// Default constructor - need to call define afterwards
BoundaryConditions() { is_defined = false; }

int get_symm() const { return m_symmetry_factor; }
int get_symmetry_factor() const { return m_symmetry_factor; }

/// define function sets members and is_defined set to true
void define(double a_dx, std::array<double, CH_SPACEDIM> a_center,
Expand Down
4 changes: 2 additions & 2 deletions Source/GRChomboCore/GRAMRLevel.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -177,9 +177,9 @@ class GRAMRLevel : public AMRLevel, public InterpSource<>

// direction irrelevant, but relevant for InterpSource
ALWAYS_INLINE double get_dx(int dir = 0) const { return m_dx; };
ALWAYS_INLINE int get_symm(int dir = 0) const
ALWAYS_INLINE int get_symmetry_factor(int dir = 0) const
{
return m_boundaries.get_symm();
return m_boundaries.get_symmetry_factor();
}

/// Returns true if m_time is the same as the time at the end of the current
Expand Down

0 comments on commit 634240c

Please sign in to comment.