LehrFEM++ 1.0.0
A simple Finite Element Library for teaching
Namespaces | Classes | Typedefs | Functions
projects::dpg Namespace Reference

Contains functionality for the implementation of DPG methods. More...

Namespaces

namespace  test
 

Classes

class  ConvectionElementMatrixProvider
 Class for local quadrature based computations sub element matrices corresponding to convection-like element matrices. More...
 
class  DiffusionElementMatrixProvider
 Class for local quadrature based computations of sub element matrices corresponding to diffusion element matrices. More...
 
class  DiscontinuousScalarReferenceFiniteElement
 Decorator class around a ScalarReferenceFiniteElement to represent discontinuous shape functions. More...
 
class  DpgElementMatrixProvider
 Class to evaluate element matrices for DPG methods. More...
 
class  DpgElementVectorProvider
 Class to evaluate element vectors of DPG methods. More...
 
class  FeDiscontinuousO0Quad
 Discontinuous constant finite element on a quadrilateral reference element. More...
 
class  FeDiscontinuousO0Segment
 Discontinuous constant finite element on a line segment. More...
 
class  FeDiscontinuousO0Tria
 Discontinuous constant finite element on a triangular reference element. More...
 
class  FluxElementMatrixProvider
 class for local quadrature based computations of sub element matrices corresponding to element matrices associated to a flux variable in the trial space More...
 
class  LoadElementVectorProvider
 Class for local quadrature based computations of sub vectors corresponding to load vectors. More...
 
class  PrescribedSignProvider
 Class which allows evaluation of the \( \text{sgn}_K \) function. More...
 
class  ProductElementMatrixProvider
 Class providing element matrices associated with bilinear forms between cartesian/product spaces. More...
 
class  ProductElementMatrixProviderBuilder
 Builder class to build a ProductElementMatrixProvider. More...
 
class  ProductElementVectorProvider
 Class providing element vectors associated with linear forms on cartesian/product spaces. More...
 
class  ProductElementVectorProviderBuilder
 Builder class to build a ProductElementVectorProvider. More...
 
class  ProductUniformFEDofHandler
 Dofhandler for uniform finite element spaces that discretizes a cartesian/product space. More...
 
class  ProductUniformFESpace
 cartesian/prodcut space of finite element functions on a hybrid 2D mesh. More...
 
class  ProductUniformFESpaceFactory
 Factory class to build a ProductUniformFESpace. More...
 
class  ReactionElementMatrixProvider
 Class for local quadrature based computations of sub element matrices corresponding to reaction element matrices. More...
 
class  SubElementMatrixProvider
 Interface class providing sub element matrices associated with bilinear forms between components of Cartesian product spaces. More...
 
class  SubElementVectorProvider
 Interface class providing element vectors associated with linear forms of a component of a cartesian/product space. More...
 
class  TraceElementMatrixProvider
 Class for local quadrature based computations of sub element matrices corresponding to element matrices associated to a trace variable in the trial space. More...
 
class  TraceScalarReferenceFiniteElement
 Decorator class around a ScalarReferenceFiniteElement to represent traces on the cell boundary. More...
 

Typedefs

using gdof_idx_t = lf::uscalfe::gdof_idx_t
 Type for indices into global matrices/vectors. More...
 
using ldof_idx_t = lf::uscalfe::ldof_idx_t
 Type for indices referring to entity matrices/vectors. More...
 
using size_type = lf::uscalfe::size_type
 Type for vector length/matrix sizes. More...
 
using dim_t = lf::uscalfe::dim_t
 Tpe for (co)-dimensions. More...
 
using glb_idx_t = lf::uscalfe::glb_idx_t
 Type for global index of entities. More...
 
using sub_idx_t = lf::uscalfe::sub_idx_t
 Type for indexing of sub-entities. More...
 
using quad_rule_collection_t = lf::uscalfe::quad_rule_collection_t
 data structure for passing collections of quadrature rules, see lf::uscalfe for more information. More...
 
