Skip to content

Commit

Permalink
Apply suggestion from code review
Browse files Browse the repository at this point in the history
Co-authored-by: Olivier Guévremont <[email protected]>
  • Loading branch information
AmishgaAlphonius and oguevremont committed Nov 28, 2023
1 parent 3d02581 commit 9615a24
Show file tree
Hide file tree
Showing 4 changed files with 78 additions and 108 deletions.
48 changes: 20 additions & 28 deletions source/solvers/heat_transfer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -951,22 +951,18 @@ HeatTransfer<dim>::write_checkpoint()
prefix + this->simulation_parameters.analytical_solution->get_filename() +
"_HT" + suffix);
if (this->simulation_parameters.post_processing.calculate_heat_flux)
{
serialize_table(
this->heat_flux_table,
prefix +
this->simulation_parameters.post_processing.heat_flux_output_name +
suffix);
}
serialize_table(
this->heat_flux_table,
prefix +
this->simulation_parameters.post_processing.heat_flux_output_name +
suffix);
if (this->simulation_parameters.post_processing
.calculate_temperature_statistics)
{
serialize_table(
this->statistics_table,
prefix +
this->simulation_parameters.post_processing.temperature_output_name +
suffix);
}
serialize_table(
this->statistics_table,
prefix +
this->simulation_parameters.post_processing.temperature_output_name +
suffix);
}

template <int dim>
Expand Down Expand Up @@ -1010,22 +1006,18 @@ HeatTransfer<dim>::read_checkpoint()
prefix + this->simulation_parameters.analytical_solution->get_filename() +
"_HT" + suffix);
if (this->simulation_parameters.post_processing.calculate_heat_flux)
{
deserialize_table(
this->heat_flux_table,
prefix +
this->simulation_parameters.post_processing.heat_flux_output_name +
suffix);
}
deserialize_table(
this->heat_flux_table,
prefix +
this->simulation_parameters.post_processing.heat_flux_output_name +
suffix);
if (this->simulation_parameters.post_processing
.calculate_temperature_statistics)
{
deserialize_table(
this->statistics_table,
prefix +
this->simulation_parameters.post_processing.temperature_output_name +
suffix);
}
deserialize_table(
this->statistics_table,
prefix +
this->simulation_parameters.post_processing.temperature_output_name +
suffix);
}


