DGOperatorImplicit< dim, number, is_viscous > Class Template Reference

Developer Documentation: MeltPoolDG::CompressibleFlow::DGOperatorImplicit< dim, number, is_viscous > Class Template Reference
Developer Documentation
MeltPoolDG::CompressibleFlow::DGOperatorImplicit< dim, number, is_viscous > 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>

Inheritance diagram for MeltPoolDG::CompressibleFlow::DGOperatorImplicit< dim, number, is_viscous >:
[legend]
Collaboration diagram for MeltPoolDG::CompressibleFlow::DGOperatorImplicit< dim, number, is_viscous >:
[legend]

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 () override
 Reinitialize the internal data structures.
 
void advance_time_step (number time, number time_step) override
 Advances solver by a single time step.
 
void add_external_force (std::shared_ptr< ExternalFlowForce< dim, number > > external_force_residuum, std::shared_ptr< ExternalFlowForceJacobian< dim, number > > external_force_jacobian) override
 
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 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.
 
- Public Member Functions inherited from MeltPoolDG::CompressibleFlow::DGOperatorBase< dim, number, n_species >
virtual ~DGOperatorBase ()=default
 
virtual void add_external_force (std::shared_ptr< ExternalFlowForce< dim, number, n_species > > external_force_residuum, std::shared_ptr< ExternalFlowForceJacobian< dim, number, n_species > > external_force_jacobian)=0
 

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.
 
TimeIntegration::BDFIntegrator< dim, number > time_integrator
 Time integrator class used for the time integration.
 
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
 

Detailed Description

template<int dim, typename number, bool is_viscous = true>
class MeltPoolDG::CompressibleFlow::DGOperatorImplicit< dim, number, is_viscous >

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 , bool is_viscous = true>
using MeltPoolDG::CompressibleFlow::DGOperatorImplicit< dim, number, is_viscous >::ConservedVariables = ConservedVariablesType<dim, number>

◆ ConservedVariablesGradient

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

◆ VectorType

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

Constructor & Destructor Documentation

◆ DGOperatorImplicit()

template<int dim, typename number , bool is_viscous>
MeltPoolDG::CompressibleFlow::DGOperatorImplicit< dim, number, is_viscous >::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 , bool is_viscous>
void MeltPoolDG::CompressibleFlow::DGOperatorImplicit< dim, number, is_viscous >::add_external_force ( std::shared_ptr< ExternalFlowForce< dim, number > >  external_force_residuum,
std::shared_ptr< ExternalFlowForceJacobian< dim, number > >  external_force_jacobian 
)
override

◆ advance_time_step()

template<int dim, typename number , bool is_viscous>
void MeltPoolDG::CompressibleFlow::DGOperatorImplicit< dim, number, is_viscous >::advance_time_step ( number  time,
number  time_step 
)
overridevirtual

Advances solver by a single time step.

This function performs a single implicit time step of size time_step starting from the solution at time time.

Note
The function does not take care about updating the solution history object or similar operations which are not directly related to the integration. It only advances the solution by a single time step starting from the current solution in the solution history object of the flow_scratch_data object.

Implements MeltPoolDG::CompressibleFlow::DGOperatorBase< dim, number, n_species >.

◆ apply_jacobian()

