interMixingFoam: Updated to using the new naming convention for phases

This commit is contained in:
Henry
2013-08-14 12:26:47 +01:00
parent af37ca2dec
commit 46dcabdb4d
12 changed files with 148 additions and 125 deletions

View File

@ -12,53 +12,6 @@
mesh mesh
); );
Info<< "Reading field alpha1\n" << endl;
volScalarField alpha1
(
IOobject
(
"alpha1",
runTime.timeName(),
mesh,
IOobject::MUST_READ,
IOobject::AUTO_WRITE
),
mesh
);
Info<< "Reading field alpha2\n" << endl;
volScalarField alpha2
(
IOobject
(
"alpha2",
runTime.timeName(),
mesh,
IOobject::MUST_READ,
IOobject::AUTO_WRITE
),
mesh
);
Info<< "Reading field alpha3\n" << endl;
volScalarField alpha3
(
IOobject
(
"alpha3",
runTime.timeName(),
mesh,
IOobject::MUST_READ,
IOobject::AUTO_WRITE
),
mesh
);
alpha3 == 1.0 - alpha1 - alpha2;
Info<< "Reading field U\n" << endl; Info<< "Reading field U\n" << endl;
volVectorField U volVectorField U
( (
@ -77,6 +30,10 @@
threePhaseMixture threePhaseProperties(U, phi); threePhaseMixture threePhaseProperties(U, phi);
volScalarField& alpha1(threePhaseProperties.alpha1());
volScalarField& alpha2(threePhaseProperties.alpha2());
volScalarField& alpha3(threePhaseProperties.alpha3());
const dimensionedScalar& rho1 = threePhaseProperties.rho1(); const dimensionedScalar& rho1 = threePhaseProperties.rho1();
const dimensionedScalar& rho2 = threePhaseProperties.rho2(); const dimensionedScalar& rho2 = threePhaseProperties.rho2();
const dimensionedScalar& rho3 = threePhaseProperties.rho3(); const dimensionedScalar& rho3 = threePhaseProperties.rho3();

View File

@ -62,9 +62,64 @@ Foam::threePhaseMixture::threePhaseMixture
) )
), ),
phase1Name_("phase1"), phase1Name_(wordList(lookup("phases"))[0]),
phase2Name_("phase2"), phase2Name_(wordList(lookup("phases"))[1]),
phase3Name_("phase3"), phase3Name_(wordList(lookup("phases"))[2]),
alpha1_
(
IOobject
(
IOobject::groupName("alpha", phase1Name_),
U.time().timeName(),
U.mesh(),
IOobject::MUST_READ,
IOobject::AUTO_WRITE
),
U.mesh()
),
alpha2_
(
IOobject
(
IOobject::groupName("alpha", phase2Name_),
U.time().timeName(),
U.mesh(),
IOobject::MUST_READ,
IOobject::AUTO_WRITE
),
U.mesh()
),
alpha3_
(
IOobject
(
IOobject::groupName("alpha", phase3Name_),
U.time().timeName(),
U.mesh(),
IOobject::MUST_READ,
IOobject::AUTO_WRITE
),
U.mesh()
),
U_(U),
phi_(phi),
nu_
(
IOobject
(
"nu",
U.time().timeName(),
U.db()
),
U.mesh(),
dimensionedScalar("nu", dimensionSet(0, 2, -1, 0, 0), 0),
calculatedFvPatchScalarField::typeName
),
nuModel1_ nuModel1_
( (
@ -99,28 +154,9 @@ Foam::threePhaseMixture::threePhaseMixture
rho1_(nuModel1_->viscosityProperties().lookup("rho")), rho1_(nuModel1_->viscosityProperties().lookup("rho")),
rho2_(nuModel2_->viscosityProperties().lookup("rho")), rho2_(nuModel2_->viscosityProperties().lookup("rho")),
rho3_(nuModel3_->viscosityProperties().lookup("rho")), rho3_(nuModel3_->viscosityProperties().lookup("rho"))
U_(U),
phi_(phi),
alpha1_(U_.db().lookupObject<const volScalarField> ("alpha1")),
alpha2_(U_.db().lookupObject<const volScalarField> ("alpha2")),
alpha3_(U_.db().lookupObject<const volScalarField> ("alpha3")),
nu_
(
IOobject
(
"nu",
U_.time().timeName(),
U_.db()
),
U_.mesh(),
dimensionedScalar("nu", dimensionSet(0, 2, -1, 0, 0), 0),
calculatedFvPatchScalarField::typeName
)
{ {
alpha3_ == 1.0 - alpha1_ - alpha2_;
calcNu(); calcNu();
} }

View File

@ -60,6 +60,15 @@ class threePhaseMixture
word phase2Name_; word phase2Name_;
word phase3Name_; word phase3Name_;
volScalarField alpha1_;
volScalarField alpha2_;
volScalarField alpha3_;
const volVectorField& U_;
const surfaceScalarField& phi_;
volScalarField nu_;
autoPtr<viscosityModel> nuModel1_; autoPtr<viscosityModel> nuModel1_;
autoPtr<viscosityModel> nuModel2_; autoPtr<viscosityModel> nuModel2_;
autoPtr<viscosityModel> nuModel3_; autoPtr<viscosityModel> nuModel3_;
@ -68,15 +77,6 @@ class threePhaseMixture
dimensionedScalar rho2_; dimensionedScalar rho2_;
dimensionedScalar rho3_; dimensionedScalar rho3_;
const volVectorField& U_;
const surfaceScalarField& phi_;
const volScalarField& alpha1_;
const volScalarField& alpha2_;
const volScalarField& alpha3_;
volScalarField nu_;
// Private Member Functions // Private Member Functions
@ -103,22 +103,49 @@ public:
// Member Functions // Member Functions
//- Return const-access to phase1 viscosityModel const word phase1Name() const
const viscosityModel& nuModel1() const
{ {
return nuModel1_(); return phase1Name_;
} }
//- Return const-access to phase2 viscosityModel const word phase2Name() const
const viscosityModel& nuModel2() const
{ {
return nuModel2_(); return phase2Name_;
} }
//- Return const-access to phase3 viscosityModel const word phase3Name() const
const viscosityModel& nuModel3() const
{ {
return nuModel3_(); return phase3Name_;
}
const volScalarField& alpha1() const
{
return alpha1_;
}
volScalarField& alpha1()
{
return alpha1_;
}
const volScalarField& alpha2() const
{
return alpha2_;
}
volScalarField& alpha2()
{
return alpha2_;
}
const volScalarField& alpha3() const
{
return alpha3_;
}
volScalarField& alpha3()
{
return alpha3_;
} }
//- Return const-access to phase1 density //- Return const-access to phase1 density
@ -139,21 +166,6 @@ public:
return rho3_; return rho3_;
}; };
const volScalarField& alpha1() const
{
return alpha1_;
}
const volScalarField& alpha2() const
{
return alpha2_;
}
const volScalarField& alpha3() const
{
return alpha3_;
}
//- Return the velocity //- Return the velocity
const volVectorField& U() const const volVectorField& U() const
{ {
@ -166,6 +178,24 @@ public:
return phi_; return phi_;
} }
//- Return const-access to phase1 viscosityModel
const viscosityModel& nuModel1() const
{
return nuModel1_();
}
//- Return const-access to phase2 viscosityModel
const viscosityModel& nuModel2() const
{
return nuModel2_();
}
//- Return const-access to phase3 viscosityModel
const viscosityModel& nuModel3() const
{
return nuModel3_();
}
//- Return the dynamic laminar viscosity //- Return the dynamic laminar viscosity
tmp<volScalarField> mu() const; tmp<volScalarField> mu() const;

