CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > OpenFOAM

Doubts with interFoam

Register Blogs Members List Search Today's Posts Mark Forums Read

Reply
 
LinkBack Thread Tools Display Modes
Old   October 8, 2012, 11:51
Default Doubts with interFoam
  #1
Member
 
Sagun Tripathi
Join Date: Aug 2012
Location: Amherst, USA
Posts: 78
Rep Power: 4
Sagun is on a distinguished road
Hello everyone!

I am a beginner level user of OpenFOAM and trying to understand how the multiphase interFoam solver works by simulating a simple case of laminar flow inside a 2-D tank. I assigned the boundary conditions on various patches using tutorials included with the software and online resources as reference. The solver worked fine without any errors but during post-processing, I am observing that the velocity vectors inside the domain near the phase-boundary are very weird (image attached).

I have used the following conditions on the patches for the three fields:

1. alpha

dimensions [0 0 0 0 0 0 0];

internalField uniform 0;

boundaryField
{
inlet
{
type zeroGradient;
}

outlet
{
type zeroGradient;
}

lower
{
type zeroGradient;
}

atmosphere
{
type inletOutlet;
inletValue uniform 0;
value uniform 0;
}

sides
{
type empty;
}
}


2. p_rgh

dimensions [1 -1 -2 0 0 0 0];

internalField uniform 0;

boundaryField
{
inlet
{
type buoyantPressure;
}

outlet
{
type buoyantPressure;
}

sides
{
type empty;
}

lower
{
type buoyantPressure;
}

atmosphere
{
type totalPressure;
p0 uniform 0;
U U;
phi phi;
rho rho;
psi none;
gamma 1;
value uniform 0;
}
}


3. U

dimensions [0 1 -1 0 0 0 0];

internalField uniform (0 0 0);

boundaryField
{
inlet
{
type fixedValue;
value uniform (1 0 0);
}
outlet
{
type zeroGradient;
}
sides
{
type empty;
}
lower
{
type fixedValue;
value uniform (0 0 0);
}
atmosphere
{
type pressureInletOutletVelocity;
tangentialVelocity uniform (0 0 0);
value uniform (0 0 0);
}
}


Could any one point out what mistake I'm making while assigning the boundary conditions.

Thanks,
Sagun
Attached Images
File Type: jpg tank_laminar_twophase.jpg (28.1 KB, 66 views)
Sagun is offline   Reply With Quote

Old   October 8, 2012, 12:11
Default
  #2
Member
 
Sagun Tripathi
Join Date: Aug 2012
Location: Amherst, USA
Posts: 78
Rep Power: 4
Sagun is on a distinguished road
Sorry attached the wrong image.
Attached Images
File Type: jpg Screenshot at 2012-10-08 17:10:26.jpg (28.3 KB, 69 views)
Sagun is offline   Reply With Quote

Old   October 8, 2012, 13:10
Default
  #3
Senior Member
 
Kent Wardle
Join Date: Mar 2009
Location: Illinois, USA
Posts: 190
Rep Power: 9
kwardle is on a distinguished road
You have not given enough information for anyone to try and give you a useful response. What is it you are trying to simulate exactly? You have shown an image of very coarse velocity vectors--is this representative of your mesh? You have not said anything about the alpha (volume fraction field)---where is the interface exactly, and physically, what are you expecting should be happening there given what you are trying to simulate?
Probably your post's title should be 'Doubts with interFoam setup' ;-)
-KW
kwardle is offline   Reply With Quote

Old   October 9, 2012, 09:14
Default
  #4
Member
 
Sagun Tripathi
Join Date: Aug 2012
Location: Amherst, USA
Posts: 78
Rep Power: 4
Sagun is on a distinguished road
My apologies for such an amateurish post. I'm basically trying to simulate laminar flow in a 2-D tank of dimensions 20mx0.1mx3m with 'x' and 'z' being the dimensions of interest and the interface located at a height of 2m along the z-axis. I have adjusted the inlet velocity and dynamic viscosities of the two fluids to make the flow laminar. This is just a very preliminary attempt at understanding interFoam. Eventually, I would like to have air and water as the two fluids with turbulent flow around an object and maybe include the effect of waves too.

I have used simpleGrading for edges both along the 'x' and 'z' axes with 20 and 6 elements in each respectively. This explains the coarse nature of my mesh. I simulated the flow for 5s using a time step of 0.05s. Here is how my fvSchemes file looks like:

ddtSchemes
{
default Euler;
}

gradSchemes
{
default Gauss linear;
}

divSchemes
{
div(rho*phi,U) Gauss limitedLinearV 1;
div(phi,alpha) Gauss vanLeer;
div(phirb,alpha) Gauss interfaceCompression;
}

laplacianSchemes
{
default Gauss linear corrected;
}

interpolationSchemes
{
default linear;
}

snGradSchemes
{
default corrected;
}

fluxRequired
{
default no;
p_rgh;
pcorr;
alpha1;
}


and the fvSolution file is:

solvers
{
pcorr
{
solver PCG;
preconditioner DIC;
tolerance 1e-10;
relTol 0;
}

p_rgh
{
solver PCG;
preconditioner DIC;
tolerance 1e-07;
relTol 0.05;
}

p_rghFinal
{
solver PCG;
preconditioner DIC;
tolerance 1e-08;
relTol 0;
}
U
{
solver PBiCG;
preconditioner DILU;
tolerance 1e-06;
relTol 0;
}
}

PIMPLE
{
momentumPredictor no;
nCorrectors 3;
nNonOrthogonalCorrectors 0;
nAlphaCorr 1;
nAlphaSubCycles 2;
cAlpha 1;
}


Please let me know in case you need more info. I'll try to do some more simulation with a finer mesh in the meanwhile.

Also, I was wondering if its possible to assign different velocities at the inlet to the two phases.

Thanks,
Sagun
Sagun is offline   Reply With Quote

Old   October 9, 2012, 11:29
Default
  #5
Senior Member
 
Kent Wardle
Join Date: Mar 2009
Location: Illinois, USA
Posts: 190
Rep Power: 9
kwardle is on a distinguished road
OK. With that info, what you have described as strange velocities on the 'interface' and shown in your images is actually not the liquid-gas interface but the velocities on the upper boundary (atmosphere). It is not surprising to see some strange things here in this configuration. Also, you probably want to tweak your BCs a little. Presumably the 'outlet' is the right wall? I would suggest you use inletOutlet for alpha there with an inletValue of 0 (only gas ingress). You may also want to try inletOutlet with inletValue (0 0 0) for U here too. You will very likely see some inflow in the gas region of your outlet wall. You might also consider moving the top surface a little farther from the liquid and making it a wall instead--depends on what you are trying to see.

As for the U at the actual gas-liquid interface, this should be relatively smooth and continuous for this case--in VOF (as in interFoam) both phases share the same velocity field. You might try and superimpose your alpha field and the U vectors if indeed you think you are seeing strange interface stuff.

That said, your mesh is not just coarse, it is extremely coarse. 120 cells? Are you running this on a smartphone or something? :-) Note your cell dimensions--1m x 0.5m. Meters! Do not expect any kind of accurate physics with that kind of resolution (unless you are simulating truly 'global' phenomena). A decent processor running interFoam can easily handle 20,000 cells at a good speed. As an aside, turning off runTimeModifiable in controlDict also helps with performance significantly in my experience.
Hope this helps,
-Kent
kwardle is offline   Reply With Quote

Old   October 9, 2012, 11:35
Default
  #6
Senior Member
 
Kent Wardle
Join Date: Mar 2009
Location: Illinois, USA
Posts: 190
Rep Power: 9
kwardle is on a distinguished road
Eventually, should you run into more of a 'need for speed', you might also want to turn on adjustTimeStep rather than use a fixed value. You could increase your maxCo (2) and maxAlphaCo (1) as well if you increase nAlphaSubcycles to ~4. This is a bit aggressive but I run like this regularly with no problems. Just keep it so the Co for each alpha sub-timestep near the interface (this is maxAlphaCo/nAlphaSubCycles) is around 0.25.
-Kent
kwardle is offline   Reply With Quote

Old   October 9, 2012, 12:06
Default
  #7
Member
 
Sagun Tripathi
Join Date: Aug 2012
Location: Amherst, USA
Posts: 78
Rep Power: 4
Sagun is on a distinguished road
Thank you immensely for your suggestions. I made the following changes to my setup:

1. Increased dimension 'z' to 8m with the liquid only upto a height of 2m.
2. Increased total number of cells to 200*80 = 16000.
3. Changed alpha at outlet to inletOutlet (and yes you were right about it being the right wall)

