Lethe Open-Source Library version 1.2.0
Developer Guide
Loading...
Searching...
No Matches
NavierStokesOperatorBase< dim, number > Class Template Referenceabstract

#include <fluid_dynamics_matrix_free_operators.h>

Inheritance diagram for NavierStokesOperatorBase< dim, number >:
[legend]

Public Types

using FECellIntegrator = FEEvaluation<dim, -1, 0, dim + 1, number>
using FEFaceIntegrator = FEFaceEvaluation<dim, -1, 0, dim + 1, number>
using VectorType = LinearAlgebra::distributed::Vector<number>
using value_type = number
using size_type = VectorizedArray<number>
using StabilizationType

Public Member Functions

 NavierStokesOperatorBase ()
 NavierStokesOperatorBase (const Mapping< dim > &mapping, const DoFHandler< dim > &dof_handler, const AffineConstraints< number > &constraints, const Quadrature< dim > &quadrature, const std::shared_ptr< Function< dim > > &forcing_function, const std::shared_ptr< PhysicalPropertiesManager > &physical_properties_manager, const StabilizationType stabilization, const unsigned int mg_level, const std::shared_ptr< SimulationControl > &simulation_control, const BoundaryConditions::FluidDynamicsBoundaryConditions< dim > &boundary_conditions, const bool &enable_hessians_jacobian, const bool &enable_hessians_residual, const bool &enable_mortar)
void reinit (const Mapping< dim > &mapping, const DoFHandler< dim > &dof_handler, const AffineConstraints< number > &constraints, const Quadrature< dim > &quadrature, const std::shared_ptr< Function< dim > > &forcing_function, const std::shared_ptr< PhysicalPropertiesManager > &physical_properties_manager, const StabilizationType stabilization, const unsigned int mg_level, const std::shared_ptr< SimulationControl > &simulation_control, const BoundaryConditions::FluidDynamicsBoundaryConditions< dim > &boundary_conditions, const bool &enable_hessians_jacobian, const bool &enable_hessians_residual, const bool &enable_mortar)
void compute_element_size ()
void compute_solid_cell_mask ()
virtual void compute_forcing_term ()
void compute_thermal_buoyancy_term (const VectorType &temperature_solution, const DoFHandler< dim > &temperature_dof_handler)
types::global_dof_index m () const
number el (unsigned int, unsigned int) const
void clear ()
void initialize_dof_vector (VectorType &vec) const
const std::shared_ptr< const Utilities::MPI::Partitioner > & get_vector_partitioner () const
void vmult (VectorType &dst, const VectorType &src) const
void Tvmult (VectorType &dst, const VectorType &src) const
void vmult_interface_down (VectorType &dst, VectorType const &src) const
void vmult_interface_up (VectorType &dst, VectorType const &src) const
const DynamicSparsityPattern & get_sparsity_pattern () const
const TrilinosWrappers::SparseMatrix & get_system_matrix () const
const MatrixFree< dim, number > & get_system_matrix_free () const
const AlignedVector< VectorizedArray< number > > get_element_size () const
void compute_inverse_diagonal (VectorType &diagonal) const
void evaluate_prescribed_neumann_traction ()
virtual void evaluate_non_linear_term_and_calculate_tau (const VectorType &newton_step)
void evaluate_time_derivative_previous_solutions (const VectorType &time_derivative_previous_solutions)
void evaluate_velocity_ale (const Mapping< dim > &mapping, const Point< dim > center_of_rotation, const unsigned int rotation_axis_direction, const std::shared_ptr< Functions::ParsedFunction< dim > > &rotor_angular_velocity)
void update_beta_force (const Tensor< 1, dim > &beta_force)
void evaluate_residual (VectorType &dst, const VectorType &src)

Public Attributes

std::shared_ptr< MortarManagerBase< dim > > mortar_manager_mf
std::shared_ptr< CouplingOperator< dim, double > > mortar_coupling_operator_mf
std::shared_ptr< NavierStokesCouplingEvaluationSIPG< dim, double > > mortar_coupling_evaluator_mf
TimerOutput timer

Protected Member Functions

virtual void do_cell_integral_local (FECellIntegrator &integrator) const =0
void do_cell_integral_range (const MatrixFree< dim, number > &matrix_free, VectorType &dst, const VectorType &src, const std::pair< unsigned int, unsigned int > &range) const
template<bool assemble_residual>
void do_boundary_face_integral_local (FEFaceIntegrator &integrator) const
template<bool assemble_residual>
void do_boundary_face_integral_range (const MatrixFree< dim, number > &matrix_free, VectorType &dst, const VectorType &src, const std::pair< unsigned int, unsigned int > &range) const
void do_internal_face_integral_range (const MatrixFree< dim, number > &matrix_free, VectorType &dst, const VectorType &src, const std::pair< unsigned int, unsigned int > &range) const
virtual void local_evaluate_residual (const MatrixFree< dim, number > &matrix_free, VectorType &dst, const VectorType &src, const std::pair< unsigned int, unsigned int > &range) const =0
TimeSteppingData initialize_time_stepping_data () const

Protected Attributes

