Skip to content

Commit 1728e53

Browse files
authored
Merge pull request #6268 from bangerth/cleanup
Be more explicit when we omit certain operations.
2 parents 1fc057d + c09d732 commit 1728e53

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

source/postprocess/composition_velocity_statistics.cc

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,13 +82,17 @@ namespace aspect
8282
Utilities::MPI::sum(local_area_integral, this->get_mpi_communicator(), global_area_integral);
8383

8484
// compute the RMS velocity for each compositional field and for the selected compositonal fields combined
85-
std::vector<double> vrms_per_composition(local_area_integral.size());
85+
std::vector<double> vrms_per_composition(local_area_integral.size(), 0.0);
8686
double velocity_square_integral_selected_fields = 0., area_integral_selected_fields = 0.;
8787
for (unsigned int c = 0; c < this->n_compositional_fields(); ++c)
8888
{
8989
if (global_area_integral[c] > 0)
9090
vrms_per_composition[c] = std::sqrt(global_velocity_square_integral[c]) /
9191
std::sqrt(global_area_integral[c]);
92+
else
93+
{
94+
// leave the field at its initialization value zero
95+
}
9296

9397
const std::vector<std::string>::iterator selected_field_it = std::find(selected_fields.begin(), selected_fields.end(), this->introspection().name_for_compositional_index(c));
9498
if (selected_field_it != selected_fields.end())
@@ -101,6 +105,10 @@ namespace aspect
101105
double vrms_selected_fields = 0.;
102106
if (area_integral_selected_fields > 0)
103107
vrms_selected_fields = std::sqrt(velocity_square_integral_selected_fields) / std::sqrt(area_integral_selected_fields);
108+
else
109+
{
110+
// leave the field at its initialization value zero
111+
}
104112

105113
const std::string unit = (this->convert_output_to_years()) ? "m/year" : "m/s";
106114
const double time_scaling = (this->convert_output_to_years()) ? year_in_seconds : 1.0;
@@ -130,7 +138,7 @@ namespace aspect
130138
statistics.add_value("RMS velocity (" + unit + ") for the selected field(s)",
131139
time_scaling * vrms_selected_fields);
132140

133-
const std::string column = {"RMS velocity (" + unit + ") for the selected field(s)"};
141+
const std::string column = "RMS velocity (" + unit + ") for the selected field(s)";
134142

135143
statistics.set_precision(column, 8);
136144
statistics.set_scientific(column, true);

0 commit comments

Comments
 (0)