Lethe Open-Source Library version 1.2.0
Developer Guide
Loading...
Searching...
No Matches
SimulationControl Class Referenceabstract

#include <simulation_control.h>

Inheritance diagram for SimulationControl:
[legend]

Public Member Functions

 SimulationControl (const Parameters::SimulationControl &param)
virtual ~SimulationControl ()=default
virtual bool integrate ()=0
virtual bool is_at_end ()=0
void add_time_step (double p_timestep)
bool is_at_start () const
bool is_steady () const
bool is_bdf () const
bool is_sdirk () const
virtual double calculate_time_step ()
bool is_refinement_step (const Parameters::MeshAdaptation &mesh_adaptation)
virtual void print_progression (const ConditionalOStream &pcout)=0
bool output_enabled () const
virtual bool is_output_iteration ()
bool get_output_boundaries () const
virtual bool is_verbose_iteration ()
virtual bool is_first_assembly ()
void update_assembly_method ()
void set_CFL (const double p_CFL)
void set_capillary_time_step_constraint (const double p_capillary_time_step_constraint)
void set_current_time_step (const double new_time_step)
void limit_initial_time_step_with_capillary_time_step_constraint ()
void set_current_capillary_time_step_ratio ()
void provide_residual (const double new_residual)
double get_time_step () const
unsigned int get_iteration_number () const
std::string get_output_name () const
std::string get_output_path () const
unsigned int get_group_files () const
unsigned int get_log_precision () const
double get_current_time () const
double get_previous_time () const
void set_stage_time (const double c_i)
void end_stages ()
std::vector< double > get_time_steps_vector () const
double get_CFL () const
double get_current_capillary_time_step_ratio () const
unsigned int get_number_subdivision () const
unsigned int get_log_frequency () const
Parameters::SimulationControl::TimeSteppingMethod get_assembly_method () const
void set_assembly_method (const Parameters::SimulationControl::TimeSteppingMethod a_method)
unsigned int get_number_of_previous_solution_in_assembly () const
std::vector< double > get_simulation_times () const
Vector< double > const & get_bdf_coefficients ()
virtual bool is_adaptive_time_stepping () const =0
virtual void save (const std::string &prefix)
virtual void read (const std::string &prefix)
std::vector< double > get_checkpointed_simulation_control_info (const std::string &prefix)

Static Public Member Functions

static unsigned int get_number_of_stages (const Parameters::SimulationControl::TimeSteppingMethod &method)

Protected Member Functions

void update_bdf_coefficients ()

Protected Attributes

Parameters::SimulationControl::TimeSteppingMethod method
Parameters::SimulationControl::TimeSteppingMethod assembly_method
double current_time
double previous_time
double time_step
double initial_time_step
double end_time
bool time_step_independent_of_end_time
std::vector< double > time_step_vector
unsigned int iteration_number
unsigned int end_iteration
unsigned int number_mesh_adapt
double CFL
double max_CFL
double capillary_time_step_constraint
double max_capillary_time_step_ratio
double current_capillary_time_step_ratio
bool adapt_with_capillary_time_step_ratio
double residual
double stop_tolerance
unsigned int output_iteration_frequency
unsigned int log_frequency
unsigned int log_precision
unsigned int subdivision
unsigned int group_files
std::string output_name
std::string output_path
bool output_boundaries
bool first_assembly
Parameters::SimulationControl::BDFStartupMethods bdf_start_method
double startup_timestep_scaling
Vector< double > bdf_coefs

Static Protected Attributes

static constexpr unsigned int n_previous_time_steps = 4

Detailed Description

Base class for controlling steady-state and transient simulations in Lethe.

The SimulationControl class is responsible for managing the progression of simulations carried out with Lethe. This is a pure virtual base class that cannot be instantiated directly. It stores core variables necessary for time-stepping control, output management, and serialization.

The class supports multiple time-stepping methods including:

  • Backward Differentiation Formula (BDF) methods: BDF1, BDF2, BDF3
  • Singly Diagonally Implicit Runge-Kutta (SDIRK) methods
  • Steady-state methods