MatrixFree< dim, number > matrix_free
AffineConstraints< number > constraints
DynamicSparsityPattern dsp
TrilinosWrappers::SparseMatrix system_matrix
AlignedVector< VectorizedArray< number > > element_size
AlignedVector< VectorizedArray< number > > solid_cell_mask
bool has_solids = false
unsigned int fe_degree
std::shared_ptr< Function< dim > > forcing_function
Tensor< 1, dim, VectorizedArray< number > > beta_force
StabilizationType stabilization
std::shared_ptr< SimulationControl > simulation_control
std::shared_ptr< PhysicalPropertiesManager > properties_manager
BoundaryConditions::FluidDynamicsBoundaryConditions< dim > boundary_conditions
bool enable_hessians_jacobian
bool enable_hessians_residual
Table< 2, Tensor< 1, dim, VectorizedArray< number > > > forcing_terms
Table< 2, Tensor< 1, dim, VectorizedArray< number > > > thermal_buoyancy_term
bool enable_face_terms
Table< 2, Tensor< 1, dim+1, VectorizedArray< number > > > nonlinear_previous_values
Table< 2, Tensor< 1, dim+1, Tensor< 1, dim, VectorizedArray< number > > > > nonlinear_previous_gradient
Table< 2, Tensor< 1, dim+1, Tensor< 1, dim, VectorizedArray< number > > > > nonlinear_previous_hessian_diagonal
Table< 2, Tensor< 1, dim+1, Tensor< 2, dim, VectorizedArray< number > > > > nonlinear_previous_hessian
Table< 2, Tensor< 1, dim+1, VectorizedArray< number > > > time_derivatives_previous_solutions
Table< 2, Tensor< 1, dim+1, VectorizedArray< number > > > face_nonlinear_previous_values
Table< 2, Tensor< 1, dim, VectorizedArray< number > > > face_target_velocity
Table< 2, VectorizedArray< number > > face_target_pressure
Table< 2, Tensor< 1, dim+1, VectorizedArray< number > > > prescribed_neumann_traction
Table< 2, VectorizedArray< number > > stabilization_parameter
Table< 2, VectorizedArray< number > > stabilization_parameter_lsic
Table< 2, VectorizedArray< number > > kinematic_viscosity_vector
Table< 2, VectorizedArray< number > > grad_kinematic_viscosity_shear_rate
Table< 2, Tensor< 1, dim+1, VectorizedArray< number > > > kinematic_viscosity_gradient
Table< 2, Tensor< 1, dim+1, Tensor< 1, dim, VectorizedArray< number > > > > previous_shear_rate
Table< 2, VectorizedArray< number > > previous_shear_rate_magnitude
Table< 1, VectorizedArray< number > > effective_beta_face
bool enable_mortar
Table< 2, Tensor< 1, dim+1, VectorizedArray< number > > > nonlinear_previous_advective_values
Table< 2, Tensor< 1, dim+1, VectorizedArray< number > > > velocity_ale
std::vector< unsigned int > constrained_indices
std::vector< std::pair< number, number > > constrained_values
std::vector< unsigned int > edge_constrained_indices
bool has_edge_constrained_indices = false
std::vector< number > edge_constrained_values
std::vector< bool > edge_constrained_cell
Table< 2, bool > bool_dof_mask
ConditionalOStream pcout

Static Private Member Functions

static IndexSet get_refinement_edges (const MatrixFree< dim, number > &matrix_free)

Detailed Description

template<int dim, typename number>
class NavierStokesOperatorBase< dim, number >

A class that serves as base for all the matrix-free Navier-Stokes operators.

Template Parameters
dimAn integer that denotes the number of spatial dimensions.
numberAbstract type for number across the class (i.e., double).

Definition at line 165 of file fluid_dynamics_matrix_free_operators.h.

Member Typedef Documentation

◆ FECellIntegrator

template<int dim, typename number>
using NavierStokesOperatorBase< dim, number >::FECellIntegrator = FEEvaluation<dim, -1, 0, dim + 1, number>

Definition at line 168 of file fluid_dynamics_matrix_free_operators.h.

◆ FEFaceIntegrator

template<int dim, typename number>
using NavierStokesOperatorBase< dim, number >::FEFaceIntegrator = FEFaceEvaluation<dim, -1, 0, dim + 1, number>

Definition at line 169 of file fluid_dynamics_matrix_free_operators.h.

◆ size_type

template<int dim, typename number>
using NavierStokesOperatorBase< dim, number >::size_type = VectorizedArray<number>

Definition at line 172 of file fluid_dynamics_matrix_free_operators.h.

◆ StabilizationType

template<int dim, typename number>
using NavierStokesOperatorBase< dim, number >::StabilizationType

◆ value_type

template<int dim, typename number>
using NavierStokesOperatorBase< dim, number >::value_type = number

Definition at line 171 of file fluid_dynamics_matrix_free_operators.h.

◆ VectorType

template<int dim, typename number>
using NavierStokesOperatorBase< dim, number >::VectorType = LinearAlgebra::distributed::Vector<number>

Definition at line 170 of file fluid_dynamics_matrix_free_operators.h.

Constructor & Destructor Documentation

◆ NavierStokesOperatorBase() [1/2]

template<int dim, typename number>
NavierStokesOperatorBase< dim, number >::NavierStokesOperatorBase ( )

Default constructor.

Definition at line 78 of file fluid_dynamics_matrix_free_operators.cc.

References pcout, and timer.

◆ NavierStokesOperatorBase() [2/2]

template<int dim, typename number>
NavierStokesOperatorBase< dim, number >::NavierStokesOperatorBase ( const Mapping< dim > & mapping,
const DoFHandler< dim > & dof_handler,
const AffineConstraints< number > & constraints,
const Quadrature< dim > & quadrature,
const std::shared_ptr< Function< dim > > & forcing_function,
const std::shared_ptr< PhysicalPropertiesManager > & physical_properties_manager,
const StabilizationType stabilization,
const unsigned int mg_level,
const std::shared_ptr< SimulationControl > & simulation_control,
const BoundaryConditions::FluidDynamicsBoundaryConditions< dim > & boundary_conditions,
const bool & enable_hessians_jacobian,
const bool & enable_hessians_residual,
const bool & enable_mortar )

Constructor that points to the reinit function.

Parameters
[in]mappingDescribes the transformations from unit to real cell.
[in]dof_handlerDescribes the layout of DoFs and the type of FE.
[in]constraintsObject with constraints according to DoFs.
[in]quadratureRequired for local operations on cells.
[in]forcing_functionFunction specified in parameter file as source term.
[in]properties_managerThe physical properties manager (see physical_properties_manager.h)
[in]stabilizationStabilization type specified in parameter file.
[in]mg_levelLevel of the operator in case of MG methods.
[in]simulation_controlRequired to get the time stepping method.
[in]physical_properties_managerRequired to have the updated values of physical properties in case of ramp or viscous initial conditions.
[in]boundary_conditionsContains information regarding all boundary conditions. Required to weakly impose boundary conditions.
[in]enable_hessians_jacobianFlag to turn hessian terms from jacobian on or off.
[in]enable_hessians_residualFlag to turn hessian terms from residual on or off.
[in]enable_mortarFlag to turn mortar parameters on or off.

Definition at line 84 of file fluid_dynamics_matrix_free_operators.cc.

References boundary_conditions, constraints, enable_hessians_jacobian, enable_hessians_residual, enable_mortar, forcing_function, pcout, reinit(), simulation_control, stabilization, and timer.

Member Function Documentation

◆ clear()

template<int dim, typename number>
void NavierStokesOperatorBase< dim, number >::clear ( )