View File

@ -10,7 +10,7 @@ FoamFile
version 2.0; version 2.0;
format ascii; format ascii;
class volScalarField; class volScalarField;
object alpha1; object alpha.air;
} }
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -5,9 +5,9 @@ cd ${0%/*} || exit 1 # run from this directory
. $WM_PROJECT_DIR/bin/tools/RunFunctions . $WM_PROJECT_DIR/bin/tools/RunFunctions
runApplication blockMesh runApplication blockMesh
cp 0/alpha1.org 0/alpha1 cp 0/alpha.air.org 0/alpha.air
cp 0/alpha2.org 0/alpha2 cp 0/alpha.other.org 0/alpha.other
cp 0/alpha3.org 0/alpha3 cp 0/alpha.water.org 0/alpha.water
runApplication setFields runApplication setFields
runApplication `getApplication` runApplication `getApplication`

View File

@ -44,6 +44,7 @@ FoamFile
defaultFaces defaultFaces
{ {
type empty; type empty;
inGroups 1(empty);
nFaces 4536; nFaces 4536;
startFace 4640; startFace 4640;
} }

View File

@ -15,24 +15,23 @@ FoamFile
} }
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// Air phases (air other water);
phase1
air
{ {
transportModel Newtonian; transportModel Newtonian;
nu nu [0 2 -1 0 0 0 0] 1.48e-05; nu nu [0 2 -1 0 0 0 0] 1.48e-05;
rho rho [1 -3 0 0 0 0 0] 1; rho rho [1 -3 0 0 0 0 0] 1;
} }
// Other Liquid other
phase2
{ {
transportModel Newtonian; transportModel Newtonian;
nu nu [0 2 -1 0 0 0 0] 1e-6; nu nu [0 2 -1 0 0 0 0] 1e-6;
rho rho [1 -3 0 0 0 0 0] 1010; rho rho [1 -3 0 0 0 0 0] 1010;
} }
// Water water
phase3
{ {
transportModel Newtonian; transportModel Newtonian;
nu nu [0 2 -1 0 0 0 0] 1e-6; nu nu [0 2 -1 0 0 0 0] 1e-6;

View File

@ -53,7 +53,7 @@ fluxRequired
default no; default no;
p_rgh; p_rgh;
pcorr; pcorr;
"alpha."; "alpha.*";
} }

View File

@ -17,7 +17,7 @@ FoamFile
solvers solvers
{ {
"alpha." "alpha.*"
{ {
nAlphaCorr 1; nAlphaCorr 1;
nAlphaSubCycles 2; nAlphaSubCycles 2;

View File

@ -17,9 +17,9 @@ FoamFile
defaultFieldValues defaultFieldValues
( (
volScalarFieldValue alpha1 0 volScalarFieldValue alpha.air 0
volScalarFieldValue alpha2 1 volScalarFieldValue alpha.other 1
volScalarFieldValue alpha3 0 volScalarFieldValue alpha.water 0
); );
regions regions
@ -29,9 +29,9 @@ regions
box (0 0 -1) (0.1461 0.292 1); box (0 0 -1) (0.1461 0.292 1);
fieldValues fieldValues
( (
volScalarFieldValue alpha1 0 volScalarFieldValue alpha.air 0
volScalarFieldValue alpha2 0 volScalarFieldValue alpha.other 0
volScalarFieldValue alpha3 1 volScalarFieldValue alpha.water 1
); );
} }
boxToCell boxToCell
@ -39,9 +39,9 @@ regions
box (0.1461 0.05 -1) (1 1 1); box (0.1461 0.05 -1) (1 1 1);
fieldValues fieldValues
( (
volScalarFieldValue alpha1 1 volScalarFieldValue alpha.air 1
volScalarFieldValue alpha2 0 volScalarFieldValue alpha.other 0
volScalarFieldValue alpha3 0 volScalarFieldValue alpha.water 0
); );
} }
); );