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

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\)

ngstrefftz.TrefftzEmbedding(*args, **kwargs)

Overloaded function.

  1. TrefftzEmbedding(bf: ngsolve.comp.SumOfIntegrals, fes: ngsolve.comp.FESpace, lf: ngsolve.comp.SumOfIntegrals, eps: float = 0, test_fes: ngsolve.comp.FESpace = None, tndof: int = 0, getrange: bool = False, stats_dict: Optional[dict] = None) -> tuple[BaseMatrix, ngsolve.la.BaseVector]

    Computes the Trefftz embedding and particular solution.

    param bf:

    operator for which the Trefftz embedding is computed.

    param fes:

    DG finite element space of the weak formulation.

    param lf:

    Rhs used to compute the particular solution.

    param eps:

    Threshold for singular values to be considered zero, defaults to 0

    param test_fes:

    Used if test space differs from trial space, defaults to None

    param tndof:

    If known, local ndofs of the Trefftz space, else eps and/or test_fes are used to find the dimension

    param getrange:

    If True, extract the range instead of the kernel

    param stats_dict:

    Pass a dictionary to fill it with stats on the singular values.

    return:

    [Trefftz embeddint, particular solution]

  2. TrefftzEmbedding(bf: ngsolve.comp.SumOfIntegrals, fes: ngsolve.comp.FESpace, eps: float = 0, test_fes: ngsolve.comp.FESpace = None, tndof: int = 0, getrange: bool = False, stats_dict: Optional[dict] = None) -> BaseMatrix

    Used without the parameter lf as input the function only returns the Trefftz embedding.

    return:

    Trefftz embedding

ngstrefftz.EmbeddedTrefftzFES(fes: ngsolve.comp.FESpace) ngsolve.comp.FESpace

Given a FESpace this wrapper produces a Trefftz FESpace using local projections, following the Embedded Trefftz-DG methodology. Use EmbTrefftzFES.SetOp() to set the operator used to construct the embedding.

Parameters:

fes – FESpace to be wrapped.

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