-
Notifications
You must be signed in to change notification settings - Fork 53
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bugfix/integral symmetry factor #256
base: main
Are you sure you want to change the base?
Changes from 20 commits
ba1bfd9
cbd4298
4c790f6
62fab66
4aef8c9
e7d64cd
ea2bb8d
b40f45f
f9fa5f3
cd53124
ae197d4
1eb4cd3
dd57179
d6808dc
d01cdf7
8bbb859
5b6c063
a4e72e0
327021d
0bee0fa
634240c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,7 +9,7 @@ | |
verbosity = 0 | ||
|
||
# location / naming of output files | ||
# output_path = "" # Main path for all files. Must exist! | ||
output_path = "/nfs/st01/hpc-gr-epss/eaf49/PR-dump" # Main path for all files. Must exist! | ||
chk_prefix = BinaryBHChk_ | ||
plot_prefix = BinaryBHPlot_ | ||
# restart_file = BinaryBHChk_000360.3d.hdf5 | ||
|
@@ -108,6 +108,11 @@ 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 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As per comment below, I think we could remove all of these and have it always on. |
||
symmetry_correction = 1 | ||
|
||
# if sommerfeld boundaries selected, must select | ||
# non zero asymptotic values | ||
num_nonzero_asymptotic_vars = 5 | ||
|
@@ -155,7 +160,7 @@ sigma = 0.3 | |
track_punctures = 1 | ||
puncture_tracking_level = 1 | ||
|
||
# calculate_constraint_norms = 0 | ||
calculate_constraint_norms = 1 | ||
|
||
# min_chi = 1.e-4 | ||
# min_lapse = 1.e-4 | ||
|
@@ -183,14 +188,15 @@ modes = 2 0 # l m for spherical harmonics | |
################################################# | ||
# Apparent Horizon Finder parameters | ||
|
||
AH_activate = 1 | ||
AH_num_ranks = 4 | ||
AH_num_points_u = 11 | ||
AH_num_points_v = 10 | ||
AH_solve_interval = 2 | ||
AH_print_interval = 2 | ||
AH_activate = 0 | ||
AH_num_ranks = 65 | ||
AH_num_points_u = 65 | ||
AH_num_points_v = 48 | ||
# AH_solve_interval = 2 | ||
# AH_print_interval = 2 | ||
# AH_merger_search_factor = 1. | ||
# AH_merger_pre_factor = 1. | ||
AH_set_origins_to_punctures = 1 | ||
|
||
################################################# | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,7 +14,8 @@ template <VariableType var_t> | |
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_coarsest_dx(a_gramr.get_gramrlevels()[0]->get_dx()), | ||
m_symmetry_factor(a_gramr.get_gramrlevels()[0]->get_symm()) | ||
{ | ||
set_level_data_vect(a_gramr); | ||
set_ref_ratios_vect(a_gramr); | ||
|
@@ -109,7 +110,7 @@ Real AMRReductions<var_t>::norm(const Interval &a_vars, | |
pow(m_domain_volume, 1.0 / static_cast<double>(a_norm_exponent)); | ||
} | ||
|
||
return norm; | ||
return norm * static_cast<double>(m_symmetry_factor); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think this needs to take account of the value of |
||
} | ||
|
||
template <VariableType var_t> | ||
|
@@ -125,7 +126,8 @@ Real AMRReductions<var_t>::sum(const Interval &a_vars) const | |
CH_assert(a_vars.begin() >= 0 && a_vars.end() < m_num_vars); | ||
CH_TIME("AMRReductions::sum"); | ||
return computeSum(m_level_data_ptrs, m_ref_ratios, m_coarsest_dx, a_vars, | ||
m_base_level); | ||
m_base_level) * | ||
static_cast<double>(m_symmetry_factor); | ||
} | ||
|
||
template <VariableType var_t> | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -34,6 +34,7 @@ BoundaryConditions::params_t::params_t() | |
vars_parity_diagnostic.fill(BoundaryConditions::EXTRAPOLATING_BC); | ||
vars_asymptotic_values.fill(0.0); | ||
extrapolation_order = 1; | ||
symmetry_factor = 1; | ||
} | ||
|
||
void BoundaryConditions::params_t::set_is_periodic( | ||
|
@@ -141,6 +142,23 @@ void BoundaryConditions::params_t::read_params(GRParmParse &pp) | |
|
||
if (reflective_boundaries_exist) | ||
{ | ||
int symmetry_correction = 0; | ||
pp.load("symmetry_correction", symmetry_correction, 0); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would actually be tempted just to remove the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. (Also just for reference from a code convention perspective it should be a bool called |
||
if (symmetry_correction != 0) | ||
{ | ||
for (int d = 0; d < CH_SPACEDIM; d++) | ||
{ | ||
if (lo_boundary[d] == 2) | ||
{ | ||
symmetry_factor *= 2; | ||
} | ||
else if (hi_boundary[d] == 2) | ||
{ | ||
symmetry_factor *= 2; | ||
} | ||
} | ||
} | ||
|
||
pp.load("vars_parity", vars_parity); | ||
if (pp.contains("vars_parity_diagnostic")) | ||
pp.load("vars_parity_diagnostic", vars_parity_diagnostic); | ||
|
@@ -215,6 +233,7 @@ void BoundaryConditions::define(double a_dx, | |
{ | ||
m_dx = a_dx; | ||
m_params = a_params; | ||
m_symmetry_factor = a_params.symmetry_factor; | ||
m_domain = a_domain; | ||
m_domain_box = a_domain.domainBox(); | ||
m_num_ghosts = a_num_ghosts; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -73,6 +73,7 @@ class BoundaryConditions | |
bool sommerfeld_boundaries_exist; | ||
bool extrapolating_boundaries_exist; | ||
bool mixed_boundaries_exist; | ||
int symmetry_factor; | ||
|
||
std::array<int, NUM_VARS> vars_parity; | ||
std::array<int, NUM_DIAGNOSTIC_VARS> | ||
|
@@ -97,11 +98,14 @@ class BoundaryConditions | |
ProblemDomain m_domain; // the problem domain (excludes boundary cells) | ||
Box m_domain_box; // The box representing the domain | ||
bool is_defined; // whether the BoundaryConditions class members are defined | ||
int m_symmetry_factor; | ||
|
||
public: | ||
/// Default constructor - need to call define afterwards | ||
BoundaryConditions() { is_defined = false; } | ||
|
||
int get_symm() const { return m_symmetry_factor; } | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Abbreviated names are against our conventions :-) Amend to |
||
|
||
/// define function sets members and is_defined set to true | ||
void define(double a_dx, std::array<double, CH_SPACEDIM> a_center, | ||
const params_t &a_params, ProblemDomain a_domain, | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -177,6 +177,10 @@ 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 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ditto - no abbreviation here. |
||
{ | ||
return m_boundaries.get_symm(); | ||
} | ||
|
||
/// Returns true if m_time is the same as the time at the end of the current | ||
/// timestep on level a_level and false otherwise | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
for f in $(find . -name "*.hpp"); do clang-format -style=file -i $f; done | ||
for f in $(find . -name "*.cpp"); do clang-format -style=file -i $f; done | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Your output path sneaked in here :-)