Derived classes implement specific simulation control strategies for transient, steady-state, adjoint, and specialized simulations (e.g., DEM, ray tracing).

Note
This class handles serialization through save() and read() methods to enable checkpointing and restart capabilities.

Definition at line 42 of file simulation_control.h.

Constructor & Destructor Documentation

◆ SimulationControl()

SimulationControl::SimulationControl ( const Parameters::SimulationControl & param)

Construct a SimulationControl object from parameter structure.

The simulation control class is constructed from a parameter structure from which it draws its arguments. This structure is not kept internally. This means that required information is copied from the struct to the class.

Parameters
[in]paramStructure of the parameters for the simulation control

Definition at line 15 of file simulation_control.cc.

References adapt_with_capillary_time_step_ratio, assembly_method, bdf_coefs, bdf_start_method, capillary_time_step_constraint, CFL, current_capillary_time_step_ratio, current_time, Parameters::SimulationControl::dt, end_iteration, end_time, first_assembly, group_files, initial_time_step, iteration_number, log_frequency, log_precision, max_capillary_time_step_ratio, max_CFL, method, n_previous_time_steps, number_mesh_adapt, output_boundaries, output_iteration_frequency, output_name, output_path, previous_time, residual, startup_timestep_scaling, stop_tolerance, subdivision, time_step, time_step_independent_of_end_time, and time_step_vector.

◆ ~SimulationControl()

virtual SimulationControl::~SimulationControl ( )
virtualdefault

Default destructor.

References method.

Member Function Documentation

◆ add_time_step()

void SimulationControl::add_time_step ( double p_timestep)

Add a time step and store the previous one in the history.

This method updates the time step history by adding the new time step to the time_step_vector. The history is maintained for BDF methods that require knowledge of previous time steps.

Parameters
[in]p_timestepThe new value of the time step for the present iteration

Definition at line 59 of file simulation_control.cc.

References time_step, and time_step_vector.

◆ calculate_time_step()

virtual double SimulationControl::calculate_time_step ( )
inlinevirtual

Calculate the next value of the time step.

The base function returns the value of the current time step, but derived classes may implement adaptive time stepping based on CFL conditions or other criteria.

Returns
The calculated time step value

Reimplemented in SimulationControlTransient.

Definition at line 426 of file simulation_control.h.

References time_step.

◆ end_stages()

void SimulationControl::end_stages ( )
inline

Restore the current time to \(t_{n+1}\) after all the stages of a multi-stage method have been solved. This reproduces exactly the value computed in integrate(), where current_time = previous_time + time_step.

Definition at line 731 of file simulation_control.h.

References current_time, previous_time, and time_step.

◆ get_assembly_method()

Parameters::SimulationControl::TimeSteppingMethod SimulationControl::get_assembly_method ( ) const
inline

Get current assembly method.

Returns
Current time stepping method used for assembly

Definition at line 797 of file simulation_control.h.

References assembly_method.

◆ get_bdf_coefficients()

Vector< double > const & SimulationControl::get_bdf_coefficients ( )
inline

Get BDF coefficients.

Returns the BDF coefficients used for time integration. These coefficients are updated by update_bdf_coefficients() when the time step or assembly method changes.

Returns
Const reference to the BDF coefficients vector

Definition at line 861 of file simulation_control.h.

References bdf_coefs.

◆ get_CFL()

double SimulationControl::get_CFL ( ) const
inline

Get current CFL number.

Returns
Current CFL condition value

Definition at line 753 of file simulation_control.h.

References CFL.

◆ get_checkpointed_simulation_control_info()

std::vector< double > SimulationControl::get_checkpointed_simulation_control_info ( const std::string & prefix)

Read and return simulation control information from checkpoint without updating.

Reads and returns the simulation control information from the checkpoint file without updating the internal simulation control state. Useful for querying checkpoint information without modifying the current simulation state.

Parameters
[in]prefixThe prefix of the checkpoint file for the simulation
Returns
A vector containing the last checkpointed iteration number and time step

