How can I use Q2-P1dc element pair in a quadrilateral mesh to solve Stokes?

More
3 years 7 months ago #3680 by Guosheng Fu
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.,
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
More
3 years 7 months ago #3681 by Younghigh
If I just simply run the following code:
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()
there is nothing shown for me in GUI, which confuses me. Can you tell me some reason?
More
3 years 7 months ago #3683 by Younghigh
Thank u again. Using the VtkOutput and viewing in ParaView can realize your idea. Nice suggestion.
More
3 years 7 months ago #3684 by Guosheng Fu
If you run
Code:
python3 test.py
and want to see the pop up gui, put the following line after Redraw().
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