using dof_map_t = lf::assemble::UniformFEDofHandler::dof_map_t
 see lf::assemble More...
 

Functions

template<class PTR >
 DpgElementMatrixProvider (PTR stiffness_provider, PTR gramianProvider) -> DpgElementMatrixProvider< typename PTR::element_type::SCALAR >
 
template<class PTR1 , class PTR2 >
 DpgElementVectorProvider (PTR1 eLoadVectorProvider, PTR2 eStiffnessProvider, PTR2 gramianProvider) -> DpgElementVectorProvider< typename PTR1::element_type::SCALAR >
 
std::vector< lf::quad::QuadRuleBoundaryQuadRule (lf::base::RefEl ref_el, const lf::quad::QuadRule &qr)
 Constructs a quadrature rule on the boundary of a reference element. More...
 
Eigen::MatrixXd OuterNormals (const lf::geometry::Geometry &geometry)
 Compute the outer normals of a geometry object. More...
 
template<typename CONVECTION_COEFF >
lf::mesh::utils::CodimMeshDataSet< bool > flagEntitiesOnInflowBoundary (const std::shared_ptr< const lf::mesh::Mesh > &mesh_p, CONVECTION_COEFF beta)
 flag all edges located on the inflow boundary More...
 
template<typename CONVECTION_COEFF >
lf::mesh::utils::CodimMeshDataSet< bool > flagEntitiesOnOutflowBoundary (const std::shared_ptr< const lf::mesh::Mesh > &mesh_p, CONVECTION_COEFF beta)
 flag all edges located on the outflow boundary More...
 
template<typename SCALAR , typename EDGESELECTOR_DIRICHLET , typename EDGESELECTOR_NEUMANN , typename FUNCTION_G , typename FUNCTION_H >
std::vector< std::pair< bool, SCALAR > > InitEssentialConditionsFromFunctions (const ProductUniformFESpace< SCALAR > &fes, size_type trace_component, size_type flux_component, EDGESELECTOR_DIRICHLET &&dirichletcondflag, EDGESELECTOR_NEUMANN &&neumanncondflag, FUNCTION_G &&g, FUNCTION_H &&h)
 Initialization of flags/values for dofs of fluxes and traces of a on a product finite element space whose values are imposed by two specified functions on two specified parts of the boundary. More...
 
template<typename SCALAR >
lf::mesh::utils::CodimMeshDataSet< SCALAR > ElementErrorEstimators (const ProductUniformFEDofHandler &trial_dofh, std::shared_ptr< ProductElementMatrixProvider< SCALAR > > stiffness_provider, std::shared_ptr< ProductElementMatrixProvider< SCALAR > > gramian_provider, std::shared_ptr< ProductElementVectorProvider< SCALAR > > load_provider, const Eigen::Matrix< SCALAR, Eigen::Dynamic, 1 > &sol_vec)
 Evaluation of the local DPG error estimators on a mesh. More...
 
template<typename SCALAR >
SCALAR EvalPosteriorError (const std::shared_ptr< const lf::mesh::Mesh > &mesh_p, const lf::mesh::utils::CodimMeshDataSet< SCALAR > &local_errors)
 Evaluation of the DPG error estimator. More...
 
template<class PTR , class DIFF_COEFF >
 DiffusionElementMatrixProvider (PTR fe_space_trial, PTR fe_space_test, size_type trial_component, size_type test_component, DIFF_COEFF alpha) -> DiffusionElementMatrixProvider< typename PTR::element_type::SCALAR, DIFF_COEFF >
 
template<class PTR , class REACTION_COEFF >
 ReactionElementMatrixProvider (PTR fe_trial, PTR fe_test, size_type trial_component, size_type test_component, REACTION_COEFF gamma) -> ReactionElementMatrixProvider< typename PTR::element_type::SCALAR, REACTION_COEFF >
 