Definition at line 257 of file simulation_control.cc.

References check_file_exists(), and time_step_vector.

◆ get_current_capillary_time_step_ratio()

double SimulationControl::get_current_capillary_time_step_ratio ( ) const
inline

Get current capillary time-step ratio (Δt/Δt_σ).

Returns
Current capillary time-step ratio (Δt/Δt_σ) value

Definition at line 764 of file simulation_control.h.

References current_capillary_time_step_ratio.

◆ get_current_time()

double SimulationControl::get_current_time ( ) const
inline

Get current simulation time.

Returns
Current simulation time

Definition at line 693 of file simulation_control.h.

References current_time.

◆ get_group_files()

unsigned int SimulationControl::get_group_files ( ) const
inline

Get number of parallel files to generate for output.

Returns
Number of parallel output files

Definition at line 671 of file simulation_control.h.

References group_files.

◆ get_iteration_number()

unsigned int SimulationControl::get_iteration_number ( ) const
inline

Get current iteration number.

Returns
Current iteration number

Definition at line 638 of file simulation_control.h.

References iteration_number.

◆ get_log_frequency()

unsigned int SimulationControl::get_log_frequency ( ) const
inline

Get log frequency.

Returns
Frequency at which the status of the simulation is written to the terminal

Definition at line 786 of file simulation_control.h.

References log_frequency.

◆ get_log_precision()

unsigned int SimulationControl::get_log_precision ( ) const
inline

Get log precision.

Returns
Number of significant digits displayed on the standard outputs

Definition at line 682 of file simulation_control.h.

References log_precision.

◆ get_number_of_previous_solution_in_assembly()

unsigned int SimulationControl::get_number_of_previous_solution_in_assembly ( ) const
inline

Get number of previous solutions required in assembly.

Returns the number of previous solution vectors required for the current time stepping method (e.g., 1 for BDF1, 2 for BDF2, etc.).

Returns
Number of previous solutions needed for the current method

Definition at line 823 of file simulation_control.h.

References method, and number_of_previous_solutions().

◆ get_number_of_stages()

unsigned int SimulationControl::get_number_of_stages ( const Parameters::SimulationControl::TimeSteppingMethod & method)
static

Return the number of stages associated with the time-stepping method. For SDIRK methods, the number of stages is given by the last digit of the method name. For other methods, the number of stages is 1.

Parameters
[in]methodThe time-stepping method for which the number of stages is requested.
Returns
The number of stages associated with the time-stepping method.

Definition at line 168 of file simulation_control.cc.

References method.

◆ get_number_subdivision()

unsigned int SimulationControl::get_number_subdivision ( ) const
inline

Get number of mesh subdivisions for output.

Returns
Number of mesh subdivisions to be used when outputting the results

Definition at line 775 of file simulation_control.h.

References subdivision.

◆ get_output_boundaries()

bool SimulationControl::get_output_boundaries ( ) const
inline

Check if the boundaries of the domain should be outputted when writing results.

Returns
true if boundaries should be included in output, false otherwise

Definition at line 478 of file simulation_control.h.

References output_boundaries.

◆ get_output_name()

std::string SimulationControl::get_output_name ( ) const
inline

Get output file name prefix.

Returns
Output file name prefix

Definition at line 649 of file simulation_control.h.

References output_name.

◆ get_output_path()

std::string SimulationControl::get_output_path ( ) const
inline

Get output directory path.

Returns
Output directory path

Definition at line 660 of file simulation_control.h.

References output_path.

◆ get_previous_time()

double SimulationControl::get_previous_time ( ) const
inline

Get previous simulation time.

Returns
Previous simulation time

Definition at line 704 of file simulation_control.h.

References previous_time.

◆ get_simulation_times()

std::vector< double > SimulationControl::get_simulation_times ( ) const
inline

Get simulation times for current and previous time steps.

Creates a vector containing the current time and previous times based on the time step history. The times are calculated by subtracting the accumulated time steps from the current time.

