- Thank you received: 6
How can I use Q2-P1dc element pair in a quadrilateral mesh to solve Stokes?
- Guosheng Fu
- Offline
- Elite Member
Less
More
3 years 7 months ago #3680
by Guosheng Fu
Replied by Guosheng Fu on topic How can I use Q2-P1dc element pair in a quadrilateral mesh to solve Stokes?
First, you shall figure out the basis functions for Qk by yourself. They are classical tensor products of 1D Legendre basis. VectorL2 is simply two copies of Qk on quads.
You can do so by visualize the shape functions of the basis on a unit square without going into details of the c++ code, e.g.,
You can do so by visualize the shape functions of the basis on a unit square without going into details of the c++ code, e.g.,
Code:
mesh = MakeStructured2DMesh(nx=1,ny=1)
gfu = GridFunction(VectorL2(mesh, order=2))
Draw(gfu)
for i in range(gfu.vec.size):
gfu.vec[i] = 1
if i > 1:
gfu.vec[i-1] = 0
Redraw()
input("next?")
The following user(s) said Thank You: Younghigh
3 years 7 months ago #3681
by Younghigh
Replied by Younghigh on topic How can I use Q2-P1dc element pair in a quadrilateral mesh to solve Stokes?
If I just simply run the following code:
there is nothing shown for me in GUI, which confuses me. Can you tell me some reason?
Code:
import netgen.gui
from ngsolve import *
import ngsolve.meshes as ngm
mesh = ngm.MakeStructured2DMesh(nx=1,ny=1)
gfu = GridFunction(VectorL2(mesh, order=2))
Draw(gfu)
gfu.vec[0] = 1
Redraw()
3 years 7 months ago #3683
by Younghigh
Replied by Younghigh on topic How can I use Q2-P1dc element pair in a quadrilateral mesh to solve Stokes?
Thank u again. Using the VtkOutput and viewing in ParaView can realize your idea. Nice suggestion.
- Guosheng Fu
- Offline
- Elite Member
Less
More
- Thank you received: 6
3 years 7 months ago #3684
by Guosheng Fu
Replied by Guosheng Fu on topic How can I use Q2-P1dc element pair in a quadrilateral mesh to solve Stokes?
If you run
and want to see the pop up gui, put the following line after Redraw().
I think i-tutorials is the good place for you to get familiar with ngsolve.
Code:
python3 test.py
Code:
input("next?")
I think i-tutorials is the good place for you to get familiar with ngsolve.
The following user(s) said Thank You: Younghigh
Time to create page: 0.104 seconds