Hi everybody,
my problem is dealing with setting a non standard boundary condition. For this I use the keyword IINDEF in subroutine usclim.f90. I would like to specify a pressure boundary condition at the outlet as well as a pressure boundary condition for the incoming flow. For the outlet it seem that I could managed the problem quite well, but I am not able to do this for the inlet. I believe that I have to indicate the direction of the velocity vector but the arrays ICODCL and RCODCL do not allow to set a direction for the velocity. How can I solve the problem?
Thomas
Hi Thomas,
What you should do instead of setting up full new boundary conditions (with the IINDEF keyword) is to reuse existing ones and modify some parameters. The herebelow approach should give you what you want.
Tell me if it fulfills your needs.
Regards,
David
For the inlet:
ITYPFB(IFAC,IPHAS)=IENTRE
ICODCL(IFAC,IPR(IPHAS))=1 ! This tells the code you want a Dirichlet boundary condition for the Pressure
RCDOCL(IFAC,IPR(IPHAS),1)=Pinlet ! This is the Pressure Dirichlet value
ICODCL(IFAC,IU(IPHAS))=3 ! This tells the code you want a Neumann boundary condition for the Velocity (default value is zero)
ICODCL(IFAC,IV(IPHAS))=3
ICODCL(IFAC,IW(IPHAS))=3
For the outlet:
ITYPFB(IFAC,IPHAS)=ISOLIB
ICODCL(IFAC,IPR(IPHAS))=1 ! This tells the code that you want a Dirichlet condition for the Pressure
RCODCL(IFAC,IPR(IPHAS),1)=Poutlet ! This is the Pressure Dirichlet value
To precise what I wrote: when you specify a value for the Pressure as a boundary condition, Velocity boundary conditions should be homegeneous Neumann. You don’t need to specify the velocity direction for example.
Hi David,
it seems to work!!! Thanks a lot for your fast and helpful response.
Regards,
Thomas
Hi David,
unfortunately I was a little bit to hasty with my conclusions. The settings do not work as I wanted. I don’t know why there is no need to define a velocity direction in this case.
Thomas
Hi Thomas,
if you specify the pressure on both sides, you need to let the velocity adapt itself alone. The mass flow rate will be determined by the competition between the pressure gradient and the friction at the wall. The direction of the velocity will be determined by the physical competition between pressure gradient, inertia effects (convection) and diffusion effects. If you want to specify the pressure distribution at the boundaries AND the velocity direction, your system will be over-specified and not correct.
What do you mean by "The settings do not work as I wanted
" ? Do you get a crash or wrong results ? Maybe you can send us you listing, f90 and Xml files so we can see further into it.
–Marc–
Hi Marc,
sorry for my late response. I still have problems to make a proper setup with pressure boundary conditions. The computation crashes after a few iterations due to " INCORRECT OR INCOMPLETE BOUNDARY CONDITIONS". Thats why I would like to send you my listing,the fortran as well as the XML file(s) of my case.
usclim.f90 (37.1 KB)
… here are more attachements…
listing-11100948.txt (81.8 KB)
Hi Thomas,
we’ve checked your usclim.f90 file and nothing seems wrong in it. We need to ckeck deeper and see why this error test is activated when it should not. Would it be possible for you to send us your full case (all f90 routines + runcase script + mesh) ? You can use the support address directly (saturne-support@edf.fr).
Best regards
Hi Marc, hi David,
I still have a question to pressure bc in CS. If I use the incompressible solver does the “total pressure” represents a static pressure (hydrostatic pressure)? I 'd like to get an information about the dynamic pressure. Do I have to add the term 1/2rhovelocity**2 to the total pressure. I’d like to get an idea about pressure drop due to the motion of the fluid.
Best regards
Thomas
Indeed!
The “total pressure” is defined in Code_Saturne as being: Ptot = Pred + rho0g(z-z0) + P0, where Pred is the so-called reduced pressure (i.e. the resolved pressure). If you want the dynamic pressure, you’ll need to add 0.5rhoU**2. You can do that by adding the usvpst.f90 subroutine in which you can defined your own variables, on a given mesh (ipart = -1 for the volumic mesh).
David
ps: In the formula for the total pressure, I’ve intentionnally forgotten the reference of the reduced pressure Pred0.
Hi everybody,
I have the same issue as Thomas’s. I started a simulation with a velocity inlet, and now, I want a pressure inlet. So I changed the usclim.f90 file, and now it seems Code_Saturne only takes into account the velocity inlet I set for the first time.
Here is my code:
iphas=1
call getfbr('inlet', nlelt, lstelt)
do ilelt = 1, nlelt
ifac = lstelt(ilelt)
iel = ifabor(ifac)
itypfb(ifac,iphas) = ientre
icodcl(ifac,ipr(iphas))=1.d0
rcdocl(ifac,ipr(iphas),1)=380.d0
icodcl(ifac,iu(iphas)) = 3.d0
icodcl(ifac,iv(iphas)) = 3.d0
icodcl(ifac,iw(iphas)) = 3.d0
enddo
I really don’t know what I am doing wrong, so if you have any idea…
Best regards
Stéphane
For sanity check, Stephane’s question has been answered in a different thread (see https://code-saturne.info/products/code-saturne/forums/general-usage/817624553 )
![]()