Returns
Vector of simulation times (current and previous)

Definition at line 838 of file simulation_control.h.

References current_time, n_previous_time_steps, and time_step_vector.

◆ get_time_step()

double SimulationControl::get_time_step ( ) const
inline

Get current time step.

Returns
Current time step value

Definition at line 627 of file simulation_control.h.

References time_step.

◆ get_time_steps_vector()

std::vector< double > SimulationControl::get_time_steps_vector ( ) const
inline

Get time step history vector.

Returns
Vector containing previous time steps

Definition at line 742 of file simulation_control.h.

References time_step_vector.

◆ integrate()

virtual bool SimulationControl::integrate ( )
pure virtual

Pure virtual function to control the progression of the simulation.

As long as integrate returns true, a simulation should proceed. The criteria used to stop/continue the simulation in integrate is a property of each individual time stepping control. For example, steady-state simulation will proceed until the number of required mesh adaptations has been performed.

Returns
true if the simulation should continue, false otherwise

Implemented in SimulationControlRayTracing, SimulationControlSteady, and SimulationControlTransient.

◆ is_adaptive_time_stepping()

virtual bool SimulationControl::is_adaptive_time_stepping ( ) const
pure virtual

Indicate if the simulation uses adaptive time stepping or not.

Pure virtual function to be implemented by derived classes based on their specific time stepping strategy.

Returns
true if the simulation has adaptive time stepping, false otherwise

Implemented in SimulationControlRayTracing, SimulationControlSteady, and SimulationControlTransient.

◆ is_at_end()

virtual bool SimulationControl::is_at_end ( )
pure virtual

Establishes if a simulation has reached its end.

The concrete implementation of the class decides what is the stopping criteria (iteration number, time_end reached, residual tolerance, etc.)

Returns
true if the simulation has reached its end condition, false otherwise

Implemented in SimulationControlAdjointSteady, SimulationControlRayTracing, SimulationControlSteady, and SimulationControlTransient.

◆ is_at_start()

bool SimulationControl::is_at_start ( ) const
inline

Establish if the iteration is the first iteration or if the simulation has not begun.

Returns
true if iteration_number <= 1, false otherwise

Definition at line 366 of file simulation_control.h.

References iteration_number.

◆ is_bdf()

bool SimulationControl::is_bdf ( ) const
inline

Establish if the method is a BDF method.

Returns
true if the method is BDF1, BDF2, BDF3, or steady BDF, false otherwise

Definition at line 391 of file simulation_control.h.

References Parameters::SimulationControl::bdf1, Parameters::SimulationControl::bdf2, Parameters::SimulationControl::bdf3, method, and Parameters::SimulationControl::steady_bdf.

◆ is_first_assembly()

virtual bool SimulationControl::is_first_assembly ( )
inlinevirtual

Check if this is the first assembly of the present iteration.

If it indeed is the first assembly, then the first_assembly flag is set to false. This function is used when providing the residual to the simulation control object when using steady-bdf methods. Since the residual must be provided once per time step (and at the beginning), this function is used to identify that.

Returns
true if this is the first assembly, false otherwise
Note
This method has a side effect: it sets first_assembly to false after being called when it returns true.

Definition at line 509 of file simulation_control.h.

References first_assembly.

◆ is_output_iteration()

bool SimulationControl::is_output_iteration ( )
virtual

Check if the present iteration is an output iteration.

Determines whether output should be written at the current iteration based on the output control chosen (iteration-based or time-based).

Returns
true if output should be written at this iteration, false otherwise

Reimplemented in SimulationControlTransient.

Definition at line 71 of file simulation_control.cc.

References get_iteration_number(), and output_iteration_frequency.

◆ is_refinement_step()

bool SimulationControl::is_refinement_step ( const Parameters::MeshAdaptation & mesh_adaptation)

Check if the current step is a refinement step.

Parameters
[in]MeshAdaptationParameters that control dynamic mesh adaptation

Definition at line 83 of file simulation_control.cc.

