Skip to content

Commit

Permalink
indent
Browse files Browse the repository at this point in the history
  • Loading branch information
mivaia committed Dec 11, 2024
1 parent 6132041 commit ee64a23
Show file tree
Hide file tree
Showing 19 changed files with 357 additions and 317 deletions.
12 changes: 7 additions & 5 deletions include/solvers/heat_transfer.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
#include <solvers/heat_transfer_assemblers.h>
#include <solvers/heat_transfer_scratch_data.h>
#include <solvers/multiphysics_interface.h>
#include <solvers/postprocessors.h>
#include <solvers/postprocessing_scalar.h>
#include <solvers/postprocessors.h>

#include <deal.II/base/convergence_table.h>
#include <deal.II/base/quadrature_lib.h>
Expand Down Expand Up @@ -131,9 +131,11 @@ class HeatTransfer : public AuxiliaryPhysics<dim, GlobalVectorType>
if (simulation_parameters.timer.type == Parameters::Timer::Type::none)
this->computing_timer.disable_output();

if (simulation_parameters.post_processing.calculate_average_temp_and_hf){
average_temperature = std::make_shared<AverageScalarInTime<dim>>(this->dof_handler);
}
if (simulation_parameters.post_processing.calculate_average_temp_and_hf)
{
average_temperature =
std::make_shared<AverageScalarInTime<dim>>(this->dof_handler);
}
}

/**
Expand Down Expand Up @@ -801,7 +803,7 @@ class HeatTransfer : public AuxiliaryPhysics<dim, GlobalVectorType>
std::shared_ptr<AverageScalarInTime<dim>> average_temperature;

/**
* @brief Locally owned average temperature calculated using the AverageScalarInTime object.
* @brief Locally owned average temperature calculated using the AverageScalarInTime object.
*/
GlobalVectorType average_temperature_to_output;