Clear the matrix-free object.

Definition at line 480 of file fluid_dynamics_matrix_free_operators.cc.

References matrix_free.

◆ compute_element_size()

template<int dim, typename number>
void NavierStokesOperatorBase< dim, number >::compute_element_size ( )

Compute the element size h of the cells required to calculate stabilization parameters.

Definition at line 352 of file fluid_dynamics_matrix_free_operators.cc.

References compute_cell_diameter(), element_size, fe_degree, and matrix_free.

◆ compute_forcing_term()

template<int dim, typename number>
void NavierStokesOperatorBase< dim, number >::compute_forcing_term ( )
virtual

Precompute forcing term at the quadrature points. This is called when the operator is initialized and must be called again whenever the time of the forcing function changes, since the forcing function is otherwise only evaluated at the time at which the operator was initialized.

Reimplemented in VANSOperator< dim, number >.

Definition at line 374 of file fluid_dynamics_matrix_free_operators.cc.

References evaluate_function(), forcing_function, forcing_terms, and matrix_free.

◆ compute_inverse_diagonal()

template<int dim, typename number>
void NavierStokesOperatorBase< dim, number >::compute_inverse_diagonal ( VectorType & diagonal) const

Compute the diagonal of the operator using an optimized MatrixFree function. Needed for preconditioners.

Parameters
[in,out]diagonalThe vector where the computed diagonal is stored.

Definition at line 1373 of file fluid_dynamics_matrix_free_operators.cc.

References do_boundary_face_integral_local(), do_cell_integral_local(), edge_constrained_indices, enable_face_terms, enable_mortar, matrix_free, mortar_coupling_operator_mf, and timer.

◆ compute_solid_cell_mask()

template<int dim, typename number>
void NavierStokesOperatorBase< dim, number >::compute_solid_cell_mask ( )

Compute a per-cell-batch mask that suppresses contributions from solid cells (material_id > 0). Each lane of solid_cell_mask is set to 1.0 for fluid cells and 0.0 for solid cells, mirroring the matrix-based behavior where solid cells are skipped during assembly.

Definition at line 324 of file fluid_dynamics_matrix_free_operators.cc.

References matrix_free, and solid_cell_mask.

◆ compute_thermal_buoyancy_term()

template<int dim, typename number>
void NavierStokesOperatorBase< dim, number >::compute_thermal_buoyancy_term ( const VectorType & temperature_solution,
const DoFHandler< dim > & temperature_dof_handler )

Precompute thermal buoyancy term for heat-transfer coupling.

Parameters
[in]temperature_solutionPresent solution of the temperature as given by the multiphysics interface.
[in]temperature_dof_handlerDoF Handler used for the heat transfer.

Definition at line 402 of file fluid_dynamics_matrix_free_operators.cc.

References forcing_terms, matrix_free, properties_manager, and thermal_buoyancy_term.

◆ do_boundary_face_integral_local()

template<int dim, typename number>
template<bool assemble_residual>
void NavierStokesOperatorBase< dim, number >::do_boundary_face_integral_local ( FEFaceIntegrator & integrator) const
protected

Carry out the integration of boundary face integrals.

Template Parameters
assemble_residualFlag to assemble the residual or the Jacobian.
Parameters
[in]integratorFEFaceEvaluation object that allows to evaluate functions at quadrature points and perform face integrations.

Definition at line 1488 of file fluid_dynamics_matrix_free_operators.cc.

References boundary_condition_requires_face_assembly(), boundary_conditions, effective_beta_face, enable_face_terms, face_nonlinear_previous_values, face_target_pressure, face_target_velocity, BoundaryConditions::function_weak, matrix_free, BoundaryConditions::neumann_traction, BoundaryConditions::outlet, prescribed_neumann_traction, BoundaryConditions::pressure, properties_manager, and velocity.

◆ do_boundary_face_integral_range()

template<int dim, typename number>
template<bool assemble_residual>
void NavierStokesOperatorBase< dim, number >::do_boundary_face_integral_range ( const MatrixFree< dim, number > & matrix_free,
VectorType & dst,
const VectorType & src,
const std::pair< unsigned int, unsigned int > & range ) const
protected

Loop over all boundary face batches within certain range and perform a face integral with access to global vectors, i.e., gathering and scattering values. This is used to weakly impose Dirichlet boundary conditions or outlet boundary conditions.

Template Parameters
assemble_residualFlag to assemble the residual or the Jacobian.
Parameters
[in]matrix_freeObject that contains all data.
[in,out]dstGlobal vector where the final result is added.
[in]srcInput vector with all values in all cells.
[in]rangeRange of the face batch.

Definition at line 1452 of file fluid_dynamics_matrix_free_operators.cc.

References do_boundary_face_integral_local(), and matrix_free.

◆ do_cell_integral_local()

template<int dim, typename number>
virtual void NavierStokesOperatorBase< dim, number >::do_cell_integral_local ( FECellIntegrator & integrator) const
protectedpure virtual

Interface to function that performs a cell integral in a cell batch without gathering and scattering the values. Should be overriden by derived classes.

Parameters
[in]integratorFEEvaluation object that allows to evaluate functions at quadrature points and perform cell integrations.

Implemented in NavierStokesNonNewtonianStabilizedOperator< dim, number >, NavierStokesStabilizedOperator< dim, number >, and VANSOperator< dim, number >.

◆ do_cell_integral_range()

template<int dim, typename number>
void NavierStokesOperatorBase< dim, number >::do_cell_integral_range ( const MatrixFree< dim, number > & matrix_free,
VectorType & dst,
const VectorType & src,
const std::pair< unsigned int, unsigned int > & range ) const
protected

Loop over all cell batches within certain range and perform a cell integral with access to global vectors, i.e., gathering and scattering values.

Parameters
[in]matrix_freeObject that contains all data.
[in,out]dstGlobal vector where the final result is added.
[in]srcInput vector with all values in all cells.
[in]rangeRange of the cell batch.

Definition at line 1413 of file fluid_dynamics_matrix_free_operators.cc.

References do_cell_integral_local(), and matrix_free.

◆ do_internal_face_integral_range()

template<int dim, typename number>
void NavierStokesOperatorBase< dim, number >::do_internal_face_integral_range ( const MatrixFree< dim, number > & matrix_free,
VectorType & dst,
const VectorType & src,
const std::pair< unsigned int, unsigned int > & range ) const
protected

