Cylinder Slip boundary condition in fenics 2017.1.0 for Superhydrophobic sim

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)

I have found this code:
fenics-nitsche/slip_stokes.py at master · MiroK/fenics-nitsche · GitHub
fenics-nitsche/stokes_freeslip.py at master · MiroK/fenics-nitsche · GitHub

if someone could help me to integrate it into my code I would be very grateful, my deadline for the project is closing in.

Hi Kamyar,

The following paper presents a Nitsche method for imposing slip boundary conditions on a circle/cylinder:

The code for the paper can be found here:

Hope that helps!

3 Likes

Hello and Thank you for your help.
unfortunately, my code uses Fenics 2017 and I can’t use this method.
Regardless Thank you again.

There are very few differences between FEniCS 2017 and FEniCS 2019/dev version. Is there a specific reason that you cannot use a later version? Or what specific problems do you run into in @IngeborgGjerde’s code?