Expand Down
2 changes: 1 addition & 1 deletion include/solvers/navier_stokes_base.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
#include <solvers/flow_control.h>
#include <solvers/multiphysics_interface.h>
#include <solvers/navier_stokes_assemblers.h>
#include <solvers/postprocessing_velocities.h>
#include <solvers/postprocessing_scalar.h>
#include <solvers/postprocessing_velocities.h>
#include <solvers/postprocessors.h>
#include <solvers/postprocessors_smoothing.h>
#include <solvers/simulation_parameters.h>
Expand Down
330 changes: 165 additions & 165 deletions include/solvers/postprocessing_scalar.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,170 +31,170 @@ using namespace dealii;
template <int dim>
class AverageScalarInTime
{
public:
/**
* @brief Constructor that initializes the solution transfer objects for the scalar field.
*
* @param[in] dof_handler Used to initialize the solution transfer objects.
*/
AverageScalarInTime(DoFHandler<dim> &dof_handler);


/**
* @brief Calculate time-averaged scalar field using vector with no ghost
* cells.
*
* @param[in] local_evaluation_point The solution vector with no ghost cells.
*
* @param[in] post_processing The postprocessing parameters to definie initial
*
* @param[in] current_time The current time.
*
* @param[in] time_step The time step.
*/
void
calculate_average_scalar(const GlobalVectorType &local_evaluation_point,
const Parameters::PostProcessing &post_processing,
const double current_time,
const double time_step);

void
initialize_vectors(const IndexSet &locally_owned_dofs,
const IndexSet &locally_relevant_dofs,
const MPI_Comm &mpi_communicator);

/**
* @brief Use the inverse of the time since the beginning of the time averaging to reevaluate the average scalar field.
*
*/
GlobalVectorType
get_average_scalar()
{
return average_scalar;
}

/**
* @brief Prepare average velocity object for dynamic mesh adaptation.
*/
void
update_average_scalar();

/**
* @brief Prepare average velocity object for dynamic mesh adaptation.
*/
void
prepare_for_mesh_adaptation();

/**
* @brief Reestablish solution vectors after dynamic mesh adaptation.
*/
void
post_mesh_adaptation();

/**
* @brief Save checkpoints to continuing averaging after restart.
*
* @param[in] prefix Name for checkpointing files.
*
* @return Vector with average values.
*/
std::vector<const GlobalVectorType *>
save(const std::string &prefix);

/**
* @brief Read checkpoints to continuing averaging after restart.
*
* @param[in] prefix Name for checkpoint files.
*
* @return Vector with average values.
*/
std::vector<GlobalVectorType *>
read(const std::string &prefix);


/**
* @brief Sanitize the average scalar object after a checkpoint has been read by
* resetting all of the locally_owned vectors using the locally_relevant
* vectors. This is necessary because only the locally_relevant_vectors are
* saved, but the calculation routines expect that the content of the
* locally_owned vectors match that of the locally_relevant vectors.
*/
void
sanitize_after_restart()
{
sum_scalar_dt = sum_scalar_dt_with_ghost_cells;
}

private:
/**
* @brief Vector to store the scalar field multiplied by time step.
*
*/
GlobalVectorType scalar_dt;

/**
* @brief Ghosted vector to store the sum of all the scalar multiplied by time step.
*
*/
GlobalVectorType sum_scalar_dt_with_ghost_cells;

/**
* @brief Vector to store the sum of all the scalar multiplied by time step.
*
*/
GlobalVectorType sum_scalar_dt;

/**
* @brief Object to transfer the averaged scalar in case of mesh adaptation.
*
*/
parallel::distributed::SolutionTransfer<dim, GlobalVectorType> solution_transfer_sum_scalar_dt;

/**
* @brief Time averaged scalar.
*/
GlobalVectorType average_scalar;

/**
* @brief Time averaged scalar containing the locally owned and locally relevant dofs for all processes.
*/
GlobalVectorType average_scalar_with_ghost_cells;

/**
* @brief Difference between the simulation starting time and the initial averaging time.
*/
double real_initial_time;

/**
* @brief Vector to store the sum of all the scalar field multiplied by time step.
*
*/
double total_time_for_average;

/**
* @brief Time step.
*
*/
double dt;

/**
* @brief First time step is stored in dt_0 and added to total_time_for_average to ensure the first average calculation does not result in a division by zero.
*
*/
double dt_0;

/**
* @brief Inverse of the total time for averaging.
*
*/
double inv_range_time;

/**
* @brief Track whether we are within the averaging time period.
*
*/
bool average_calculation;

public:
/**
* @brief Constructor that initializes the solution transfer objects for the scalar field.
*
* @param[in] dof_handler Used to initialize the solution transfer objects.
*/
AverageScalarInTime(DoFHandler<dim> &dof_handler);


/**
* @brief Calculate time-averaged scalar field using vector with no ghost
* cells.
*
* @param[in] local_evaluation_point The solution vector with no ghost cells.
*
* @param[in] post_processing The postprocessing parameters to definie initial
*
* @param[in] current_time The current time.
*
* @param[in] time_step The time step.
*/
void
calculate_average_scalar(const GlobalVectorType &local_evaluation_point,
const Parameters::PostProcessing &post_processing,
const double current_time,
const double time_step);

void
initialize_vectors(const IndexSet &locally_owned_dofs,
const IndexSet &locally_relevant_dofs,
const MPI_Comm &mpi_communicator);

/**
* @brief Use the inverse of the time since the beginning of the time averaging to reevaluate the average scalar field.
*
*/
GlobalVectorType
get_average_scalar()
{
return average_scalar;
}

/**
* @brief Prepare average velocity object for dynamic mesh adaptation.
*/
void
update_average_scalar();

/**
* @brief Prepare average velocity object for dynamic mesh adaptation.
*/
void
prepare_for_mesh_adaptation();

/**
* @brief Reestablish solution vectors after dynamic mesh adaptation.
*/
void
post_mesh_adaptation();

/**
* @brief Save checkpoints to continuing averaging after restart.
*
* @param[in] prefix Name for checkpointing files.
*
* @return Vector with average values.
*/
std::vector<const GlobalVectorType *>
save(const std::string &prefix);

/**
* @brief Read checkpoints to continuing averaging after restart.
*
* @param[in] prefix Name for checkpoint files.
*
* @return Vector with average values.
*/
std::vector<GlobalVectorType *>
read(const std::string &prefix);


/**
* @brief Sanitize the average scalar object after a checkpoint has been read by
* resetting all of the locally_owned vectors using the locally_relevant
* vectors. This is necessary because only the locally_relevant_vectors are
* saved, but the calculation routines expect that the content of the
* locally_owned vectors match that of the locally_relevant vectors.
*/
void
sanitize_after_restart()
{
sum_scalar_dt = sum_scalar_dt_with_ghost_cells;
}

private:
/**
* @brief Vector to store the scalar field multiplied by time step.
*
*/
GlobalVectorType scalar_dt;

/**
* @brief Ghosted vector to store the sum of all the scalar multiplied by time step.
*
*/
GlobalVectorType sum_scalar_dt_with_ghost_cells;

/**
* @brief Vector to store the sum of all the scalar multiplied by time step.
*
*/
GlobalVectorType sum_scalar_dt;

/**
* @brief Object to transfer the averaged scalar in case of mesh adaptation.
*
*/
parallel::distributed::SolutionTransfer<dim, GlobalVectorType>
solution_transfer_sum_scalar_dt;

/**
* @brief Time averaged scalar.
*/
GlobalVectorType average_scalar;

/**
* @brief Time averaged scalar containing the locally owned and locally relevant dofs for all processes.
*/
GlobalVectorType average_scalar_with_ghost_cells;

/**
* @brief Difference between the simulation starting time and the initial averaging time.
*/
double real_initial_time;

/**
* @brief Vector to store the sum of all the scalar field multiplied by time step.
*
*/
double total_time_for_average;

/**
* @brief Time step.
*
*/
double dt;

/**
* @brief First time step is stored in dt_0 and added to total_time_for_average to ensure the first average calculation does not result in a division by zero.
*
*/
double dt_0;

/**
* @brief Inverse of the total time for averaging.
*
*/
double inv_range_time;

/**
* @brief Track whether we are within the averaging time period.
*
*/
bool average_calculation;
};

#endif
#endif
Loading

0 comments on commit ee64a23

Please sign in to comment.