Variational namespace
Namespace Rodin::
Directory src/Rodin/Variational
Module which provides the necessary tools for constructing and solving variational problems.
The Variational module is the core of the Rodin finite element framework. It provides classes for defining finite element spaces, trial and test functions, variational forms, boundary conditions, and problems.
Finite Element Spaces
P0— Piecewise constant (discontinuous) finite element spaceP0g— Global constant space (1 DOF for scalar, vdim for vector)P1— Piecewise linear (continuous) finite element spaceH1— Higher-order -conforming finite element space (arbitrary polynomial order)
Functions
TrialFunction— Represents the unknown solution in a variational formulationTestFunction— Represents the weighting functionGridFunction— A concrete function storing DOF values in a finite element space
Variational Forms
The module supports building variational problems of the form:
which are translated into linear algebra problems .
Key expression classes:
Integral(A, B)— Domain integrals (bilinear or linear forms)BoundaryIntegral(A, B)— Boundary integralsFaceIntegral(A, B)— Integrals over all faces (interior + boundary)InterfaceIntegral(A, B)— Integrals over interior faces only
Differential operators:
Grad(u)— Gradient operatorDiv(u)— Divergence operatorJacobian(u)— Jacobian (gradient of vector field)Transpose(A)— Matrix transpose
Algebraic operators:
Dot(A, B)— Inner product / Frobenius contractionTrace(A)— Matrix traceFrobenius(A)— Frobenius normComponent(u, i)— Extract -th component of vector function
DG operators:
Jump(u)— Jump across internal faces:Average(u)— Average across internal faces:
Boundary conditions:
DirichletBC(u, g)— Essential boundary conditionsPeriodicBC(u, dofMap)— Periodic boundary conditions
Convenience functions:
RealFunction— Scalar function from constant or lambdaVectorFunction— Vector function from initializer listZero— Zero scalar/vector functionPow,Exp,Sqrt,Sin,Cos,Tan,Abs,Min,Max— Pointwise math operations
Special operators:
BoundaryNormal(mesh)— Outward unit normal onFaceNormal(mesh)— Unit normal on mesh facesIdentityMatrix(n)— identity matrix functionF::x,F::y,F::z— Coordinate projection functionsRe(u),Im(u),Conjugate(u)— Complex-valued function operators
Advanced operators:
Potential(K, u)— Integral convolution:Flow(t, u, vel)— Flow composition (characteristic tracing for advection)TraceOperator(u, attr)— Boundary traceLinearElasticityIntegral(u, v)(lambda, mu)— Hooke elasticity bilinear form
Problem
The Problem class assembles all forms and boundary conditions into a solvable linear system.
P1 Vh(mesh); TrialFunction u(Vh); TestFunction v(Vh); Problem poisson(u, v); poisson = Integral(Grad(u), Grad(v)) - Integral(f, v) + DirichletBC(u, Zero()); Solver::CG(poisson).solve();
Classes
-
template<class Solution, class TrialFES, class TestFES>class BilinearForm<Solution, TrialFES, TestFES, ::Mat>
- Bilinear form specialization that assembles into a PETSc matrix.
-
template<class Solution, class TrialFES, class TestFES, class Scalar>class BilinearForm<Solution, TrialFES, TestFES, Math::Matrix<Scalar>>
- Specialization of BilinearForm for a dense matrix operator.
-
template<class Solution, class TrialFES, class TestFES, class Scalar>class BilinearForm<Solution, TrialFES, TestFES, Math::SparseMatrix<Scalar>>
- Speciallization of BilinearForm for a matrix type.
-
template<class Operator>class BilinearFormBase
- Base class for bilinear form representations.
-
template<size_t K>class FeketeTetrahedron
- Cached Fekete-type nodes on the reference tetrahedron for degree K.
-
template<size_t K>class FeketeTriangle
- Cached Fekete-type nodes on the reference triangle for degree K.
-
template<class Derived>class FiniteElementBase
- Base class for finite elements.
-
template<class Derived>class FiniteElementSpace<Geometry::Mesh<Context::MPI>, Derived>
- Represents a finite element space defined on a distributed mesh.
-
template<class Derived>class FunctionBase
- Base class for functions defined on finite element meshes.
-
template<class FES>class GridFunction<FES, ::Vec>
- Grid function specialization storing DOF coefficients in a PETSc vector (
Vec). -
template<class FES>class GridFunction<FES, Math::Vector<typename FormLanguage::Traits<FES>::ScalarType>>
- Grid function storing its degrees of freedom in a dense Math::Vector over the space's scalar type (the standard local backend).
-
template<class Derived, class FES = typename FormLanguage::class GridFunctionBase
Traits<Derived>:: FESType, class Data = typename FormLanguage:: Traits<Derived>:: DataType> - Base class for discrete finite element functions.
-
template<size_t K, class Scalar>class H1<K, Math::SpatialVector<Scalar>, Geometry::Mesh<Context::MPI>>
- Distributed vector-valued H1 finite element space for MPI meshes.
-
template<size_t K, class Scalar>class H1<K, Scalar, Geometry::Mesh<Context::MPI>>
- Distributed H1 finite element space for MPI meshes (scalar range).
- class Integrator
- Abstract base class for integrators in variational formulations.
-
template<class FES>struct IsTestFunction<PETSc::Variational::TestFunction<FES>>
- Marks PETSc test functions as valid test functions.
-
template<class Solution, class FES>struct IsTrialFunction<PETSc::Variational::TrialFunction<Solution, FES>>
- Marks PETSc trial functions as valid trial functions.
-
template<size_t K>class JacobiPolynomial
- Jacobi polynomial evaluator.
-
template<size_t K>class LegendrePolynomial
- Compile-time degree Legendre polynomial evaluator.
-
template<class Solution, class FES>class LinearElasticityIntegral
- Helper class to construct linear elasticity integrators.
-
template<class Solution, class FES, class LambdaDerived, class MuDerived>class LinearElasticityIntegrator
- Bilinear form integrator for linear elasticity.
-
template<class Solution, class MuDerived, class LambdaDerived, class Range, class Mesh>class LinearElasticityIntegrator<Solution, P1<Range, Mesh>, MuDerived, LambdaDerived>
- P1 linear elasticity bilinear form integrator.
-
template<class FES>class LinearForm<FES, ::Vec>
- Linear form specialization that assembles into a PETSc vector.
-
template<class Derived>class NonLinearFormIntegrator
- CRTP mixin for nonlinear form integrators.
-
template<class Range, class Mesh>class P0
- Degree 0 Lagrange finite element space.
-
template<class Range>class P0<Range, Geometry::Mesh<Context::MPI>>
- Distributed P0 finite element space for MPI meshes.
-
template<class Range>class P0Element
- Degree 0 Lagrange element.
-
template<>class P0g<Math::SpatialVector<Real>, Geometry::Mesh<Context::MPI>>
- Distributed vector P0g finite element space for MPI meshes.
-
template<>class P0g<Real, Geometry::Mesh<Context::MPI>>
- Distributed scalar P0g finite element space for MPI meshes.
-
template<class Range, class Mesh>class P1
- Degree 1 Lagrange finite element space.
-
template<class Range>class P1<Range, Geometry::Mesh<Context::MPI>>
- Distributed P1 finite element space for MPI meshes.
-
template<class Range>class P1Element
- Degree 1 Lagrange element.
-
template<class U, class V>class Problem<PETSc::Math::LinearSystem, U, V>
- PETSc variational problem for a single trial / test function pair.
-
template<class U1, class U2, class U3, class... Us>class Problem<PETSc::Math::LinearSystem, U1, U2, U3, Us...>
- PETSc variational problem for multiple coupled trial / test functions.
-
template<class F>class RealFunction<F>
- Represents a scalar function given by an arbitrary scalar function.
-
template<class NestedDerived>class RealFunction<FunctionBase<NestedDerived>>
- Real-valued function that wraps another real function expression.
-
template<>class RealFunction<Integer>
- Represents a constant scalar function initialized from an Integer.
-
template<>class RealFunction<Real>
- Represents a constant scalar function with type Real.
-
template<class Derived>class RealFunctionBase
- Base class for real-valued scalar functions.
- class RelativeError
- Utility class for computing relative errors.
-
template<class F>class VectorFunction<F>
- Vector function backed by a callable.
-
template<class Scalar>class VectorFunction<Math::Vector<Scalar>>
- Vector function backed by an existing dense vector.
-
template<class V, class ... Values>class VectorFunction<V, Values...>
- Represents a vector function which may be constructed from values which can be converted to objects of type RealFunction.
-
template<class Scalar, class Derived>class VectorFunctionBase
- Base class for vector-valued functions defined on a mesh.
Typedefs
- using RealP0Element = P0Element<Real>
- Alias for P0Element<Real>
- using ComplexP0Element = P0Element<Complex>
- Alias for P0Element<Complex>
-
template<class Scalar>using VectorP0Element = P0Element<Math::
SpatialVector<Scalar>> - Alias for P0Element<Math::SpatialVector<Scalar>>
- using RealVectorP0Element = VectorP0Element<Real>
- Alias for real vector P0Element.
- using ComplexVectorP0Element = VectorP0Element<Complex>
- Alias for complex vector P0Element.
- using RealP1Element = P1Element<Real>
- Alias for P1Element<Real>
- using ComplexP1Element = P1Element<Complex>
- Alias for P1Element<Complex>
-
template<class Scalar>using VectorP1Element = P1Element<Math::
SpatialVector<Scalar>> - Alias for P1Element<Math::SpatialVector<Scalar>>
-
using RealVectorP1Element = P1Element<Math::
SpatialVector<Real>> - Alias for real vector P1Element.
Typedef documentation
template<class Scalar>
using Rodin:: Variational:: VectorP1Element = P1Element<Math:: SpatialVector<Scalar>>
Alias for P1Element<Math::SpatialVector<Scalar>>
| Template parameters | |
|---|---|
| Scalar | Scalar type for vector components |