openfoam/applications/solvers/multiphase/driftFluxFoam/incompressibleTwoPhaseInteractingMixture/incompressibleTwoPhaseInteractingMixture.C
Mark Olesen 13778f7647 ENH: use dictionary::readEntry for detection of input errors (#762, #1033)
- instead of   dict.lookup(name) >> val;
  can use      dict.readEntry(name, val);

  for checking of input token sizes.
  This helps catch certain types of input errors:

  {

      key1 ;                // <- Missing value
      key2 1234             // <- Missing ';' terminator
      key3 val;
  }

STYLE: readIfPresent() instead of 'if found ...' in a few more places.
2018-10-05 10:15:13 +02:00

157 lines
3.9 KiB
C

/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2014-2015 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 "incompressibleTwoPhaseInteractingMixture.H"
#include "addToRunTimeSelectionTable.H"
#include "surfaceFields.H"
#include "fvc.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
defineTypeNameAndDebug(incompressibleTwoPhaseInteractingMixture, 0);
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::incompressibleTwoPhaseInteractingMixture::
incompressibleTwoPhaseInteractingMixture
(
const volVectorField& U,
const surfaceScalarField& phi
)
:
IOdictionary
(
IOobject
(
"transportProperties",
U.time().constant(),
U.db(),
IOobject::MUST_READ_IF_MODIFIED,
IOobject::NO_WRITE
)
),
twoPhaseMixture(U.mesh(), *this),
muModel_
(
mixtureViscosityModel::New
(
"mu",
subDict(phase1Name_),
U,
phi
)
),
nucModel_
(
viscosityModel::New
(
"nuc",
subDict(phase2Name_),
U,
phi
)
),
rhod_("rho", dimDensity, muModel_->viscosityProperties()),
rhoc_("rho", dimDensity, nucModel_->viscosityProperties()),
dd_
(
"d",
dimLength,
muModel_->viscosityProperties().lookupOrDefault("d", 0.0)
),
alphaMax_(muModel_->viscosityProperties().lookupOrDefault("alphaMax", 1.0)),
U_(U),
phi_(phi),
mu_
(
IOobject
(
"mu",
U_.time().timeName(),
U_.db()
),
U_.mesh(),
dimensionedScalar(dimensionSet(1, -1, -1, 0, 0), Zero),
calculatedFvPatchScalarField::typeName
)
{
correct();
}
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
bool Foam::incompressibleTwoPhaseInteractingMixture::read()
{
if (regIOobject::read())
{
if
(
muModel_().read(subDict(phase1Name_))
&& nucModel_().read(subDict(phase2Name_))
)
{
muModel_->viscosityProperties().readEntry("rho", rhod_);
nucModel_->viscosityProperties().readEntry("rho", rhoc_);
dd_ = dimensionedScalar
(
"d",
dimLength,
muModel_->viscosityProperties().lookupOrDefault("d", 0)
);
alphaMax_ =
muModel_->viscosityProperties().lookupOrDefault
(
"alphaMax",
1.0
);
return true;
}
else
{
return false;
}
}
else
{
return false;
}
}
// ************************************************************************* //