Loop over all internal face batches within certain range and perform a face integral with access to global vectors, i.e., gathering and scattering values. This is only required for compilation and not needed for our CG implementation.

Parameters
[in]matrix_freeObject that contains all data.
[in,out]dstGlobal vector where the final result is added.
[in]srcInput vector with all values in all cells.
[in]rangeRange of the face batch.

Definition at line 1435 of file fluid_dynamics_matrix_free_operators.cc.

References matrix_free.

◆ el()

template<int dim, typename number>
number NavierStokesOperatorBase< dim, number >::el ( unsigned int ,
unsigned int  ) const

Access a particular element in the matrix. Only required for compilation and it is not used.

Parameters
int
int
Returns
number

Definition at line 472 of file fluid_dynamics_matrix_free_operators.cc.

◆ evaluate_non_linear_term_and_calculate_tau()

◆ evaluate_prescribed_neumann_traction()

template<int dim, typename number>
void NavierStokesOperatorBase< dim, number >::evaluate_prescribed_neumann_traction ( )

Store the values of the prescribed Neumann traction boundary condition to use it \((\boldsymbol{\sigma} \cdot \mathbf{n},\, \mathbf{v}) = (\mathrm{traction\_fn},\, \mathbf{v})\). in the residual assembly and Jacobian assembly of the matrix-free operator.

Definition at line 863 of file fluid_dynamics_matrix_free_operators.cc.

References boundary_conditions, enable_face_terms, evaluate_function(), matrix_free, prescribed_neumann_traction, and timer.

◆ evaluate_residual()

template<int dim, typename number>
void NavierStokesOperatorBase< dim, number >::evaluate_residual ( VectorType & dst,
const VectorType & src )

Evaluate right hand side using the matrix-free operator.

Parameters
[in,out]dstDestination vector holding the result.
[in]srcInput vector for which the residual is evaluated.

Definition at line 1350 of file fluid_dynamics_matrix_free_operators.cc.

References do_boundary_face_integral_range(), do_internal_face_integral_range(), enable_face_terms, local_evaluate_residual(), matrix_free, and timer.

◆ evaluate_time_derivative_previous_solutions()

template<int dim, typename number>
void NavierStokesOperatorBase< dim, number >::evaluate_time_derivative_previous_solutions ( const VectorType & time_derivative_previous_solutions)

Store the values of the vector containing the time derivatives of previous solutions to use them in the Jacobian and residual cell integrals.

Parameters
[in]time_derivative_previous_solutionsVector with the time derivative of previous solutions.

Definition at line 1241 of file fluid_dynamics_matrix_free_operators.cc.

References matrix_free, time_derivatives_previous_solutions, and timer.

◆ evaluate_velocity_ale()

template<int dim, typename number>
void NavierStokesOperatorBase< dim, number >::evaluate_velocity_ale ( const Mapping< dim > & mapping,
const Point< dim > center_of_rotation,
const unsigned int rotation_axis_direction,
const std::shared_ptr< Functions::ParsedFunction< dim > > & rotor_angular_velocity )

Store the values of the vector containing the ALE velocity to use them in the Jacobian and residual cell integrals. This function is called when the mortar feature is enabled.

Parameters
[in]mappingDescribes the transformations from unit to real cell.
[in]center_of_rotationCenter of rotation of the rotor domain.
[in]rotation_axis_directionDirection of the rotation axis.
[in]rotor_angular_velocityAngular velocity of the rotor domain.

Definition at line 1268 of file fluid_dynamics_matrix_free_operators.cc.

References LetheGridTools::angular_to_linear_velocity(), matrix_free, simulation_control, timer, and velocity_ale.

◆ get_element_size()

template<int dim, typename number>
const AlignedVector< VectorizedArray< number > > NavierStokesOperatorBase< dim, number >::get_element_size ( ) const

Get the element size object.

Returns
Aligned vector with the size of all elements.

Definition at line 856 of file fluid_dynamics_matrix_free_operators.cc.

References element_size.

◆ get_refinement_edges()

template<int dim, typename number>
IndexSet NavierStokesOperatorBase< dim, number >::get_refinement_edges ( const MatrixFree< dim, number > & matrix_free)
staticprivate

Get the refinement edges. Only needed if the local smoothing multigrid approach is used.

Parameters
[in]matrix_freeObject that contains all data.
Returns
Set containing the indices of the refinement edges.

Definition at line 1683 of file fluid_dynamics_matrix_free_operators.cc.

References matrix_free.

◆ get_sparsity_pattern()

template<int dim, typename number>
const DynamicSparsityPattern & NavierStokesOperatorBase< dim, number >::get_sparsity_pattern ( ) const

Return sparsity pattern used to set up the sparse matrix by get_system_matrix().

Returns
Sparsity pattern.

Definition at line 649 of file fluid_dynamics_matrix_free_operators.cc.

References dsp.

◆ get_system_matrix()

template<int dim, typename number>
const TrilinosWrappers::SparseMatrix & NavierStokesOperatorBase< dim, number >::get_system_matrix ( ) const

Calculate matrix if needed, e.g., by coarse-grid solver when a multigrid algorithm is used.

Returns
Trilinos sparse matrix.

Definition at line 658 of file fluid_dynamics_matrix_free_operators.cc.

References bool_dof_mask, constrained_indices, constraints, do_boundary_face_integral_local(), do_cell_integral_local(), dsp, edge_constrained_indices, enable_face_terms, enable_mortar, get_vector_partitioner(), matrix_free, mortar_coupling_operator_mf, system_matrix, and timer.

◆ get_system_matrix_free()

template<int dim, typename number>
const MatrixFree< dim, number > & NavierStokesOperatorBase< dim, number >::get_system_matrix_free ( ) const

Get the system matrix free object.

Returns
Matrix free object.

Definition at line 849 of file fluid_dynamics_matrix_free_operators.cc.

References matrix_free.

◆ get_vector_partitioner()

template<int dim, typename number>
const std::shared_ptr< const Utilities::MPI::Partitioner > & NavierStokesOperatorBase< dim, number >::get_vector_partitioner ( ) const

Get the vector partitioner object required for local smoothing multigrid preconditioner.

Returns
Pointer to vector partitioner.

Definition at line 495 of file fluid_dynamics_matrix_free_operators.cc.

References matrix_free.

◆ initialize_dof_vector()

