mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
multiphase: completed renaming of phase fields to use the new groupName convention and interface
This commit is contained in:
@ -0,0 +1,244 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
|
||||
\\/ 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 "diameterModel.H"
|
||||
#include "fixedValueFvPatchFields.H"
|
||||
#include "slipFvPatchFields.H"
|
||||
#include "partialSlipFvPatchFields.H"
|
||||
#include "surfaceInterpolate.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::phaseModel::phaseModel
|
||||
(
|
||||
const word& phaseName,
|
||||
const dictionary& phaseDict,
|
||||
const fvMesh& mesh
|
||||
)
|
||||
:
|
||||
volScalarField
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
IOobject::groupName("alpha", phaseName),
|
||||
mesh.time().timeName(),
|
||||
mesh,
|
||||
IOobject::MUST_READ,
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
mesh
|
||||
),
|
||||
name_(phaseName),
|
||||
phaseDict_(phaseDict),
|
||||
nu_
|
||||
(
|
||||
"nu",
|
||||
dimensionSet(0, 2, -1, 0, 0),
|
||||
phaseDict_.lookup("nu")
|
||||
),
|
||||
kappa_
|
||||
(
|
||||
"kappa",
|
||||
dimensionSet(1, 1, -3, -1, 0),
|
||||
phaseDict_.lookup("kappa")
|
||||
),
|
||||
Cp_
|
||||
(
|
||||
"Cp",
|
||||
dimensionSet(0, 2, -2, -1, 0),
|
||||
phaseDict_.lookup("Cp")
|
||||
),
|
||||
rho_
|
||||
(
|
||||
"rho",
|
||||
dimDensity,
|
||||
phaseDict_.lookup("rho")
|
||||
),
|
||||
U_
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
IOobject::groupName("U", phaseName),
|
||||
mesh.time().timeName(),
|
||||
mesh,
|
||||
IOobject::MUST_READ,
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
mesh
|
||||
),
|
||||
DDtU_
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
IOobject::groupName("DDtU", phaseName),
|
||||
mesh.time().timeName(),
|
||||
mesh
|
||||
),
|
||||
mesh,
|
||||
dimensionedVector("0", dimVelocity/dimTime, vector::zero)
|
||||
),
|
||||
phiAlpha_
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
IOobject::groupName("phiAlpha", phaseName),
|
||||
mesh.time().timeName(),
|
||||
mesh
|
||||
),
|
||||
mesh,
|
||||
dimensionedScalar("0", dimensionSet(0, 3, -1, 0, 0), 0)
|
||||
)
|
||||
{
|
||||
const word phiName = IOobject::groupName("phi", name_);
|
||||
|
||||
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])
|
||||
|| isA<slipFvPatchVectorField>(U_.boundaryField()[i])
|
||||
|| isA<partialSlipFvPatchVectorField>(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
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
dPtr_ = diameterModel::New
|
||||
(
|
||||
phaseDict_,
|
||||
*this
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::phaseModel::~phaseModel()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
Foam::autoPtr<Foam::phaseModel> Foam::phaseModel::clone() const
|
||||
{
|
||||
notImplemented("phaseModel::clone() const");
|
||||
return autoPtr<phaseModel>(NULL);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void Foam::phaseModel::correct()
|
||||
{
|
||||
//nuModel_->correct();
|
||||
}
|
||||
|
||||
|
||||
bool Foam::phaseModel::read(const dictionary& phaseDict)
|
||||
{
|
||||
phaseDict_ = phaseDict;
|
||||
|
||||
//if (nuModel_->read(phaseDict_))
|
||||
{
|
||||
phaseDict_.lookup("nu") >> nu_.value();
|
||||
phaseDict_.lookup("kappa") >> kappa_.value();
|
||||
phaseDict_.lookup("Cp") >> Cp_.value();
|
||||
phaseDict_.lookup("rho") >> rho_.value();
|
||||
|
||||
return true;
|
||||
}
|
||||
// else
|
||||
// {
|
||||
// return false;
|
||||
// }
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
Foam::tmp<Foam::volScalarField> Foam::phaseModel::d() const
|
||||
{
|
||||
return dPtr_().d();
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,227 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\/ 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/>.
|
||||
|
||||
Class
|
||||
Foam::phaseModel
|
||||
|
||||
SourceFiles
|
||||
phaseModel.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef phaseModel_H
|
||||
#define phaseModel_H
|
||||
|
||||
#include "dictionary.H"
|
||||
#include "dictionaryEntry.H"
|
||||
#include "dimensionedScalar.H"
|
||||
#include "volFields.H"
|
||||
#include "surfaceFields.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// Forward declarations
|
||||
class diameterModel;
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class phaseModel Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class phaseModel
|
||||
:
|
||||
public volScalarField
|
||||
{
|
||||
// Private data
|
||||
|
||||
//- Name of phase
|
||||
word name_;
|
||||
|
||||
dictionary phaseDict_;
|
||||
|
||||
//- Kinematic viscosity
|
||||
dimensionedScalar nu_;
|
||||
|
||||
//- Thermal conductivity
|
||||
dimensionedScalar kappa_;
|
||||
|
||||
//- Heat capacity
|
||||
dimensionedScalar Cp_;
|
||||
|
||||
//- Density
|
||||
dimensionedScalar rho_;
|
||||
|
||||
//- Velocity
|
||||
volVectorField U_;
|
||||
|
||||
//- Substantive derivative of the velocity
|
||||
volVectorField DDtU_;
|
||||
|
||||
//- Volumetric flux of the phase
|
||||
surfaceScalarField phiAlpha_;
|
||||
|
||||
//- Volumetric flux for the phase
|
||||
autoPtr<surfaceScalarField> phiPtr_;
|
||||
|
||||
//- Diameter model
|
||||
autoPtr<diameterModel> dPtr_;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
// Constructors
|
||||
|
||||
phaseModel
|
||||
(
|
||||
const word& phaseName,
|
||||
const dictionary& phaseDict,
|
||||
const fvMesh& mesh
|
||||
);
|
||||
|
||||
//- Return clone
|
||||
autoPtr<phaseModel> clone() const;
|
||||
|
||||
//- Return a pointer to a new phase created on freestore
|
||||
// from Istream
|
||||
class iNew
|
||||
{
|
||||
const fvMesh& mesh_;
|
||||
|
||||
public:
|
||||
|
||||
iNew
|
||||
(
|
||||
const fvMesh& mesh
|
||||
)
|
||||
:
|
||||
mesh_(mesh)
|
||||
{}
|
||||
|
||||
autoPtr<phaseModel> operator()(Istream& is) const
|
||||
{
|
||||
dictionaryEntry ent(dictionary::null, is);
|
||||
return autoPtr<phaseModel>
|
||||
(
|
||||
new phaseModel(ent.keyword(), ent, mesh_)
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~phaseModel();
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
const word& name() const
|
||||
{
|
||||
return name_;
|
||||
}
|
||||
|
||||
const word& keyword() const
|
||||
{
|
||||
return name();
|
||||
}
|
||||
|
||||
tmp<volScalarField> d() const;
|
||||
|
||||
const dimensionedScalar& nu() const
|
||||
{
|
||||
return nu_;
|
||||
}
|
||||
|
||||
const dimensionedScalar& kappa() const
|
||||
{
|
||||
return kappa_;
|
||||
}
|
||||
|
||||
const dimensionedScalar& Cp() const
|
||||
{
|
||||
return Cp_;
|
||||
}
|
||||
|
||||
const dimensionedScalar& rho() const
|
||||
{
|
||||
return rho_;
|
||||
}
|
||||
|
||||
const volVectorField& U() const
|
||||
{
|
||||
return U_;
|
||||
}
|
||||
|
||||
volVectorField& U()
|
||||
{
|
||||
return U_;
|
||||
}
|
||||
|
||||
const volVectorField& DDtU() const
|
||||
{
|
||||
return DDtU_;
|
||||
}
|
||||
|
||||
volVectorField& DDtU()
|
||||
{
|
||||
return DDtU_;
|
||||
}
|
||||
|
||||
const surfaceScalarField& phi() const
|
||||
{
|
||||
return phiPtr_();
|
||||
}
|
||||
|
||||
surfaceScalarField& phi()
|
||||
{
|
||||
return phiPtr_();
|
||||
}
|
||||
|
||||
const surfaceScalarField& phiAlpha() const
|
||||
{
|
||||
return phiAlpha_;
|
||||
}
|
||||
|
||||
surfaceScalarField& phiAlpha()
|
||||
{
|
||||
return phiAlpha_;
|
||||
}
|
||||
|
||||
//- Correct the phase properties
|
||||
void correct();
|
||||
|
||||
//- Read base transportProperties dictionary
|
||||
bool read(const dictionary& phaseDict);
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
Reference in New Issue
Block a user