template<int dim, typename number , bool is_viscous>
void MeltPoolDG::CompressibleFlow::DGOperatorImplicit< dim, number, is_viscous >::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
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 , bool is_viscous>
void MeltPoolDG::CompressibleFlow::DGOperatorImplicit< dim, number, is_viscous >::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 , bool is_viscous>
void MeltPoolDG::CompressibleFlow::DGOperatorImplicit< dim, number, is_viscous >::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 , bool is_viscous>
void MeltPoolDG::CompressibleFlow::DGOperatorImplicit< dim, number, is_viscous >::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 , bool is_viscous>
void MeltPoolDG::CompressibleFlow::DGOperatorImplicit< dim, number, is_viscous >::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.
srcCurrent solution vector used to compute the residual.
dstVector in which the residual is stored.
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 , bool is_viscous>
void MeltPoolDG::CompressibleFlow::DGOperatorImplicit< dim, number, is_viscous >::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 , bool is_viscous = true>
void MeltPoolDG::CompressibleFlow::DGOperatorImplicit< dim, number, is_viscous >::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 , bool is_viscous = true>
void MeltPoolDG::CompressibleFlow::DGOperatorImplicit< dim, number, is_viscous >::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 , bool is_viscous = true>
void MeltPoolDG::CompressibleFlow::DGOperatorImplicit< dim, number, is_viscous >::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 , bool is_viscous = true>
void MeltPoolDG::CompressibleFlow::DGOperatorImplicit< dim, number, is_viscous >::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 , bool is_viscous>
void MeltPoolDG::CompressibleFlow::DGOperatorImplicit< dim, number, is_viscous >::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.
cell_batch_idID of the current cell batch.

◆ local_cell_residual()

template<int dim, typename number , bool is_viscous = true>
void MeltPoolDG::CompressibleFlow::DGOperatorImplicit< dim, number, is_viscous >::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 , bool is_viscous = true>
void MeltPoolDG::CompressibleFlow::DGOperatorImplicit< dim, number, is_viscous >::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 , bool is_viscous = true>
void MeltPoolDG::CompressibleFlow::DGOperatorImplicit< dim, number, is_viscous >::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 varibales on the inner face.
phi_pCell integrator for the primary varibales on the outer face.
q_indexQuadrature point index.

◆ local_face_residual()

template<int dim, typename number , bool is_viscous = true>
void MeltPoolDG::CompressibleFlow::DGOperatorImplicit< dim, number, is_viscous >::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 , bool is_viscous>
void MeltPoolDG::CompressibleFlow::DGOperatorImplicit< dim, number, is_viscous >::reinit ( )
overridevirtual

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.

Implements MeltPoolDG::CompressibleFlow::DGOperatorBase< dim, number, n_species >.

Member Data Documentation

◆ convective_terms

template<int dim, typename number , bool is_viscous = true>
ConvectiveKernels<dim, number> MeltPoolDG::CompressibleFlow::DGOperatorImplicit< dim, number, is_viscous >::convective_terms
private

Object for the convective term evaluations.

◆ current_time_step

template<int dim, typename number , bool is_viscous = true>
number MeltPoolDG::CompressibleFlow::DGOperatorImplicit< dim, number, is_viscous >::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 , bool is_viscous = true>
VectorType MeltPoolDG::CompressibleFlow::DGOperatorImplicit< dim, number, is_viscous >::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 , bool is_viscous = true>
std::vector<std::shared_ptr<ExternalFlowForceJacobian<dim, number> > > MeltPoolDG::CompressibleFlow::DGOperatorImplicit< dim, number, is_viscous >::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 , bool is_viscous = true>
std::vector<std::shared_ptr<ExternalFlowForce<dim, number> > > MeltPoolDG::CompressibleFlow::DGOperatorImplicit< dim, number, is_viscous >::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 , bool is_viscous = true>
OperationScratchData<dim, number>& MeltPoolDG::CompressibleFlow::DGOperatorImplicit< dim, number, is_viscous >::flow_scratch_data
private

Scratch data for compressible flows.

◆ time_integrator

template<int dim, typename number , bool is_viscous = true>
TimeIntegration::BDFIntegrator<dim, number> MeltPoolDG::CompressibleFlow::DGOperatorImplicit< dim, number, is_viscous >::time_integrator
private

Time integrator class used for the time integration.

◆ time_integrator_old_solution

template<int dim, typename number , bool is_viscous = true>
const VectorType* MeltPoolDG::CompressibleFlow::DGOperatorImplicit< dim, number, is_viscous >::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 , bool is_viscous = true>
ViscousKernels<dim, number> MeltPoolDG::CompressibleFlow::DGOperatorImplicit< dim, number, is_viscous >::viscous_terms
private

Object for the viscous term evaluations.


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