References Parameters::MeshAdaptation::frequency, get_iteration_number(), is_refinement_step(), and Parameters::MeshAdaptation::refinement_at_frequency.

◆ is_sdirk()

bool SimulationControl::is_sdirk ( ) const
inline

Establish if the method is an SDIRK method.

Returns
true if the method is sdirk22, sdirk33, or sdirk45, false otherwise

Definition at line 406 of file simulation_control.h.

References method, Parameters::SimulationControl::sdirk22, Parameters::SimulationControl::sdirk33, and Parameters::SimulationControl::sdirk45.

◆ is_steady()

bool SimulationControl::is_steady ( ) const
inline

Establish if the simulation is a steady-state simulation.

Returns
true if the method is steady or steady_bdf, false otherwise

Definition at line 377 of file simulation_control.h.

References method, Parameters::SimulationControl::steady, and Parameters::SimulationControl::steady_bdf.

◆ is_verbose_iteration()

bool SimulationControl::is_verbose_iteration ( )
virtual

Check if the present iteration is a verbose iteration.

Determines if output should be written to the terminal at the current iteration based on the log_frequency setting.

Returns
true if verbose output should be written at this iteration, false otherwise

Definition at line 207 of file simulation_control.cc.

References get_iteration_number(), and log_frequency.

◆ limit_initial_time_step_with_capillary_time_step_constraint()

void SimulationControl::limit_initial_time_step_with_capillary_time_step_constraint ( )
inline

Update initial time step to respect the capillary time-step constraint. If the initial time step is already below the capillary time step, then we do not change it.

Definition at line 582 of file simulation_control.h.

References capillary_time_step_constraint, initial_time_step, max_capillary_time_step_ratio, and set_current_time_step().

◆ output_enabled()

bool SimulationControl::output_enabled ( ) const
inline

Check if VTU/PVTU/PVD outputs are disabled.

Definition at line 456 of file simulation_control.h.

References output_iteration_frequency.

◆ print_progression()

virtual void SimulationControl::print_progression ( const ConditionalOStream & pcout)
pure virtual

Print the current progress status of the simulation.

Pure virtual function that prints simulation progress information to the terminal. The specific format and content depend on the derived class implementation.

Parameters
[in]pcoutParallel conditional output stream used to print the information

Implemented in SimulationControlAdjointSteady, SimulationControlRayTracing, SimulationControlSteady, SimulationControlTransient, and SimulationControlTransientDEM.

◆ provide_residual()

void SimulationControl::provide_residual ( const double new_residual)
inline

Provide the value of the residual at the beginning of the iteration to the simulation controller.

Used primarily in adjoint time-stepping to track convergence.

Parameters
[in]new_residualValue of the residual at the beginning of an adjoint time-stepping time step

Definition at line 616 of file simulation_control.h.

References residual.

◆ read()

void SimulationControl::read ( const std::string & prefix)
virtual

Read the simulation control information from a checkpoint file.

Reads and updates the time step vector, the CFL value, the time and the iteration number from a checkpoint file to restart the simulation.

Parameters
[in]prefixThe prefix of the checkpoint file for the simulation

Reimplemented in SimulationControlTransient.

Definition at line 231 of file simulation_control.cc.

References CFL, check_file_exists(), current_time, iteration_number, previous_time, time_step, and time_step_vector.

◆ save()

void SimulationControl::save ( const std::string & prefix)
virtual

Save the simulation control information to a checkpoint file.

Saves the time step vector, the CFL value, the time and the iteration number to enable restart capabilities.

Parameters
[in]prefixThe prefix of the checkpoint file for the simulation

Definition at line 213 of file simulation_control.cc.

References CFL, current_time, iteration_number, and time_step_vector.

◆ set_assembly_method()

void SimulationControl::set_assembly_method ( const Parameters::SimulationControl::TimeSteppingMethod a_method)
inline

Set the assembly method.

Parameters
[in]a_methodThe time stepping method to use for assembly

Definition at line 808 of file simulation_control.h.

References assembly_method.

◆ set_capillary_time_step_constraint()

