- Thank you received: 0
Visualisation of surface PDE solution
3 years 7 months ago #3631
by mary
Visualisation of surface PDE solution was created 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
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
- mneunteufel
- Offline
- Premium Member
Less
More
- Thank you received: 59
3 years 7 months ago #3635
by mneunteufel
Replied by mneunteufel on topic Visualisation of surface PDE solution
Hi Marie-Therese,
if you want to run the code as a python file with Netgen you have to remove the line
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.
Best
Michael
if you want to run the code as a python file with Netgen you have to remove the line
Code:
from ngsolve.webgui import Draw
Attached I copied parts of the surface pde tutorial into a python file, which draws the solution in Netgen.
Best
Michael
Attachments:
3 years 7 months ago #3654
by mary
Replied by mary on topic Visualisation of surface PDE solution
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
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
- mneunteufel
- Offline
- Premium Member
Less
More
- Thank you received: 59
3 years 7 months ago #3655
by mneunteufel
Replied by mneunteufel on topic Visualisation of surface PDE solution
With
you can normalize your solution.
If you want to set something into a GridFunction on the surface you have to use the syntax
Otherwise the result will be zero.
Best
Michael
Code:
u_0 = Normalize(grad(u))
#or equivalently
u_0 = 1/Norm(grad(u))*grad(u)
If you want to set something into a GridFunction on the surface you have to use the syntax
Code:
gf.Set(..., definedon=mesh.Boundaries(".*")).
Best
Michael
3 years 7 months ago #3656
by mary
Replied by mary on topic Visualisation of surface PDE solution
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
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
- christopher
- Offline
- Administrator
Less
More
- Thank you received: 101
3 years 7 months ago - 3 years 7 months ago #3657
by christopher
Replied by christopher on topic Visualisation of surface PDE solution
Hi Mary,
you can do the meshing from python:
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:
Best
Christopher
you can do the meshing from python:
Code:
from netgen.stl import STLGeometry
from ngsolve import *
geo = STLGeometry(filename)
mesh = Mesh(geo.GenerateMesh(maxh=, ..., perfstepsend=MeshingStep.MESHSURFACE) )
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:
Code:
mesh = Mesh(meshfile)
geo = STLGeometry(geofile)
mesh.ngmesh.SetGeometry(geo)
Best
Christopher
Last edit: 3 years 7 months ago by christopher.
Time to create page: 0.105 seconds