Inlet pressure boundary condition

Questions and remarks about code_saturne usage
Forum rules
Please read the forum usage recommendations before posting.
Post Reply
lorenzo.iron
Posts: 18
Joined: Tue May 11, 2021 1:22 pm

Inlet pressure boundary condition

Post by lorenzo.iron »

Good morning,

I'd like to impose an inlet pressure instead of an inlet flow. I understand that it is required to use a subroutine but I don't know how to do it. So far I just learned to use the GUI.

Even though the analisys could be less stable, it would suite directly my problem and experimental conditions.

Of course, I'll impose also an outlet pressure, easily using the GUI as already implemented.

Can you guide me in arranging this inlet pressure boundary condition subroutine?

Thank you.
Lorenzo
Yvan Fournier
Posts: 4070
Joined: Mon Feb 20, 2012 3:25 pm

Re: Inlet pressure boundary condition

Post by Yvan Fournier »

Hello,

Did you use the search feature on this form ? If I remember correctly, there is a relatively recent (no more than 2 years) example for this, which you can try to follow (as a general recommendation, avoid examples that are very old, but search for relatively recent examples of similar threads).

Best regards.
Tsubasa
Posts: 175
Joined: Fri Nov 20, 2020 4:09 am

Re: Inlet pressure boundary condition

Post by Tsubasa »

Hello,

You should add the following code in "cs_user_boundary_condition.f90" for pressure inlet boundary condition.
This code also include pressure boundaty condition for outlet just in case, but you can do it in GUI as you said.

Code: Select all

!===============================================================================
! Assign boundary conditions to boundary faces here

! For each subset:
! - use selection criteria to filter boundary faces of a given subset
! - loop on faces from a subset
!   - set the boundary condition for each face
!===============================================================================
call getfbr('inlet', nlelt, lstelt)
do ilelt = 1, nlelt
   ifac = lstelt(ilelt)
   itypfb(ifac) = ientre

!Dirichlet B.C for pressure:
   icodcl(ifac,ipr) = 1
   rcodcl(ifac,ipr,1) = 101325.633 //pressure value you want

!Neumann B.C for velocity:
   icodcl(ifac,iu)= 3
   icodcl(ifac,iv)= 3
   icodcl(ifac,iw)= 3
enddo


call getfbr('outlet', nlelt, lstelt)
do ilelt = 1, nlelt
   ifac = lstelt(ilelt)
   itypfb(ifac) = isolib

!Dirichlet B.C for pressure:
   icodcl(ifac,ipr) = 1
   rcodcl(ifac,ipr,1) = 101325.000 //pressure value you want

!Neumann B.C for velocity:
   icodcl(ifac,iu)= 3
   icodcl(ifac,iv)= 3
   icodcl(ifac,iw)= 3
enddo

!--------
! Formats
!--------
If your inlet boundary has another name insted of "inlet", which can be set in e.g. Salome when you make a geometry, you should change "inlet" in the code.

Best regards,
Tsubasa
Post Reply