void SimulationControl::set_capillary_time_step_constraint ( const double p_capillary_time_step_constraint)
inline

Set the value of the current capillary time-step constraint.

The solver computes and provides the current capillary time-step constraint to the SimulationControl for use in adaptive time-stepping.

Parameters
[in]p_capillary_time_step_constraintValue of the current capillary time-step constraint computed by the solver.

Definition at line 550 of file simulation_control.h.

References capillary_time_step_constraint.

◆ set_CFL()

void SimulationControl::set_CFL ( const double p_CFL)
inline

Set the value of the CFL condition.

The solver calculates and provides the CFL number to the simulation control for use in adaptive time stepping.

Parameters
[in]p_CFLValue of the CFL condition calculated by the solver

Definition at line 535 of file simulation_control.h.

References CFL.

◆ set_current_capillary_time_step_ratio()

void SimulationControl::set_current_capillary_time_step_ratio ( )
inline

Set the current capillary time-step ratio (Δt/Δt_σ).

Definition at line 594 of file simulation_control.h.

References capillary_time_step_constraint, current_capillary_time_step_ratio, and time_step.

◆ set_current_time_step()

void SimulationControl::set_current_time_step ( const double new_time_step)
inline

Manually force the value of the time step for the present iteration.

Sets the time step to a specific value. This time step is appended to the time step history.

Parameters
[in]new_time_stepThe new value of the time step
Precondition
new_time_step must be positive (cannot go backward in time)

Definition at line 567 of file simulation_control.h.

References time_step.

◆ set_stage_time()

void SimulationControl::set_stage_time ( const double c_i)
inline

Move the current time to an intermediate stage of a multi-stage (SDIRK) method, \(t_{stage} = t_n + c_i \Delta t\), so that time-dependent functions (forcing, boundary conditions) are evaluated at the time of the stage being solved. end_stages() must be called once all the stages have been solved.

Parameters
[in]c_iTime fraction of the stage within the time step (c coefficient of the Butcher tableau).

Definition at line 720 of file simulation_control.h.

References current_time, previous_time, and time_step.

◆ update_assembly_method()

void SimulationControl::update_assembly_method ( )

Define the assembly method to use while integrating.

Used to start BDF2 and BDF3 schemes with lower-order methods before transitioning to the full-order scheme. This ensures stability during the initial time steps.

Definition at line 98 of file simulation_control.cc.

References assembly_method, Parameters::SimulationControl::bdf1, Parameters::SimulationControl::bdf2, Parameters::SimulationControl::bdf3, bdf_start_method, initial_time_step, iteration_number, method, Parameters::SimulationControl::multiple_step_bdf, set_current_time_step(), and startup_timestep_scaling.

◆ update_bdf_coefficients()

void SimulationControl::update_bdf_coefficients ( )
inlineprotected

Update the BDF coefficients.

It is necessary to update the coefficients when there is a change in the time step values or the time stepping scheme. This method recalculates the BDF coefficients based on the current assembly method and time step history.

See also
calculate_bdf_coefficients

Definition at line 282 of file simulation_control.h.

References assembly_method, bdf_coefs, calculate_bdf_coefficients(), and time_step_vector.

Member Data Documentation

◆ adapt_with_capillary_time_step_ratio

bool SimulationControl::adapt_with_capillary_time_step_ratio
protected

Enable adaptive time-stepping that respects the capillary time-step constraint.

For capillary-driven multiphase flows, stability of the solved problem can be ensured by respecting the capillary time-step constraint [1]. By default, this parameter is set to false and can only be used when simulating multiphase flows.

Reference:

[1] F. Denner, F. Evrard, and B. van Wachem, “Breaching the capillary time-step constraint using a coupled VOF method with implicit surface tension,” J. Comput. Phys., vol. 459, p. 111128, Jun. 2022, doi: 10.1016/j.jcp.2022.111128

Definition at line 187 of file simulation_control.h.

◆ assembly_method

Parameters::SimulationControl::TimeSteppingMethod SimulationControl::assembly_method
protected

