-
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
Adding Cosmology Example #260
base: main
Are you sure you want to change the base?
Conversation
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.
Looks great! A few minor comments on comments and naming but all the main bits are fine. Once this is updated it can go to Josu for review!
Examples/Cosmo/CosmoDiagnostics.hpp
Outdated
{ | ||
} | ||
|
||
//! The compute member which calculates the constraints at each point in the |
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.
update comment!
rho_scaled = emtensor.rho / pow(vars.chi, 3. / 2.); | ||
S_scaled = emtensor.S / pow(vars.chi, 3. / 2.); | ||
|
||
// Write the constraints into the output FArrayBox |
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.
I would say "into the output vector of cells" in the comment
current_cell.store_vars(S_scaled, c_S_scaled); | ||
current_cell.store_vars(K_scaled, c_K_scaled); | ||
|
||
// store_vars(out, current_cell); |
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.
remove this comment
Examples/Cosmo/CosmoLevel.cpp
Outdated
m_p.scalar_field_mode)), | ||
m_state_new, m_state_new, INCLUDE_GHOST_CELLS); | ||
|
||
fillAllGhosts(); |
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.
Maybe just add a comment to say this Gamma Calculator is not needed since the data is conformally flat, but it is left for generality.
Examples/Cosmo/CosmoLevel.cpp
Outdated
scalar_field, m_dx, m_p.G_Newton); | ||
BoxLoops::loop(cosmo_diagnostics, m_state_new, m_state_diagnostics, | ||
EXCLUDE_GHOST_CELLS); | ||
// Assign initial rho_mean here |
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.
Maybe make the calculation of initial_rho_mean
a public function in the class InitialScalarData? That way it is clear that this is specific to that choice of data and initial params, and people can go there to see how it is calculated.
m_puncture_tracker.set_interpolator(a_interpolator); | ||
} | ||
|
||
void set_K_mean(double a_K_mean) { m_K_mean = a_K_mean; } |
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.
Maybe add a comment for each function as not completely obvious, or just one comment for all
/// class | ||
/** | ||
* This class implements a slightly more generic version of the moving puncture | ||
* gauge. In particular it uses a Bona-Masso slicing condition of the form |
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.
update comment
double m_K_mean; | ||
|
||
public: | ||
CosmoMovingPunctureGauge(const params_t &a_params) : m_params(a_params) {} |
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.
I think you should pass K_mean in the constructor, even if you default it to zero, as otherwise you risk evolving with it unset.
|
||
// Divide Ham_abs_sum by rho_mean | ||
data_t criterion = Ham_abs_sum / m_rho_mean * sqrt_gamma * m_dx; | ||
auto regrid = simd_compare_gt(r, m_rad); |
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.
Add some comments on what this is doing with the rad parameter - and change the name!
data_t criterion = Ham_abs_sum / m_rho_mean * sqrt_gamma * m_dx; | ||
auto regrid = simd_compare_gt(r, m_rad); | ||
|
||
// data_t criterion = 0.0; |
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.
remove this?
A few more misc points:
|
e71af04
to
801f623
Compare
I've resolved Katy's comments, rebased the commits, and updated the branch. Now, (I think) it's ready (?) for @JCAurre to review. 🥺 |
@JCAurre The wiki page of running Cosmo example is also done. See https://github.com/GRTLCollaboration/GRChombo/wiki/Running-the-Cosmo-example |
m_time); | ||
rho_extraction.execute_query(&interpolator, | ||
m_p.data_path + "rho_" + "lineout"); | ||
// Ham lineout |
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.
Will this run on a restart? Maybe it does, but I think it might be better to put it into the restart function, as I did on the ScalarFieldBH example - take a look at that and see what you think. I don't think we need this at every timestep. Otherwise the changes look good! Maybe you can also fix the x axis on my Ham plot which idk how to do :-)
I created a new directory Examples/Cosmo and added all relevant files for doing a cosmology example. The example simulates expanding FLRW spacetime with a sinusoidal scalar field and quadratic potential. We choose a mass of the scalar field as equal to the wave number such that the constraints are satisfied initially. The example also provides how to do a lineout extraction from the simulation and how to use CosmoHamTaggingCriterion.
Note that CosmoAMR.hpp and CosmoMovingPunctureGauge.hpp were added to Source/Cosmology. CosmoHamTaggingCriterion.hpp could be found in Source/TaggingCriteria.