template<class PTR , typename CONVECTION_COEFF_1 , typename CONVECTION_COEFF_2 >
 ConvectionElementMatrixProvider (PTR fe_trial, PTR fe_test, size_type trial_component, size_type test_component, CONVECTION_COEFF_1 beta_1, CONVECTION_COEFF_2 beta_2) -> ConvectionElementMatrixProvider< typename PTR::element_type::SCALAR, CONVECTION_COEFF_1, CONVECTION_COEFF_2 >
 
template<class PTR , class DIFF_COEFF >
 FluxElementMatrixProvider (PTR fe_space_trial, PTR fe_space_test, size_type trial_component, size_type test_component, DIFF_COEFF alpha) -> FluxElementMatrixProvider< typename PTR::element_type::SCALAR, DIFF_COEFF >
 
template<class PTR , class COEFF >
 TraceElementMatrixProvider (PTR fe_space_trial, PTR fe_space_test, size_type trial_component, size_type test_component, COEFF alpha) -> TraceElementMatrixProvider< typename PTR::element_type::SCALAR, COEFF >
 
template<class PTR , class FUNCTOR >
 LoadElementVectorProvider (PTR fe_space_test, size_type test_component, FUNCTOR f) -> LoadElementVectorProvider< typename PTR::element_type::SCALAR, FUNCTOR >
 
template<typename ptr , typename vector >
 ProductElementMatrixProvider (ptr fe_space_tiral, ptr fe_space_test, vector subproviders) -> ProductElementMatrixProvider< typename ptr::element_type::SCALAR >
 
template<typename PTR , typename vector >
 ProductElementVectorProvider (PTR fe_space_test, vector subproviders) -> ProductElementVectorProvider< typename PTR::element_type::SCALAR >
 

Detailed Description

Contains functionality for the implementation of DPG methods.

Typedef Documentation

◆ dim_t

Tpe for (co)-dimensions.

Definition at line 20 of file dpg.h.

◆ dof_map_t

see lf::assemble

Definition at line 22 of file product_dofhandler.h.

◆ gdof_idx_t

Type for indices into global matrices/vectors.

Definition at line 11 of file dpg.h.

◆ glb_idx_t

Type for global index of entities.

Definition at line 23 of file dpg.h.

◆ ldof_idx_t

Type for indices referring to entity matrices/vectors.

Definition at line 14 of file dpg.h.

◆ quad_rule_collection_t

data structure for passing collections of quadrature rules, see lf::uscalfe for more information.

Definition at line 31 of file loc_comp_dpg.h.

◆ size_type

Type for vector length/matrix sizes.

type for vector length/matrix sizes

Definition at line 17 of file dpg.h.

◆ sub_idx_t

Type for indexing of sub-entities.

Definition at line 26 of file dpg.h.

Function Documentation

◆ BoundaryQuadRule()

std::vector< lf::quad::QuadRule > projects::dpg::BoundaryQuadRule ( lf::base::RefEl  ref_el,
const lf::quad::QuadRule qr 
)

Constructs a quadrature rule on the boundary of a reference element.

Parameters
ref_elThe reference element on whose boundary a quadrule should be constructed (triangle or quadrilateral).
qra quadrule on the reference line segment.
Returns
a vector x s.t. x[i] is a valid quadrule on edge i of the referene element ref_el

This function constructs a quadrature rule on the boundary of a reference element based on another quadrature rule on the reference line segment which is transformed to all edges of the reference element.

Definition at line 13 of file dpg_tools.cc.

References lf::base::RefEl::kQuad(), lf::base::RefEl::kTria(), lf::base::RefEl::NumSubEntities(), lf::quad::QuadRule::Points(), and lf::quad::QuadRule::Weights().

Referenced by projects::dpg::FluxElementMatrixProvider< SCALAR, DIFF_COEFF >::FluxElementMatrixProvider(), and projects::dpg::TraceElementMatrixProvider< SCALAR, COEFF >::TraceElementMatrixProvider().

◆ ConvectionElementMatrixProvider()

