Files
openfoam/applications/solvers/multiphase/twoPhaseEulerFoam/phaseModel/phaseModel/phaseModel.C
2011-01-05 18:24:29 +00:00

158 lines
3.8 KiB
C

/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "phaseModel.H"
#include "fixedValueFvPatchFields.H"
#include "surfaceInterpolate.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::phaseModel::phaseModel
(
const fvMesh& mesh,
const dictionary& transportProperties,
const word& phaseName
)
:
dict_
(
transportProperties.subDict("phase" + phaseName)
),
name_(phaseName),
d_
(
dict_.lookup("d")
),
nu_
(
dict_.lookup("nu")
),
rho_
(
dict_.lookup("rho")
),
U_
(
IOobject
(
"U" + phaseName,
mesh.time().timeName(),
mesh,
IOobject::MUST_READ,
IOobject::AUTO_WRITE
),
mesh
)
{
const word phiName = "phi" + phaseName;
IOobject phiHeader
(
phiName,
mesh.time().timeName(),
mesh,
IOobject::NO_READ
);
if (phiHeader.headerOk())
{
Info<< "Reading face flux field " << phiName << endl;
phiPtr_.reset
(
new surfaceScalarField
(
IOobject
(
phiName,
mesh.time().timeName(),
mesh,
IOobject::MUST_READ,
IOobject::AUTO_WRITE
),
mesh
)
);
}
else
{
Info<< "Calculating face flux field " << phiName << endl;
wordList phiTypes
(
U_.boundaryField().size(),
calculatedFvPatchScalarField::typeName
);
forAll(U_.boundaryField(), i)
{
if (isA<fixedValueFvPatchVectorField>(U_.boundaryField()[i]))
{
phiTypes[i] = fixedValueFvPatchScalarField::typeName;
}
}
phiPtr_.reset
(
new surfaceScalarField
(
IOobject
(
phiName,
mesh.time().timeName(),
mesh,
IOobject::NO_READ,
IOobject::AUTO_WRITE
),
fvc::interpolate(U_) & mesh.Sf(),
phiTypes
)
);
}
}
Foam::autoPtr<Foam::phaseModel> Foam::phaseModel::New
(
const fvMesh& mesh,
const dictionary& transportProperties,
const word& phaseName
)
{
return autoPtr<phaseModel>
(
new phaseModel(mesh, transportProperties, phaseName)
);
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::phaseModel::~phaseModel()
{}
// ************************************************************************* //