Page 1 of 3
Dirichlet boudary condition for inlet and outlet
Posted: Mon Nov 30, 2020 2:33 pm
by Tsubasa
Hello,
Now I am looking for how to set Dirichlet boudary condition for inlet and outlet pressure. I mean I want to define the profile of pressure at in/outlet.
However, looking at the user's guide, I am not sure how to set it.
As far as I understand, is it impossible to set it in GUI? Should I edit script?
Could someone teach me how to set it or give me examples?
Re: Dirichlet boudary condition for inlet and outlet
Posted: Mon Nov 30, 2020 6:40 pm
by Yvan Fournier
Hello,
The documentation in the user's guide is a reference, but not easy without examples. You should check the Doxygen documentation instead (where the user's guide is being progressively migrated) for example
http://code-saturne.org/cms/sites/defau ... index.html for version 6.2, which contains examples of user-defined functions which should be more useful.
If you want de define a profile which can be described by an equation (rather than data points), you can do it in the GUI, at least for the velocity (select "user law" in the options).
Best regards,
Yvan
Re: Dirichlet boudary condition for inlet and outlet
Posted: Mon Nov 30, 2020 7:08 pm
by Tsubasa
OK, I will check it.
At the moment, I want to set the profile based on data set, not equations.
I hope I can find solution for this. Thank you.
Re: Dirichlet boudary condition for inlet and outlet
Posted: Tue Dec 01, 2020 3:11 pm
by Tsubasa
Hello Yvan,
Thank you for your answer.
As you said, I took a look at the Doxygen documentation, and it is useful for me to get tips.
However, because I'm not a technical person, I've been unclear for how to carry out simulation with additional setting.
As far as I understand, I have to copy the DATA/REFERENCE/cs_user_scripts.py file to DATA and edit it. Do I Just do it, right?
Now, I hope I can set pressure profile (which is not described by equation). For example, at inlet and outlet condition, can I give specific pressure values from data set, which includes positions(which pressure values are given to) and pressure values related to positions.
However, I'm not sure which page I should read to know hot to set it.
I would appreciate if you could give me tips and examples I can use as a reference.
Best regards,
Tsubasa
Re: Dirichlet boudary condition for inlet and outlet
Posted: Tue Dec 01, 2020 3:42 pm
by Yvan Fournier
Hello,
If you need to modify settings in cs_user_scripts.py, you can place it in DATA, but in most cases, having the XML file (generated by the GUI) in DATA is enough.
In a similar manner, if you need settings in user sources (C or Fortran), you must copy the files to activate from SRC/REFERENCE to SRC, and adapt it based on the examples.
Best regards,
Yvan
Re: Dirichlet boudary condition for inlet and outlet
Posted: Tue Dec 01, 2020 4:15 pm
by Tsubasa
Hello,
Thank you very much.
Anyway, I will take a look all examples I can refer.
Below, if I misunderstood something, I am grateful if someone correct it.
As far as I understand, I don't have to worry about cs_user_scripts.py file because XML generated by the GUI is already enough.
For the boundary condition I've intented, I have to copy the files from SRC/REFERENCE to SRC, and I have to edit it by referencing files in SRC/EXAMPLES.
Thank you.
Tsubasa
Re: Dirichlet boudary condition for inlet and outlet
Posted: Thu Dec 03, 2020 10:52 am
by Mohammad
Hello,
Yes that's right you just need to add
cs_user_boundary_conditions.f90 or
cs_user_boundary_conditions.c to
SRC folder.
For Dirichlet B.C. you need something like this (in Fortran):
Code: Select all
call getfbr('BOUNDARY_NAME', nlelt, lstelt)
do ilelt = 1, nlelt
ifac = lstelt(ilelt)
itypfb(ifac) = 77! Custom number (better to be a big number should not be equal to another boundary)
!Dirichlet B.C for velocity:
icodcl(ifac,iu) = 1 ! 1 means Dirichlet
rcodcl(ifac,iu,1) = 20 !ux
icodcl(ifac,iv) = 1
rcodcl(ifac,iv,1) = 30 !uy
icodcl(ifac,iw) = 1
rcodcl(ifac,iw,1) = 50 !uz
!Dirichlet B.C for pressure:
icodcl(ifac,ipr) = 1
rcodcl(ifac,ipr,1) = 110000 !pressure value
enddo
Just replace
BOUNDARY_NAME with your boundary name which specified while creating mesh and change the values of
rcodcl(ifac,X,1) with your desired Dirichlet values.
itypfb(ifac) is the ID of the boundary which must be unique an not equal to a previous boundary.
Regards,
Mohammad
Re: Dirichlet boudary condition for inlet and outlet
Posted: Wed Dec 09, 2020 6:16 pm
by Tsubasa
Hello Mohammad,
Thank you for your help.
I will give it a try.
Thank you,
Tsubasa
Re: Dirichlet boudary condition for inlet and outlet
Posted: Mon Jan 04, 2021 7:46 am
by Tsubasa
Hello,
Now, I am trying pressure-driven flow for pipe as can be seen in
As inlet and outlet conditions, I want to impose pressure value only.
For other parameters such as velocity and kinematic energy, I want to put them as a Zero value, becasue I want to check pure pressure-driven flow. (I will not use turbulence model, but laminar flow instead.)
For example, 100050Pa on inlet and 100010Pa on outlet are what I intend now.
If in that case, as far as I understand from Mohammad's post,
should I impose below condition for inlet Dirichlet condition?
Code: Select all
call getfbr('Inlet', nlelt, lstelt)
do ilelt = 1, nlelt
ifac = lstelt(ilelt)
itypfb(ifac) = 77! Custom number (better to be a big number should not be equal to another boundary)
!Dirichlet B.C for velocity:
icodcl(ifac,iu) = 1 ! 1 means Dirichlet
rcodcl(ifac,iu,1) = 0 !ux
icodcl(ifac,iv) = 1
rcodcl(ifac,iv,1) = 0 !uy
icodcl(ifac,iw) = 1
rcodcl(ifac,iw,1) = 0 !uz
!Dirichlet B.C for pressure:
icodcl(ifac,ipr) = 1
rcodcl(ifac,ipr,1) = 100050 !pressure value
enddo
For outlet condition, how should I add to above code? Should I just copy again above like this?
Code: Select all
do ilelt = 1, nlelt
ifac = lstelt(ilelt)
itypfb(ifac) = 77! Custom number (better to be a big number should not be equal to another boundary)
!Dirichlet B.C for velocity:
icodcl(ifac,iu) = 1 ! 1 means Dirichlet
rcodcl(ifac,iu,1) = 0 !ux
icodcl(ifac,iv) = 1
rcodcl(ifac,iv,1) = 0 !uy
icodcl(ifac,iw) = 1
rcodcl(ifac,iw,1) = 0 !uz
!Dirichlet B.C for pressure:
icodcl(ifac,ipr) = 1
rcodcl(ifac,ipr,1) = 100050 !pressure value
enddo
do ilelt = 2, nlelt
ifac = lstelt(ilelt)
itypfb(ifac) = 77! Custom number (better to be a big number should not be equal to another boundary)
!Dirichlet B.C for velocity:
icodcl(ifac,iu) = 1 ! 1 means Dirichlet
rcodcl(ifac,iu,1) = 0 !ux
icodcl(ifac,iv) = 1
rcodcl(ifac,iv,1) = 0 !uy
icodcl(ifac,iw) = 1
rcodcl(ifac,iw,1) = 0 !uz
!Dirichlet B.C for pressure:
icodcl(ifac,ipr) = 1
rcodcl(ifac,ipr,1) = 100010 !pressure value
enddo
Would someone help me?
Best regards,
Tsubasa
Re: Dirichlet boudary condition for inlet and outlet
Posted: Mon Jan 04, 2021 4:00 pm
by Yvan Fournier
Hello,
You can try, but if you impose a Dirichlet for pressure, you should remove the one for Velocity (if you define no BC, it should default to homogeneous Neumann I beleive).
Regards,
Yvan