![]() |
Lethe Open-Source Library version 1.2.0
Developer Guide
|
#include <postprocessing_velocities.h>
Classes | |
| struct | SupportPointDoFs |
Public Member Functions | |
| AverageVelocities (DoFHandler< dim > &dof_handler) | |
| void | calculate_average_velocities (const VectorType &local_evaluation_point, const Parameters::PostProcessing< dim > &post_processing, const double ¤t_time, const double &time_step) |
| void | update_average_velocities () |
| void | calculate_reynolds_stresses (const VectorType &local_evaluation_point) |
| std::shared_ptr< VectorType > | get_average_velocities () |
| const VectorType & | get_reynolds_normal_stresses () |
| const VectorType & | get_reynolds_shear_stresses () |
| void | initialize_vectors (const DofsType &locally_owned_dofs, const DofsType &locally_relevant_dofs, const MPI_Comm &mpi_communicator) |
| void | prepare_for_mesh_adaptation () |
| void | post_mesh_adaptation () |
| std::vector< const VectorType * > | save (const std::string &prefix) |
| std::vector< VectorType * > | read (const std::string &prefix) |
| void | sanitize_after_restart (const double current_time) |
| void | zero_average_after_restart () |
Private Member Functions | |
| void | gather_locally_owned_support_points () |
Private Attributes | |
| double | inv_range_time |
| double | dt_0 |
| VectorType | velocity_dt |
| VectorType | sum_velocity_dt |
| VectorType | average_velocities |
| std::shared_ptr< VectorType > | get_av |
| VectorType | reynolds_normal_stress_dt |
| VectorType | sum_reynolds_normal_stress_dt |
| VectorType | reynolds_normal_stresses |
| VectorType | get_rns |
| VectorType | reynolds_shear_stress_dt |
| VectorType | sum_reynolds_shear_stress_dt |
| VectorType | reynolds_shear_stresses |
| VectorType | get_rss |
| VectorType | sum_velocity_dt_with_ghost_cells |
| VectorType | sum_rns_dt_with_ghost_cells |
| VectorType | sum_rss_dt_with_ghost_cells |
| SolutionTransfer< dim, VectorType > | solution_transfer_sum_velocity_dt |
| SolutionTransfer< dim, VectorType > | solution_transfer_sum_reynolds_normal_stress_dt |
| SolutionTransfer< dim, VectorType > | solution_transfer_sum_reynolds_shear_stress_dt |
| double | dt |
| double | real_initial_time |
| double | total_time_for_average |
| bool | has_started_averaging |
| const DoFHandler< dim > & | dof_handler |
| std::vector< SupportPointDoFs > | locally_owned_support_points |
Calculates the time-averaged velocities and pressure \((\langle u \rangle, \langle v \rangle, \langle w \rangle, \langle p \rangle)\) and the independent components of the Reynolds stresses tensor \((\langle u'u' \rangle, \langle v'v' \rangle, \langle w'w' \rangle, \langle u'v' \rangle, \langle v'w' \rangle, \langle w'u' \rangle)\).
The Reynolds stresses are computed at every velocity support point from the degrees of freedom of the velocity components at that point. They are stored in vectors with the layout of the solution: the normal stresses in the velocity slots and the turbulent kinetic energy in the pressure slot of the normal stress vector, and \(\langle u'v' \rangle\), \(\langle v'w' \rangle\) and \(\langle w'u' \rangle\) in the u, v and w slots of the shear stress vector. The turbulent kinetic energy is only stored at the pressure degrees of freedom that share their support point with a velocity support point.
| dim | An integer that denotes the dimension of the space in which the flow is solved. |
| VectorType | The vector type used for the solvers (Trilinos (normal or block) or deal.II vectors). |
| DofsType | The type of storage of indices which differs according to vector. |
Definition at line 49 of file postprocessing_velocities.h.
| AverageVelocities< dim, VectorType, DofsType >::AverageVelocities | ( | DoFHandler< dim > & | dof_handler | ) |
Constructor that initializes the solution transfer objects for the velocity and the Reynolds stresses, the total time for average and average calculation variables.
| [in] | dof_handler | Used to initialize the solution transfer objects and to pair the degrees of freedom of the velocity components that share a support point. It must outlive the object. |
Definition at line 22 of file postprocessing_velocities.cc.
References dof_handler, get_av, has_started_averaging, solution_transfer_sum_reynolds_normal_stress_dt, solution_transfer_sum_reynolds_shear_stress_dt, solution_transfer_sum_velocity_dt, and total_time_for_average.
| void AverageVelocities< dim, VectorType, DofsType >::calculate_average_velocities | ( | const VectorType & | local_evaluation_point, |
| const Parameters::PostProcessing< dim > & | post_processing, | ||
| const double & | current_time, | ||
| const double & | time_step ) |
Calculate time-averaged velocities and pressure using vector with no ghost cells.
| [in] | local_evaluation_point | The solution vector with no ghost cells. |
| [in] | post_processing | The postprocessing parameters to definie initial time of averaging. |
| [in] | current_time | The current time in the simulation. |
| [in] | time_step | The current time step. |
Definition at line 37 of file postprocessing_velocities.cc.
References average_velocities, calculate_reynolds_stresses(), dt, dt_0, has_started_averaging, Parameters::PostProcessing< dim >::initial_time_for_average_velocities, inv_range_time, real_initial_time, sum_velocity_dt, total_time_for_average, and velocity_dt.
| void AverageVelocities< dim, VectorType, DofsType >::calculate_reynolds_stresses | ( | const VectorType & | local_evaluation_point | ) |
Calculate normal and other resolved time-averaged Reynold stresses \((\langle u'u' \rangle, \langle v'v' \rangle, \langle w'w' \rangle)\) and \((\langle u'v' \rangle, \langle v'w' \rangle, \langle w'u' \rangle)\).
| [in] | local_evaluation_point | The solution vector with no ghost cells. |
Definition at line 105 of file postprocessing_velocities.cc.
References average_velocities, dt, inv_range_time, locally_owned_support_points, reynolds_normal_stress_dt, reynolds_normal_stresses, reynolds_shear_stress_dt, reynolds_shear_stresses, sum_reynolds_normal_stress_dt, and sum_reynolds_shear_stress_dt.
|
private |
Gather the degrees of freedom of every locally owned velocity support point, with the pressure degree of freedom at the same point.
The velocity components of a support point are paired through the finite element, since the global numbering of the degrees of freedom does not group them when a mesh object carries more than one degree of freedom per component (velocity degree of 3 or more, unequal velocity and pressure degrees, bubble enrichment). The pressure degree of freedom is the one with the same unit support point.
Definition at line 208 of file postprocessing_velocities.cc.
References dof_handler, locally_owned_support_points, AverageVelocities< dim, VectorType, DofsType >::SupportPointDoFs::pressure, and AverageVelocities< dim, VectorType, DofsType >::SupportPointDoFs::velocity.
|
inline |
Give the average of solutions with ghost cells.
Definition at line 107 of file postprocessing_velocities.h.
References average_velocities, and get_av.
|
inline |
Give the time-averaged Reynolds normal stresses with ghost cells.
Definition at line 120 of file postprocessing_velocities.h.
References get_rns, and reynolds_normal_stresses.
|
inline |
Give the time-averaged Reynolds shear stresses with ghost cells.
Definition at line 132 of file postprocessing_velocities.h.
References get_rss, and reynolds_shear_stresses.
| void AverageVelocities< dim, VectorType, DofsType >::initialize_vectors | ( | const DofsType & | locally_owned_dofs, |
| const DofsType & | locally_relevant_dofs, | ||
| const MPI_Comm & | mpi_communicator ) |
Initialize all the important vectors for the average velocities and reynolds stresses calculation. This includes the vector for the checkpoints. Also gather the degrees of freedom of the locally owned velocity support points used to calculate the Reynolds stresses. This must be called after the degrees of freedom of the DoFHandler given to the constructor have been distributed and renumbered.
| [in] | locally_owned_dofs | The owned dofs. |
| [in] | locally_relevant_dofs | The locally relevant dofs. |
| [in] | mpi_communicator | The communicator information. |
Definition at line 164 of file postprocessing_velocities.cc.
References average_velocities, dof_handler, gather_locally_owned_support_points(), get_av, get_rns, get_rss, reynolds_normal_stress_dt, reynolds_normal_stresses, reynolds_shear_stress_dt, reynolds_shear_stresses, sum_reynolds_normal_stress_dt, sum_reynolds_shear_stress_dt, sum_rns_dt_with_ghost_cells, sum_rss_dt_with_ghost_cells, sum_velocity_dt, sum_velocity_dt_with_ghost_cells, and velocity_dt.
| void AverageVelocities< dim, VectorType, DofsType >::post_mesh_adaptation | ( | ) |
Reestablish solution vectors after dynamic mesh adaptation.
Definition at line 336 of file postprocessing_velocities.cc.
References solution_transfer_sum_reynolds_normal_stress_dt, solution_transfer_sum_reynolds_shear_stress_dt, solution_transfer_sum_velocity_dt, sum_reynolds_normal_stress_dt, sum_reynolds_shear_stress_dt, sum_rns_dt_with_ghost_cells, sum_rss_dt_with_ghost_cells, sum_velocity_dt, sum_velocity_dt_with_ghost_cells, and update_average_velocities().
| void AverageVelocities< dim, VectorType, DofsType >::prepare_for_mesh_adaptation | ( | ) |
Prepare average velocity object for dynamic mesh adaptation.
Definition at line 321 of file postprocessing_velocities.cc.
References get_av, get_rns, get_rss, solution_transfer_sum_reynolds_normal_stress_dt, solution_transfer_sum_reynolds_shear_stress_dt, solution_transfer_sum_velocity_dt, sum_reynolds_normal_stress_dt, sum_reynolds_shear_stress_dt, and sum_velocity_dt.
| std::vector< VectorType * > AverageVelocities< dim, VectorType, DofsType >::read | ( | const std::string & | prefix | ) |
Read checkpoints to continuing averaging after restart.
| [in] | prefix | Name for checkpoint files. |
Definition at line 404 of file postprocessing_velocities.cc.
References check_file_exists(), dt_0, has_started_averaging, real_initial_time, sum_rns_dt_with_ghost_cells, sum_rss_dt_with_ghost_cells, and sum_velocity_dt_with_ghost_cells.
|
inline |
Sanitize the average velocity 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.
The total time over which the averaging has been carried out is not stored in the checkpoint file, but it is entirely determined by the time at which the averaging started, which is stored, and by the time at which the simulation is restarted. Restoring it here allows the averaged fields to be reevaluated from the checkpointed sums without accumulating an additional contribution, which would otherwise be needed to give the averaged fields a meaningful value right after a restart.
| [in] | current_time | The time at which the simulation is restarted. |
Definition at line 208 of file postprocessing_velocities.h.
References dt_0, has_started_averaging, real_initial_time, sum_reynolds_normal_stress_dt, sum_reynolds_shear_stress_dt, sum_rns_dt_with_ghost_cells, sum_rss_dt_with_ghost_cells, sum_velocity_dt, sum_velocity_dt_with_ghost_cells, total_time_for_average, and update_average_velocities().
| std::vector< const VectorType * > AverageVelocities< dim, VectorType, DofsType >::save | ( | const std::string & | prefix | ) |
Save checkpoints to continuing averaging after restart.
| [in] | prefix | Name for checkpointing files. |
Definition at line 378 of file postprocessing_velocities.cc.
References dt_0, has_started_averaging, real_initial_time, sum_reynolds_normal_stress_dt, sum_reynolds_shear_stress_dt, sum_rns_dt_with_ghost_cells, sum_rss_dt_with_ghost_cells, sum_velocity_dt, and sum_velocity_dt_with_ghost_cells.
| void AverageVelocities< dim, VectorType, DofsType >::update_average_velocities | ( | ) |
Definition at line 77 of file postprocessing_velocities.cc.
References average_velocities, inv_range_time, reynolds_normal_stresses, reynolds_shear_stresses, sum_reynolds_normal_stress_dt, sum_reynolds_shear_stress_dt, sum_velocity_dt, and total_time_for_average.
| void AverageVelocities< dim, VectorType, DofsType >::zero_average_after_restart | ( | ) |
Reinitialize the values of sum_velocities_dt_with_ghost_cells vector to 0 and the has_started_averaging flag to false. If the initial time for average velocities parameter is greater than the simulation time, the checkpointed time average velocities are ignored after a restart. This allows users to restart a simulation with a different averaging start time.
Definition at line 429 of file postprocessing_velocities.cc.
References has_started_averaging, sum_reynolds_normal_stress_dt, sum_reynolds_shear_stress_dt, sum_rns_dt_with_ghost_cells, sum_rss_dt_with_ghost_cells, sum_velocity_dt, and sum_velocity_dt_with_ghost_cells.
|
private |
Vector to store average velocities.
Definition at line 289 of file postprocessing_velocities.h.
|
private |
DoFHandler of the velocity and pressure fields.
Definition at line 419 of file postprocessing_velocities.h.
|
private |
Time step.
Definition at line 395 of file postprocessing_velocities.h.
|
private |
Store the first time step in case it varies.
Definition at line 271 of file postprocessing_velocities.h.
|
private |
Shared pointer to the getter vector for the average velocities.
Definition at line 295 of file postprocessing_velocities.h.
|
private |
Getter vector for the average Reynolds normal stresses.
Definition at line 321 of file postprocessing_velocities.h.
|
private |
Getter vector for the average Reynolds shear stresses.
Definition at line 347 of file postprocessing_velocities.h.
|
private |
Track whether we are within the averaging time period.
Definition at line 413 of file postprocessing_velocities.h.
|
private |
Inverse for total time for averaging.
Definition at line 265 of file postprocessing_velocities.h.
|
private |
Degrees of freedom of the locally owned velocity support points.
Definition at line 425 of file postprocessing_velocities.h.
|
private |
Initial time of the simulation.
Definition at line 401 of file postprocessing_velocities.h.
|
private |
Vector to store the velocities multiplied by the time step to calculate the normal stresses.
Definition at line 302 of file postprocessing_velocities.h.
|
private |
Vector with average Reynolds normal stresses.
Definition at line 315 of file postprocessing_velocities.h.
|
private |
Vector to store the velocities multiplied by the time step to calculate the shear stresses.
Definition at line 328 of file postprocessing_velocities.h.
|
private |
Vector with average average Reynolds shear stresses.
Definition at line 341 of file postprocessing_velocities.h.
|
private |
Object used to transfer the average Reynolds normal stresses in case of mesh adaptation.
Definition at line 381 of file postprocessing_velocities.h.
|
private |
Object used to transfer the average Reynolds shear stresses in case of mesh adaptation.
Definition at line 389 of file postprocessing_velocities.h.
|
private |
Object used to transfer the average velocities in case of mesh adaptation.
Definition at line 373 of file postprocessing_velocities.h.
|
private |
Vector to store sum of the velocities multiplied by the time step to calculate the normal stresses.
Definition at line 309 of file postprocessing_velocities.h.
|
private |
Vector to store the sum the velocities multiplied by the time step to calculate the shear stresses.
Definition at line 335 of file postprocessing_velocities.h.
|
private |
Ghosted vector to store sum of the velocities multiplied by the time step to calculate the normal stresses.
Definition at line 360 of file postprocessing_velocities.h.
|
private |
Ghosted vector to store the sum the velocities multiplied by the time step to calculate the shear stresses.
Definition at line 367 of file postprocessing_velocities.h.
|
private |
Vector to store the sum of all the velocities multiplied by time step.
Definition at line 283 of file postprocessing_velocities.h.
|
private |
Ghosted vector to store the sum of all the velocities multiplied by time step.
Definition at line 353 of file postprocessing_velocities.h.
|
private |
Total period of time for averaging.
Definition at line 407 of file postprocessing_velocities.h.
|
private |
Vector to store the velocity multiplied by time step.
Definition at line 277 of file postprocessing_velocities.h.