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
Topography on lower surface (e.g. CMB) #1519
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 good except for the one variable name and a few small typos. Feel free to modify the other postprocessor as well, either in this PR or in a separate one. Also this change definitely deserves a file in doc/modules/changes.
{ | ||
const double depth_face_center = this->get_geometry_model().depth (cell->face(f)->center()); | ||
const double upper_depth_cutoff = cell->face(f)->minimum_vertex_distance()/3; | ||
const double lower_depth_cutoff = this->get_geometry_model().maximal_depth() - cell->face(f)->minimum_vertex_distance()/3; |
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.
there is an additional space in the formula after the minus
if (cell->at_boundary(f) && this->get_geometry_model().depth (cell->face(f)->center()) < cell->face(f)->minimum_vertex_distance()/3) | ||
// see if the cell is at the *top* or *bottom* boundary, not just any boundary | ||
unsigned int face_idx = numbers::invalid_unsigned_int; | ||
bool at_upper_surface; |
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.
Please add a comment here that the variable is set to false if the face is at the lower boundary. Maybe a name like top_or_bottom_boundary_face
or lower_or_upper_boundary_face
would make that clearer?
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.
Actually I think at_upper_surface might make more sense because then true has a clear meaning, which isn't the case if the name is top_or_bottom_boundary_face. But I agree that I should add a comment that false corresponds to the lower boundary. On it!
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.
You are right, just add the comment and it should be fine.
{ | ||
const double depth_face_center = this->get_geometry_model().depth (cell->face(f)->center()); | ||
const double upper_depth_cutoff = cell->face(f)->minimum_vertex_distance()/3; | ||
const double lower_depth_cutoff = this->get_geometry_model().maximal_depth() - cell->face(f)->minimum_vertex_distance()/3; |
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.
same double space as above
@@ -215,7 +253,8 @@ namespace aspect | |||
prm.declare_entry ("Subtract mean of dynamic topography", "false", | |||
Patterns::Bool (), | |||
"Option to remove the mean dynamic topography " | |||
"in the outputted data file (not visualization). " | |||
"in the visualization. The mean dynamic topography is calculated " | |||
"and subtracted separately for the upper and lower boundary. " |
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.
Nice catch!
prm.declare_entry ("Density below","9900", | ||
Patterns::Double (0), | ||
"Dynamic topography is calculated as the excess or lack of mass that is supported by mantle flow. " | ||
"This value depends on the density of material that is moved up or down, i.e. mantle above CMB, and 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.
double space
if (cell->at_boundary(f) && this->get_geometry_model().depth (cell->face(f)->center()) < cell->face(f)->minimum_vertex_distance()/3) | ||
// see if the cell is at the *top* or *bottom* boundary, not just any boundary | ||
unsigned int face_idx = numbers::invalid_unsigned_int; | ||
bool at_upper_surface; |
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 it happen that this variable stays undefined? (neither one of the if's below is true)
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.
Additionally, can a cell be on the "upper" and the "lower" surface at the same time? If not, can this be checked with an Assert()?
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.
@tjhei If at_upper_surface is undefined face_idx is also not assigned and we check for that in the next if loop
if (face_idx == numbers::invalid_unsigned_int)
continue
If it's not assigned we continue to the next cell so I don't think there's an issue.
I will add an Assert statement that addresses your second comment.
for (unsigned int f=0; f<GeometryInfo<dim>::faces_per_cell; ++f) | ||
{ | ||
const double depth_face_center = this->get_geometry_model().depth (cell->face(f)->center()); | ||
const double upper_depth_cutoff = cell->face(f)->minimum_vertex_distance()/3; |
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 you write 3.0
instead of 3
here and at the other places?
@@ -215,7 +253,8 @@ namespace aspect | |||
prm.declare_entry ("Subtract mean of dynamic topography", "false", | |||
Patterns::Bool (), | |||
"Option to remove the mean dynamic topography " | |||
"in the outputted data file (not visualization). " | |||
"in the visualization. The mean dynamic topography is calculated " | |||
"and subtracted separately for the upper and lower boundary. " | |||
"'true' subtracts the mean, 'false' leaves " | |||
"the calculated dynamic topography as is. "); |
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 space at the end
"density of the material that is displaced (generally outer core material). While the density of mantle rock " | ||
"is part of the material model, this parameter `Density below' allows the user to specify the density " | ||
"value of material that is displaced below the solid surface. By default this material is assumed to " | ||
"be outer core material with a density of 9900. " |
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 space at the end
57043f3
to
eb7b98b
Compare
@gassmoeller @tjhei I took another stab at this and also included it in the postprocessor/dynamic_topography.cc. In the latter the CMB topography is outputted as a separate file and only if the parameter 'Output lower surface topography' is set to true. If it's not set to true it's not even calculated. |
/run-tests |
eb7b98b
to
14fb7a3
Compare
@gassmoeller: I rebased to master and updated existing dynamic topography tests to also output / test the lower boundary topography |
14fb7a3
to
6c7c731
Compare
@gassmoeller There seem to be three tests related to the stokes solver that don't fail because they compile. I'm not sure what the reason is for that. I checked and fixed all the topography related warnings and tests. |
8a88c41
to
dafbb28
Compare
if (depth_face_center < upper_depth_cutoff && depth_face_center > lower_depth_cutoff) | ||
AssertThrow(false, ExcMessage("Your geometry model so small that the upper and lower boundary of " | ||
"the domain are bordered by the same cell. " | ||
"Consider using a higher mesh resolution.") ); |
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 like this error message.
|
||
// Check if cell is at upper and lower surface at the same time | ||
if (depth_face_center < upper_depth_cutoff && depth_face_center > lower_depth_cutoff) | ||
AssertThrow(false, ExcMessage("Your geometry model so small that the upper and lower boundary of " |
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.
this sentence no verb :-)
@jaustermann These tests crash with your PR, and they use the dynamic topography postprocessor. Please run:
take a look at the error message and think about why that parameter file causes a floating point exception. Let me know if you want to discuss how to debug those errors. |
354dcfe
to
e5706e9
Compare
@gassmoeller This might be ready to be looked at again whenever you have a chance. |
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.
Ok, 4 small documentation issues remaining. Ready to merge once you address them.
{ | ||
for (unsigned int f=0; f<GeometryInfo<dim>::faces_per_cell; ++f) | ||
if (cell->at_boundary(f) && this->get_geometry_model().depth (cell->face(f)->center()) < cell->face(f)->minimum_vertex_distance()/3) | ||
// see if the cell is at the *top* or *bottom* boundary, not just any boundary |
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.
indent
@@ -70,9 +70,19 @@ namespace aspect | |||
bool subtract_mean_dyn_topography; | |||
|
|||
/** | |||
* A parameter that specifies whether the lower topography is outputted. | |||
*/ |
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.
indent
prm.declare_entry ("Density above","0", | ||
Patterns::Double (0), | ||
"Dynamic topography is calculated as the excess or lack of mass that is supported by mantle flow. " | ||
"This value depends on the density of material that is moved up or down, i.e. crustal rock, and the " | ||
"density of the material that is displaced (generally water or air). While the density of crustal rock " | ||
"is part of the material model, this parameter `Density above' allows the user to specify the density " | ||
"value of material that is displaced above the solid surface. By default this material is assumed to " | ||
"be air, with a density of 0. " | ||
"be air, with a density of 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.
Keep the space at the end of the line, there is another line below.
"density of the material that is displaced (generally outer core material). While the density of mantle rock " | ||
"is part of the material model, this parameter `Density below' allows the user to specify the density " | ||
"value of material that is displaced below the solid surface. By default this material is assumed to " | ||
"be outer core material with a density of 9900." |
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.
also here, missing space at end of line
e5706e9
to
5e21482
Compare
…opography at the lower surface; Adjust tests
5e21482
to
33c6c09
Compare
All tests pass, and all comments have been addressed. |
I've worked with @ian-r-rose on this extension to the existing dynamic topography processor. It now also calculates topography at the lower surface of the model domain. I've only added this to the visualization postprocessor for now. The equivalent extension has to be done in the dynamic topography postprocessor that outputs the values in a file. I will do that once I have your comments on this file. This pull request will also break all existing dynamic topography tests and I can update those once the tester has run.