I would like to write fluid traction \sigma(u,p)n as vector-version expression :
on the side surface “wall” of 3D cylinder:
from ngsolve import *
from netgen.csg import *
from ngsolve.webgui import Draw
geo = CSGeometry()
cyl = Cylinder(Pnt(0,0,0), Pnt(4,0,0),1)
cyl.bc("wall")
right = Plane( Pnt(4,0,0), Vec(1,0,0))
left = Plane(Pnt(0,0,0), Vec(-1,0,0))
finitecyl = cyl * left * right
geo.Add(finitecyl)
mesh = Mesh(geo.GenerateMesh(maxh=0.5))
Draw(mesh)
fes = VectorH1(mesh,order = 2)*H1(mesh,order =1)
Fluid_total = GridFunction(fes)
velocity = Fluid_total.components[0]
pressure = Fluid_total.components[1]
Then, define matrix-valued CoefficientFunction:
def Stress_fluid(strain_f,p):
return 2*strain_f-p*Id(3)
& vector-valued CF normal:
normal = CoefficientFunction((0, y/2, z/2))
Finally, my goal is to achieve:
traction = Stress_fluid(Sym(Grad(velocity)),pressure)*normal
By
print(traction)
From the expression tree, I think it seems correct.
However, I am not sure. can you help me, is it right?