- Thank you received: 0
Higher-Order FESpace mapped on mesh nodes
- ekarabelas
- Topic Author
- Offline
- New Member
Less
More
3 years 5 days ago #4077
by ekarabelas
Higher-Order FESpace mapped on mesh nodes was created by ekarabelas
Hello,
I was wondering if there are routines in NGSolve to evaluate a FE-Function based on a higher order polynomial space (like the P2 in the Taylor-Hood Element) on the nodes of a mesh? I know, there is a VTK output routine, but this writes Files and I would like to evaluate the function in python and use it then as numpy-array for something else.
Best Regards
Elias
I was wondering if there are routines in NGSolve to evaluate a FE-Function based on a higher order polynomial space (like the P2 in the Taylor-Hood Element) on the nodes of a mesh? I know, there is a VTK output routine, but this writes Files and I would like to evaluate the function in python and use it then as numpy-array for something else.
Best Regards
Elias
- christopher
- Offline
- Administrator
Less
More
- Thank you received: 101
3 years 4 days ago #4078
by christopher
Replied by christopher on topic Higher-Order FESpace mapped on mesh nodes
Hi, yes you can create a numpy array of evaluation - points by giving an array of coordinates to the mesh and then put this array into the coefficientfunction to evaluate it:
Best
Christopher
Code:
xvals = np.linspace(0, 1, 1000)
pts = mesh(xvals, 0, 0)
vals = cf(pts)
Best
Christopher
3 years 4 days ago #4079
by joachim
Replied by joachim on topic Higher-Order FESpace mapped on mesh nodes
An alternativ is to define points on the reference element, and evaluate the function on the mapped points, simultaneously on all elements:
We use this in the webgui, see
github.com/NGSolve/ngsolve/blob/master/python/webgui.py
line 250
Joachim
Code:
pts = mesh.MapToAllElements({ngs.ET.TRIG: ir_trig, ngs.ET.QUAD: ir_quad}, vb)
values = func(pts)
We use this in the webgui, see
github.com/NGSolve/ngsolve/blob/master/python/webgui.py
line 250
Joachim
- ekarabelas
- Topic Author
- Offline
- New Member
Less
More
- Thank you received: 0
3 years 4 days ago #4082
by ekarabelas
Replied by ekarabelas on topic Higher-Order FESpace mapped on mesh nodes
Dear Joachim, dear Christopher,
thanks for the quick reply I will try this out.
Thanks
Elias
thanks for the quick reply I will try this out.
Thanks
Elias
- ekarabelas
- Topic Author
- Offline
- New Member
Less
More
- Thank you received: 0
3 years 4 days ago #4083
by ekarabelas
Replied by ekarabelas on topic Higher-Order FESpace mapped on mesh nodes
One additional thing that wasn't clear to me. When you guys speak of CoefficientFunction this is the same as a FE-Solution?
- christopher
- Offline
- Administrator
Less
More
- Thank you received: 101
3 years 4 days ago - 3 years 4 days ago #4084
by christopher
Replied by christopher on topic Higher-Order FESpace mapped on mesh nodes
Yes, a fe solution GridFunction is derived from CoefficientFunction, so allows to evaluate itself like a CoefficientFunction. CoefficientFunction is any function on the mesh, like for example the coordinate-CFs x, y and z.
Also grad(u) is a coefficientfunction, also x * sin(u), ...
All of these function can be evaluated on points in the mesh.
Also grad(u) is a coefficientfunction, also x * sin(u), ...
All of these function can be evaluated on points in the mesh.
Last edit: 3 years 4 days ago by christopher.
Time to create page: 0.103 seconds