CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   OpenFOAM (http://www.cfd-online.com/Forums/openfoam/)
-   -   Doubts with interFoam (http://www.cfd-online.com/Forums/openfoam/107864-doubts-interfoam.html)

Sagun October 8, 2012 10:51

Doubts with interFoam
 
1 Attachment(s)
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

Sagun October 8, 2012 11:11

1 Attachment(s)
Sorry attached the wrong image.

kwardle October 8, 2012 12:10

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

Sagun October 9, 2012 08:14

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

kwardle October 9, 2012 10:29

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 October 9, 2012 10:35

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

Sagun October 9, 2012 11:06

1 Attachment(s)
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

kwardle October 9, 2012 13:02

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.

Sagun October 15, 2012 09:47

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 October 16, 2012 09:38

Also, what boundary condition should I specify at the inlet in the 0/U file?

hfsf November 27, 2012 09:48

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

Sagun November 27, 2012 10:00

I figured that out some time back. Thanks though. :)


All times are GMT -4. The time now is 17:40.