DGOperatorImplicit< dim, number > Class Template Reference

Developer Documentation: MeltPoolDG::CompressibleFlow::DGOperatorImplicit< dim, number > Class Template Reference
Developer Documentation
MeltPoolDG::CompressibleFlow::DGOperatorImplicit< dim, number > Class Template Referencefinal

Operator for the matrix-free evaluation of a compressible single-phase flow cutDG formulation for implicit time integration. More...

#include <dg_operator_implicit.hpp>

Public Types

using VectorType = dealii::LinearAlgebra::distributed::Vector< number >
 
using ConservedVariables = ConservedVariablesType< dim, number >
 
using ConservedVariablesGradient = ConservedVariablesGradientType< dim, number >
 

Public Member Functions

 DGOperatorImplicit (OperationScratchData< dim, number > &flow_scratch_data)
 Constructor.
 
void reinit ()
 Reinitialize the internal data structures.
 
void add_external_force (std::shared_ptr< ExternalFlowForce< dim, number > > external_force_residuum, std::shared_ptr< ExternalFlowForceJacobian< dim, number > > external_force_jacobian)
 
void compute_system_matrix_from_matrixfree (dealii::TrilinosWrappers::SparseMatrix &sparse_matrix) const
 Compute the matrix representation of the Jacobian.
 
void compute_inverse_diagonal_from_matrixfree (VectorType &diagonal) const
 Compute the inverse elements of the diagonal of the Jacobian.
 
void set_preconditioner_time_step (const number time_step)
 
void apply_jacobian (number time_step, VectorType &dst, const VectorType &src) const
 Compute the result of J*x, where J is the Jacobian.
 
void compute_residual (number current_time, number time_step, const VectorType &src, VectorType &dst, const VectorType &old_solution) const
 Compute the negative residual.
 
void local_cell_jacobian_kernel (FECellIntegrator< dim, dim+2, number > &delta_phi, const FECellIntegrator< dim, dim+2, number > &phi, unsigned int q_index) const
 Local cell operations at the given quadrature point for computing the Jacobian.
 
void local_face_jacobian_kernel (FEFaceIntegrator< dim, dim+2, number > &delta_phi_m, FEFaceIntegrator< dim, dim+2, number > &delta_phi_p, const FEFaceIntegrator< dim, dim+2, number > &phi_m, const FEFaceIntegrator< dim, dim+2, number > &phi_p, unsigned int q_index) const
 Local face operations at the given quadrature point for computing the Jacobian.
 
void local_boundary_face_jacobian_kernel (FEFaceIntegrator< dim, dim+2, number > &delta_phi_m, const FEFaceIntegrator< dim, dim+2, number > &phi_m, unsigned int q_index) const
 Local boundary face operations at the given quadrature point for computing the Jacobian.
 

Private Member Functions

void apply_jacobian_analytic (const VectorType &src, VectorType &dst) const
 Compute the result of J*x, where J is the Jacobian computed analytically.
 
void apply_jacobian_finite_differences (const VectorType &src, VectorType &dst) const
 Compute the result of J*x, where J is the Jacobian approximated by finite differences.
 
void local_cell_residual (const dealii::MatrixFree< dim, number > &matrix_free, dealii::LinearAlgebra::distributed::Vector< number > &dst, const dealii::LinearAlgebra::distributed::Vector< number > &src, const std::pair< unsigned int, unsigned int > &cell_range) const
 The local cell applier computing the residual contribution of the cell.
 
void local_face_residual (const dealii::MatrixFree< dim, number > &matrix_free, dealii::LinearAlgebra::distributed::Vector< number > &dst, const dealii::LinearAlgebra::distributed::Vector< number > &src, const std::pair< unsigned int, unsigned int > &face_range) const
 The local cell applier computing the residual contribution of the inner faces.
 
void local_boundary_face_residual (const dealii::MatrixFree< dim, number > &matrix_free, dealii::LinearAlgebra::distributed::Vector< number > &dst, const dealii::LinearAlgebra::distributed::Vector< number > &src, const std::pair< unsigned int, unsigned int > &face_range) const
 The local cell applier computing the residual contribution of the boundary faces.
 
void local_cell_jacobian (const dealii::MatrixFree< dim, number > &matrix_free, VectorType &dst, const VectorType &src, const std::pair< unsigned int, unsigned int > &cell_range) const
 Computes the cell contribution of the Jacobian.
 
