Trefftz spaces

Trefftz finite element spaces extend the ngsolve class of FESpace. They provide test and trial functions that are elementwise solutions to chosen PDEs. They are ment to be used in a DG setting with dgjumps=True.

class ngstrefftz.trefftzfespace(mesh, **kwargs)
Trefftz space for different PDEs. Use kwarg ‘eq’ to choose the PDE, currently implemented are:
  • laplace - for Laplace equation

  • qtelliptic - for the quasi-Trefftz space for an elliptic problem

  • wave - for the second order acoustic wave equation

  • qtwave - for the quasi-Trefftz space

  • fowave - for the first order acoustic wave equation, returns TnT (sigv,tauw)

  • foqtwave - for the quasi-Trefftz space

  • helmholtz - planewaves for the helmholtz equation

  • helmholtzconj - returns the complex conjungate of the planewaves

Keyword arguments can be:

eq: string

Choose type of Trefftz functions.

order: int = 1

Order of finite element space

dgjumps: bool = True

Enable discontinuous space for DG methods, this flag is always True for trefftzfespace.

complex: bool = False

Set if FESpace should be complex

useshift: bool = True

shift of basis functins to element center

usescale: bool = True

scale element basis functions with diam

__init__(self: ngstrefftz.trefftzfespace, mesh: ngsolve.comp.Mesh, **kwargs) -> None

Embedded Trefftz method

The embedded Trefftz method produces a Galerkin projection of an underlying discontinuous Galerkin method onto a subspace of Trefftz-type. It can be applied to very general cases, including inhomogeneous sources and non-constant coefficient differential operators. \(\newcommand{\Th}{\mathcal{T}_h} \newcommand{\Vhp}{V^p(\Th)} \newcommand{\bT}{\mathbf{T}} \newcommand{\bW}{\mathbf{W}} \newcommand{\bl}{\mathbf{l}} \newcommand{\bM}{\mathbf{M}} \newcommand{\bL}{\mathbf{L}} \newcommand{\bA}{\mathbf{A}} \newcommand{\bU}{\mathbf{U}} \newcommand{\bV}{\mathbf{V}} \newcommand{\calL}{\mathcal{L}} \newcommand{\bu}{\mathbf{u}} \newcommand{\IT}{\mathbb{T}} \newcommand{\calG}{\mathcal{G}} \newcommand{\be}{\mathbf{e}} \newcommand{\bx}{{\mathbf x}} \newcommand{\inner}[1]{\langle #1 \rangle} \DeclareMathOperator\Ker{ker}\)

Specifically, for an operator \(\calL\) we are looking to find a basis for its kernel over the space of polynomails. We call this projection \(\bT\) Then we can solve the reduced problem: Find \(\bu_\IT\) so that

\[\begin{equation} \label{eq:trefftzlinearsys} \bT^T\bA\bT ~ \bu_\IT = \bT^T \bl. \end{equation}\]

The solution in the full polynomial space is then given by \(\bu=\bT\bu_\IT\)

class ngstrefftz.TrefftzEmbedding(self: ngstrefftz.TrefftzEmbedding, top: ngsolve.comp.SumOfIntegrals = None, trhs: ngsolve.comp.SumOfIntegrals = None, cop: ngsolve.comp.SumOfIntegrals = None, crhs: ngsolve.comp.SumOfIntegrals = None, ndof_trefftz: int = 0, eps: float = 0.0, fes: ngsolve.comp.FESpace = None, fes_test: ngsolve.comp.FESpace = None, fes_conformity: ngsolve.comp.FESpace = None, ignoredofs: pyngcore.pyngcore.BitArray = None)

Gives access to the embedding matrix and a particular solution and can be used to construct an EmbeddedTrefftzFESpace.

The dimension of the local Trefftz space is determined by the kernel of top, after removing the dofs fixed by the conforming condition in cop and crhs.

If a different test space is used, the dimension of the local Trefftz space is at best dim(fes)-dim(fes_test) and may increase by zero singular values of top (with respect to the threshold eps).

Constructs a new Trefftz embedding object.

param top:

the differential operation. Can be None

param trhs:

right hand side of the var. formulation

param cop:

left hand side of the conformity operation

param crhs:

right hand side of the conformity operation

param eps:

cutoff for singular values from the SVD of the local operator. values below eps are considered zero and therefore in the kernel of top. (default: 0.0)

param ndof_trefftz:

fixes the number of degrees of freedom per element that are to be considered in the Trefftz space generated by top (i.e. the local dimension of the kernel of top on one element) cannot be used together with eps (default: 0)

param fes:

the finite element space of top (optional, determined from top if not given)

param fes_test:

the finite element test space of top (optional, determined from top if not given)

param fes_conformity:

finite element space of the conformity operation (optional, determined from cop if not given)

Embed(self: ngstrefftz.TrefftzEmbedding, arg0: ngsolve.la.BaseVector) ngsolve.la.BaseVector

Embed a Trefftz GridFunction into the underlying FESpace

GetEmbedding(self: ngstrefftz.TrefftzEmbedding) ngsolve.la.BaseMatrix

Get the sparse embedding matrix

GetParticularSolution(*args, **kwargs)

Overloaded function.

  1. GetParticularSolution(self: ngstrefftz.TrefftzEmbedding) -> ngsolve.la.BaseVector

Particular solution as GridFunction vector of the underlying FESpace

  1. GetParticularSolution(self: ngstrefftz.TrefftzEmbedding, arg0: ngsolve.comp.SumOfIntegrals) -> ngsolve.la.BaseVector

Particular solution as GridFunction vector of the underlying FESpace, given a trhs

ngstrefftz.EmbeddedTrefftzFES(emb: ngcomp::TrefftzEmbedding) ngsolve.comp.FESpace

Given a TrefftzEmbedding this wrapper produces a Trefftz FESpace using local projections, following the Embedded Trefftz-DG methodology.

Parameters:

TrefftzEmbedding – The Trefftz embedding object.

Returns:

EmbTrefftzFES

Trefftz + tent-pitching

Given a tent-pitched mesh produced by ngstents the following function returns a solver using Trefftz, or quas-Trefftz, finite elements to solve the acoustic wave equation.

ngstrefftz.TWave(order: int, tps: ngstrefftz.TentSlab, wavespeedcf: ngsolve.fem.CoefficientFunction, BBcf: ngsolve.fem.CoefficientFunction = None) ngstrefftz.TrefftzTents

Create solver for acoustiv wave equation on tent-pitched mesh.

Parameters:
  • order – Polynomial order of the Trefftz space.

  • tps – Tent-pitched slab.

  • wavespeedcf – PDE Coefficient

  • BB – PDE Coefficient

The solver class returned by TWave is used to set initial and boundary conditions and to propagate the solution in the given tent slab.

class ngstrefftz.TrefftzTents
Propagate(self: ngstrefftz.TrefftzTents) None

Solve tent slab

SetInitial(self: ngstrefftz.TrefftzTents, arg0: ngsolve.fem.CoefficientFunction) None

Set initial condition

SetBoundaryCF(self: ngstrefftz.TrefftzTents, arg0: ngsolve.fem.CoefficientFunction) None

Set boundary condition