Previous: Test case set up Up: Basic test case Next: Test case modification
This is an automatically generated documentation by LaTeX2HTML utility. In case of any issue, please, contact us at info@cfdsupport.com.
Phase ratio initialization
- Following method can be applied to any quantity
 - Field initialization using setFields utility reads set up from system/setFieldsDict:
# cat system/setFieldsDict
 
/*--------------------------------*- 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;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
defaultFieldValues
(
    volScalarFieldValue alpha.water 0
);
regions
(
    boxToCell
    {
        box (0 0 -1) (1 1 1);
        fieldValues
        (
            volScalarFieldValue alpha.water 1
        );
    }
);
// ************************************************************************* //
- The default value of the field alpha.water can be set in section defaultFieldValues (quantity alpha.water represents volume fraction of the first phase in the cell, 0 corresponds to 0% of first phase, 1 corresponds to 100% of first phase)
 - In section regions we can choose cell region and set values for chosen quantities in this region
 - Function boxToCell selects all cell having centers of gravity inside the box specified by two opposite vertices: V1(0 0 -1) a V2(1 1 1)
 - Parameter fieldValues defines value for selected quantities in the selected region
 - Create a file alpha.water:
# mv 0/alpha.water.orig 0/alpha.water
 - Initialize the phases:
# setFields
 - Now we have following initial condition: the first phase is located in the top right quarter of the domain, the second phase is in the rest of the domain:
# paraFoam
 
															Figure: Initial phase magnitude
- Run the test case:
# interFoam > log &
 - View results:
# paraFoam
 
											Figure: Phase magnitude in time![]()