template<class PTR , typename CONVECTION_COEFF_1 , typename CONVECTION_COEFF_2 >
projects::dpg::ConvectionElementMatrixProvider ( PTR  fe_trial,
PTR  fe_test,
size_type  trial_component,
size_type  test_component,
CONVECTION_COEFF_1  beta_1,
CONVECTION_COEFF_2  beta_2 
) -> ConvectionElementMatrixProvider< typename PTR::element_type::SCALAR, CONVECTION_COEFF_1, CONVECTION_COEFF_2 >

◆ DiffusionElementMatrixProvider()

template<class PTR , class DIFF_COEFF >
projects::dpg::DiffusionElementMatrixProvider ( PTR  fe_space_trial,
PTR  fe_space_test,
size_type  trial_component,
size_type  test_component,
DIFF_COEFF  alpha 
) -> DiffusionElementMatrixProvider< typename PTR::element_type::SCALAR, DIFF_COEFF >

◆ DpgElementMatrixProvider()

template<class PTR >
projects::dpg::DpgElementMatrixProvider ( PTR  stiffness_provider,
PTR  gramianProvider 
) -> DpgElementMatrixProvider< typename PTR::element_type::SCALAR >

◆ DpgElementVectorProvider()

template<class PTR1 , class PTR2 >
projects::dpg::DpgElementVectorProvider ( PTR1  eLoadVectorProvider,
PTR2  eStiffnessProvider,
PTR2  gramianProvider 
) -> DpgElementVectorProvider< typename PTR1::element_type::SCALAR >

◆ ElementErrorEstimators()

template<typename SCALAR >
lf::mesh::utils::CodimMeshDataSet< SCALAR > projects::dpg::ElementErrorEstimators ( const ProductUniformFEDofHandler trial_dofh,
std::shared_ptr< ProductElementMatrixProvider< SCALAR > >  stiffness_provider,
std::shared_ptr< ProductElementMatrixProvider< SCALAR > >  gramian_provider,
std::shared_ptr< ProductElementVectorProvider< SCALAR > >  load_provider,
const Eigen::Matrix< SCALAR, Eigen::Dynamic, 1 > &  sol_vec 
)

Evaluation of the local DPG error estimators on a mesh.

Parameters
trial_dofhlocal-to-global index mapping for the trial space of the DPG method
stiffness_providerevaluates the extended element stiffness matrix \( B \)
gramian_providerevaluates the local Gramian matrix \( G \)
load_providerevaluates the extended element load vector \( l \)
sol_vecfinite element vector of a function in the trial space
Returns
A datastructure of scalar values, which for each cell contains the loacl DPG error estimate for the function represented by sol_vec.
Template Parameters
SCALARa scalar type like 'double'

Definition at line 327 of file dpg_tools.h.

References ElementErrorEstimators(), projects::dpg::ProductUniformFEDofHandler::GlobalDofIndices(), projects::dpg::ProductUniformFEDofHandler::Mesh(), and projects::dpg::ProductUniformFEDofHandler::NumLocalDofs().

Referenced by ElementErrorEstimators(), projects::dpg::test::TestConververgencePrimalDPGAdaptedNormConvectionDiffusionDirichletBVP(), and projects::dpg::test::TestConververgencePrimalDPGConvectionDiffusionDirichletBVP().

◆ EvalPosteriorError()

template<typename SCALAR >
SCALAR projects::dpg::EvalPosteriorError ( const std::shared_ptr< const lf::mesh::Mesh > &  mesh_p,
const lf::mesh::utils::CodimMeshDataSet< SCALAR > &  local_errors 
)

Evaluation of the DPG error estimator.

Parameters
mesh_pthe underlying mesh
local_errorsdata structure containing the local DPG error estimator for each cell of the mesh
Returns
The global DPG error estimator.
Template Parameters
Scalara scalar type like 'double'

Definition at line 374 of file dpg_tools.h.

References EvalPosteriorError().

Referenced by EvalPosteriorError(), projects::dpg::test::TestConververgencePrimalDPGAdaptedNormConvectionDiffusionDirichletBVP(), and projects::dpg::test::TestConververgencePrimalDPGConvectionDiffusionDirichletBVP().

