CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   OpenFOAM Running, Solving & CFD (http://www.cfd-online.com/Forums/openfoam-solving/)
-   -   interFoam - stratified flow - problem with shear stress at interface (http://www.cfd-online.com/Forums/openfoam-solving/70679-interfoam-stratified-flow-problem-shear-stress-interface.html)

 AnjaMiehe December 2, 2009 08:23

interFoam - stratified flow - problem with shear stress at interface

4 Attachment(s)
Dear Foamers,

I have a problem when simulating stratified flow of transformer oil and water with interFoam.

I simulate in a 2D channel of width 0.1 m and 6 m length. The interface shall be at 0.05 m, so at 50 %. Water is the denser fluid, so at the bottom of the channel, and the transformer oil the lighter fluid. I start the simulation with a wall of zero thickness (splitMesh) at the interface to ensure the Poiseuille profile (see Folder 01_Poiseuille in tar). The analytic solution is matched perfectly (see Poiseuille_TransformerOil_Water.pdf).
Then I take the last step as the starting point for the simulation without a wall. The resulting profile is in general not bad, but it does not match. Without any change in the profile I tried the following: run a longer simulation time (*1.5); enlarge the length of the channel (+ 2 m); enlarge number of cells in length (*1.5); enlarge number of cells in cross section (*1.5); schemes of 2nd order; surface correction factor from 1 to 0 (see TowPhaseFlow.pdf). :confused:
The problem seems to be the shear stress compatibility condition at the interface (continuity of shear stress at the interface) (see ShearStress.pdf).

Anja

 AnjaMiehe December 9, 2009 04:27

Another Try for stratified flow

3 Attachment(s)
Hello everybody,

I tried the two phase stratified, laminar flow for water treated as two different phases, a water-similar oil (HT350) and water and for water and air. Using water for both phases works perfectly, HT350 and water too, as their properties are very similar. Air and water is even worse than the transformer oil from above.

I am not sure if that is a problem with the simulation or with the coding of the interface treatment. If anybody has an idea, it is very welcome.

Thanks, Anja

Attachment 1693

Attachment 1694

Attachment 1695

 nuovodna June 10, 2010 09:39

Hi, i m trying to simulate a two-phases Poiseuille flow like you but i have some problems. The water-air interface is not stable: the flow is not stratified. I setted up a case with: inlet / outlet boundary with a pressure drop and top / bottom wall (there's no gravity). How can i solve this problem and simulate a stratified flow?

Emanuele

EDIT: i have seen your attached file right now. Thanks

RE-EDIT : i dont understand this part of how to
- change /constant/polyMesh/boundary
between faceSet command and splitMesh. I n what way i have to modify the boundary file??

RE-RE-EDIT: solved reading this post http://www.cfd-online.com/Forums/ope...thickness.html

 nuovodna June 10, 2010 11:46

How can you obtained a no-zero value of U along the interface?? I setted U at fixedValue (0 0 0) and obviously at the interface U values are 0.

 nuovodna June 10, 2010 12:38

1 Attachment(s)
I made a new mesh but i have a problem with splitMesh: it returns this error

Code:

```--> FOAM FATAL ERROR: Face 1024 in faceSet interface is not an internal face.```

I attach my case

 AnjaMiehe June 11, 2010 02:29

Hey Emanuele,

thanks for your interest in my work. I would like to ask you to do some steps the next time you post your case. Every command you enter in OpenFOAM will lead to a message on the terminal, if you do the commands as, for example,
• faceset |tee log.faceset
you can see the message on the terminal and have a log file where you can read it and post it here, too. It is far easier to find the fault this way.

In general, I did two different simulations. First, I simulate the velocity profile with a baffle (wall of zero thickness in OpenFOAM) seperating the two fluids. I obtained the two Poiseuille-Profiles. I did this to avoid the development of a wavy interface. With these results I deleted the interface (that is the entry for the two faces in the file of the time step to continue with) and continued to obtain the multiphase flow velocity profile.

Additionally, I did not start with air right away because of some problems in setting up the case.. Therefore I started with water-water, water-waterLikeOil, water-HeavyOil and at last water-air as the difference in properties increases this way. I also did not use gravity, but surface tension.

Please find attached my water-air case. In the post, probably in the afternoon, I will also write the commands and files together for the mesh with internal face walls (baffles).
Due to a securty error, I cannot upload the tar.gz of my case. Please write me a mail to get the files.

Hope it does help. Best wishes Anja

 AnjaMiehe June 11, 2010 08:55

How I did my mesh

My constant/polyMesh/blockMeshDict is:

Code:

```  /*--------------------------------*- C++ -*----------------------------------*\ | =========                |                                                | | \\      /  F ield        | OpenFOAM: The Open Source CFD Toolbox          | |  \\    /  O peration    | Version:  1.6                                  | |  \\  /    A nd          | Web:      http://www.OpenFOAM.org              | |    \\/    M anipulation  |                                                | \*---------------------------------------------------------------------------*/ FoamFile {     version    2.0;     format      ascii;     class      dictionary;     object      blockMeshDict; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // convertToMeters 1.0; vertices        (     (0 0 0)     (6 0 0)     (6 0.001 0)     (0 0.001 0)     (0 0 0.05)     (6 0 0.05)     (6 0.001 0.05)     (0 0.001 0.05)     (0 0 0.1)     (6 0 0.1)     (6 0.001 0.1)     (0 0.001 0.1) ); blocks          (     hex (0 1 2 3 4 5 6 7) (600 1 50) simpleGrading (1 1 1)     hex (4 5 6 7 8 9 10 11) (600 1 50) simpleGrading (1 1 1) ); edges          ( ); patches        (     wall top     (         (8 9 10 11)     )     wall bottom     (         (0 3 2 1)     )     patch inletWater     (     (0 4 7 3)     )     patch inletAir     (     (4 8 11 7)     )     patch outletWater     (     (2 6 5 1)     )     patch outletAir     (     (5 6 10 9)     )     empty frontAndBack     (     (6 7 11 10)         (7 6 2 3)     (4 5 9 8)     (0 1 5 4)     ) ); mergePatchPairs ( ); // ************************************************************************* //```
The command I use is: blockMesh |tee log.blockMesh
The log.blockMesh file does look like:

Code:

```/*---------------------------------------------------------------------------*\ | =========                |                                                | | \\      /  F ield        | OpenFOAM: The Open Source CFD Toolbox          | |  \\    /  O peration    | Version:  1.6                                  | |  \\  /    A nd          | Web:      www.OpenFOAM.org                      | |    \\/    M anipulation  |                                                | \*---------------------------------------------------------------------------*/ Build  : 1.6-f802ff2d6c5a Exec  : blockMesh Date  : Jun 11 2010 Time  : 14:15:10 Host  : hugo163 PID    : 21816 Case  : /home/anja/01_Einlauf nProcs : 1 SigFpe : Enabling floating point exception trapping (FOAM_SIGFPE). // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // Create time Creating block mesh from     "/home/anja/01_Einlauf/constant/polyMesh/blockMeshDict" Creating blockCorners Creating curved edges Creating blocks Creating patches Creating block mesh topology Default patch type set to empty Check block mesh topology         Basic statistics                 Number of internal faces : 1                 Number of boundary faces : 10                 Number of defined boundary faces : 10                 Number of undefined boundary faces : 0         Checking patch -> block consistency Creating block offsets Creating merge list . Creating points with scale 1 Creating cells Creating patches Creating mesh from block mesh Default patch type set to empty Writing polyMesh End```
Create a system/faceSetDict like:

Code:

```/*--------------------------------*- C++ -*----------------------------------*\ | =========                |                                                | | \\      /  F ield        | OpenFOAM: The Open Source CFD Toolbox          | |  \\    /  O peration    | Version:  1.6                                  | |  \\  /    A nd          | Web:      http://www.OpenFOAM.org              | |    \\/    M anipulation  |                                                | \*---------------------------------------------------------------------------*/ FoamFile {     version    2.0;     format      ascii;     class      dictionary;     object      faceSetDict; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // Name of set to operate on name interface; // One of clear/new/invert/add/delete|subset/list action new; // Actions to apply to pointSet. These are all the topoSetSource's ending // in ..ToFace (see the meshTools library). topoSetSources (     // Faces with face centre within box     boxToFace     {         box  (0 0 0.0499) (6.0 0.001 0.0501);     } ); // ************************************************************************* //```
The command I use is: faceSet |tee log.faceSet
The log.faceSet file does look like:

Code:

```/*---------------------------------------------------------------------------*\ | =========                |                                                | | \\      /  F ield        | OpenFOAM: The Open Source CFD Toolbox          | |  \\    /  O peration    | Version:  1.6                                  | |  \\  /    A nd          | Web:      www.OpenFOAM.org                      | |    \\/    M anipulation  |                                                | \*---------------------------------------------------------------------------*/ Build  : 1.6-f802ff2d6c5a Exec  : faceSet Date  : Jun 11 2010 Time  : 14:17:14 Host  : hugo163 PID    : 22251 Case  : /home/anja/01_Einlauf nProcs : 1 SigFpe : Enabling floating point exception trapping (FOAM_SIGFPE). // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // Create time Create polyMesh for time = 0 Reading faceSetDict Backing up interface into interface_old Set:interface  Size:0  Action:new     Adding faces with centre within box (0 0 0.0499) (6 0.001 0.0501) Writing interface (size 600) to "constant/polyMesh/sets/interface" End```
The size must be exactly the number of cells in x direction for the case at hand. Goto file constant/polyMesh/faces:

Code:

```/*--------------------------------*- C++ -*----------------------------------*\ | =========                |                                                | | \\      /  F ield        | OpenFOAM: The Open Source CFD Toolbox          | |  \\    /  O peration    | Version:  1.6                                  | |  \\  /    A nd          | Web:      www.OpenFOAM.org                      | |    \\/    M anipulation  |                                                | \*---------------------------------------------------------------------------*/ FoamFile {     version    2.0;     format      ascii;     class      faceList;     location    "constant/polyMesh";     object      faces; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 240700 ( 4(1 602 1804 1203) 4(1202 1203 1804 1803) 4(2 603 1805 1204) 4(1203 1204 1805 1804) 4(3 604 1806 1205) 4(1204 1205 1806 1805) 4(4 605 1807 1206) 4(1205 1206 1807 1806) 4(5 606 1808 1207) ... ...```
and get the number 240700. Edit the file constant/polyMesh/boundary to make it look like that (9 instead of 7 because every interface consists of to "surfaces")

Code:

```/*--------------------------------*- C++ -*----------------------------------*\ | =========                |                                                | | \\      /  F ield        | OpenFOAM: The Open Source CFD Toolbox          | |  \\    /  O peration    | Version:  1.6                                  | |  \\  /    A nd          | Web:      www.OpenFOAM.org                      | |    \\/    M anipulation  |                                                | \*---------------------------------------------------------------------------*/ FoamFile {     version    2.0;     format      ascii;     class      polyBoundaryMesh;     location    "constant/polyMesh";     object      boundary; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 9 //!!!!! beause of the two new faces (     top     {         type            wall;         nFaces          600;         startFace      119300;     }     bottom     {         type            wall;         nFaces          600;         startFace      119900;     }     inletWater     {         type            patch;         nFaces          50;         startFace      120500;     }     inletAir     {         type            patch;         nFaces          50;         startFace      120550;     }     outletWater     {         type            patch;         nFaces          50;         startFace      120600;     }     outletAir     {         type            patch;         nFaces          50;         startFace      120650;     }     frontAndBack     {         type            empty;         nFaces          120000;         startFace      120700;     }                // !! here the new faces     interface_up     {         type            patch;         nFaces          0;         startFace      240700; // number from /constant/polyMesh/faces     }     interface_down     {         type            patch;         nFaces          0;         startFace      240700;     } ) // ************************************************************************* //```
The splitMesh command is in general: splitMesh faceSet newface1 newface2
The newface1/2 are form the boundary file and will be the new boundaries. The command here is therefore: splitMesh interface interface_up interface_down |tee log.splitMesh
and the log.splitMesh file does look like:

Code:

```/*---------------------------------------------------------------------------*\ | =========                |                                                | | \\      /  F ield        | OpenFOAM: The Open Source CFD Toolbox          | |  \\    /  O peration    | Version:  1.6                                  | |  \\  /    A nd          | Web:      www.OpenFOAM.org                      | |    \\/    M anipulation  |                                                | \*---------------------------------------------------------------------------*/ Build  : 1.6-f802ff2d6c5a Exec  : splitMesh interface interface_up interface_down Date  : Jun 11 2010 Time  : 14:27:58 Host  : hugo163 PID    : 24566 Case  : /home/anja/01_Einlauf nProcs : 1 SigFpe : Enabling floating point exception trapping (FOAM_SIGFPE). // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // Create time Create polyMesh for time = 0 Read 600 faces to split Adding point and face zones Constructed topologyModifier: Splitter {     type attachDetach;     faceZoneName membraneFaces;     masterPatchName interface_up;     slavePatchName interface_down;     triggerTimes 1(0);     manualTrigger false;     active true; } Writing mesh to 0.001 end```
Now you have to add the new faces interface_up and interface_down to all the boundary files in the folder 0 with the properties you want to have, for example a wall in my case

last: do a checkMesh |tee log.checkMesh

to be sure that everything went well

 nuovodna June 14, 2010 06:44

The wrong part in my case is the faceSet command: i obtain a size (122) not equal to x size (16). At this resolution checkMesh fail but if i increase (eg 600) it gives a good output but faceSet still says a wrong size. Perhaps there is something wrong on my blockMesh file. I changed it according to your own and now it works.

Thanks

PS It's important to delete *Zones files in constant/polyMesh before splitMesh command

 AnjaMiehe June 14, 2010 06:49

I am happy that your mesh works now. Hope, that the simulation will too.

 All times are GMT -4. The time now is 04:10.