Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions source/material_model/latent_heat.cc
Original file line number Diff line number Diff line change
Expand Up @@ -393,12 +393,12 @@ namespace aspect
// we have to scale them here so that they are relative factors in comparison to the product
// of the prefactors of all phases above the current one
unsigned int index = 0;
for (unsigned int c=0; c<options.n_values_per_key.size(); ++c)
for (const auto &n_phases : options.n_values_per_key)
{
double product = 1.;
for (unsigned int phase=0; phase<options.n_values_per_key[c]; ++phase)
for (unsigned int phase = 0; phase < n_phases; ++phase)
{
if (phase>0)
if (phase > 0)
phase_prefactors[index] /= product;
product *= phase_prefactors[index];
index += 1;
Expand Down
4 changes: 2 additions & 2 deletions source/particle/property/composition_reaction.cc
Original file line number Diff line number Diff line change
Expand Up @@ -242,8 +242,8 @@ namespace aspect
(Utilities::split_string_list(prm.get ("List of reaction times")));

if (this->convert_output_to_years() == true)
for (unsigned int i=0; i<reaction_times.size(); ++i)
reaction_times[i] *= year_in_seconds;
for (double &time : reaction_times)
time *= year_in_seconds;

AssertThrow ((reactants.size() == products.size()),
ExcMessage ("The list of reactants and products need to have the "
Expand Down
4 changes: 2 additions & 2 deletions source/particle/property/elastic_stress.cc
Original file line number Diff line number Diff line change
Expand Up @@ -174,8 +174,8 @@ namespace aspect
old_solution_values.end());

EvaluationFlags::EvaluationFlags evaluation_flags_union = EvaluationFlags::nothing;
for (unsigned int i=0; i<evaluation_flags.size(); ++i)
evaluation_flags_union |= evaluation_flags[i];
for (const auto flag : evaluation_flags)
evaluation_flags_union |= flag;

// Update evaluators to the current cell
if (evaluation_flags_union & (EvaluationFlags::values | EvaluationFlags::gradients))
Expand Down
4 changes: 2 additions & 2 deletions source/postprocess/current_surface.cc
Original file line number Diff line number Diff line change
Expand Up @@ -122,9 +122,9 @@ namespace aspect

// Fill the coordinates with the x-values used for the data table.
// This only works in 2D, and will need to be updated for 3D.
coordinates[0].clear();
coordinates[0].resize(temp_surface.size());
for (unsigned int i=0; i<temp_surface.size(); ++i)
coordinates[0].push_back(temp_surface[i][0]);
coordinates[0][i] = temp_surface[i][0];

// Create a surface function for the elevations.
surface_function = std::make_unique<Functions::InterpolatedTensorProductGridData<dim-1>>(coordinates, data_table);
Expand Down
50 changes: 26 additions & 24 deletions source/postprocess/visualization/material_properties.cc
Original file line number Diff line number Diff line change
Expand Up @@ -121,42 +121,42 @@ namespace aspect
in.requested_properties
= MaterialModel::MaterialProperties::uninitialized;

for (unsigned int i=0; i<property_names.size(); ++i)
for (const auto &property_name : property_names)
{
if (property_names[i] == "viscosity")
if (property_name == "viscosity")
in.requested_properties = in.requested_properties | MaterialModel::MaterialProperties::viscosity;

else if (property_names[i] == "density")
else if (property_name == "density")
in.requested_properties = in.requested_properties | MaterialModel::MaterialProperties::density;

else if (property_names[i] == "thermal expansivity")
else if (property_name == "thermal expansivity")
in.requested_properties = in.requested_properties | MaterialModel::MaterialProperties::thermal_expansion_coefficient;

else if (property_names[i] == "specific heat")
else if (property_name == "specific heat")
in.requested_properties = in.requested_properties | MaterialModel::MaterialProperties::specific_heat;

else if (property_names[i] == "thermal conductivity")
else if (property_name == "thermal conductivity")
in.requested_properties = in.requested_properties | MaterialModel::MaterialProperties::thermal_conductivity;

else if (property_names[i] == "thermal diffusivity")
else if (property_name == "thermal diffusivity")
in.requested_properties = in.requested_properties | MaterialModel::MaterialProperties::density
| MaterialModel::MaterialProperties::specific_heat
| MaterialModel::MaterialProperties::thermal_conductivity;

else if (property_names[i] == "compressibility")
else if (property_name == "compressibility")
in.requested_properties = in.requested_properties | MaterialModel::MaterialProperties::compressibility;

else if (property_names[i] == "entropy derivative pressure")
else if (property_name == "entropy derivative pressure")
in.requested_properties = in.requested_properties | MaterialModel::MaterialProperties::entropy_derivative_pressure;

else if (property_names[i] == "entropy derivative temperature")
else if (property_name == "entropy derivative temperature")
in.requested_properties = in.requested_properties | MaterialModel::MaterialProperties::entropy_derivative_temperature;

else if (property_names[i] == "reaction terms")
else if (property_name == "reaction terms")
in.requested_properties = in.requested_properties | MaterialModel::MaterialProperties::reaction_terms;

// We don't know what a material model needs to compute the melt fraction.
else if (property_names[i] == "melt fraction")
else if (property_name == "melt fraction")
in.requested_properties = MaterialModel::MaterialProperties::all_properties;
}

Expand Down Expand Up @@ -201,48 +201,50 @@ namespace aspect
for (unsigned int q=0; q<n_quadrature_points; ++q)
{
unsigned output_index = 0;
for (unsigned int i=0; i<property_names.size(); ++i, ++output_index)
for (const auto &property_name : property_names)
{
if (property_names[i] == "viscosity")
if (property_name == "viscosity")
computed_quantities[q][output_index] = out.viscosities[q];

else if (property_names[i] == "density")
else if (property_name == "density")
computed_quantities[q][output_index] = out.densities[q];

else if (property_names[i] == "thermal expansivity")
else if (property_name == "thermal expansivity")
computed_quantities[q][output_index] = out.thermal_expansion_coefficients[q];

else if (property_names[i] == "specific heat")
else if (property_name == "specific heat")
computed_quantities[q][output_index] = out.specific_heat[q];

else if (property_names[i] == "thermal conductivity")
else if (property_name == "thermal conductivity")
computed_quantities[q][output_index] = out.thermal_conductivities[q];

else if (property_names[i] == "thermal diffusivity")
else if (property_name == "thermal diffusivity")
computed_quantities[q][output_index] = out.thermal_conductivities[q]/(out.densities[q]*out.specific_heat[q]);

else if (property_names[i] == "compressibility")
else if (property_name == "compressibility")
computed_quantities[q][output_index] = out.compressibilities[q];

else if (property_names[i] == "entropy derivative pressure")
else if (property_name == "entropy derivative pressure")
computed_quantities[q][output_index] = out.entropy_derivative_pressure[q];

else if (property_names[i] == "entropy derivative temperature")
else if (property_name == "entropy derivative temperature")
computed_quantities[q][output_index] = out.entropy_derivative_temperature[q];

else if (property_names[i] == "reaction terms")
else if (property_name == "reaction terms")
{
for (unsigned int k=0; k<this->n_compositional_fields(); ++k, ++output_index)
{
computed_quantities[q][output_index] = out.reaction_terms[q][k];
}
--output_index;
}
else if (property_names[i] == "melt fraction")
else if (property_name == "melt fraction")
computed_quantities[q][output_index] = melt_fractions[q];
else
AssertThrow(false,
ExcMessage("Material property not implemented for this postprocessor."));

++output_index;
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions source/simulator/parameters.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2102,9 +2102,9 @@ namespace aspect
AssertThrow (normalized_fields.size() <= n_compositional_fields,
ExcMessage("Invalid input parameter file: Too many entries in List of normalized fields"));

for (unsigned int i_field = 0; i_field < normalized_fields.size(); ++i_field)
for (unsigned int field : normalized_fields)
{
AssertThrow(normalized_fields[i_field]<n_compositional_fields,
AssertThrow(field<n_compositional_fields,
ExcMessage("Invalid input parameter file: An entry in List of normalized fields is larger then the number of fields."));
}

Expand Down