OpenFOAM logo
The Open Source CFD Toolbox
  Source Guide OpenCFD Solutions Contact OpenFOAM

createFields.H

Go to the documentation of this file.
00001     Info<< "Reading field p\n" << endl;
00002     volScalarField p
00003     (
00004         IOobject
00005         (
00006             "p",
00007             runTime.timeName(),
00008             mesh,
00009             IOobject::MUST_READ,
00010             IOobject::AUTO_WRITE
00011         ),
00012         mesh
00013     );
00014 
00015     Info<< "Reading field alpha1\n" << endl;
00016     volScalarField alpha1
00017     (
00018         IOobject
00019         (
00020             "alpha1",
00021             runTime.timeName(),
00022             mesh,
00023             IOobject::MUST_READ,
00024             IOobject::AUTO_WRITE
00025         ),
00026         mesh
00027     );
00028 
00029     Info<< "Calculating field alpha1\n" << endl;
00030     volScalarField alpha2("alpha2", scalar(1) - alpha1);
00031 
00032     Info<< "Reading field U\n" << endl;
00033     volVectorField U
00034     (
00035         IOobject
00036         (
00037             "U",
00038             runTime.timeName(),
00039             mesh,
00040             IOobject::MUST_READ,
00041             IOobject::AUTO_WRITE
00042         ),
00043         mesh
00044     );
00045 
00046     #include "createPhi.H"
00047 
00048 
00049     Info<< "Reading transportProperties\n" << endl;
00050     twoPhaseMixture twoPhaseProperties(U, phi);
00051 
00052     dimensionedScalar rho10
00053     (
00054         twoPhaseProperties.subDict
00055         (
00056             twoPhaseProperties.phase1Name()
00057         ).lookup("rho0")
00058     );
00059 
00060     dimensionedScalar rho20
00061     (
00062         twoPhaseProperties.subDict
00063         (
00064             twoPhaseProperties.phase2Name()
00065         ).lookup("rho0")
00066     );
00067 
00068     dimensionedScalar psi1
00069     (
00070         twoPhaseProperties.subDict
00071         (
00072             twoPhaseProperties.phase1Name()
00073         ).lookup("psi")
00074     );
00075 
00076     dimensionedScalar psi2
00077     (
00078         twoPhaseProperties.subDict
00079         (
00080             twoPhaseProperties.phase2Name()
00081         ).lookup("psi")
00082     );
00083 
00084     dimensionedScalar pMin(twoPhaseProperties.lookup("pMin"));
00085 
00086     volScalarField rho1 = rho10 + psi1*p;
00087     volScalarField rho2 = rho20 + psi2*p;
00088 
00089     volScalarField rho
00090     (
00091         IOobject
00092         (
00093             "rho",
00094             runTime.timeName(),
00095             mesh,
00096             IOobject::READ_IF_PRESENT,
00097             IOobject::AUTO_WRITE
00098         ),
00099         alpha1*rho1 + alpha2*rho2
00100     );
00101 
00102 
00103     // Mass flux
00104     // Initialisation does not matter because rhoPhi is reset after the
00105     // alpha1 solution before it is used in the U equation.
00106     surfaceScalarField rhoPhi
00107     (
00108         IOobject
00109         (
00110             "rho*phi",
00111             runTime.timeName(),
00112             mesh,
00113             IOobject::NO_READ,
00114             IOobject::NO_WRITE
00115         ),
00116         fvc::interpolate(rho)*phi
00117     );
00118 
00119     volScalarField dgdt =
00120         pos(alpha2)*fvc::div(phi)/max(alpha2, scalar(0.0001));
00121 
00122     // Construct interface from alpha1 distribution
00123     interfaceProperties interface(alpha1, U, twoPhaseProperties);
00124 
00125     // Construct incompressible turbulence model
00126     autoPtr<incompressible::turbulenceModel> turbulence
00127     (
00128         incompressible::turbulenceModel::New(U, phi, twoPhaseProperties)
00129     );
Copyright © 2000-2009 OpenCFD Ltd