Sorry, I keep trying to upload the code or a picture of the result, but it does not allow me. This is the code from the website that I copied over. I ran it in the terminal, but the Netgen solution result was a grey figure, which is not what is displayed in the site. Am I missing something?
I think it might be because of this: “Including OpenCascade geometry kerneloptfile ./ng.opt does not exist - using default values”
Thank you for your time!
from ngsolve import *
from ngsolve.webgui import Draw
from netgen.geom2d import SplineGeometry
geo = SplineGeometry()
geo.AddRectangle( (0, 0), (2, 0.41), bcs = (“wall”, “outlet”, “wall”, “inlet”))
geo.AddCircle ( (0.2, 0.2), r=0.05, leftdomain=0, rightdomain=1, bc=“cyl”)
mesh = Mesh( geo.GenerateMesh(maxh=0.05))
mesh.Curve(3)
Draw (mesh)
V = H1(mesh, order=2, dirichlet=“wall|inlet|cyl”)
Q = H1(mesh, order=1)
X = VVQ
ux,uy,p = X.TrialFunction()
vx,vy,q = X.TestFunction()
div_u = grad(ux)[0]+grad(uy)[1]
div_v = grad(vx)[0]+grad(vy)[1]
a = BilinearForm(X)
a += (grad(ux)grad(vx)+grad(uy)grad(vy) + div_uq + div_vp) * dx
a.Assemble()
#Set inhomogeneous Dirichlet boundary condition only on inlet boundary:
gfu = GridFunction(X)
uin = 1.54y*(0.41-y)/(0.41*0.41)
gfu.components[0].Set(uin, definedon=mesh.Boundaries(“inlet”))
velocity = CoefficientFunction(gfu.components[0:2])
Draw(velocity, mesh, “vel”)
SetVisualization(max=2)
res = gfu.vec.CreateVector()
res.data = -a.mat * gfu.vec
inv = a.mat.Inverse(freedofs=X.FreeDofs(), inverse=“umfpack”)
gfu.vec.data += inv * res
Draw(velocity, mesh, “vel”)