template<int dim, typename number>
void NavierStokesOperatorBase< dim, number >::initialize_dof_vector ( VectorType & vec) const

Initialize a given vector by delegating it to the MatrixFree function in charge of this task.

Parameters
[in,out]vecVector to be initialized.

Definition at line 487 of file fluid_dynamics_matrix_free_operators.cc.

References matrix_free.

◆ initialize_time_stepping_data()

template<int dim, typename number>
TimeSteppingData NavierStokesOperatorBase< dim, number >::initialize_time_stepping_data ( ) const
protected

Initialize time stepping data such as the time step size and BDF coefficients.

Returns
TimeSteppingData structure containing all of the information for time-stepping

Definition at line 282 of file fluid_dynamics_matrix_free_operators.cc.

References TimeSteppingData::a_ii, SDIRKStageData::a_ij, TimeSteppingData::bdf_coefficients, TimeSteppingData::dt, TimeSteppingData::is_bdf, TimeSteppingData::is_sdirk, TimeSteppingData::is_transient, sdirk_table(), simulation_control, time_stepping_is_bdf(), and time_stepping_is_sdirk().

◆ local_evaluate_residual()

template<int dim, typename number>
virtual void NavierStokesOperatorBase< dim, number >::local_evaluate_residual ( const MatrixFree< dim, number > & matrix_free,
VectorType & dst,
const VectorType & src,
const std::pair< unsigned int, unsigned int > & range ) const
protectedpure virtual

Interface to function in charge of computing the residual using a cell integral in a cell batch with gathering and scattering values. Should be overriden by derived classes.

Parameters
[in]matrix_freeObject that contains all data.
[in,out]dstGlobal vector where the final result is added.
[in]srcInput vector with all values in all cells.
[in]rangeRange of the cell batch.

Implemented in NavierStokesNonNewtonianStabilizedOperator< dim, number >, NavierStokesStabilizedOperator< dim, number >, and VANSOperator< dim, number >.

◆ m()

template<int dim, typename number>
types::global_dof_index NavierStokesOperatorBase< dim, number >::m ( ) const

Get the total number of DoFs.

Returns
Total number of degrees of freedom.

Definition at line 461 of file fluid_dynamics_matrix_free_operators.cc.

References matrix_free.

◆ reinit()

template<int dim, typename number>
void NavierStokesOperatorBase< dim, number >::reinit ( const Mapping< dim > & mapping,
const DoFHandler< dim > & dof_handler,
const AffineConstraints< number > & constraints,
const Quadrature< dim > & quadrature,
const std::shared_ptr< Function< dim > > & forcing_function,
const std::shared_ptr< PhysicalPropertiesManager > & physical_properties_manager,
const StabilizationType stabilization,
const unsigned int mg_level,
const std::shared_ptr< SimulationControl > & simulation_control,
const BoundaryConditions::FluidDynamicsBoundaryConditions< dim > & boundary_conditions,
const bool & enable_hessians_jacobian,
const bool & enable_hessians_residual,
const bool & enable_mortar )

Initialize the main matrix free object that contains all data and is needed to perform loops over cells, and initialize relevant member variables such as parameters and element size. Calculate edge constraints in case the local smoothing multigrid is used.

Parameters
[in]mappingDescribes the transformations from unit to real cell.
[in]dof_handlerDescribes the layout of DoFs and the type of FE.
[in]constraintsObject with constraints according to DoFs.
[in]quadratureRequired for local operations on cells.
[in]forcing_functionFunction specified in parameter file as source term.
[in]properties_managerThe physical properties manager (see physical_properties_manager.h)
[in]stabilizationStabilization type specified in parameter file.
[in]mg_levelLevel of the operator in case of MG methods.
[in]simulation_controlRequired to get the time stepping method.
[in]boundary_conditionsContains information regarding all boundary conditions. Required to weakly impose boundary conditions.
[in]enable_hessians_jacobianFlag to turn hessian terms from jacobian on or off.
[in]enable_hessians_residualFlag to turn hessian terms from residual on or off.
[in]enable_mortarFlag to turn mortar parameters on or off.

Definition at line 119 of file fluid_dynamics_matrix_free_operators.cc.

References bool_dof_mask, boundary_conditions, compute_element_size(), compute_forcing_term(), compute_solid_cell_mask(), constrained_indices, constrained_values, constraints, create_bool_dof_mask(), edge_constrained_cell, edge_constrained_indices, edge_constrained_values, enable_face_terms, enable_hessians_jacobian, enable_hessians_residual, enable_mortar, fe_degree, forcing_function, BoundaryConditions::function_weak, get_refinement_edges(), Parameters::Stabilization::gls, has_edge_constrained_indices, has_solids, matrix_free, BoundaryConditions::neumann_traction, BoundaryConditions::outlet, BoundaryConditions::pressure, properties_manager, Parameters::Stabilization::pspg_supg, simulation_control, solid_cell_mask, stabilization, and system_matrix.

◆ Tvmult()

template<int dim, typename number>
void NavierStokesOperatorBase< dim, number >::Tvmult ( VectorType & dst,
const VectorType & src ) const

Perform the transposed operator evaluation.

Parameters
[in,out]dstDestination vector holding the result.
[in]srcInput source vector.

Definition at line 566 of file fluid_dynamics_matrix_free_operators.cc.

References vmult().

◆ update_beta_force()

template<int dim, typename number>
void NavierStokesOperatorBase< dim, number >::update_beta_force ( const Tensor< 1, dim > & beta_force)

Store the values of the source term calculated if dynamic control is enabled in the appropriate structure.

Parameters
[in]beta_forceSource term calculated by the dynamic flow control.

Definition at line 1338 of file fluid_dynamics_matrix_free_operators.cc.

References beta_force.

◆ vmult()

template<int dim, typename number>
void NavierStokesOperatorBase< dim, number >::vmult ( VectorType & dst,
const VectorType & src ) const

Perform an operator evaluation dst = A*src by looping with the help of the MatrixFree object over all cells and evaluating the effect of cell integrals.

Parameters
[in,out]dstDestination vector holding the result.
[in]srcInput source vector.

Definition at line 502 of file fluid_dynamics_matrix_free_operators.cc.

References constrained_indices, do_boundary_face_integral_range(), do_cell_integral_range(), do_internal_face_integral_range(), edge_constrained_indices, edge_constrained_values, enable_face_terms, enable_mortar, matrix_free, mortar_coupling_operator_mf, and timer.