void local_face_jacobian (const dealii::MatrixFree< dim, number > &matrix_free, VectorType &dst, const VectorType &src, const std::pair< unsigned int, unsigned int > &face_range) const
 Computes the inner face contribution of the Jacobian.
 
void local_boundary_face_jacobian (const dealii::MatrixFree< dim, number > &matrix_free, dealii::LinearAlgebra::distributed::Vector< number > &dst, const dealii::LinearAlgebra::distributed::Vector< number > &src, const std::pair< unsigned int, unsigned int > &face_range) const
 Computes the boundary face contribution of the Jacobian.
 

Private Attributes

const VectorTypetime_integrator_old_solution = nullptr
 
VectorType disturbed_residual
 
number current_time_step
 
OperationScratchData< dim, number > & flow_scratch_data
 Scratch data for compressible flows.
 
ConvectiveKernels< dim, number > convective_terms
 Object for the convective term evaluations.
 
ViscousKernels< dim, number > viscous_terms
 Object for the viscous term evaluations.
 
std::vector< std::shared_ptr< ExternalFlowForce< dim, number > > > external_forces_residual
 
std::vector< std::shared_ptr< ExternalFlowForceJacobian< dim, number > > > external_forces_jacobian
 
const bool is_viscous
 

Detailed Description

template<int dim, typename number>
class MeltPoolDG::CompressibleFlow::DGOperatorImplicit< dim, number >

Operator for the matrix-free evaluation of a compressible single-phase flow cutDG formulation for implicit time integration.

Template Parameters
dimDimension of the considered simulation case.
numberFloating point format type.
is_viscousIndicates whether the flow is viscous.

Member Typedef Documentation

◆ ConservedVariables

template<int dim, typename number >
using MeltPoolDG::CompressibleFlow::DGOperatorImplicit< dim, number >::ConservedVariables = ConservedVariablesType<dim, number>

◆ ConservedVariablesGradient

template<int dim, typename number >
using MeltPoolDG::CompressibleFlow::DGOperatorImplicit< dim, number >::ConservedVariablesGradient = ConservedVariablesGradientType<dim, number>

◆ VectorType

template<int dim, typename number >
using MeltPoolDG::CompressibleFlow::DGOperatorImplicit< dim, number >::VectorType = dealii::LinearAlgebra::distributed::Vector<number>

Constructor & Destructor Documentation

◆ DGOperatorImplicit()

template<int dim, typename number >
MeltPoolDG::CompressibleFlow::DGOperatorImplicit< dim, number >::DGOperatorImplicit ( OperationScratchData< dim, number > &  flow_scratch_data)
explicit

Constructor.

Parameters
flow_scratch_dataReference to the flow scratch data object (usually owned by the corresponding operation class).

Member Function Documentation

◆ add_external_force()

template<int dim, typename number >
void MeltPoolDG::CompressibleFlow::DGOperatorImplicit< dim, number >::add_external_force ( std::shared_ptr< ExternalFlowForce< dim, number > >  external_force_residuum,
std::shared_ptr< ExternalFlowForceJacobian< dim, number > >  external_force_jacobian 
)

Add additional fluid forces provided by the user of the class (e.g. gravity, ...).

Parameters
external_force_residuumA provided shared pointer to the external force definition added to the residuum.
external_force_jacobianA provided shared pointer to the external force Jacobian definition.

◆ apply_jacobian()

template<int dim, typename number >
void MeltPoolDG::CompressibleFlow::DGOperatorImplicit< dim, number >::apply_jacobian ( number  time_step,
VectorType dst,
const VectorType src 
) const

Compute the result of J*x, where J is the Jacobian.

The method on how to compute/approximate the Jacobian is defined by the user in the compressible flow data.

Parameters
time_stepCurrent time step size.
srcSource vector x with which the Jacobian gets multiplied.
dstLocation at which the result of J*x is stored.
Exceptions
Exceptionif the layout of the two given vectors src and dst are not identical.
Note
This function assumes that the function set_stage_constants() has been called in advance.

◆ apply_jacobian_analytic()

template<int dim, typename number >
void MeltPoolDG::CompressibleFlow::DGOperatorImplicit< dim, number >::apply_jacobian_analytic ( const VectorType src,
VectorType dst 
) const
private