Current method used for the present assembly.

This is used to differentiate the substeps of SDIRK methods or to start-up BDF simulations. For example, BDF2 and BDF3 schemes may start with lower-order methods before transitioning to the full-order scheme.

Definition at line 56 of file simulation_control.h.

◆ bdf_coefs

Vector<double> SimulationControl::bdf_coefs
protected

BDF coefficients used for time-stepping methods.

Definition at line 269 of file simulation_control.h.

◆ bdf_start_method

Parameters::SimulationControl::BDFStartupMethods SimulationControl::bdf_start_method
protected

The method used to start high-order BDF schemes.

Definition at line 258 of file simulation_control.h.

◆ capillary_time_step_constraint

double SimulationControl::capillary_time_step_constraint
protected

Capillary time-step constraint for simulation time-stepping.

Time-step constraint for capillary-driven multiphase flows. The constraint is computed according to [1]:

\[\Delta t_\sigma = \sqrt{\frac{(\rho_0 + \rho_1) h^3}{2 \pi \sigma}} \]

with \( \sigma\) the surface tension coefficient, \( \rho_0\) and \(\rho_1\) the densities of fluid 0 and 1 respectively, and \( h\) the smallest cell measure.

Remarks
Since SimulationControl is unaware of the physical properties and cells dimensions, the current capillary time-step constraint must be set through SimulationControl::set_capillary_time_step_constraint.

Reference:

[1] F. Denner, F. Evrard, and B. van Wachem, “Breaching the capillary time-step constraint using a coupled VOF method with implicit surface tension,” J. Comput. Phys., vol. 459, p. 111128, Jun. 2022, doi: 10.1016/j.jcp.2022.111128

Definition at line 146 of file simulation_control.h.

◆ CFL

double SimulationControl::CFL
protected

Courant-Friedrich-Levy (CFL) condition value.

Remarks
Since the SimulationControl is unaware of the information propagation mechanism (for instance the velocity), the current CFL must be set by the solver itself using set_CFL().

Definition at line 112 of file simulation_control.h.

◆ current_capillary_time_step_ratio

double SimulationControl::current_capillary_time_step_ratio
protected

Computed ratio between the current time step and the capillary time-step constraint (Δt/Δt_σ).

Definition at line 169 of file simulation_control.h.

◆ current_time

double SimulationControl::current_time
protected

Time of the current iteration being solved for.

Definition at line 59 of file simulation_control.h.

◆ end_iteration

unsigned int SimulationControl::end_iteration
protected

Simulation end iteration.

Definition at line 100 of file simulation_control.h.

◆ end_time

double SimulationControl::end_time
protected

Simulation end time.

Definition at line 71 of file simulation_control.h.

◆ first_assembly

bool SimulationControl::first_assembly
protected

Indicator to tell if this is the first assembly of a time step.

Definition at line 255 of file simulation_control.h.

◆ group_files

unsigned int SimulationControl::group_files
protected

Number of parallel files to generate for output.

Definition at line 238 of file simulation_control.h.

◆ initial_time_step

double SimulationControl::initial_time_step
protected

Initial time step given in the parameter file.

Definition at line 68 of file simulation_control.h.

◆ iteration_number

unsigned int SimulationControl::iteration_number
protected

Iteration number.

Iterations start at 0, but the first actual iteration is iteration 1.

Definition at line 97 of file simulation_control.h.

◆ log_frequency

unsigned int SimulationControl::log_frequency
protected

Log iteration frequency.

Controls the frequency at which the status of the simulation is written to the terminal.

Definition at line 224 of file simulation_control.h.

◆ log_precision

unsigned int SimulationControl::log_precision
protected

Log precision.

Controls the number of significant digits displayed on the standard outputs.

Definition at line 232 of file simulation_control.h.

◆ max_capillary_time_step_ratio

double SimulationControl::max_capillary_time_step_ratio
protected

The user inputted ratio between the time step and the capillary time-step constraint (Δt/Δt_σ).

