-
Notifications
You must be signed in to change notification settings - Fork 54
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
Add ADM Mass / Spin and Extrapolation to Infinity #121
base: main
Are you sure you want to change the base?
Changes from all commits
e733757
6e165f7
23e2bfb
229908c
b77e7dd
8d2f682
613b4b9
6a80629
03f8455
26a87a5
ecc83d2
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 | ||||
---|---|---|---|---|---|---|
|
@@ -6,7 +6,7 @@ | |||||
#include "KerrBHLevel.hpp" | ||||||
#include "BoxLoops.hpp" | ||||||
#include "CCZ4RHS.hpp" | ||||||
#include "ChiTaggingCriterion.hpp" | ||||||
#include "ChiExtractionTaggingCriterion.hpp" | ||||||
#include "ComputePack.hpp" | ||||||
#include "KerrBHLevel.hpp" | ||||||
#include "NanCheck.hpp" | ||||||
|
@@ -20,6 +20,9 @@ | |||||
#include "GammaCalculator.hpp" | ||||||
#include "KerrBH.hpp" | ||||||
|
||||||
#include "ADMQuantities.hpp" | ||||||
#include "ADMQuantitiesExtraction.hpp" | ||||||
|
||||||
void KerrBHLevel::specificAdvance() | ||||||
{ | ||||||
// Enforce the trace free A_ij condition and positive chi and alpha | ||||||
|
@@ -38,9 +41,9 @@ void KerrBHLevel::initialData() | |||||
if (m_verbosity) | ||||||
pout() << "KerrBHLevel::initialData " << m_level << endl; | ||||||
|
||||||
// First set everything to zero then calculate initial data Get the Kerr | ||||||
// solution in the variables, then calculate the \tilde\Gamma^i numerically | ||||||
// as these are non zero and not calculated in the Kerr ICs | ||||||
// First set everything to zero then calculate initial data | ||||||
// Get the Kerr solution in the variables, then calculate the \tilde\Gamma^i | ||||||
// numerically as these are non zero and not calculated in the Kerr ICs | ||||||
BoxLoops::loop( | ||||||
make_compute_pack(SetValue(0.), KerrBH(m_p.kerr_params, m_dx)), | ||||||
m_state_new, m_state_new, INCLUDE_GHOST_CELLS); | ||||||
|
@@ -97,5 +100,39 @@ void KerrBHLevel::preTagCells() | |||||
void KerrBHLevel::computeTaggingCriterion(FArrayBox &tagging_criterion, | ||||||
const FArrayBox ¤t_state) | ||||||
{ | ||||||
BoxLoops::loop(ChiTaggingCriterion(m_dx), current_state, tagging_criterion); | ||||||
BoxLoops::loop(ChiExtractionTaggingCriterion(m_dx, m_level, m_p.max_level, | ||||||
m_p.extraction_params, | ||||||
m_p.activate_extraction), | ||||||
current_state, tagging_criterion); | ||||||
} | ||||||
|
||||||
void KerrBHLevel::specificPostTimeStep() | ||||||
{ | ||||||
CH_TIME("KerrBHLevel::specificPostTimeStep"); | ||||||
// Do the extraction on the min extraction level | ||||||
if (m_p.activate_extraction == 1) | ||||||
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. Pretty sure you corrected this elsewhere.
Suggested change
|
||||||
{ | ||||||
int min_level = m_p.extraction_params.min_extraction_level(); | ||||||
bool calculate_adm = at_level_timestep_multiple(min_level); | ||||||
if (calculate_adm) | ||||||
{ | ||||||
// Populate the ADM Mass and Spin values on the grid | ||||||
fillAllGhosts(); | ||||||
BoxLoops::loop(ADMQuantities(m_p.extraction_params.center, m_dx, | ||||||
c_Madm, c_Jadm), | ||||||
m_state_new, m_state_diagnostics, | ||||||
EXCLUDE_GHOST_CELLS); | ||||||
|
||||||
if (m_level == min_level) | ||||||
{ | ||||||
CH_TIME("ADMExtraction"); | ||||||
// Now refresh the interpolator and do the interpolation | ||||||
m_gr_amr.m_interpolator->refresh(); | ||||||
ADMQuantitiesExtraction my_extraction( | ||||||
m_p.extraction_params, m_dt, m_time, m_restart_time, c_Madm, | ||||||
c_Jadm); | ||||||
my_extraction.execute_query(m_gr_amr.m_interpolator); | ||||||
} | ||||||
} | ||||||
} | ||||||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -29,6 +29,8 @@ class SimulationParameters : public SimulationParametersBase | |
pp.load("kerr_mass", kerr_params.mass); | ||
pp.load("kerr_spin", kerr_params.spin); | ||
pp.load("kerr_center", kerr_params.center, center); | ||
|
||
pp.load("activate_extraction", activate_extraction, false); | ||
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. Might as well use the one in |
||
} | ||
|
||
void check_params() | ||
|
@@ -51,6 +53,7 @@ class SimulationParameters : public SimulationParametersBase | |
} | ||
|
||
KerrBH::params_t kerr_params; | ||
bool activate_extraction; | ||
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 above) |
||
}; | ||
|
||
#endif /* SIMULATIONPARAMETERS_HPP_ */ |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -95,6 +95,7 @@ vars_parity = 0 0 4 6 0 5 0 #chi and hij | |
0 1 2 3 #Theta and Gamma | ||
0 1 2 3 1 2 3 #lapse shift and B | ||
vars_parity_diagnostic = 0 1 2 3 #Ham and Mom | ||
0 0 #ADM M and J | ||
|
||
# if sommerfeld boundaries selected, must select | ||
# non zero asymptotic values | ||
|
@@ -144,4 +145,26 @@ sigma = 0.3 | |
# min_lapse = 1.e-4 | ||
|
||
################################################# | ||
# Extraction parameters | ||
|
||
# extraction_center = 256 256 256 # defaults to center | ||
activate_extraction = 1 | ||
num_extraction_radii = 3 | ||
extraction_radii = 30. 40. 50. | ||
extraction_levels = 2 1 0 | ||
num_points_phi = 50 | ||
num_points_theta = 51 | ||
# num_modes = 3 | ||
# modes = 2 0 # l m for spherical harmonics | ||
# 2 1 | ||
# 2 2 | ||
|
||
# integral_file_prefix = "Weyl4_mode_" | ||
|
||
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. Can you add the extrapolation parameters here (even if just commented out)? |
||
# write_extraction = 0 | ||
# extraction_subpath = "data/extraction" # directory for 'write_extraction = 1' | ||
# extraction_file_prefix = "Weyl4_extraction_" | ||
|
||
################################################# | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -95,6 +95,7 @@ vars_parity = 0 0 4 6 0 5 0 #chi and hij | |
0 1 2 3 #Theta and Gamma | ||
0 1 2 3 1 2 3 #lapse shift and B | ||
vars_parity_diagnostic = 0 1 2 3 #Ham and Mom | ||
0 0 #ADM M and J | ||
|
||
# if sommerfeld boundaries selected, must select | ||
# non zero asymptotic values | ||
|
@@ -118,7 +119,7 @@ max_steps = 4 | |
# Spatial derivative order (only affects CCZ4 RHS) | ||
max_spatial_derivative_order = 4 # can be 4 or 6 | ||
|
||
nan_check = 1 | ||
# nan_check = 1 | ||
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. Why? |
||
|
||
# Lapse evolution | ||
lapse_advec_coeff = 1.0 | ||
|
@@ -144,3 +145,29 @@ sigma = 0.3 | |
# min_lapse = 1.e-4 | ||
|
||
################################################# | ||
# Extraction parameters | ||
|
||
# extraction_center = 256 256 256 # defaults to center | ||
activate_extraction = 1 | ||
TaigoFr marked this conversation as resolved.
Show resolved
Hide resolved
|
||
num_extraction_radii = 3 | ||
extraction_radii = 30. 40. 50. | ||
extraction_levels = 1 1 0 | ||
num_points_phi = 50 | ||
num_points_theta = 51 | ||
# num_modes = 3 | ||
# modes = 2 0 # l m for spherical harmonics | ||
# 2 1 | ||
# 2 2 | ||
|
||
extraction_extrapolation_order = 3 | ||
extraction_extrapolation_radii = 0 1 2 | ||
|
||
# integral_file_prefix = "Weyl4_mode_" | ||
|
||
# write_extraction = 0 | ||
# extraction_subpath = "data/extraction" # directory for 'write_extraction = 1' | ||
# extraction_file_prefix = "Weyl4_extraction_" | ||
|
||
################################################# | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -54,19 +54,25 @@ template <class SurfaceGeometry> class SurfaceExtraction | |
std::string data_path, integral_file_prefix; | ||
std::string extraction_path, extraction_file_prefix; | ||
|
||
std::vector<int> | ||
radii_idxs_for_extrapolation; // 2 for 2nd order, 3 for 3rd order | ||
|
||
int min_extraction_level() | ||
{ | ||
return *(std::min_element(extraction_levels.begin(), | ||
extraction_levels.end())); | ||
} | ||
|
||
//! deletes invalid or repeated | ||
void validate_extrapolation_radii(); | ||
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. Can we do this via parameter checking instead? This will make it more transparent to the user. |
||
}; | ||
|
||
using vars_t = std::tuple<int, VariableType, Derivative>; | ||
|
||
protected: | ||
const SurfaceGeometry m_geom; //!< the geometry class which knows about | ||
//!< the particular surface | ||
const params_t m_params; | ||
params_t m_params; | ||
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. This can be made |
||
std::vector<std::tuple<int, VariableType, Derivative>> | ||
m_vars; //!< the vector of pairs of | ||
//!< variables and derivatives to extract | ||
|
@@ -189,8 +195,12 @@ template <class SurfaceGeometry> class SurfaceExtraction | |
//! convenience caller for write_integrals in the case of just integral per | ||
//! surface | ||
void write_integral(const std::string &a_filename, | ||
const std::vector<double> a_integrals, | ||
const std::string a_label = "") const; | ||
const std::vector<double> &a_integrals, | ||
const std::string &a_label = "") const; | ||
|
||
// returns empty vector if no extrapolation is done | ||
std::vector<double> richardson_extrapolation( | ||
const std::vector<std::vector<double>> &integrals) const; | ||
Comment on lines
+202
to
+203
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 it's slightly odd that this function returns an empty vector in the case of no extrapolation. It would be better if it was only called if there is extrapolation that needs to be done. |
||
}; | ||
|
||
#include "SurfaceExtraction.impl.hpp" | ||
|
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.
Can't extrapolate Weyl4 as time is not retarded.