I have attached an image of the velocity vectors in the domain and the flow appears to be much more reasonable. However, what I don't understand is why does the gas tends to flow out of the domain near the outlet?

Regards,
Sagun
Attached Images
File Type: jpg Screenshot at 2012-10-09 16:59:22.jpg (65.3 KB, 55 views)
Sagun is offline   Reply With Quote

Old   October 9, 2012, 14:02
Default
  #8
Senior Member
 
Kent Wardle
Join Date: Mar 2009
Location: Illinois, USA
Posts: 190
Rep Power: 9
kwardle is on a distinguished road
Well, take a look at the velocity magnitudes, the vectors are not scaled or you would see the magnitude of gas flow is very small. As for why the gas flows as it does (slightly in from the outlet and then up out the top surface), I am not quite sure but I think it has to do with the use of buoyantPressure on the outlet surface. I think there may be an optional "rho" argument on this BC type which might help. This is what I have always seen in this type of flow. Like I said, you might try to make the top surface a wall instead, but in that case what you will likely see on the outlet in the gas region is flow coming in and making a u-turn and going right back out. If you search the forum there are lots of people with questions regarding how to get a physical BC for pressure on an 'outlet'. I am not sure I have the answer though generally the oddities of flow in the gas phase do not affect what you are looking at. There is a BC type in 2.1.1 called phaseHydrostaticPressure which is for use with similar boundaries (vertical 'zero' pressure outlets) in multiphaseEulerFoam. It seems to solve this but I am not sure if it will work as-is for interFoam.

BTW, I realized I didn't answer your question for whether you can set a velocity profile for the two phases on the inlet. Yes, this is possible and there are a variety of ways. Again lots of info on setting a velocity profile on the inlet in the forum here.
kwardle is offline   Reply With Quote

Old   October 15, 2012, 10:47
Default
  #9
Member
 
Sagun Tripathi
Join Date: Aug 2012
Location: Amherst, USA
Posts: 78
Rep Power: 4
Sagun is on a distinguished road
Hello again,

With reference to my previous question to you about specifying different velocity profiles to the two phases, I looked up some of the forums over here and found out that one needs to modify the setFields dictionary file. So I did the same and now my setFields file looks like this:

defaultFieldValues
(
volScalarFieldValue alpha1 0
volVectorFieldValue U (0 0 0)
);

regions
(
boxToCell
{
box (0 0 0) (20 0.1 1.5);
fieldValues
(
volScalarFieldValue alpha1 1
volVectorFieldValue U (1 0 0)
);
}
);

But I think this specifies zero velocity throughout the gas phase and 1 m/s in the liquid phase. How can I set these values only at the inlet?

Regards,
Sagun
Sagun is offline   Reply With Quote

Old   October 16, 2012, 10:38
Default
  #10
Member
 
Sagun Tripathi
Join Date: Aug 2012
Location: Amherst, USA
Posts: 78
Rep Power: 4
Sagun is on a distinguished road
Also, what boundary condition should I specify at the inlet in the 0/U file?
Sagun is offline   Reply With Quote

Old   November 27, 2012, 09:48
Default
  #11
Member
 
Hanniel Freitas
Join Date: Jan 2012
Location: Natal, Brazil
Posts: 33
Rep Power: 4
hfsf is on a distinguished road
So, you are trying to set specific conditions only at the patch inlet? If the answer is YES, you could check the groovyBC utility. Sorry if I missunderstood your question.

Best,

hfsf
hfsf is offline   Reply With Quote

Old   November 27, 2012, 10:00
Default
  #12
Member
 
Sagun Tripathi
Join Date: Aug 2012
Location: Amherst, USA
Posts: 78
Rep Power: 4
Sagun is on a distinguished road
I figured that out some time back. Thanks though.
Sagun is offline   Reply With Quote

Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
InterFoam stops after deltaT goes to 1e14 francesco_b OpenFOAM Running, Solving & CFD 8 July 31, 2013 03:29
Segmentation fault in interFoam run through openMPI voingiappone OpenFOAM 16 November 2, 2011 08:49
Slow interFoam compared with other CFD tools? Ralph M OpenFOAM Programming & Development 1 November 17, 2010 07:46
Steady state version of interFoam anger OpenFOAM Running, Solving & CFD 1 October 1, 2009 13:49
Open Channel Flow using InterFoam type solver sxhdhi OpenFOAM Running, Solving & CFD 3 May 5, 2009 22:58


All times are GMT -4. The time now is 06:26.