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<< "Reading field U\n" << endl;
00030     volVectorField U
00031     (
00032         IOobject
00033         (
00034             "U",
00035             runTime.timeName(),
00036             mesh,
00037             IOobject::MUST_READ,
00038             IOobject::AUTO_WRITE
00039         ),
00040         mesh
00041     );
00042 
00043 #   include "createPhi.H"
00044 
00045     Info<< "Creating phaseChangeTwoPhaseMixture\n" << endl;
00046     autoPtr<phaseChangeTwoPhaseMixture> twoPhaseProperties =
00047         phaseChangeTwoPhaseMixture::New(U, phi);
00048 
00049     const dimensionedScalar& rho1 = twoPhaseProperties->rho1();
00050     const dimensionedScalar& rho2 = twoPhaseProperties->rho2();
00051     const dimensionedScalar& pSat = twoPhaseProperties->pSat();
00052 
00053     // Need to store rho for ddt(rho, U)
00054     volScalarField rho
00055     (
00056         IOobject
00057         (
00058             "rho",
00059             runTime.timeName(),
00060             mesh,
00061             IOobject::READ_IF_PRESENT
00062         ),
00063         alpha1*rho1 + (scalar(1) - alpha1)*rho2,
00064         alpha1.boundaryField().types()
00065     );
00066     rho.oldTime();
00067 
00068 
00069     label pRefCell = 0;
00070     scalar pRefValue = 0.0;
00071     setRefCell(p, mesh.solutionDict().subDict("PISO"), pRefCell, pRefValue);
00072 
00073 
00074     // Construct interface from alpha1 distribution
00075     interfaceProperties interface(alpha1, U, twoPhaseProperties());
00076 
00077     // Construct incompressible turbulence model
00078     autoPtr<incompressible::turbulenceModel> turbulence
00079     (
00080         incompressible::turbulenceModel::New(U, phi, twoPhaseProperties())
00081     );
Copyright © 2000-2009 OpenCFD Ltd