◆ flagEntitiesOnInflowBoundary()

template<typename CONVECTION_COEFF >
lf::mesh::utils::CodimMeshDataSet< bool > projects::dpg::flagEntitiesOnInflowBoundary ( const std::shared_ptr< const lf::mesh::Mesh > &  mesh_p,
CONVECTION_COEFF  beta 
)

flag all edges located on the inflow boundary

Parameters
mesh_pthe underlying mesh
betathe prescribed convection field \( \beta \) .
Returns
a datastructure of boolean values which specifies for each edge, if it lies on the inflow boundary or not.

An edge is located on the inflow boundary, if it is located on the boundary \( \partial \Omega \) and if it holds that \( \beta \cdot n_{\Omega} \) < 0 on that edge.

Note
For non constant convection fields this condition may or may not hold on the whole edge, so we only check this condition in the midpoint of the edge.

Definition at line 155 of file dpg_tools.h.

References lf::mesh::utils::flagEntitiesOnBoundary(), and OuterNormals().

Referenced by flagEntitiesOnOutflowBoundary().

◆ flagEntitiesOnOutflowBoundary()

template<typename CONVECTION_COEFF >
lf::mesh::utils::CodimMeshDataSet< bool > projects::dpg::flagEntitiesOnOutflowBoundary ( const std::shared_ptr< const lf::mesh::Mesh > &  mesh_p,
CONVECTION_COEFF  beta 
)

flag all edges located on the outflow boundary

Parameters
mesh_pthe underlying mesh
betathe prescribed convection field \( \beta \)
Returns
a datastructure of boolean values, which specifies for each edge, if it lies on the outflow boundary or not

An edge is located on the outflow boundary, if it is located on the boundary \( \partial \Omega \) and if it holds that \( \beta \cdot n_{\Omega} \geq 0 \) on that edge.

Note
For non constant convection fields this condition may or may not hold on the whole edge, so we only check this condition in the midpoint of the edge.

Definition at line 204 of file dpg_tools.h.

References lf::mesh::utils::flagEntitiesOnBoundary(), and flagEntitiesOnInflowBoundary().

◆ FluxElementMatrixProvider()

template<class PTR , class DIFF_COEFF >
projects::dpg::FluxElementMatrixProvider ( PTR  fe_space_trial,
PTR  fe_space_test,
size_type  trial_component,
size_type  test_component,
DIFF_COEFF  alpha 
) -> FluxElementMatrixProvider< typename PTR::element_type::SCALAR, DIFF_COEFF >

◆ InitEssentialConditionsFromFunctions()

template<typename SCALAR , typename EDGESELECTOR_DIRICHLET , typename EDGESELECTOR_NEUMANN , typename FUNCTION_G , typename FUNCTION_H >
std::vector< std::pair< bool, SCALAR > > projects::dpg::InitEssentialConditionsFromFunctions ( const ProductUniformFESpace< SCALAR > &  fes,
size_type  trace_component,
size_type  flux_component,
EDGESELECTOR_DIRICHLET &&  dirichletcondflag,
EDGESELECTOR_NEUMANN &&  neumanncondflag,
FUNCTION_G &&  g,
FUNCTION_H &&  h 
)

Initialization of flags/values for dofs of fluxes and traces of a on a product finite element space whose values are imposed by two specified functions on two specified parts of the boundary.

Template Parameters
SCALARscalar type like 'double'
EDGESELECTOR_DIRICHLETand EDGESELECTOR_NEUMANN predicates returning true for edges with fixed dofs
FUNCTION_Gand FUNCTION_H MeshFunction which define the imposed values on the edges

InitEssentialConditionsFromFunctions

