-
Notifications
You must be signed in to change notification settings - Fork 242
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
Improve heat flux map postprocessor and dynamic topography postprocessor #5603
Changes from all commits
fe40b0b
c3ed0e5
e8d149d
d290eb7
db58e71
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 |
---|---|---|
@@ -0,0 +1,8 @@ | ||
Changed: The postprocessor 'heat flux map' now outputs the heat flux values in | ||
the same format as the 'dynamic topography' postprocessor does for dynamic | ||
topography. This in particular means instead of writing all values into a | ||
single file 'heat flux map' now writes one file per boundary. Both | ||
postprocessors now take care to not include spaces in the data file | ||
headers so that separating the header columns by spaces works correctly. | ||
<br> | ||
(Rene Gassmoeller, 2024/03/15) |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -365,9 +365,9 @@ namespace aspect | |
|
||
// Possibly output the result to file. | ||
if (output_surface) | ||
output_to_file(true, stored_values_surface); | ||
output_to_file(top_boundary_id, stored_values_surface); | ||
if (output_bottom) | ||
output_to_file(false, stored_values_bottom); | ||
output_to_file(bottom_boundary_id, stored_values_bottom); | ||
|
||
return std::pair<std::string,std::string>("Computing dynamic topography", ""); | ||
} | ||
|
@@ -411,32 +411,35 @@ namespace aspect | |
*/ | ||
template <int dim> | ||
void | ||
DynamicTopography<dim>::output_to_file(const bool upper, | ||
std::vector<std::pair<Point<dim>, | ||
double>> &stored_values) | ||
DynamicTopography<dim>::output_to_file(const types::boundary_id boundary_id, | ||
const std::vector<std::pair<Point<dim>,double>> &position_and_topography) | ||
{ | ||
// get boundary name and avoid spaces for file output | ||
std::string boundary_name = this->get_geometry_model().translate_id_to_symbol_name(boundary_id); | ||
std::replace(boundary_name.begin(), boundary_name.end(), ' ', '_'); | ||
|
||
std::ostringstream output; | ||
|
||
// On processor 0, write header lines | ||
if (Utilities::MPI::this_mpi_process(this->get_mpi_communicator()) == 0) | ||
{ | ||
output << "# " | ||
<< ((dim==2)? "x y " : "x y z ") | ||
<< (upper ? "surface topography" : "bottom topography") << std::endl; | ||
<< "dynamic_topography_" << boundary_name << std::endl; | ||
} | ||
|
||
for (unsigned int i=0; i<stored_values.size(); ++i) | ||
for (unsigned int i = 0; i < position_and_topography.size(); ++i) | ||
{ | ||
output << std::setprecision(10) | ||
<< stored_values[i].first | ||
<< position_and_topography[i].first | ||
<< ' ' | ||
<< std::setprecision(10) | ||
<< stored_values[i].second | ||
<< position_and_topography[i].second | ||
<< std::endl; | ||
} | ||
|
||
std::string filename = this->get_output_directory() + | ||
(upper ? "dynamic_topography_surface." : "dynamic_topography_bottom.") + | ||
"dynamic_topography_" + boundary_name + "." + | ||
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. What if someone hands over a boundary id that is neither top nor bottom? This is now possible and wasn't before, but I guess that actually is something we allow because we're just writing a file? |
||
Utilities::int_to_string(this->get_timestep_number(), 5); | ||
if (this->get_parameters().run_postprocessors_on_nonlinear_iterations) | ||
filename.append("." + Utilities::int_to_string (this->get_nonlinear_iteration(), 4)); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,9 @@ | ||
# x y bottom topography | ||
112500 0 -20.35932195 | ||
337500 0 -22.5880606 | ||
562500 0 -13.12252722 | ||
787500 0 55.68976695 | ||
1012500 0 55.68976696 | ||
1237500 0 -13.12252721 | ||
1462500 0 -22.58806058 | ||
1687500 0 -20.35932193 | ||
# x y dynamic_topography_bottom | ||
112500 0 -20.35932198 | ||
337500 0 -22.58806059 | ||
562500 0 -13.12252715 | ||
787500 0 55.68976686 | ||
1012500 0 55.68976686 | ||
1237500 0 -13.12252713 | ||
1462500 0 -22.58806056 | ||
1687500 0 -20.35932195 | ||
Comment on lines
+1
to
+9
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 are the values different? I guess this is just floating point precision? |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,9 @@ | ||
# x y bottom topography | ||
112500 0 -20.35932195 | ||
337500 0 -22.5880606 | ||
562500 0 -13.12252722 | ||
787500 0 55.68976695 | ||
1012500 0 55.68976696 | ||
1237500 0 -13.12252721 | ||
1462500 0 -22.58806058 | ||
1687500 0 -20.35932193 | ||
# x y dynamic_topography_bottom | ||
112500 0 -20.35932198 | ||
337500 0 -22.58806059 | ||
562500 0 -13.12252715 | ||
787500 0 55.68976686 | ||
1012500 0 55.68976686 | ||
1237500 0 -13.12252713 | ||
1462500 0 -22.58806056 | ||
1687500 0 -20.35932195 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,9 @@ | ||
# x y bottom topography | ||
112500 0 -20.35932195 | ||
337500 0 -22.5880606 | ||
562500 0 -13.12252722 | ||
787500 0 55.68976695 | ||
1012500 0 55.68976696 | ||
1237500 0 -13.12252721 | ||
1462500 0 -22.58806058 | ||
1687500 0 -20.35932193 | ||
# x y dynamic_topography_bottom | ||
112500 0 -20.35932198 | ||
337500 0 -22.58806059 | ||
562500 0 -13.12252715 | ||
787500 0 55.68976686 | ||
1012500 0 55.68976686 | ||
1237500 0 -13.12252713 | ||
1462500 0 -22.58806056 | ||
1687500 0 -20.35932195 |
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 how you wrote this for the heat flux; would you mind changing the variable names for the dynamic topography as well? (I looked at the .h file and was very confused about the function, because neither the documentation nor the variable names told me anything what these "values" are.)