Expand Down
92 changes: 40 additions & 52 deletions source/solvers/navier_stokes_base.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1635,33 +1635,27 @@ NavierStokesBase<dim, VectorType, DofsType>::read_checkpoint()
prefix + post_processing.pressure_drop_output_name +
suffix);
if (this->simulation_parameters.forces_parameters.calculate_force)
{
for (unsigned int boundary_id = 0;
boundary_id < this->simulation_parameters.boundary_conditions.size;
++boundary_id)
{
deserialize_table(this->forces_tables[boundary_id],
prefix +
this->simulation_parameters.forces_parameters
.force_output_name +
"_" + Utilities::int_to_string(boundary_id, 2) +
suffix);
}
}
for (unsigned int boundary_id = 0;
boundary_id < this->simulation_parameters.boundary_conditions.size;
++boundary_id)
{
deserialize_table(
this->forces_tables[boundary_id],
prefix +
this->simulation_parameters.forces_parameters.force_output_name +
"_" + Utilities::int_to_string(boundary_id, 2) + suffix);
}
if (this->simulation_parameters.forces_parameters.calculate_torque)
{
for (unsigned int boundary_id = 0;
boundary_id < this->simulation_parameters.boundary_conditions.size;
++boundary_id)
{
deserialize_table(this->torques_tables[boundary_id],
prefix +
this->simulation_parameters.forces_parameters
.torque_output_name +
"_" + Utilities::int_to_string(boundary_id, 2) +
suffix);
}
}
for (unsigned int boundary_id = 0;
boundary_id < this->simulation_parameters.boundary_conditions.size;
++boundary_id)
{
deserialize_table(
this->torques_tables[boundary_id],
prefix +
this->simulation_parameters.forces_parameters.torque_output_name +
"_" + Utilities::int_to_string(boundary_id, 2) + suffix);
}
if (this->simulation_parameters.analytical_solution->calculate_error())
deserialize_table(
this->error_table,
Expand Down Expand Up @@ -2243,33 +2237,27 @@ NavierStokesBase<dim, VectorType, DofsType>::write_checkpoint()
prefix + post_processing.pressure_drop_output_name +
suffix);
if (this->simulation_parameters.forces_parameters.calculate_force)
{
for (unsigned int boundary_id = 0;
boundary_id < this->simulation_parameters.boundary_conditions.size;
++boundary_id)
{
serialize_table(this->forces_tables[boundary_id],
prefix +
this->simulation_parameters.forces_parameters
.force_output_name +
"_" + Utilities::int_to_string(boundary_id, 2) +
suffix);
}
}
for (unsigned int boundary_id = 0;
boundary_id < this->simulation_parameters.boundary_conditions.size;
++boundary_id)
{
serialize_table(
this->forces_tables[boundary_id],
prefix +
this->simulation_parameters.forces_parameters.force_output_name +
"_" + Utilities::int_to_string(boundary_id, 2) + suffix);
}
if (this->simulation_parameters.forces_parameters.calculate_torque)
{
for (unsigned int boundary_id = 0;
boundary_id < this->simulation_parameters.boundary_conditions.size;
++boundary_id)
{
serialize_table(this->torques_tables[boundary_id],
prefix +
this->simulation_parameters.forces_parameters
.torque_output_name +
"_" + Utilities::int_to_string(boundary_id, 2) +
suffix);
}
}
for (unsigned int boundary_id = 0;
boundary_id < this->simulation_parameters.boundary_conditions.size;
++boundary_id)
{
serialize_table(
this->torques_tables[boundary_id],
prefix +
this->simulation_parameters.forces_parameters.torque_output_name +
"_" + Utilities::int_to_string(boundary_id, 2) + suffix);
}
if (this->simulation_parameters.analytical_solution->calculate_error())
serialize_table(
this->error_table,
Expand Down
22 changes: 8 additions & 14 deletions source/solvers/tracer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -583,13 +583,10 @@ Tracer<dim>::write_checkpoint()
prefix + this->simulation_parameters.analytical_solution->get_filename() +
"_tracer" + suffix);
if (this->simulation_parameters.post_processing.calculate_tracer_statistics)
{
serialize_table(
this->statistics_table,
prefix +
this->simulation_parameters.post_processing.tracer_output_name +
suffix);
}
serialize_table(
this->statistics_table,
prefix + this->simulation_parameters.post_processing.tracer_output_name +
suffix);
}

template <int dim>
Expand Down Expand Up @@ -633,13 +630,10 @@ Tracer<dim>::read_checkpoint()
prefix + this->simulation_parameters.analytical_solution->get_filename() +
"_tracer" + suffix);
if (this->simulation_parameters.post_processing.calculate_tracer_statistics)
{
deserialize_table(
this->statistics_table,
prefix +
this->simulation_parameters.post_processing.tracer_output_name +
suffix);
}
deserialize_table(
this->statistics_table,
prefix + this->simulation_parameters.post_processing.tracer_output_name +
suffix);
}


Expand Down
24 changes: 10 additions & 14 deletions source/solvers/vof.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1861,13 +1861,11 @@ VolumeOfFluid<dim>::write_checkpoint()
prefix + "VOF_monitoring_" + fluid_id + suffix);
}
if (this->simulation_parameters.post_processing.calculate_barycenter)
{
serialize_table(
this->table_barycenter,
prefix +
this->simulation_parameters.post_processing.barycenter_output_name +
suffix);
}
serialize_table(
this->table_barycenter,
prefix +
this->simulation_parameters.post_processing.barycenter_output_name +
suffix);
}

template <int dim>
Expand Down Expand Up @@ -1931,13 +1929,11 @@ VolumeOfFluid<dim>::read_checkpoint()
prefix + "VOF_monitoring_" + fluid_id + suffix);
}
if (this->simulation_parameters.post_processing.calculate_barycenter)
{
deserialize_table(
this->table_barycenter,
prefix +
this->simulation_parameters.post_processing.barycenter_output_name +
suffix);
}
deserialize_table(
this->table_barycenter,
prefix +
this->simulation_parameters.post_processing.barycenter_output_name +
suffix);
}


Expand Down

0 comments on commit 9615a24

Please sign in to comment.