Lethe Open-Source Library version 1.2.0
Developer Guide
Loading...
Searching...
No Matches
FlowControl< dim > Class Template Reference

#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

Detailed Description

template<int dim>
class FlowControl< dim >

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".

Template Parameters
dimNumber of spatial dimensions.

Definition at line 30 of file flow_control.h.

Constructor & Destructor Documentation

◆ FlowControl()

template<int dim>
FlowControl< dim >::FlowControl ( const Parameters::DynamicFlowControl< dim > & flow_control)
explicit

Constructor of the flow controller.

Parameters
[in]flow_controlParameters 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.

Member Function Documentation

◆ calculate_beta()

template<int dim>
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().

Parameters
[in]average_velocity_nAverage velocity of the last time step.
[in]dtCurrent time step.
[in]step_numberCurrent 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.

◆ get_beta()

template<int dim>
Tensor< 1, dim > FlowControl< dim >::get_beta ( ) const
inline

Get the beta force of the current time step.

Returns
Beta force tensor, whose only non-zero component is along the flow direction.

Definition at line 68 of file flow_control.h.

References beta.

◆ get_beta_particles()

template<int dim>
Tensor< 1, 3 > FlowControl< dim >::get_beta_particles ( const double & fluid_density,
const double & particle_density ) const
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²).

Parameters
[in]fluid_densityDensity of the fluid.
[in]particle_densityDensity of the particles.
Returns
Beta force for the particles. It is a tensor of dimension 3 since it is added to the gravity of the DEM parameters, which is always a tensor of dimension 3.

Definition at line 90 of file flow_control.h.

References beta.

◆ main_flow_controller()

template<int dim>
double FlowControl< dim >::main_flow_controller ( const double & average_velocity_n,
const double & dt ) const
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.

Parameters
[in]average_velocity_nAverage velocity of the last time step.
[in]dtCurrent time step.
Returns
Beta force calculated by the main controller.

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.

◆ proportional_flow_controller()

template<int dim>
double FlowControl< dim >::proportional_flow_controller ( const double & average_velocity_n,
const double & dt ) const
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.

Parameters
[in]average_velocity_nAverage velocity of the last time step.
[in]dtCurrent time step.
Returns
Beta force calculated by the proportional controller.

Definition at line 40 of file flow_control.cc.

References alpha, and target_average_velocity.

◆ read()

template<int dim>
void FlowControl< dim >::read ( const std::string & prefix)

Read the state of the flow controller from a checkpoint file.

Parameters
[in]prefixPrefix 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.

◆ save()

template<int dim>
void FlowControl< dim >::save ( const std::string & prefix) const

Save the state of the flow controller to a checkpoint file.

Parameters
[in]prefixPrefix 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.

Member Data Documentation

◆ alpha

template<int dim>
double FlowControl< dim >::alpha
private

Relaxation coefficient of the controllers.

Definition at line 177 of file flow_control.h.

◆ beta

template<int dim>
Tensor<1, dim> FlowControl< dim >::beta
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.

◆ beta_threshold

template<int dim>
double FlowControl< dim >::beta_threshold
private

Relative change of the beta force below which the previous beta force is kept.

Definition at line 181 of file flow_control.h.

◆ flow_direction

template<int dim>
unsigned int FlowControl< dim >::flow_direction
private

Direction of the flow (0 for x, 1 for y and 2 for z).

Definition at line 190 of file flow_control.h.

◆ force_free_deceleration_is_allowed

template<int dim>
bool FlowControl< dim >::force_free_deceleration_is_allowed = true
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.

◆ force_free_velocity_band_factor

template<int dim>
double FlowControl< dim >::force_free_velocity_band_factor
private
Initial value:
=
static constexpr double initial_force_free_velocity_band_factor

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.

◆ initial_beta

template<int dim>
double FlowControl< dim >::initial_beta
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.

◆ initial_force_free_velocity_band_factor

template<int dim>
double FlowControl< dim >::initial_force_free_velocity_band_factor = 1.01
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.

◆ minimum_force_free_velocity_band_factor

template<int dim>
double FlowControl< dim >::minimum_force_free_velocity_band_factor = 1.00125
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.

◆ previous_average_velocity

template<int dim>
double FlowControl< dim >::previous_average_velocity = 0.0
private

Average velocity of the previous time step.

Definition at line 187 of file flow_control.h.

◆ previous_beta

template<int dim>
double FlowControl< dim >::previous_beta = 0.0
private

Beta force applied during the previous time step.

Definition at line 184 of file flow_control.h.

◆ target_average_velocity

template<int dim>
double FlowControl< dim >::target_average_velocity
private

Target average velocity.

Definition at line 170 of file flow_control.h.

◆ zero_beta_tolerance

template<int dim>
double FlowControl< dim >::zero_beta_tolerance = 1e-6
staticconstexprprivate

Below this magnitude, a beta force is considered to be zero.

Definition at line 155 of file flow_control.h.


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