CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   Open Source Meshers: Gmsh, Netgen, CGNS, ... (http://www.cfd-online.com/Forums/openfoam-meshing-open/)
-   -   empty boundry for interFoam (http://www.cfd-online.com/Forums/openfoam-meshing-open/85617-empty-boundry-interfoam.html)

billynoe March 2, 2011 13:22

empty boundry for interFoam
 
I am trying to use a gmsh mesh in OpenFoam for interFoam solver. Basically the two fluids water and air in my case need to be separated by a boundary patch. I made the mesh in gmsh with the boundary as a physical surface. then when I do gmshToFoam it recognizes the patch exists but it is always empty ie. it has no faces so it cannot be used by foam. the two volumes between the interface were defined as separate physical volumes as well. does anyone have experience with interFoam and gmsh that can give me some help.

gwierink March 9, 2011 12:29

Hi William,

After your PM I'll continue here for the forum.

I am not sure if I understand what you are trying to do. From your post it seems that you want to separate the two phases by a patch. If the patch is empty, flux will simply flow through it. If you want to separate phases with a patch, what do you want the patch to do? What is the physical idea?

billynoe March 9, 2011 13:14

My geometry is shown here I added a block on top to represent the air. My problem is the interface patch is empty. So I can't specify initial constraints on the interface. I'm pretty sure it is empty because it is an internal edge that is not an outside boundary. I want to simulate flowing water exposed at the surface to air and constrained by gravity. maybe interFoam is the wrong solver for this. In the future I would eventually like to simulate the transfer of oxygen into the water.

gwierink March 9, 2011 13:57

So you have a kind of cake slice, is that correct? And you put another cake slice on top for the air? What kind of constraint do you want to apply? A membrane? If you just want air on top of water, I would just make the cake slice wtice as high and use setFields to define where is water and where is air.

billynoe March 9, 2011 14:28

It is a wedge with radial symmetry. Yes it is just air on water. I will look into setFields I'm not familiar with this function yet. Thank you.

gwierink March 9, 2011 14:50

I think in your case you can just do

Code:

cp $FOAM_TUTORIALS/multiphase/interFoam/laminar/damBreak/system/setFieldsDict system/
in your case directory. Then adjust the box area in system/setFieldsDict and set the fields to 1 and 0 in the appropriate areas and simply type
Code:

setFields
in your case directory.

msbealo March 10, 2011 06:03

billynoe,

Thanks for the PM. I think gwierink is correct. Unless you want something specific at the interface (i.e. a membrane), then setFields is the way to separate air and water. The damBreak or floatingObject tutorial are good examples of setting air/water interfaces where you want them.

Mark

billynoe March 10, 2011 12:54

Thanks guys I appreciate the help. One more question how hard would it be to simulate diffusion across the interface based on concentration in the fluid.
For example I have an equation which relates the diffusion rate of the gas to the concentration of the gas in the liquid. basically rate=e^(-a(concentration)) which I derived. It has a good fit to experimental data, but it might not be technically correct.

gwierink March 10, 2011 14:38

Hi William,

If you're talking about the same gas (i.e. the air next to the water and not some third gas) (another gas could be a scalar that is transported, then you can implement Fick's law straight away) interFoam doesn't use diffusion as such. It's of course possible, but probably some work to implement interfacial diffusion in interFoam. Perhaps interPhaseChangeFoam or cavitatingFoam are a better base to work with, or perhaps use twoPhaseEulerFoam for an entirely different approach ...

billynoe March 10, 2011 18:20

thanks Gijs I'll look into those. The gas is air but the equation relates to the oxygen diffusion and dissolved oxygen concentration in water.

gwierink March 11, 2011 01:41

Alright, so if it's a concentration of oxygen in water, you could model that as a tracer concentration. The tracer can then also be defined in the air, with different diffusivity of course. If you like this idea, have a look at "How to add temperature to icoFoam". There, a scalar field T is added and transported around according to a transport equation with given diffusivity coefficient. You could do the same, but replace "T" with "Coxygen" or something like that and define different diffusivity coefficient for different phases. that is, put DCair and DCwater as oxygen diffusivity coefficient for air and water, respectively, in the transportProperties dictionary. Then, add these to createFields.H:

Code:

dimensionedScalar DCair
(
    transportProperties.lookup("DCair")
);

dimensionedScalar DCwater
(
    transportProperties.lookup("DCwater")
);

and define DC for different phases, just before the transport equation

Code:

forAll(alpha1, cellI)
{
    if (alpha1[cellI] < 0.5)
    {
        // Define diff. coeff. in air
        DC = DCair;
    }
    if (alpha1[cellI] > 0.5)
    {
        // Define diff. coeff. in water
        DC = DCwater;
    }
}


akidess March 11, 2011 12:49

Quote:

Originally Posted by gwierink (Post 298944)
Code:

forAll(alpha1, cellI)
{
    if (alpha1[cellI] < 0.5)
    {
        // Define diff. coeff. in air
        DC = DCair;
    }
    if (alpha1[cellI] > 0.5)
    {
        // Define diff. coeff. in water
        DC = DCwater;
    }
}


Much more efficiently done by DC = alpha * DCwater + (1 - alpha) * DCair ;)

gwierink March 11, 2011 15:09

Hi Anton,

Yep, good point, you live and you learn hehe :D

billynoe March 14, 2011 16:50

Thanks for the tips. I got the phases figured out, but the solution keeps crashing. I think I have the wrong boundary conditions. The DO modeling will have to wait until I get the basic model worked out. Should I need to specify the Pressure of the gas 101.3KPa and if so how do I do this?

gwierink March 15, 2011 02:01

You can set a reference pressure and a reference point in the PISO parameters in system/fvSolution:
Code:

pRefPoint      (0.51 0.51 0.51);
pRefValue      0;

Instead of pRefPoint you can also set a pRefCell. If you would like (or need) to set up a pressure field as an initial condition you can run the case with potentialFoam to get an initial guess for pressure. PyFoam has a handy tool for that called pyFoamPotentialRunner.


All times are GMT -4. The time now is 16:36.