Hi,
I tried a simple example from the tutorial and visualized with Draw and VTKOutput/Paraview.
Code:
from netgen.csg import CSGeometry, Plane, Pnt, Vec
geo = CSGeometry()
left = Plane (Pnt(0,0,0), Vec(-1,0,0) )
right = Plane (Pnt(1,1,1), Vec( 1,0,0) )
front = Plane (Pnt(0,0,0), Vec(0,-1,0) ).bc("outer")
back = Plane (Pnt(1,1,1), Vec(0, 1,0) ).bc("outer")
bot = Plane (Pnt(0,0,0), Vec(0,0,-1) ).bc("outer")
top = Plane (Pnt(1,1,1), Vec(0,0, 1) ).bc("outer")
cube = left * right * front * back * bot * top
geo.Add(cube)
geo.PeriodicSurfaces(left,right)
geo.PeriodicSurfaces(front,back)
geo.PeriodicSurfaces(bot,top)
from ngsolve import *
mesh = Mesh(geo.GenerateMesh(maxh=0.3))
from ngsolve.webgui import Draw
fes = Periodic(H1(mesh,order=3,dirichlet="outer"))
u,v = fes.TrialFunction(), fes.TestFunction()
a = BilinearForm(fes,symmetric=True)
a += SymbolicBFI(grad(u) * grad(v))
f = LinearForm(fes)
f += SymbolicLFI(x*v)
u = GridFunction(fes,"u")
with TaskManager():
a.Assemble()
f.Assemble()
u.vec.data = a.mat.Inverse(fes.FreeDofs()) * f.vec
Draw(u)
import ngsolve as ng
vtk = ng.VTKOutput(mesh,coefs=[u],names=["u"],filename="results/rve")
vtk.Do(time=0.0)
What I don’t understand is the difference of the solution.
While the Draw looks symmetrical and smooth, Paraview’s result looks heavely influenced by the element shape.
Is there an option to get a similar picture in Paraview?
Are there Informations that Draw uses, that are not exported vie VTKOutput?
I would be very thankful for any help!
Best
Willi