How to define the inlet turbulence quantities by subroutine?

Questions and remarks about code_saturne usage
Forum rules
Please read the forum usage recommendations before posting.
Post Reply
Jundi He
Posts: 106
Joined: Fri Jan 13, 2017 3:23 pm

How to define the inlet turbulence quantities by subroutine?

Post by Jundi He »

Hi Code Saturne develop team:

I have a simulation of a simple channel flow, in the simulation, I need to copy the outlet informations (velocity field, temperature field, turbulence quantity fields) to define the inlet condition. Firstly, I should know how to define the inlet boundary conditions by the subroutine, from an example in Doxygen, I know how to define the inlet velocity field:

call getfbr('inlet', nlfac, lstfac)

do ilelt = 1, nlfac
ifac = lstfac(ilelt)
iel = ifabor(ifac)
itypfb(ifac) = ientre
rcodcl(ifac,iu,1) = 1
rcodcl(ifac,iv,1) = 0.d0
rcodcl(ifac,iw,1) = 0.d0

In the above subroutine, I've define the inlet velocity component in 3 directions, and how should I define the turbulence quantities? (I am using k-omega turbulence model) Then how should I define the temperature field of the inlet face? Thanks.

Regards!
Jundi
Yvan Fournier
Posts: 4081
Joined: Mon Feb 20, 2012 3:25 pm

Re: How to define the inlet turbulence quantities by subrout

Post by Yvan Fournier »

Hello,

You can reinject outlet (or interior) conditions at the inlet, using the "mapped inlet" option, which is available directly in the GUI (and also described in the Doxygen examples).

Best regards,

Yvan
Jundi He
Posts: 106
Joined: Fri Jan 13, 2017 3:23 pm

Re: How to define the inlet turbulence quantities by subrout

Post by Jundi He »

Hi Yvan:

No, I will copy the outlet velocity field, turbulence quantity fields, but for the temperature field, I need to do some calculation then impose the result at the inlet, so better to use the subroutine, first to read the outlet surface information, then impose them to the inlet surface. Do you know how to define the inlet turbulence quantities in the subroutine? Thanks!

Regards!
Jundi
Yvan Fournier
Posts: 4081
Joined: Mon Feb 20, 2012 3:25 pm

Re: How to define the inlet turbulence quantities by subrout

Post by Yvan Fournier »

Hello,

You can still use the mapped inlet example here https://www.code-saturne.org/doxygen/sr ... apped.html, using the mapping for velocity and turbulence, and adding your modifications to temperature (note the loop on fields when applying the mapping; you can do something different/extra for temperature if needed).

Regards,

Yvan
Jundi He
Posts: 106
Joined: Fri Jan 13, 2017 3:23 pm

Re: How to define the inlet turbulence quantities by subrout

Post by Jundi He »

Hi,

I've use the mapped inlet subroutine to carried out a test channel flow, with the inlet from the top surface and the outlet at the bottom surface, constant wall heat flux was impose at the wall. For the velocity and the turbulence quantities, I directly copy the field form the outlet surface and impose them to the inlet surface. For the temperature, I first calculate the outlet bulk temperature then remove the increase of the bulk temperature, then impose them at the inlet surface. The problem is, when I carried out the simulation, the axial velocity keep increasing, which is not physical. This is my mapped inlet subroutine, do you know what is the problem? Thanks!

Regards!
Jundi
Attachments
cs_user_boundary_conditions-mapped_inlet.f90
(8.54 KiB) Downloaded 207 times
Yvan Fournier
Posts: 4081
Joined: Mon Feb 20, 2012 3:25 pm

Re: How to define the inlet turbulence quantities by subrout

Post by Yvan Fournier »

Hello,

You did not set the value of the "normalize" argument, which ensures the mean values remains the one initially prescribed. In general, I recommend setting "normalize" to 1 for all arguments except turbulence variables (for which forcing the mean value would defeat the purpose of the mapped inet), or those with special treatment.

Actually, in you case for temperature, if you set "normalize" to 1, is is equivalent to removing the bulk temperature increase (by using a multiplier rather than by subtracting a value).

Best regards,

Yvan
Jundi He
Posts: 106
Joined: Fri Jan 13, 2017 3:23 pm

Re: How to define the inlet turbulence quantities by subrout

Post by Jundi He »

Hi Yvan:

This is my mapped inlet subroutine. For the turbulence quantities (I am using k-omega model), I set the normalize = 0, for other fields, I set the normalize = 1, to ensure the same mean value at the inlet and outlet. For temperature, I set normalize = 0, then subtract the increase of bulk temperature. Am I doing it correctly in this subroutine?

I've tried to set the normalize of temperature to 1, and that caused the simulation keep oscillating instead of converge.

Regards!
Jundi
Attachments
cs_user_boundary_conditions-mapped_inlet.f90
(8.77 KiB) Downloaded 193 times
Post Reply