CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Running, Solving & CFD (https://www.cfd-online.com/Forums/openfoam-solving/)
-   -   Mesh generated VOF fields (interFoam) (https://www.cfd-online.com/Forums/openfoam-solving/202396-mesh-generated-vof-fields-interfoam.html)

cuikahlil May 30, 2018 02:33

Mesh generated VOF fields (interFoam)
 
1 Attachment(s)
Hello!

I would like to ask if anybody has an idea about how to make a mesh generated setFields (I don't know how to formally call this case so I'll just go with this). I want to make an fluid domain similar to the one in the picture attached, where separate domains are for the air and water. In setFields we usually do this using BoxToCell, but clearly it cannot be used for the one I/m trying to do. I have also heard of funkySetFields but I cannot imagine it working for me (but maybe I am wrong, I haven't actually tried).

Thank you in advance!

Santiago May 30, 2018 03:20

You mean like the interface being represented by a certain grid line?

cuikahlil May 30, 2018 03:45

Yeah. Maybe a better way of saying this is how can I create a non-box geometry for air-water phases in interFoam?

Santiago May 30, 2018 03:57

Quote:

Originally Posted by cuikahlil (Post 693982)
Yeah. Maybe a better way of saying this is how can I create a non-box geometry for air-water phases in interFoam?

But you mean to use interfoam as an interface tracking method?

Santiago May 30, 2018 03:59

Quote:

Originally Posted by cuikahlil (Post 693982)
Yeah. Maybe a better way of saying this is how can I create a non-box geometry for air-water phases in interFoam?

To create non box geometries has nothing to do with interfoam. Use pointwise or snappy to generate the geometry you need, and then run it using whatever OF solver you want.

cuikahlil May 30, 2018 04:34

No, I simply wish to implement interFoam where my initial fluid geometries are non-rectangular.

tomf May 31, 2018 03:29

For setFields, you can just make your box extend to outside your domain, so with a flat surface, you can still use a box. I guess this would work:

Code:

/*--------------------------------*- C++ -*----------------------------------*\
| =========                |                                                |
| \\      /  F ield        | OpenFOAM: The Open Source CFD Toolbox          |
|  \\    /  O peration    | Version:  dev                                  |
|  \\  /    A nd          | Web:      www.OpenFOAM.org                      |
|    \\/    M anipulation  |                                                |
\*---------------------------------------------------------------------------*/
FoamFile
{
    version    2.0;
    format      ascii;
    class      dictionary;
    location    "system";
    object      setFieldsDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

zWater = 700

defaultFieldValues
(
    volScalarFieldValue alpha.water 0
);

regions
(
    // Set cell values
    // (does zerogradient on boundaries)
    boxToCell
    {
        box (-999 -999 -999) (999 999 $zWater);

        fieldValues
        (
            volScalarFieldValue alpha.water 1
        );
    }

    // Set patch values (using ==)
    boxToFace
    {
        box (-999 -999 -999) (999 999 $zWater);

        fieldValues
        (
            volScalarFieldValue alpha.water 1
        );
    }
);

// ************************************************************************* //


cuikahlil May 31, 2018 05:23

Thank you very much! I'll give it a try. A friend also mentioned to me that I can manually set the water domain in 0/alpha.water by typing 1 in the face where I want water to be. I guess this is not the most elegant solution, but as long as my mesh is not super fine, it should be manageable.


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