23 const double current_time,
24 const double time_step)
26 const double epsilon = 1e-6;
27 const double initial_time =
32 if (current_time >= (initial_time - epsilon))
61 const IndexSet &locally_relevant_dofs,
62 const MPI_Comm &mpi_communicator)
65 scalar_dt.reinit(locally_owned_dofs, mpi_communicator);
70 locally_relevant_dofs,
74 locally_relevant_dofs,
111std::vector<const GlobalVectorType *>
116 std::vector<const GlobalVectorType *> avg_scalar_set_transfer;
119 std::string filename = prefix +
".averagescalar";
120 std::ofstream output(filename.c_str());
121 output <<
"Average scalar" << std::endl;
122 output <<
"dt_0 " <<
dt_0 << std::endl;
127 return avg_scalar_set_transfer;
131std::vector<GlobalVectorType *>
134 std::vector<GlobalVectorType *> sum_vectors;
137 std::string filename = prefix +
".averagescalar";
139 "checkpoint file of the time-averaged scalar, given by "
140 "'subsection restart' - 'set filename'");
141 std::ifstream input(filename.c_str());
144 std::getline(input, buffer);
145 input >> buffer >>
dt_0;
Calculates the time-averaged scalar field.
SolutionTransfer< dim, GlobalVectorType > solution_transfer_sum_scalar_dt
Object to transfer the averaged scalar in case of mesh adaptation.
std::vector< const GlobalVectorType * > save(const std::string &prefix)
Save checkpoints to continue the averaging after the restart.
GlobalVectorType average_scalar_with_ghost_cells
Time averaged scalar containing the locally owned and locally relevant dofs for all processes.
void zero_average_after_restart()
Reinitialize the values of sum_scalar_dt_with_ghost_cells vector to 0 and the has_started_averaging f...
GlobalVectorType average_scalar
Time averaged scalar.
double inv_range_time
Inverse of the total time for averaging.
void prepare_for_mesh_adaptation()
Prepare average scalar object for dynamic mesh adaptation.
GlobalVectorType scalar_dt
Vector to store the scalar field multiplied by time step.
bool has_started_averaging
Track whether we are within the averaging time period.
GlobalVectorType sum_scalar_dt_with_ghost_cells
Ghosted vector to store the sum of all the scalar multiplied by time step.
GlobalVectorType sum_scalar_dt
Vector to store the sum of all the scalar multiplied by time step.
double dt_0
First time step is stored in dt_0 and added to total_time_for_average to ensure the first average cal...
double total_time_for_average
Vector to store the sum of all the scalar field multiplied by time step.
void calculate_average_scalar(const GlobalVectorType &local_evaluation_point, const Parameters::PostProcessing< dim > &post_processing, const double current_time, const double time_step)
Calculate time-averaged scalar field using vector with no ghost cells.
AverageScalar(const DoFHandler< dim > &dof_handler)
Constructor that initializes the solution transfer objects for the scalar field.
void initialize_vectors(const IndexSet &locally_owned_dofs, const IndexSet &locally_relevant_dofs, const MPI_Comm &mpi_communicator)
Calculate time-averaged scalar field using vector with no ghost cells.
void post_mesh_adaptation()
Reestablish solution vectors after dynamic mesh adaptation.
double real_initial_time
Difference between the simulation starting time and the initial averaging time.
std::vector< GlobalVectorType * > read(const std::string &prefix)
Read checkpoints to continuing averaging after restart.
void update_average_scalar()
Prepare average scalar object for dynamic mesh adaptation.
Postprocessing - Defines the parameters for the post-processing. In Lethe, post-processing implies th...
double initial_time_for_average_temp_and_hf
void check_file_exists(const std::string &file_name, const std::string &file_description)
Verify that a file that Lethe must read exists and can be opened, and raise an error stated in the us...
dealii::TrilinosWrappers::MPI::Vector GlobalVectorType