![]() |
Lethe Open-Source Library version 1.2.0
Developer Guide
|
#include <flow_control.h>
Public Member Functions | |
| FlowControl (const Parameters::DynamicFlowControl &flow_control) | |
| void | calculate_beta (const double &average_velocity_n, const double &dt, const unsigned int &step_number) |
| Tensor< 1, dim > | get_beta () const |
| Tensor< 1, 3 > | get_beta_particles (const double &fluid_density, const double &particle_density) const |
| void | save (const std::string &prefix) const |
| void | read (const std::string &prefix) |
Private Member Functions | |
| double | proportional_flow_controller (const double &average_velocity_n, const double &dt) const |
| double | main_flow_controller (const double &average_velocity_n, const double &dt) const |
Private Attributes | |
| Tensor< 1, dim > | beta |
| double | target_average_velocity |
| double | initial_beta |
| double | alpha |
| double | beta_threshold |
| double | previous_beta = 0.0 |
| double | previous_average_velocity = 0.0 |
| unsigned int | flow_direction |
| bool | force_free_deceleration_is_allowed = true |
| double | force_free_velocity_band_factor |
Static Private Attributes | |
| static constexpr double | zero_beta_tolerance = 1e-6 |
| static constexpr double | initial_force_free_velocity_band_factor = 1.01 |
| static constexpr double | minimum_force_free_velocity_band_factor = 1.00125 |
Dynamic flow controller that drives the average velocity of the flow towards a target value.
At each time step, the controller calculates a force coefficient beta, applied as a source term in the momentum equation along the flow direction, from the average velocity of the previous time steps. The main controller is based on Wang, 2009, "A non-body conformal grid method for simulations of laminar and turbulent flows with a compressible large eddy simulation solver".
| dim | Number of spatial dimensions. |
Definition at line 30 of file flow_control.h.
|
explicit |
Constructor of the flow controller.
| [in] | flow_control | Parameters of the dynamic flow control. When the flow control is enabled, its flow direction must be smaller than dim. |
Definition at line 18 of file flow_control.cc.
References alpha, beta_threshold, Parameters::DynamicFlowControl::enable_flow_control, flow_direction, initial_beta, and target_average_velocity.
| void FlowControl< dim >::calculate_beta | ( | const double & | average_velocity_n, |
| const double & | dt, | ||
| const unsigned int & | step_number ) |
Calculate the beta force coefficient applied during the current time step.
The coefficient adjusts the flow rate towards the target average velocity. Once the target is reached, the controller calculates the beta force that keeps the flow rate constant. The new coefficient is stored and can be obtained with get_beta().
| [in] | average_velocity_n | Average velocity of the last time step. |
| [in] | dt | Current time step. |
| [in] | step_number | Current time step number. |
Definition at line 69 of file flow_control.cc.
References beta, beta_threshold, flow_direction, force_free_deceleration_is_allowed, force_free_velocity_band_factor, initial_beta, main_flow_controller(), minimum_force_free_velocity_band_factor, previous_average_velocity, previous_beta, proportional_flow_controller(), target_average_velocity, and zero_beta_tolerance.
|
inline |
Get the beta force of the current time step.
Definition at line 68 of file flow_control.h.
References beta.
|
inline |
Get the beta force of the current time step scaled for the particles.
The particles are subjected to the same pressure gradient as the fluid, which gives beta_p * rho_p = beta_f * rho_f, in units of a pressure gradient M/(T²L²).
| [in] | fluid_density | Density of the fluid. |
| [in] | particle_density | Density of the particles. |
Definition at line 90 of file flow_control.h.
References beta.
|
private |
Calculate a beta force from the previous beta force and the average velocities of the last two time steps, following Wang (2009).
Once the target average velocity has been reached, a beta force opposed to the target flow is set to zero.
| [in] | average_velocity_n | Average velocity of the last time step. |
| [in] | dt | Current time step. |
Definition at line 48 of file flow_control.cc.
References alpha, force_free_deceleration_is_allowed, previous_average_velocity, previous_beta, and target_average_velocity.
|
private |
Calculate a beta force from the last average velocity only. It is used for the first and second time steps, when no initial beta is given or when the history of the main controller is not available yet.
| [in] | average_velocity_n | Average velocity of the last time step. |
| [in] | dt | Current time step. |
Definition at line 40 of file flow_control.cc.
References alpha, and target_average_velocity.
| void FlowControl< dim >::read | ( | const std::string & | prefix | ) |
Read the state of the flow controller from a checkpoint file.
| [in] | prefix | Prefix of the checkpoint files. The state is read from the file named prefix followed by the extension .flowcontrol. |
Definition at line 174 of file flow_control.cc.
References check_file_exists(), force_free_deceleration_is_allowed, force_free_velocity_band_factor, previous_average_velocity, and previous_beta.
| void FlowControl< dim >::save | ( | const std::string & | prefix | ) | const |
Save the state of the flow controller to a checkpoint file.
| [in] | prefix | Prefix of the checkpoint files. The state is written in the file named prefix followed by the extension .flowcontrol. |
Definition at line 156 of file flow_control.cc.
References force_free_deceleration_is_allowed, force_free_velocity_band_factor, previous_average_velocity, and previous_beta.
|
private |
Relaxation coefficient of the controllers.
Definition at line 177 of file flow_control.h.
|
private |
Beta force of the current time step. Only its component along the flow direction is non-zero.
Definition at line 167 of file flow_control.h.
|
private |
Relative change of the beta force below which the previous beta force is kept.
Definition at line 181 of file flow_control.h.
|
private |
Direction of the flow (0 for x, 1 for y and 2 for z).
Definition at line 190 of file flow_control.h.
|
private |
True while the target average velocity has not been reached once without any force applied. In that state, an average velocity slightly above the target (within the force-free velocity band) is allowed to decrease without any force, through the pressure drop only.
Definition at line 196 of file flow_control.h.
|
private |
Ratio of the upper limit of the force-free velocity band to the target average velocity. Its distance to 1 is halved when the pressure drop alone is too slow to bring the average velocity back to the target.
Definition at line 201 of file flow_control.h.
|
private |
Initial beta force given by the user. It is only used when its magnitude is larger than zero_beta_tolerance.
Definition at line 174 of file flow_control.h.
|
staticconstexprprivate |
Initial ratio of the upper limit of the force-free velocity band to the target average velocity.
Definition at line 159 of file flow_control.h.
|
staticconstexprprivate |
Smallest ratio of the upper limit of the force-free velocity band to the target average velocity. The band stops shrinking below this value.
Definition at line 163 of file flow_control.h.
|
private |
Average velocity of the previous time step.
Definition at line 187 of file flow_control.h.
|
private |
Beta force applied during the previous time step.
Definition at line 184 of file flow_control.h.
|
private |
Target average velocity.
Definition at line 170 of file flow_control.h.
|
staticconstexprprivate |
Below this magnitude, a beta force is considered to be zero.
Definition at line 155 of file flow_control.h.