Page 1 of 1

Pressure inlet condition by Subroutine

Posted: Mon Jan 18, 2021 10:49 pm
by Tsubasa
Hello,
Could you help me to solve this problem below?


Now I am trying pressure-driven flow for 2-dimentional room, as can be seen in here:
room.png
Other boundary is set as wall coniditon, and symmetry condition is used for z-direction boundary as following:
boundary_GUI.png

Becasue pressure inlet condition cannot be set by GUI, I used user-subroutine as following:

Code: Select all

call getfbr('inlet_extruded', 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

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


call getfbr('outlet_extruded', 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.0

!Dirichlet B.C for pressure:
   icodcl(ifac,iu)= 3
   icodcl(ifac,iv)= 3
   icodcl(ifac,iw)= 3

enddo
Pressure difference is 0.633 Pa (101325.633 Pa-101325.0 Pa), and this can be found in the first picture above.
However, this simulation became divergent eventually like this:
divergent.png
Even this picture, Dirichlet pressure values, which is set by subroutine, are imposed correctly.



Followings are other computional setting.
-As a turbulence model, I used k-omega SST.
-Time step and mesh size are enough for stable computation.
-k and omega are set by GUI.

Could anyone give me tips for this divergent problem?
Is my subroutine code correct? (In the subroutine code, I want to impose Dirichlet condition for pressure and Neumann condition for velocity at both inlet and outlet.)

As far as I understand, if I impose pressure inlet for imcompressible flow, a velocity at inlet can be calculated by Bernoulli's principle. For example, a velocity at inlet can be calculated by both using P at inlet and P0 at outlet by Bernoulli's equation. Then, this velocity is imposed at inlet as "like velociry inlet".
Therefore, I think, even though pressure inlet condition is used, this condition is actually same to imposing velocity inlet.
This theory is clearly explained by this:https://www.youtube.com/watch?v=Er2j5Kq17as

I tried many many times by changing some condtions e.g. delta time step, mesh size and other boundary condition.
If I put velocity inlet condition, simulation can be done well.
In addition, for simple 2-dimentional channel flow without turbulence model, I succeeded pressure driven flow by above subroutine code, in which divergence did not occur.

Could someone help me or sugget tips and check wether my subroutine is correct or not?

Sincerely,
Tsubasa

Re: Pressure inlet condition by Subroutine

Posted: Tue Jan 19, 2021 11:01 pm
by Yvan Fournier
Hello,

Do you have a small mesh with this case ? If so, could you post it with the case setup here so that I can experiment with it ?

Regards,

Yvan

Re: Pressure inlet condition by Subroutine

Posted: Wed Jan 20, 2021 4:28 pm
by Tsubasa
Hello Yvan,

Thank you for your help.

Can you download this?
experiment.zip
(3.56 MiB) Downloaded 435 times
Sincerely,
Tsubasa

Re: Pressure inlet condition by Subroutine

Posted: Thu Jan 21, 2021 8:16 pm
by Yvan Fournier
Hello,

I'll test this in the next few days.

Best regards,

Yvan

Re: Pressure inlet condition by Subroutine

Posted: Wed Jan 27, 2021 4:07 pm
by Tsubasa
Hello Yvan,

Thank you for your help.

As you said, simulation did not become divergence if I used "Time varying(adaptive)" of time setting.
However looking at the result, flow is reversed (from outlet to inlet.)
Could you check whether reverse flow happened or not.

Or could you post the setup case without result (RESU), which was done by varying time step?

Best regards.
Hamada