## Code_Saturne Neumann boundary condition implement for coupling case

Miscellaneous discussion topics about Code_Saturne (development, ...)
yang
Posts: 15
Joined: Thu Jul 14, 2022 3:39 pm

### Code_Saturne Neumann boundary condition implement for coupling case

Hi team,

I am using Code_Saturne 7.0.2 to test coupling case by PLE coupling library, and using c language. I successfully do coupling case by Dirichlet boundary condition for lid-driven case(or cavity flow), and in Code_Saturne part, my code shows as follows,

Now, I am testing the Nuemann boundary condition, and I send velocity gradient (dUx/dx, dUy/dx, dUz/dx) perpendicular to the boundary. The code in CS shows as follows,

However, the code can run but I found the flow field does not change after a lots time step, and all velocities are zero. Do you know how to deal with the problem?
Attachment: the configure file in Code_Saturne.

Much appreciated!
Yang

Code: Select all

``````// Implement Dirichlet BC
icodcl[(ivarv + ic) * n_b_faces + face_id] = 1;
rcodcl[(ivarv + ic) * n_b_faces + face_id] = v_luma[3 * i + ic];
// here, v_luma[] is the velocity component in there direction at a coupling point.

// Implement Neumann BC
icodcl[(ivarv + ic) * n_b_faces + face_id] = 3;
rcodcl[(ivarv + ic) * n_b_faces + face_id] = v_luma[3 * i + ic];
//here, I send velocity gradient  (dUx/dx, dUy/dx, dUz/dx) using  v_luma[].``````
Attachments
setup.xml
(7.64 KiB) Downloaded 289 times
Yvan Fournier
Posts: 4107
Joined: Mon Feb 20, 2012 3:25 pm

### Re: Code_Saturne Neumann boundary condition implement for coupling case

Hello,

This post should be in the "code_saturne usage" section, not in the "discussion" section, so I may move it in the coming days.

for Neuman BC's you also need to use another part of rcodcl, which consists of 3 non-interleaved (Fortran style) arrays.

Instead of setting:

Code: Select all

``rcodcl[(ivarv + ic) * n_b_faces + face_id]``
You must set

Code: Select all

``rcodcl[2*n_b_faces*nvar + (ivarv + ic)*n_b_faces + face_id]``
I also recommend first testing with fixed values, rather than a gradient (to check that it works as expected).

Regards,

Yvan