Parameters
dofhthe local_to-global index mapping of the product space
fe_spec_edge_tracedescription of the local shape functions for a 'kSegment' type entity for the trace component
fe_spec_edge_fluxdescription of the local shape functions for a 'kSegment' type entity for the flux component
dirichletcondflagpredicate object whose evaluation operator returns true for all edges on which the degrees of freedom for the trace component should be set to a fixed value
neumanncondflagpredicate object whose evaluation operator returns true for all edges on which the degrees of freedom for the flux component should be set to a fixed value.
gfunctor providing the evaluation of the essential conditions for the trace component (dirichlet data)
hfunctor providing the evalutation of the essential conditions for the flux component (neumann data)
trace_componentthe index of the trace component in the product space
flux_componentthe index of the flux component in the product space
Returns
a vector of flag-value pairs, a 'true' first component indicates a fixed dof, the second component provides the value in this case.

The dpg formulation usually involves variables, which represent fluxes or traces. This allows us to impose both Dirichlet and Neumann boundary conditions as essential boundary conditions on the corresponding components and is a generalization of the lehrfempp function lf::fe::InitEssentialConditionFromFunction to product spaces.

This function is meant to supply information for the elimination of essential dofs by means of the function lf::assembl::fix_flagged_solution_components().

Definition at line 272 of file dpg_tools.h.

References projects::dpg::ProductUniformFESpace< SCALAR >::ComponentFESpace(), lf::fe::InitEssentialConditionFromFunction(), projects::dpg::ProductUniformFESpace< SCALAR >::LocGlobMap(), projects::dpg::ProductUniformFEDofHandler::NumDofs(), and projects::dpg::ProductUniformFEDofHandler::Offset().

◆ LoadElementVectorProvider()

template<class PTR , class FUNCTOR >
projects::dpg::LoadElementVectorProvider ( PTR  fe_space_test,
size_type  test_component,
FUNCTOR  f 
) -> LoadElementVectorProvider< typename PTR::element_type::SCALAR, FUNCTOR >

◆ OuterNormals()

Eigen::MatrixXd projects::dpg::OuterNormals ( const lf::geometry::Geometry geometry)

Compute the outer normals of a geometry object.

Parameters
geometryThe geometry of the cell for which the outer normals are computed. Should be either a triangle or quadrilateral
Returns
The outer normals, packed into the columns of a 2xn matrix, where n is the number of edges of the geometry .

Definition at line 49 of file dpg_tools.cc.

References lf::geometry::Corners(), lf::geometry::Geometry::Jacobian(), lf::base::RefEl::kQuad(), lf::base::RefEl::kTria(), lf::base::RefEl::NodeCoords(), lf::geometry::Geometry::RefEl(), and lf::base::RefEl::SubSubEntity2SubEntity().

Referenced by projects::dpg::TraceElementMatrixProvider< SCALAR, COEFF >::Eval(), and flagEntitiesOnInflowBoundary().

◆ ProductElementMatrixProvider()

template<typename ptr , typename vector >
projects::dpg::ProductElementMatrixProvider ( ptr  fe_space_tiral,
ptr  fe_space_test,
vector  subproviders 
) -> ProductElementMatrixProvider< typename ptr::element_type::SCALAR >

◆ ProductElementVectorProvider()

template<typename PTR , typename vector >
projects::dpg::ProductElementVectorProvider ( PTR  fe_space_test,
vector  subproviders 
) -> ProductElementVectorProvider< typename PTR::element_type::SCALAR >

◆ ReactionElementMatrixProvider()

template<class PTR , class REACTION_COEFF >
projects::dpg::ReactionElementMatrixProvider ( PTR  fe_trial,
PTR  fe_test,
size_type  trial_component,
size_type  test_component,
REACTION_COEFF  gamma 
) -> ReactionElementMatrixProvider< typename PTR::element_type::SCALAR, REACTION_COEFF >

◆ TraceElementMatrixProvider()

template<class PTR , class COEFF >
projects::dpg::TraceElementMatrixProvider ( PTR  fe_space_trial,
PTR  fe_space_test,
size_type  trial_component,
size_type  test_component,
COEFF  alpha 
) -> TraceElementMatrixProvider< typename PTR::element_type::SCALAR, COEFF >