◆ vmult_interface_down()

template<int dim, typename number>
void NavierStokesOperatorBase< dim, number >::vmult_interface_down ( VectorType & dst,
VectorType const & src ) const

Vmult operator for an interface. Required only if local smoothing multigrid is used and for meshes with hanging nodes.

Parameters
[in,out]dstDestination vector holding the result.
[in]srcInput source vector.

Definition at line 574 of file fluid_dynamics_matrix_free_operators.cc.

References constrained_indices, do_boundary_face_integral_range(), do_cell_integral_range(), do_internal_face_integral_range(), enable_face_terms, and matrix_free.

◆ vmult_interface_up()

template<int dim, typename number>
void NavierStokesOperatorBase< dim, number >::vmult_interface_up ( VectorType & dst,
VectorType const & src ) const

Vmult operator for an interface. Required only if local smoothing multigrid is used and for meshes with hanging nodes.

Parameters
[in,out]dstDestination vector holding the result.
[in]srcInput source vector.

Definition at line 600 of file fluid_dynamics_matrix_free_operators.cc.

References do_boundary_face_integral_range(), do_cell_integral_range(), do_internal_face_integral_range(), edge_constrained_indices, enable_face_terms, has_edge_constrained_indices, matrix_free, and timer.

Member Data Documentation

◆ beta_force

template<int dim, typename number>
Tensor<1, dim, VectorizedArray<number> > NavierStokesOperatorBase< dim, number >::beta_force
protected

Additional source term in the case of dynamic flow control.

Definition at line 692 of file fluid_dynamics_matrix_free_operators.h.

◆ bool_dof_mask

template<int dim, typename number>
Table<2, bool> NavierStokesOperatorBase< dim, number >::bool_dof_mask
protected

DoF mask object needed for the sparsity pattern and computation of the system matrix of the coarse level in case FE_Q_iso_Q1 elements are used.

Definition at line 958 of file fluid_dynamics_matrix_free_operators.h.

◆ boundary_conditions

template<int dim, typename number>
BoundaryConditions::FluidDynamicsBoundaryConditions<dim> NavierStokesOperatorBase< dim, number >::boundary_conditions
protected

Boundary conditions object to impose the correct boundary conditions. This object is only used to impose boundary conditions that appear in the weak form as face terms (Weak Dirichlet boundary conditions and, eventually, outlets). However, the entire boundary_conditions object is stored instead of trying to isolate which parameters are used since many of them are used in the initialization of the boundary conditions.

Definition at line 721 of file fluid_dynamics_matrix_free_operators.h.

◆ constrained_indices

template<int dim, typename number>
std::vector<unsigned int> NavierStokesOperatorBase< dim, number >::constrained_indices
protected

Vector with the constrained indices used for the local smoothing approach.

Definition at line 918 of file fluid_dynamics_matrix_free_operators.h.

◆ constrained_values

template<int dim, typename number>
std::vector<std::pair<number, number> > NavierStokesOperatorBase< dim, number >::constrained_values
mutableprotected

Vector with the constrained values used for the local smoothing approach.

Definition at line 924 of file fluid_dynamics_matrix_free_operators.h.

◆ constraints

template<int dim, typename number>
AffineConstraints<number> NavierStokesOperatorBase< dim, number >::constraints
protected

Object that stores constraints for the matrix free implementation.

Definition at line 637 of file fluid_dynamics_matrix_free_operators.h.

◆ dsp

template<int dim, typename number>
DynamicSparsityPattern NavierStokesOperatorBase< dim, number >::dsp
mutableprotected

Sparsity pattern used when the matrix of certain level is computed and stored.

Definition at line 643 of file fluid_dynamics_matrix_free_operators.h.

◆ edge_constrained_cell

template<int dim, typename number>
std::vector<bool> NavierStokesOperatorBase< dim, number >::edge_constrained_cell
protected

Vector used to mark edge constrained cells in order to verify constrained indices for the local smoothing approach.

Definition at line 951 of file fluid_dynamics_matrix_free_operators.h.

◆ edge_constrained_indices

template<int dim, typename number>
std::vector<unsigned int> NavierStokesOperatorBase< dim, number >::edge_constrained_indices
protected

Vector with the constrained edge indices for the local smoothing approach.

Definition at line 930 of file fluid_dynamics_matrix_free_operators.h.

◆ edge_constrained_values

template<int dim, typename number>
std::vector<number> NavierStokesOperatorBase< dim, number >::edge_constrained_values
mutableprotected

Vector with edge constrained values used for the local smoothing approach.

Definition at line 943 of file fluid_dynamics_matrix_free_operators.h.

◆ effective_beta_face

template<int dim, typename number>
Table<1, VectorizedArray<number> > NavierStokesOperatorBase< dim, number >::effective_beta_face
protected

Table with correct alignment for vectorization to store the values of the face penalization term effective_beta_face.

Definition at line 891 of file fluid_dynamics_matrix_free_operators.h.

◆ element_size

template<int dim, typename number>
AlignedVector<VectorizedArray<number> > NavierStokesOperatorBase< dim, number >::element_size
protected

Aligned vector to store the element size of all the elements.

Definition at line 656 of file fluid_dynamics_matrix_free_operators.h.

◆ enable_face_terms

template<int dim, typename number>
bool NavierStokesOperatorBase< dim, number >::enable_face_terms
protected

Flag to turn the calculation of face terms on or off. This is used for weakly imposed Dirichlet boundary conditions or outlets.

Definition at line 753 of file fluid_dynamics_matrix_free_operators.h.

◆ enable_hessians_jacobian

template<int dim, typename number>
bool NavierStokesOperatorBase< dim, number >::enable_hessians_jacobian
protected

Flag to turn hessian terms from jacobian on or off.

Definition at line 727 of file fluid_dynamics_matrix_free_operators.h.

◆ enable_hessians_residual

template<int dim, typename number>
bool NavierStokesOperatorBase< dim, number >::enable_hessians_residual
protected

Flag to turn hessian terms from residual on or off.

Definition at line 733 of file fluid_dynamics_matrix_free_operators.h.

◆ enable_mortar

template<int dim, typename number>
bool NavierStokesOperatorBase< dim, number >::enable_mortar
protected

Flag to turn the computation of mortar coupling terms on or off.

Definition at line 896 of file fluid_dynamics_matrix_free_operators.h.

