^ >

Space-time Trefftz-DG on tent pitched meshes

Two examples of the current Trefftz-DG method using tent pitching.

A wave hitting a corner, producing a singularity:

A wave in inhomogeneous material:

I am still a little torn about the current way of steering things from python, because it is quite rigid, but at least it is possible to start tent pitching using Trefftz-DG for the accoustic wave equation.

We start by importing and setting some parameters:

from trefftzngs import *
import netgen.gui
from ngsolve import *
D = initmesh.dim
t = CoordCF(D)
order = 4
t_start = 0
t_step = 0.01
initmesh = # your space mesh 

We create the WaveTents object, which will handle everything, and set initial and boundary conditions

sq = sqrt(0.5);
# Simple example use solution for initial cond. + dirichlet/neumann bndc. 
# supply fct + derivatives
bdd = CoefficientFunction((
    sin( t+sq*(x+y) ), # used to reconstruct the 2nd order solution
    sq*cos(t+sq*(x+y)), # init. cond. / Neumann bc
    cos(t+sq*(x+y)) # init. cond. / Dirichlet bc
TT=WaveTents(order,initmesh,c,bdd) # set boundary condition
TT.SetWavefront(bdd,t_start) # set initial cond.

Now we set up the GridFunction to draw, provided by GetWave(), and then we are ready to start the iteration.

gfu = TT.GetWave()

with TaskManager():
    for t in range(0,80):
        gfu.vec.data = TT.GetWave().vec.data

        t_start += t_step
        print("time: " + str(t_start))

It is also possible to use neumann bdc

for i in range(0,len(initmesh.GetBoundaries())):