Divergence with free inlet/outlet boundary conditions

Questions and remarks about code_saturne usage
Forum rules
Please read the forum usage recommendations before posting.
Post Reply
alvaro1553

Divergence with free inlet/outlet boundary conditions

Post by alvaro1553 »

Hi everyone,

I am doing a simulation about a flue gases duct in which two fans are taking flow from a common header. It occurred to me that this could be simulated on code-saturne by identifying both fans as two negative inlets (using user subroutines) where the boundary conditions are established.

The geometry selected to perform the simulation consists of a pipeline that is composed by two outlets (defined as two negative inlets on code-saturne) and one upper inlet (defines as a free inlet/outlet on code-saturne), as shown in the following picture.

Image

As regard to the boundary conditions, they have been defined by means of an user function as follows:

Code: Select all


subroutine cs_user_boundary_conditions &
 ( nvar   , nscal  ,                                              &
   icodcl , itrifb , itypfb , izfppp ,                            &
   dt     ,                                                       &
   rcodcl )
use paramx
use numvar
use optcal
use cstphy
use cstnum
use entsor
use parall
use period
use ihmpre
use ppppar
use ppthch
use coincl
use cpincl
use ppincl
use ppcpfu
use atincl
use atsoil
use ctincl
use elincl
use cs_fuel_incl
use mesh
use field
use turbomachinery
use iso_c_binding
use cs_c_bindings

implicit none

integer          nvar   , nscal
integer          icodcl(nfabor,nvarcl)
integer          itrifb(nfabor), itypfb(nfabor)
integer          izfppp(nfabor)

double precision dt(ncelet)
double precision rcodcl(nfabor,nvarcl,3)

integer          ifac, iel, ii, ivar
integer          izone
integer          ilelt, nlelt
double precision uref2, d2s3
double precision rhomoy, xdh, xustar2
double precision xitur
double precision xkent, xeent

integer, allocatable, dimension(:) :: lstelt
double precision, dimension(:), pointer :: bfpro_rom

allocate(lstelt(nfabor)) 

call field_get_val_s(ibrom, bfpro_rom)

!--------------------------------------------------------------------------------------------------------

call getfbr('CC_IN1', nlelt, lstelt)

do ilelt=1, nlelt	
	
	ifac=lstelt(ilelt) 
	
	itypfb(ifac)=ientre
	
	rcodcl(ifac,ipr,3)=0.0d0
	
	rcodcl(ifac,iu,1)= -8.97d0
	rcodcl(ifac,iv,1)= 0.0d0
	rcodcl(ifac,iw,1)= 0.0d0

	uref2 = rcodcl(ifac,iu,1)**2 + rcodcl(ifac,iv,1)**2 + rcodcl(ifac,iw,1)**2
	uref2 = max(uref2,1.d-12)
	xdh = 0.9d0
	rhomoy  = bfpro_rom(ifac)
	
	call keendb( uref2, xdh, rhomoy, viscl0, cmu, xkappa, xustar2, xkent, xeent )
	
	rcodcl(ifac,ik,1)  = xkent
        rcodcl(ifac,iep,1) = xeent
    
enddo

!------------------------------------------------------------------------------------------------------

call getfbr('CC_IN2', nlelt, lstelt)

do ilelt=1, nlelt		
	
	ifac=lstelt(ilelt) 
	
	itypfb(ifac)=ientre
	
	rcodcl(ifac,ipr,3)=0.0d0
	
	rcodcl(ifac,iu,1)= 0.0d0
	rcodcl(ifac,iv,1)= 9.54d0
	rcodcl(ifac,iw,1)= 0.0d0

        uref2 = rcodcl(ifac,iu,1)**2 + rcodcl(ifac,iv,1)**2 + rcodcl(ifac,iw,1)**2
	uref2 = max(uref2,1.d-12)
	xdh = 0.9d0
	rhomoy  = bfpro_rom(ifac)
	
	call keendb( uref2, xdh, rhomoy, viscl0, cmu, xkappa, xustar2, xkent, xeent )
	
	rcodcl(ifac,ik,1)  = xkent
        rcodcl(ifac,iep,1) = xeent
 enddo

!---------------------------------------------------------------------------------------------------------

call getfbr('CC_FREEIN',nlelt,lstelt)

do ilelt=1,nlelt
ifac=lstelt(ilelt)
itypfb(ifac)=ifrent
enddo

deallocate(lstelt)  ! temporary array for boundary faces selection

return
end subroutine cs_user_boundary_conditions
The problem lies on the results. It can be observed the velocity field going to infinite as the simulation goes forward, which make the solution diverge after a large number of iterations. Results on the video attached.

Image

The simulation parameters are represented on the attached xml.

Greetings and thanks in advance.
Attachments
Intento_PLF.XML
XML
(6.32 KiB) Downloaded 208 times
Last edited by alvaro1553 on Mon Apr 25, 2016 11:04 am, edited 1 time in total.
Yvan Fournier
Posts: 4080
Joined: Mon Feb 20, 2012 3:25 pm

Re: Divergence with free inlet/outlet boundary conditions

Post by Yvan Fournier »

Hello,

Could you post the code in a more readable manner (using the "code" option from this forum's editor, for example), with correct indentation ? It is quite hard to read otherwise.

How "fast" does the code diverge ? Using free inlet/outlets, assigning a "head loss" to those boundary conditions may be required, especially in the case of multiple free inlet/outlets (I'll check).

Regards,

Yvan
alvaro1553

Re: Divergence with free inlet/outlet boundary conditions

Post by alvaro1553 »

Hello,

I already edited the post in a more readable manner. Don't hesitate to tell me if you still have any problem with the indentation.

The code starts diverging on the very few iterations, the velocity field goes to infinite progressively.

I tried to find an example of boundary conditions user's function in which the "head loss" is defined. However, I wasn't able to find a suitable example with the head loss predefined.
I also tried to define the head loss in the cs_user_boundary_conditions.f90 by means of "ivar" in the following manner: rcodcl(ifac,ipr,3)=0.0d0 , defining value for the pressure on the inlet and outlet faces, but it stills does not give any result.
On the other hand, it is possible to define a head loss on the GUI , in the free inlet/outlet definition and I would like to know what "ivar" is associated to this "head loss" to define it manually on the user function.

I am looking forward for your answer.

Thank you very much
lorenzo.iron
Posts: 18
Joined: Tue May 11, 2021 1:22 pm

Re: Divergence with free inlet/outlet boundary conditions

Post by lorenzo.iron »

Hello,
I found this post and it contains an issue similar to the one I'm currently facing: when I set a free inlet/outlet boundary condition the simulation diverges.

I've a sort of jet pump (see example picture), with a water inlet (1), a water outlet (4) and a suction (2).


If I set the suction (2) boundary condition as free inlet/outlet (because the flow can change direction based on the inlet/outlet pressure conditions) the simulation diverges, whereas if I set is as an outlet condition the simulation converges.

When i run the same simulation 1 year ago with a previous version of Code_Saturne there was no issue.

Is there any CS setting I can try to overcome this problem?

Thank you!
Attachments
Capture.PNG
Yvan Fournier
Posts: 4080
Joined: Mon Feb 20, 2012 3:25 pm

Re: Divergence with free inlet/outlet boundary conditions

Post by Yvan Fournier »

Hello,

Not sure about any relevant settings.
With which version do you have the issue, and which version was ok ?

Is the case small enough to be shared ?

Best regards,

Yvan
Post Reply