◆ face_nonlinear_previous_values

template<int dim, typename number>
Table<2, Tensor<1, dim + 1, VectorizedArray<number> > > NavierStokesOperatorBase< dim, number >::face_nonlinear_previous_values
protected

Table with correct alignment for vectorization to store the values of the velocity at faces.

Definition at line 801 of file fluid_dynamics_matrix_free_operators.h.

◆ face_target_pressure

template<int dim, typename number>
Table<2, VectorizedArray<number> > NavierStokesOperatorBase< dim, number >::face_target_pressure
protected

Table with correct alignment for vectorization to store the values of the target pressure of a pressure boundary condition.

Definition at line 815 of file fluid_dynamics_matrix_free_operators.h.

◆ face_target_velocity

template<int dim, typename number>
Table<2, Tensor<1, dim, VectorizedArray<number> > > NavierStokesOperatorBase< dim, number >::face_target_velocity
protected

Table with correct alignment for vectorization to store the values of the target velocity of a weakly imposed Dirichlet boundary condition.

Definition at line 808 of file fluid_dynamics_matrix_free_operators.h.

◆ fe_degree

template<int dim, typename number>
unsigned int NavierStokesOperatorBase< dim, number >::fe_degree
protected

Finite element degree for the operator.

Definition at line 680 of file fluid_dynamics_matrix_free_operators.h.

◆ forcing_function

template<int dim, typename number>
std::shared_ptr<Function<dim> > NavierStokesOperatorBase< dim, number >::forcing_function
protected

Force function or source function for the Navier-Stokes equations.

Definition at line 686 of file fluid_dynamics_matrix_free_operators.h.

◆ forcing_terms

template<int dim, typename number>
Table<2, Tensor<1, dim, VectorizedArray<number> > > NavierStokesOperatorBase< dim, number >::forcing_terms
protected

Table with precomputed forcing term values.

Definition at line 739 of file fluid_dynamics_matrix_free_operators.h.

◆ grad_kinematic_viscosity_shear_rate

template<int dim, typename number>
Table<2, VectorizedArray<number> > NavierStokesOperatorBase< dim, number >::grad_kinematic_viscosity_shear_rate
protected

Table with correct alignment for vectorization to store the values of the gradient of the kinematic viscosity w.r.t shear rate.

Definition at line 861 of file fluid_dynamics_matrix_free_operators.h.

◆ has_edge_constrained_indices

template<int dim, typename number>
bool NavierStokesOperatorBase< dim, number >::has_edge_constrained_indices = false
protected

Variable to identify whether there are edge constrained indices for the local smoothing approach.

Definition at line 937 of file fluid_dynamics_matrix_free_operators.h.

◆ has_solids

template<int dim, typename number>
bool NavierStokesOperatorBase< dim, number >::has_solids = false
protected

Flag indicating whether the simulation contains any solid region (material_id > 0). When false, the solid-cell masking is skipped entirely so the no-solid case has zero overhead in the inner loop.

Definition at line 674 of file fluid_dynamics_matrix_free_operators.h.

◆ kinematic_viscosity_gradient

template<int dim, typename number>
Table<2, Tensor<1, dim + 1, VectorizedArray<number> > > NavierStokesOperatorBase< dim, number >::kinematic_viscosity_gradient
protected

Table with correct alignment for vectorization to store the values of the kinematic viscosity gradient.

Definition at line 869 of file fluid_dynamics_matrix_free_operators.h.

◆ kinematic_viscosity_vector

template<int dim, typename number>
Table<2, VectorizedArray<number> > NavierStokesOperatorBase< dim, number >::kinematic_viscosity_vector
protected

Table with correct alignment for vectorization to store the values of the kinematic viscosity.

Definition at line 854 of file fluid_dynamics_matrix_free_operators.h.

◆ matrix_free

template<int dim, typename number>
MatrixFree<dim, number> NavierStokesOperatorBase< dim, number >::matrix_free
protected

Object storing all the relevant data needed for the matrix free implementation.

Definition at line 631 of file fluid_dynamics_matrix_free_operators.h.

◆ mortar_coupling_evaluator_mf

template<int dim, typename number>
std::shared_ptr<NavierStokesCouplingEvaluationSIPG<dim, double> > NavierStokesOperatorBase< dim, number >::mortar_coupling_evaluator_mf

Definition at line 503 of file fluid_dynamics_matrix_free_operators.h.

◆ mortar_coupling_operator_mf

template<int dim, typename number>
std::shared_ptr<CouplingOperator<dim, double> > NavierStokesOperatorBase< dim, number >::mortar_coupling_operator_mf

Definition at line 501 of file fluid_dynamics_matrix_free_operators.h.

◆ mortar_manager_mf

template<int dim, typename number>
std::shared_ptr<MortarManagerBase<dim> > NavierStokesOperatorBase< dim, number >::mortar_manager_mf

Mortar coupling manager, operator, and evaluator used in the matrix-free solver. The matrix-based solver uses the shared pointers created in the NS base. Because we have a different system_operator here, we need to create new pointers.

Definition at line 500 of file fluid_dynamics_matrix_free_operators.h.

◆ nonlinear_previous_advective_values

template<int dim, typename number>
Table<2, Tensor<1, dim + 1, VectorizedArray<number> > > NavierStokesOperatorBase< dim, number >::nonlinear_previous_advective_values
protected

Table with correct alignment for vectorization to store the values of the velocity within the advective term. If ALE is enabled, this term is given by u - u_ALE. Otherwise, it returns the regular velocity tensor.

Definition at line 905 of file fluid_dynamics_matrix_free_operators.h.

◆ nonlinear_previous_gradient

template<int dim, typename number>
Table<2, Tensor<1, dim + 1, Tensor<1, dim, VectorizedArray<number> > > > NavierStokesOperatorBase< dim, number >::nonlinear_previous_gradient
protected

Table with correct alignment for vectorization to store the gradients of the previous newton step.

Definition at line 769 of file fluid_dynamics_matrix_free_operators.h.

◆ nonlinear_previous_hessian

template<int dim, typename number>
Table<2, Tensor<1, dim + 1, Tensor<2, dim, VectorizedArray<number> > > > NavierStokesOperatorBase< dim, number >::nonlinear_previous_hessian
protected

Table with correct alignment for vectorization to store the hessian of the previous newton step.

Definition at line 785 of file fluid_dynamics_matrix_free_operators.h.

