Skip to content
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

Merged
merged 1 commit into from May 10, 2017

Conversation

jaustermann
Copy link
Contributor

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.

Copy link
Member

@gassmoeller gassmoeller left a 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;
Copy link
Member

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;
Copy link
Member

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?

Copy link
Contributor Author

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!

Copy link
Member

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;
Copy link
Member

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. "
Copy link
Member

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 "
Copy link
Member

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;
Copy link
Member

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)

Copy link
Member

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()?

Copy link
Contributor Author

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;
Copy link
Member

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. ");
Copy link
Member

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. "
Copy link
Member

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

@jaustermann jaustermann force-pushed the CMB_topography branch 2 times, most recently from 57043f3 to eb7b98b Compare May 9, 2017 02:45
@jaustermann
Copy link
Contributor Author

@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.

@gassmoeller
Copy link
Member

/run-tests

@jaustermann
Copy link
Contributor Author

jaustermann commented May 9, 2017

@gassmoeller: I rebased to master and updated existing dynamic topography tests to also output / test the lower boundary topography

@jaustermann
Copy link
Contributor Author

@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.

@jaustermann jaustermann force-pushed the CMB_topography branch 2 times, most recently from 8a88c41 to dafbb28 Compare May 9, 2017 19:24
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.") );
Copy link
Contributor

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 "
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this sentence no verb :-)

@gassmoeller
Copy link
Member

@jaustermann These tests crash with your PR, and they use the dynamic topography postprocessor. Please run:

ctest -R postprocess_iterations_Stokes_only
cd tests
../aspect postprocess_iterations_Stokes_only.x.prm

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.

@jaustermann jaustermann force-pushed the CMB_topography branch 2 times, most recently from 354dcfe to e5706e9 Compare May 10, 2017 01:49
@jaustermann
Copy link
Contributor Author

@gassmoeller This might be ready to be looked at again whenever you have a chance.

Copy link
Member

@gassmoeller gassmoeller left a 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
Copy link
Member

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.
*/
Copy link
Member

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."
Copy link
Member

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."
Copy link
Member

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

…opography at the lower surface; Adjust tests
@gassmoeller
Copy link
Member

All tests pass, and all comments have been addressed.

@gassmoeller gassmoeller merged commit 1e20e7b into geodynamics:master May 10, 2017
@jaustermann jaustermann deleted the CMB_topography branch June 22, 2018 21:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants