Visualisation of surface PDE solution

1 month 1 week ago #3631 by mary
Dear all,

I copy&pasted your surface_pde notebook and ran it as a py file - all works fine, except for the visualisation. I do see the mesh in the gui, but there is no solution (also when I click on the visual tab - I can't find the solution 'u' even though it should be set). I do think that the program works fine otherwise - I can output the solution vector (all real numbers ....), so I think something is not working for the visualisation (since also the other examples work - for example poisson.py is fine and it shows the solution).
Is there anything else that I need to set for surface pdes?

Thanks a lot
Marie-Therese

Please Log in or Create an account to join the conversation.

1 month 1 week ago #3635 by mneunteufel
Hi Marie-Therese,

if you want to run the code as a python file with Netgen you have to remove the line
from ngsolve.webgui import Draw
Otherwise the solutions will not be drawn.

Attached I copied parts of the surface pde tutorial into a python file, which draws the solution in Netgen.

File Attachment:

File Name: surf_pde.py
File Size:1 KB


Best
Michael
Attachments:

Please Log in or Create an account to join the conversation.

1 month 1 week ago #3654 by mary
Thanks a lot - it's working now :-)

I actually have another question - is it possible to calculate the normalised gradient of u on the surface? So u is a solution of the surface Laplacian - how do I calc \nabla u /\lVert \nabla u \rVert?

I started with
gradu = grad(u).Trace()
But how do I get its norm and assign it to a gridfunction?

Thanks a lot
Marie-Therese

Please Log in or Create an account to join the conversation.

1 month 1 week ago #3655 by mneunteufel
With
u_0 = Normalize(grad(u))
#or equivalently
u_0 = 1/Norm(grad(u))*grad(u)
you can normalize your solution.

If you want to set something into a GridFunction on the surface you have to use the syntax
gf.Set(..., definedon=mesh.Boundaries(".*")).
Otherwise the result will be zero.

Best
Michael

Please Log in or Create an account to join the conversation.

1 month 1 week ago #3656 by mary
Thank you so much - I used the HDivSurface space to interpolate it, so that's fine.

Sorry to bother you with one more thing - I would like to solve the equation on a more complicated geometry. I imported the respective stl file into ngsolve and I meshed the domain. Can I just go ahead an use the surface mesh in the python file then - like import the stl and the mesh file?

Thanks a lot and good Easter weekend
Marie-Therese

Please Log in or Create an account to join the conversation.

1 month 1 week ago - 1 month 1 week ago #3657 by christopher
Hi Mary,
you can do the meshing from python:
from netgen.stl import STLGeometry
from ngsolve import *
geo = STLGeometry(filename)
mesh = Mesh(geo.GenerateMesh(maxh=, ..., perfstepsend=MeshingStep.MESHSURFACE) )
this also only meshes the surface and no volume. To do this in the gui you can select meshing options -> Last Step -> Optimize Surface.

you can also load generated meshes, but the stl geometry is not stored with the mesh, so for example curving or refinement (that respects the true geometry) would not work, to allow this as well set the geometry:
mesh = Mesh(meshfile)
geo = STLGeometry(geofile)
mesh.ngmesh.SetGeometry(geo)

Best
Christopher

Please Log in or Create an account to join the conversation.

© 2019 Netgen/NGSolve