Hello everyone, good day.
I have to use an outdated code for my master’s degree project simulation, and I can’t add a slip bc to the face of my cylinder for Superhydrophobic simulation. the geometry is the old von Karman vortex street.
I searched the web and discourse group, and there are some examples of Nitsche but I don’t understand how to add them to this code. I know as much as that I should define a function and replace the V in this part:
bcu_cyl_wall = DirichletBC(V, Constant((0, 0)), surfaces, cylinder_noslip_tag)
I would be grateful if someone could help.
this is the code: (I shortened it as much as possible If needed please tell me to upload the full code)
inlet_tag = 3
outlet_tag = 2
wall_tag = 1
cylinder_noslip_tag = 4
# Define function spaces
V = VectorFunctionSpace(mesh, 'CG', 2)
Q = FunctionSpace(mesh, 'CG', 1)
# Define trial and test functions
u, v = TrialFunction(V), TestFunction(V)
p, q = TrialFunction(Q), TestFunction(Q)
u_n, p_n = Function(V), Function(Q)
# Starting from rest or are we given the initial state
for path, func, name in zip(('u_init', 'p_init'), (u_n, p_n), ('u0', 'p0')):
if path in flow_params:
comm = mesh.mpi_comm()
XDMFFile(comm, flow_params[path]).read_checkpoint(func, name, 0)
# assert func.vector().norm('l2') > 0
u_, p_ = Function(V), Function(Q) # Solve into these
dt = Constant(solver_params['dt'])
# Define expressions used in variational forms
U = Constant(0.5)*(u_n + u)
n = FacetNormal(mesh)
f = Constant((0, 0))
epsilon = lambda u :sym(nabla_grad(u))
sigma = lambda u, p: 2*mu*epsilon(u) - p*Identity(2)
inflow_profile = flow_params['inflow_profile'](mesh, degree=2)
# Define boundary conditions, first those that are constant in time
bcu_inlet = DirichletBC(V, inflow_profile, surfaces, inlet_tag)
# No slip
bcu_wall = DirichletBC(V, Constant((0, 0)), surfaces, wall_tag)
bcu_cyl_wall = DirichletBC(V, Constant((0, 0)), surfaces, cylinder_noslip_tag)
# Fixing outflow pressure
bcp_outflow = DirichletBC(Q, Constant(0), surfaces, outlet_tag)