◆ nonlinear_previous_hessian_diagonal

template<int dim, typename number>
Table<2, Tensor<1, dim + 1, Tensor<1, dim, VectorizedArray<number> > > > NavierStokesOperatorBase< dim, number >::nonlinear_previous_hessian_diagonal
protected

Table with correct alignment for vectorization to store the hessian diagonal of the previous newton step.

Definition at line 777 of file fluid_dynamics_matrix_free_operators.h.

◆ nonlinear_previous_values

template<int dim, typename number>
Table<2, Tensor<1, dim + 1, VectorizedArray<number> > > NavierStokesOperatorBase< dim, number >::nonlinear_previous_values
protected

Table with correct alignment for vectorization to store the values of the previous newton step.

Definition at line 761 of file fluid_dynamics_matrix_free_operators.h.

◆ pcout

template<int dim, typename number>
ConditionalOStream NavierStokesOperatorBase< dim, number >::pcout
protected

Conditional OStream for parallel output.

Definition at line 964 of file fluid_dynamics_matrix_free_operators.h.

◆ prescribed_neumann_traction

template<int dim, typename number>
Table<2, Tensor<1, dim + 1, VectorizedArray<number> > > NavierStokesOperatorBase< dim, number >::prescribed_neumann_traction
protected

Table with correct alignment for vectorization to store the values of the prescribed Neumann traction boundary condition values.

\((\boldsymbol{\sigma} \cdot \mathbf{n},\, \mathbf{v}) = (\mathrm{traction\_fn},\, \mathbf{v})\). assembled \((\mathbf{v},\mathrm{traction\_fn})\) on boundary faces where Neumann traction is prescribed. Our test function v involves both velocity and pressure components. Hence, the prescribed_neumann_traction has \(\dim\) components corresponding to velocity and 1 component corresponding to pressure (which is dummy), totalling \(\dim+1\) components.

Definition at line 832 of file fluid_dynamics_matrix_free_operators.h.

◆ previous_shear_rate

template<int dim, typename number>
Table<2, Tensor<1, dim + 1, Tensor<1, dim, VectorizedArray<number> > > > NavierStokesOperatorBase< dim, number >::previous_shear_rate
protected

Table with correct alignment for vectorization to store the values of the shear_rate.

Definition at line 877 of file fluid_dynamics_matrix_free_operators.h.

◆ previous_shear_rate_magnitude

template<int dim, typename number>
Table<2, VectorizedArray<number> > NavierStokesOperatorBase< dim, number >::previous_shear_rate_magnitude
protected

Table with correct alignment for vectorization to store the values of the shear_rate_magnitude.

Definition at line 884 of file fluid_dynamics_matrix_free_operators.h.

◆ properties_manager

template<int dim, typename number>
std::shared_ptr<PhysicalPropertiesManager> NavierStokesOperatorBase< dim, number >::properties_manager
protected

Object pointing to the physical properties manager of the matrix free class.

Definition at line 710 of file fluid_dynamics_matrix_free_operators.h.

◆ simulation_control

template<int dim, typename number>
std::shared_ptr<SimulationControl> NavierStokesOperatorBase< dim, number >::simulation_control
protected

Object storing the information regarding the time stepping method.

Definition at line 704 of file fluid_dynamics_matrix_free_operators.h.

◆ solid_cell_mask

template<int dim, typename number>
AlignedVector<VectorizedArray<number> > NavierStokesOperatorBase< dim, number >::solid_cell_mask
protected

Per-cell-batch mask used to suppress contributions from solid cells (material_id > 0) inside the cell integrals. Each lane is 1.0 for fluid cells and 0.0 for solid cells. Mirrors the matrix-based behavior where solid cells are skipped during assembly. Only filled when has_solids is true.

Definition at line 666 of file fluid_dynamics_matrix_free_operators.h.

◆ stabilization

template<int dim, typename number>
StabilizationType NavierStokesOperatorBase< dim, number >::stabilization
protected

Stabilization type needed to add or remove terms from operator.

Definition at line 698 of file fluid_dynamics_matrix_free_operators.h.

◆ stabilization_parameter

template<int dim, typename number>
Table<2, VectorizedArray<number> > NavierStokesOperatorBase< dim, number >::stabilization_parameter
protected

Table with correct alignment for vectorization to store the values of the stabilization parameter tau.

Definition at line 839 of file fluid_dynamics_matrix_free_operators.h.

◆ stabilization_parameter_lsic

template<int dim, typename number>
Table<2, VectorizedArray<number> > NavierStokesOperatorBase< dim, number >::stabilization_parameter_lsic
protected

Table with correct alignment for vectorization to store the values of the stabilization parameter tau lsic.

Definition at line 846 of file fluid_dynamics_matrix_free_operators.h.

◆ system_matrix

template<int dim, typename number>
TrilinosWrappers::SparseMatrix NavierStokesOperatorBase< dim, number >::system_matrix
mutableprotected

Sparse trilinos matrix used when the matrix of certain level is computed and stored.

Definition at line 650 of file fluid_dynamics_matrix_free_operators.h.

◆ thermal_buoyancy_term

template<int dim, typename number>
Table<2, Tensor<1, dim, VectorizedArray<number> > > NavierStokesOperatorBase< dim, number >::thermal_buoyancy_term
protected

Table with precomputed thermal buoyancy term values.

Definition at line 746 of file fluid_dynamics_matrix_free_operators.h.

◆ time_derivatives_previous_solutions

template<int dim, typename number>
Table<2, Tensor<1, dim + 1, VectorizedArray<number> > > NavierStokesOperatorBase< dim, number >::time_derivatives_previous_solutions
protected

Table with correct alignment for vectorization to store the time derivatives of previous solutions.

Definition at line 793 of file fluid_dynamics_matrix_free_operators.h.

◆ timer

template<int dim, typename number>
TimerOutput NavierStokesOperatorBase< dim, number >::timer
mutable

Timer for internal operator calls.

Definition at line 972 of file fluid_dynamics_matrix_free_operators.h.

◆ velocity_ale

template<int dim, typename number>
Table<2, Tensor<1, dim + 1, VectorizedArray<number> > > NavierStokesOperatorBase< dim, number >::velocity_ale
protected

Table with correct alignment for vectorization to store the values of the ALE velocity used in mortar coupling terms.

Definition at line 912 of file fluid_dynamics_matrix_free_operators.h.


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