When SimulationControl::adapt_with_capillary_time_step_ratio is set to true, the time step of the simulation should respect the following:

\[\Delta t \leq N_\text{CTR} \, \Delta t_\sigma \]

with \( \Delta t \) the computed time step, \( N_\text{CTR} \) the capillary time-step ratio, and \( \Delta t_\sigma \) the SimulationControl::capillary_time_step_constraint.

Definition at line 163 of file simulation_control.h.

◆ max_CFL

double SimulationControl::max_CFL
protected

Maximal CFL condition for adaptive time stepping.

This is used to control adaptive time stepping. In the case of constant time stepping or steady-state simulations, this parameter remains unused.

Definition at line 120 of file simulation_control.h.

◆ method

Parameters::SimulationControl::TimeSteppingMethod SimulationControl::method
protected

Time stepping method used for the simulation (BDF, SDIRK, steady, etc.).

Definition at line 46 of file simulation_control.h.

◆ n_previous_time_steps

unsigned int SimulationControl::n_previous_time_steps = 4
staticconstexprprotected

Number of time steps stored.

BDF methods require a number of previous time steps. This number is known a priori and depends on the method used. We do not keep all the time steps to prevent the accumulation within a large vector.

Note
Currently set to 4 to support up to BDF3 methods.

Definition at line 208 of file simulation_control.h.

◆ number_mesh_adapt

unsigned int SimulationControl::number_mesh_adapt
protected

Number of mesh adaptation iterations performed.

Definition at line 103 of file simulation_control.h.

◆ output_boundaries

bool SimulationControl::output_boundaries
protected

Output boundaries flag.

Controls if the boundaries of the domain are outputted when writing results.

Definition at line 252 of file simulation_control.h.

◆ output_iteration_frequency

unsigned int SimulationControl::output_iteration_frequency
protected

Output iteration frequency.

Controls the output of the simulation results when the output is controlled by the iteration number. A value of 0 disables output.

Definition at line 216 of file simulation_control.h.

◆ output_name

std::string SimulationControl::output_name
protected

Output file name prefix.

Definition at line 241 of file simulation_control.h.

◆ output_path

std::string SimulationControl::output_path
protected

Output directory path.

Definition at line 244 of file simulation_control.h.

◆ previous_time

double SimulationControl::previous_time
protected

Time of the previous iteration.

Definition at line 62 of file simulation_control.h.

◆ residual

double SimulationControl::residual
protected

Current value of the norm of the right-hand side residual.

Definition at line 190 of file simulation_control.h.

◆ startup_timestep_scaling

double SimulationControl::startup_timestep_scaling
protected

The time scaling used for small time steps at the startup of the simulation.

This scaling factor is applied during the startup phase when using high-order BDF methods to gradually transition to the full-order scheme.

Definition at line 266 of file simulation_control.h.

◆ stop_tolerance

double SimulationControl::stop_tolerance
protected

Residual tolerance at which the simulation stops.

This is used when adjoint time-stepping is employed.

Definition at line 197 of file simulation_control.h.

◆ subdivision

unsigned int SimulationControl::subdivision
protected

Number of mesh subdivisions to be used when outputting the results.

Definition at line 235 of file simulation_control.h.

◆ time_step

double SimulationControl::time_step
protected

Time step linking the previous iteration and the current time.

Definition at line 65 of file simulation_control.h.

◆ time_step_independent_of_end_time

bool SimulationControl::time_step_independent_of_end_time
protected

Boolean to keep the time step for the last iteration regardless of the end time.

When true, the last time step is not adjusted to match the end time exactly. Applies to both fixed time step and adaptive time step simulations.

Definition at line 80 of file simulation_control.h.

◆ time_step_vector

std::vector<double> SimulationControl::time_step_vector
protected

Time step vector storing previous time steps.

This vector accumulates the time steps of the previous iterations. This is required for multiple-step methods such as BDF schemes. The vector size is limited by n_previous_time_steps to prevent accumulation within a large vector.

Definition at line 90 of file simulation_control.h.


The documentation for this class was generated from the following files: