CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   OpenFOAM Running, Solving & CFD (http://www.cfd-online.com/Forums/openfoam-solving/)
-   -   Injection of a fluid into a cavity (http://www.cfd-online.com/Forums/openfoam-solving/59016-injection-fluid-into-cavity.html)

francesco_b January 17, 2008 05:07

Hi all, I would like to us
 
Hi all,

I would like to use OF to simulate the injection of a fluid into a cavity. I tried to use interFoam but I got some issues about BC, I've read some threads about this but still I don't understand how to write the correct BC and initial values. My geometry is like the one in the cavity tutorial, but i have 3 walls, 2 empty and 1 inlet. Am I missing something? I tried also to put an outlet but still nothing happened, the fluid doesn't move.

I don't know how to upload files, if you tell me I can put my test_case here.

Thanks in advance

Francesco

francesco_b January 18, 2008 12:53

I have put a outlet, and now I
 
I have put a outlet, and now I'm able to see the fluid filling my domain, but I still got problems when the fluid reach this boundary, how can I solve it?

Someone could give me a hint?

Thanks in advance

Francesco

danvica January 18, 2008 13:21

I'm trying to use interfoam to
 
I'm trying to use interfoam too.

Maybe we can help each other. At the moment I've stability problems just with some geometries/meshes.

Which kind of problem (stability, gamma/pd/U values, ...) ?

francesco_b January 21, 2008 05:35

Hi Daniele, my problem is p
 
Hi Daniele,

my problem is probably the solver. I would like to simulate the injection of a fluid into a cavity with OF, I tought that interFoam could be a good choice for the possibility of interface tracking. Probably it is not a good choice; the other softwares I have seen use this strategy: they consider the cavity empty and pressure = 0, then they fill it with the fluid, which has a positive pressure, computing the movement of the interface.

My problem with interFoam are due to the outlet, I would like to have a close cavity. InterFoam is an incompressible solver, so it needs an outlet for the air which is in the cavity. Maybe it would be better to use a compressible solver, what do you think? Can rhopSonicFoam treat a problem like this one? Have you found a way to overcome the problem of the outlet?

danvica January 21, 2008 07:21

Interfoam solvers (RAS and LES
 
Interfoam solvers (RAS and LES) involve two incompressible fluids. Basically what is entering in the computational domain has to go out somewhere. As far as I understand pressure=0 in operfoam doesn't mean "empty". Pressure is just an offset value. What really means is pressure difference between different points.

Changing to compressible doesn't help too much. You don't want to compress something. Just fill in the empty space.

I don't know rhopSonicFoam. I just remember an older thread in which Mr.Jasak (if i remember right) said that at that moment there were no solver for the fluid/empty case.

I'll try to search that thread. In the meanwhile i'll be happy if someone more involved in OF would confirm/refuse my opinion.

danvica January 21, 2008 07:26

I forget to ask you which is e
 
I forget to ask you which is exacly your case.

In all the real cases I'm aware of there's always an outlet path for the fluid. "Empty" is not a common situation, I believe.

francesco_b January 21, 2008 09:17

Hi Daniele, what I've told
 
Hi Daniele,

what I've told you is the behavior of a normal software for simulating molding, like Flow3D. I know that in a real case there are always outlets for the air, but for my purpose I don't want neither need to know where they are.
If there are no solver at the moment for doing this, how do you solve this problem with interFoam? I'm curious about this since my results are not good.

Best Rigards

Francesco

danvica January 21, 2008 11:47

Thanks for the explanation.
 
Thanks for the explanation.

Personally I'm using rasinterfoam to study the flow of water into kitchen/bathroom faucets. So in my cases I'm force to have an outlet.

The only big problem I have is concerning the best schema/solution setup in order to avoid instability during all the simulation.

Regarding your case what I would try is:

1. Add an outlet in a non critical area. That's not easy because it has to be big enought to let the secondary fluid go out without interferring with the main fluid.

2. Use icoFoam or turbFoam. This are solvers for incompressible single-fluid. You can't add gravity force, that however you don't need i think.
I never tried them without an outlet, but if you use a pressure based inlet maybe it can work.

francesco_b January 21, 2008 12:49

Hi Daniele, I've tried the
 
Hi Daniele,

I've tried the first solution but it is not that simple, even in a simple case the result is not good, the fluid tends to exit through the outlet.

For the second suggestion, the problem is that the domain of the fluid is a part of the calculus domain and I don't know how to use single-fluid solver for this computation, especially for the calculation of the interface, which is the aim of my simulation.

I think there are 2 ways to solve my problem:

1) Use a 2-phase solver (filling fluid and gas), compressible so that I could compress the low-density gas which is in the cavity at the beginning of the simulation, till my fluid fills the whole cavity.

2) maybe easier to compute: For each step accordingly to the previous geometry of the interface and the cavity, find the newer interface, than calculate the flux of the flow in the subdomain and go on till the cavity is filled.

I couldn't imagine how to do this in practical, is there anybody who could help me giving me any advice about my two ways to solve the problem?

Thanks in advance

Francesco

pad January 22, 2008 04:47

Hello all, Just a thought -
 
Hello all,

Just a thought - don't know if it is even possible since I have not worked with OpenFoam yet (very interested in the possibilities of OF though).

What if you treat all boundaries as outlets and once the fluid reaches the boundary (or the vicinity of it) you switch it to a wall boundary?

Regards,
Per

francesco_b January 22, 2008 05:54

Hi Per, Thanks for your sug
 
Hi Per,

Thanks for your suggestion, It could be a nice idea, I could test it, but this is not what I want.

I've thought about realizing the first way, I'm trying to use cavitatingFoam in order to have a 2 phase compressible solver. Is there someone who could tell me if I'm in the right or wrong way?

Thanks in advance

Francesco

francesco_b January 22, 2008 06:55

Hi all, I've tried to use
 
Hi all,

I've tried to use cavitatingFoam, but I received neither an error message nor the computation of the simulation:

/*---------------------------------------------------------------------------*\
| ========= | |
| \ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \ / O peration | Version: 1.4.1 |
| \ / A nd | Web: http://www.openfoam.org |
| \/ M anipulation | |
\*---------------------------------------------------------------------------*/

Exec : cavitatingFoam . injection2
Date : Jan 22 2008
Time : 11:50:11
Host : biprox
PID : 11582
Root : /home/area3/OpenFOAM/area3-1.4.1/run/tutorials/cavitatingFoam
Case : injection2
Nprocs : 1
Create time

Create mesh for time = 0

Reading thermodynamicProperties

Reading transportProperties

Reading field p

Creating compressibilityModel

Selecting compressibility model linear
Reading field U

Reading/calculating face flux field phiv

Reading/calculating face flux field phi

phiv Courant Number mean: 1.71053e-06 max: 0.00104 acoustic max: 1.50804

Starting time loop


end


What's wrong? Please give me a hint or an advice to solve this situation

Thanks in advance

Francesco

francesco_b January 31, 2008 06:45

Hi All, after many try I th
 
Hi All,

after many try I think that interFoam can be a good choice, but I have to implement the boundary condition that Per suggested, i.e. boundaries as outlets untill the fluid with gamma >= 0.5 reaches the cell close to the boundary one, after that it switches that face to wall BC.

Any suggestions or hints about how to do it?

Thanks in advance

Francesco

billy February 20, 2008 12:07

Hi, I think you have to do
 
Hi,

I think you have to do a gradual switch or else you might get numerical instabilities.

What you need to do is create a new wall BC.

francesco_b February 20, 2008 13:01

Hi Billy, I've tried to mo
 
Hi Billy,

I've tried to modify the outletInlet BC but I'm not expert of C++ and I don't know how to retrieve the value of gamma in the cell close to the boundary patch. Does anybody know how to do it?

If you want I can send you my files, I'm sorry but I'm not able to upload them.

For your suggestion of a gradual switch, do you have any hint on how to perform this? Is there already any exemple of this somewhere in the code?

Thanks in advance

Francesco

billy February 22, 2008 06:32

I would like to try and implem
 
I would like to try and implement this eventually but I am short of time at the moment.

I don't think this is anywhere in the code. I would like also to hear comments from other people in this forum.

francesco_b February 26, 2008 09:31

I've implemented the boundary
 
I've implemented the boundary condition, it should work, the problem is now that I don't know how to test it, I mean I've done some tests but results seems to be a bit strange.

My BC acts like a filter based on gamma, that is when gamma in the cell near the patch is < 0.5 there is an outflow, otherwise there is a wall.

Can you tell me which test to perform to evaluate if my boundary condition is correct?

Thanks in advance

Francesco

caw February 26, 2008 11:02

Dear Francesco, if your are
 
Dear Francesco,

if your are willing to share your BC, i would give you a simple test case or perform the test myself.
Whatever you like.

Kind regards
Christian

caw February 27, 2008 07:15

Francesco, i have a simple
 
Francesco,

i have a simple test case for you. Here is an image:
http://www.cfd-online.com/OpenFOAM_D...your_image.gif
There is a circular inlet at the lower end of the cavity, there i fluid (gamma = 1) is injected into the cavity. The grey surface is called wall and behaves like a wall. The green surface is called outlet but defined as wall for now. The blue surface is called upper_outlet and acts as an outlet. So in the simulation the fluid level rises with advancing time against gravity.

For your case i would suggest to switch the upper_outlet to wall. Then use your new BC for the surface called outlet. Now, fluid two should be able to leave the domain while the injected fluid one is held back and rises in the same way as mentioned above.

Test case for interFoam with animation frames:


Would you please share your BC so a can perform some tests as well?

Thanks and regards
Christian

caw February 27, 2008 07:20

Francesco, i have a simple
 
Francesco,

i have a simple test case for you. Here is an image:
http://www.cfd-online.com/OpenFOAM_D...ges/1/6826.jpg
There is a circular inlet at the lower end of the cavity, there i fluid (gamma = 1) is injected into the cavity. The grey surface is called wall and behaves like a wall. The green surface is called outlet but defined as wall for now. The blue surface is called upper_outlet and acts as an outlet. So in the simulation the fluid level rises with advancing time against gravity.

For your case i would suggest to switch the upper_outlet to wall. Then use your new BC for the surface called outlet. Now, fluid two should be able to leave the domain while the injected fluid one is held back and rises in the same way as mentioned above.

The test case for interFoam is to large to post it here. If you want it, just drop me an email.

Would you please share your BC so a can perform some tests as well?

Thanks and regards
Christian


All times are GMT -4. The time now is 07:59.