twoPhaseMixture: Added support for named phases

e.g. in transportProperties

phases (air water);
This commit is contained in:
Henry 2012-04-16 11:46:35 +01:00
parent 25504bf856
commit aa7c66a3ff
5 changed files with 54 additions and 66 deletions

View File

@ -25,38 +25,6 @@
mesh
);
volScalarField gamma
(
IOobject
(
"gamma",
runTime.timeName(),
mesh,
IOobject::NO_READ,
IOobject::AUTO_WRITE
),
max(min((rho - rholSat)/(rhovSat - rholSat), scalar(1)), scalar(0))
);
gamma.oldTime();
Info<< "Creating compressibilityModel\n" << endl;
autoPtr<barotropicCompressibilityModel> psiModel =
barotropicCompressibilityModel::New
(
thermodynamicProperties,
gamma
);
const volScalarField& psi = psiModel->psi();
rho == max
(
psi*p
+ (1.0 - gamma)*rhol0
+ ((gamma*psiv + (1.0 - gamma)*psil) - psi)*pSat,
rhoMin
);
Info<< "Reading field U\n" << endl;
volVectorField U
(
@ -78,6 +46,27 @@
twoPhaseMixture twoPhaseProperties(U, phiv, "gamma");
volScalarField& gamma(twoPhaseProperties.alpha1());
gamma.oldTime();
Info<< "Creating compressibilityModel\n" << endl;
autoPtr<barotropicCompressibilityModel> psiModel =
barotropicCompressibilityModel::New
(
thermodynamicProperties,
gamma
);
const volScalarField& psi = psiModel->psi();
rho == max
(
psi*p
+ (1.0 - gamma)*rhol0
+ ((gamma*psiv + (1.0 - gamma)*psil) - psi)*pSat,
rhoMin
);
// Create incompressible turbulence model
autoPtr<incompressible::turbulenceModel> turbulence
(

View File

@ -12,20 +12,6 @@
mesh
);
Info<< "Reading field alpha1\n" << endl;
volScalarField alpha1
(
IOobject
(
"alpha1",
runTime.timeName(),
mesh,
IOobject::MUST_READ,
IOobject::AUTO_WRITE
),
mesh
);
Info<< "Reading field U\n" << endl;
volVectorField U
(
@ -46,6 +32,8 @@
Info<< "Reading transportProperties\n" << endl;
twoPhaseMixture twoPhaseProperties(U, phi);
volScalarField& alpha1(twoPhaseProperties.alpha1());
const dimensionedScalar& rho1 = twoPhaseProperties.rho1();
const dimensionedScalar& rho2 = twoPhaseProperties.rho2();

View File

@ -12,20 +12,6 @@
mesh
);
Info<< "Reading field alpha1\n" << endl;
volScalarField alpha1
(
IOobject
(
"alpha1",
runTime.timeName(),
mesh,
IOobject::MUST_READ,
IOobject::AUTO_WRITE
),
mesh
);
Info<< "Reading field U\n" << endl;
volVectorField U
(
@ -45,6 +31,8 @@
Info<< "Reading transportProperties\n" << endl;
twoPhaseMixture twoPhaseProperties(U, phi);
volScalarField& alpha1(twoPhaseProperties.alpha1());
const dimensionedScalar& rho1 = twoPhaseProperties.rho1();
const dimensionedScalar& rho2 = twoPhaseProperties.rho2();

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -59,8 +59,8 @@ Foam::twoPhaseMixture::twoPhaseMixture
:
transportModel(U, phi),
phase1Name_("phase1"),
phase2Name_("phase2"),
phase1Name_(found("phases") ? wordList(lookup("phases"))[0] : "phase1"),
phase2Name_(found("phases") ? wordList(lookup("phases"))[1] : "phase2"),
nuModel1_
(
@ -89,7 +89,18 @@ Foam::twoPhaseMixture::twoPhaseMixture
U_(U),
phi_(phi),
alpha1_(U_.db().lookupObject<const volScalarField> (alpha1Name)),
alpha1_
(
IOobject
(
found("phases") ? word("alpha" + phase1Name_) : alpha1Name,
U_.time().timeName(),
U_.db(),
IOobject::MUST_READ,
IOobject::AUTO_WRITE
),
U_.mesh()
),
nu_
(

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -69,7 +69,7 @@ protected:
const volVectorField& U_;
const surfaceScalarField& phi_;
const volScalarField& alpha1_;
volScalarField alpha1_;
volScalarField nu_;
@ -110,6 +110,18 @@ public:
return phase2Name_;
}
//- Return the phase-fraction of phase 1
const volScalarField& alpha1() const
{
return alpha1_;
}
//- Return the phase-fraction of phase 1
volScalarField& alpha1()
{
return alpha1_;
}
//- Return const-access to phase1 viscosityModel
const viscosityModel& nuModel1() const
{