Compute the result of J*x, where J is the Jacobian computed analytically.

Parameters
srcSource vector x with which the Jacobian gets multiplied.
dstLocation at which the result of J*x is stored.
Exceptions
Exceptionif the layout of the two given vectors src and dst are not identical.

◆ apply_jacobian_finite_differences()

template<int dim, typename number >
void MeltPoolDG::CompressibleFlow::DGOperatorImplicit< dim, number >::apply_jacobian_finite_differences ( const VectorType src,
VectorType dst 
) const
private

Compute the result of J*x, where J is the Jacobian approximated by finite differences.

Parameters
srcSource vector x with which the Jacobian gets multiplied.
dstLocation at which the result of J*x is stored.
Exceptions
Exceptionif the layout of the two given vectors src and dst are not identical.

◆ compute_inverse_diagonal_from_matrixfree()

template<int dim, typename number >
void MeltPoolDG::CompressibleFlow::DGOperatorImplicit< dim, number >::compute_inverse_diagonal_from_matrixfree ( VectorType diagonal) const

Compute the inverse elements of the diagonal of the Jacobian.

Parameters
diagonalVector in which the inverse elements of the diagonal are stored.

◆ compute_residual()

template<int dim, typename number >
void MeltPoolDG::CompressibleFlow::DGOperatorImplicit< dim, number >::compute_residual ( number  current_time,
number  time_step,
const VectorType src,
VectorType dst,
const VectorType old_solution 
) const

Compute the negative residual.

Compute the negative residual, i.e. -(y'-F(y)) where y' is the temporal derivative of the primary variables and F is the sum of all fluxes occuring in the compressible Navier-Stokes equations (right-hand side).

Parameters
current_timeCurrent physical time.
time_stepCurrent time step size.
srcCurrent solution vector used to compute the residual.
dstVector in which the residual is stored.
old_solutionVector containing the solution at the previous time step.
Exceptions
Assertif the layout of the two given vectors src and dst are not identical.
Note
This function assumes that the function set_stage_constants() has been called in advance.

◆ compute_system_matrix_from_matrixfree()

template<int dim, typename number >
void MeltPoolDG::CompressibleFlow::DGOperatorImplicit< dim, number >::compute_system_matrix_from_matrixfree ( dealii::TrilinosWrappers::SparseMatrix &  sparse_matrix) const

Compute the matrix representation of the Jacobian.

Parameters
sparse_matrixSpars matrix in which the resulting matrix representation is stored.

◆ local_boundary_face_jacobian()

template<int dim, typename number >
void MeltPoolDG::CompressibleFlow::DGOperatorImplicit< dim, number >::local_boundary_face_jacobian ( const dealii::MatrixFree< dim, number > &  matrix_free,
dealii::LinearAlgebra::distributed::Vector< number > &  dst,
const dealii::LinearAlgebra::distributed::Vector< number > &  src,
const std::pair< unsigned int, unsigned int > &  face_range 
) const
private

Computes the boundary face contribution of the Jacobian.

Computes the contribution of the boundary faces to the product of the Jacobian and the provided source vector for a specified face range. The current solution of the primary variables, required for the Jacobian computation, is retrieved from the solution_history object.

Parameters
matrix_freeThe matrix-free object utilized by the applier.
dstThe destination vector to which the computed result is added.
srcThe source vector to be multiplied with the Jacobian.
face_rangeThe range of faces considered by the applier.

◆ local_boundary_face_jacobian_kernel()

template<int dim, typename number >
void MeltPoolDG::CompressibleFlow::DGOperatorImplicit< dim, number >::local_boundary_face_jacobian_kernel ( FEFaceIntegrator< dim, dim+2, number > &  delta_phi_m,
const FEFaceIntegrator< dim, dim+2, number > &  phi_m,
unsigned int  q_index 
) const

Local boundary face operations at the given quadrature point for computing the Jacobian.

Parameters
delta_phi_mFace integrator for the change in the primary variables on the inner face. Quadrature point distributions are added to this integrator.
phi_mCell integrator for the primary varibales on the inner face.
q_indexQuadrature point index.

◆ local_boundary_face_residual()

template<int dim, typename number >
void MeltPoolDG::CompressibleFlow::DGOperatorImplicit< dim, number >::local_boundary_face_residual ( const dealii::MatrixFree< dim, number > &  matrix_free,
dealii::LinearAlgebra::distributed::Vector< number > &  dst,
const dealii::LinearAlgebra::distributed::Vector< number > &  src,
const std::pair< unsigned int, unsigned int > &  face_range 
) const
private

The local cell applier computing the residual contribution of the boundary faces.

Parameters
matrix_freeMatrix free object on which the applier works on.
dstDestination vector to which the result is added.
srcCurrent solution.
face_rangeFace range which is considered in the applier.

◆ local_cell_jacobian()

template<int dim, typename number >
void MeltPoolDG::CompressibleFlow::DGOperatorImplicit< dim, number >::local_cell_jacobian ( const dealii::MatrixFree< dim, number > &  matrix_free,
VectorType dst,
const VectorType src,
const std::pair< unsigned int, unsigned int > &  cell_range 
) const
private

Computes the cell contribution of the Jacobian.

Computes the contribution of the cells to the product of the Jacobian and the provided source vector for a specified cell range. The current solution of the primary variables, required for the Jacobian computation, is retrieved from the solution_history object.

Parameters
matrix_freeThe matrix-free object utilized by the applier.
dstThe destination vector to which the computed result is added.
srcThe source vector to be multiplied with the Jacobian.
cell_rangeThe range of cells considered by the applier.

◆ local_cell_jacobian_kernel()

template<int dim, typename number >
void MeltPoolDG::CompressibleFlow::DGOperatorImplicit< dim, number >::local_cell_jacobian_kernel ( FECellIntegrator< dim, dim+2, number > &  delta_phi,
const FECellIntegrator< dim, dim+2, number > &  phi,
unsigned int  q_index 
) const

Local cell operations at the given quadrature point for computing the Jacobian.

Parameters
delta_phiCell integrator for the change in the primary variables. Quadrature point distributions are added to this integrator.
phiCell integrator for the primary variables.
q_indexQuadrature point index.

◆ local_cell_residual()

template<int dim, typename number >
void MeltPoolDG::CompressibleFlow::DGOperatorImplicit< dim, number >::local_cell_residual ( const dealii::MatrixFree< dim, number > &  matrix_free,
dealii::LinearAlgebra::distributed::Vector< number > &  dst,
const dealii::LinearAlgebra::distributed::Vector< number > &  src,
const std::pair< unsigned int, unsigned int > &  cell_range 
) const
private

The local cell applier computing the residual contribution of the cell.

Parameters
matrix_freeMatrix free object on which the applier works on.
dstDestination vector to which the result is added.
srcCurrent solution.
cell_rangeCell range which is considered in the applier.

◆ local_face_jacobian()

template<int dim, typename number >
void MeltPoolDG::CompressibleFlow::DGOperatorImplicit< dim, number >::local_face_jacobian ( const dealii::MatrixFree< dim, number > &  matrix_free,
VectorType dst,
const VectorType src,
const std::pair< unsigned int, unsigned int > &  face_range 
) const
private

Computes the inner face contribution of the Jacobian.

Computes the contribution of the inner faces to the product of the Jacobian and the provided source vector for a specified face range. The current solution of the primary variables, required for the Jacobian computation, is retrieved from the solution_history object.

Parameters
matrix_freeThe matrix-free object utilized by the applier.
dstThe destination vector to which the computed result is added.
srcThe source vector to be multiplied with the Jacobian.
face_rangeThe range of faces considered by the applier.

◆ local_face_jacobian_kernel()

template<int dim, typename number >
void MeltPoolDG::CompressibleFlow::DGOperatorImplicit< dim, number >::local_face_jacobian_kernel ( FEFaceIntegrator< dim, dim+2, number > &  delta_phi_m,
FEFaceIntegrator< dim, dim+2, number > &  delta_phi_p,
const FEFaceIntegrator< dim, dim+2, number > &  phi_m,
const FEFaceIntegrator< dim, dim+2, number > &  phi_p,
unsigned int  q_index 
) const

Local face operations at the given quadrature point for computing the Jacobian.

Parameters
delta_phi_mFace integrator for the change in the primary variables on the inner face. Quadrature point distributions are added to this integrator.
delta_phi_pFace integrator for the change in the primary variables on the outer face. Quadrature point distributions are added to this integrator.
phi_mCell integrator for the primary variables on the inner face.
phi_pCell integrator for the primary variables on the outer face.
q_indexQuadrature point index.

◆ local_face_residual()

template<int dim, typename number >
void MeltPoolDG::CompressibleFlow::DGOperatorImplicit< dim, number >::local_face_residual ( const dealii::MatrixFree< dim, number > &  matrix_free,
dealii::LinearAlgebra::distributed::Vector< number > &  dst,
const dealii::LinearAlgebra::distributed::Vector< number > &  src,
const std::pair< unsigned int, unsigned int > &  face_range 
) const
private

The local cell applier computing the residual contribution of the inner faces.

Parameters
matrix_freeMatrix free object on which the applier works on.
dstDestination vector to which the result is added.
srcCurrent solution.
face_rangeFace range which is considered in the applier.

◆ reinit()

template<int dim, typename number >
void MeltPoolDG::CompressibleFlow::DGOperatorImplicit< dim, number >::reinit ( )

Reinitialize the internal data structures.

The reinitialization includes setting a new required size for the solution history object according to the demands of the used time integrator.

◆ set_preconditioner_time_step()

template<int dim, typename number >
void MeltPoolDG::CompressibleFlow::DGOperatorImplicit< dim, number >::set_preconditioner_time_step ( const number  time_step)
inline

This function sets the current time step used in the preconditioner. It should be called before the preconditioner is applied to the system matrix.

Parameters
time_stepThe current time step size used by the preconditioner.

Member Data Documentation

◆ convective_terms

template<int dim, typename number >
ConvectiveKernels<dim, number> MeltPoolDG::CompressibleFlow::DGOperatorImplicit< dim, number >::convective_terms
private

Object for the convective term evaluations.

◆ current_time_step

template<int dim, typename number >
number MeltPoolDG::CompressibleFlow::DGOperatorImplicit< dim, number >::current_time_step
mutableprivate

Current time step size. This needs to be stored as this value is required by the local cell appliers.

◆ disturbed_residual

template<int dim, typename number >
VectorType MeltPoolDG::CompressibleFlow::DGOperatorImplicit< dim, number >::disturbed_residual
mutableprivate

This vector is used in the approximation of the jacobian by finite differences. Here the vector stores the residual with a disturbed input.

◆ external_forces_jacobian

template<int dim, typename number >
std::vector<std::shared_ptr<ExternalFlowForceJacobian<dim, number> > > MeltPoolDG::CompressibleFlow::DGOperatorImplicit< dim, number >::external_forces_jacobian
private

This set of pointers may hold a list of external fluid force contributions to the jacobian (e.g., gravity, or user-defined source terms)

◆ external_forces_residual

template<int dim, typename number >
std::vector<std::shared_ptr<ExternalFlowForce<dim, number> > > MeltPoolDG::CompressibleFlow::DGOperatorImplicit< dim, number >::external_forces_residual
private

This set of pointers may hold a list of external fluid force contributions to the residuum (e.g., gravity, or user-defined source terms)

◆ flow_scratch_data

template<int dim, typename number >
OperationScratchData<dim, number>& MeltPoolDG::CompressibleFlow::DGOperatorImplicit< dim, number >::flow_scratch_data
private

Scratch data for compressible flows.

◆ is_viscous

template<int dim, typename number >
const bool MeltPoolDG::CompressibleFlow::DGOperatorImplicit< dim, number >::is_viscous
private

A boolean flag indicating whether the flow is viscous or not. This is determined by the material data.

◆ time_integrator_old_solution

template<int dim, typename number >
const VectorType* MeltPoolDG::CompressibleFlow::DGOperatorImplicit< dim, number >::time_integrator_old_solution = nullptr
mutableprivate

This vector is used to compute the temporal derivative y' in the residual computation by y'=(current_solution-old_solution)/dt. We do not take the old_solution directly from solution_history as providing the option to pass a (fictional) old solution can have performance advantages, e.g. in the bdf time integration. It can be set by the function set_stage_constants().

◆ viscous_terms

template<int dim, typename number >
ViscousKernels<dim, number> MeltPoolDG::CompressibleFlow::DGOperatorImplicit< dim, number >::viscous_terms
private

Object for the viscous term evaluations.


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