Commit b9275431 authored by Henry Weller's avatar Henry Weller
Browse files

reactingTwoPhaseEulerFoam::IATE: Added phaseChange source

to handle the effect of condensation and evaporation on bubble size
parent 803f4e66
......@@ -257,6 +257,73 @@ Foam::ThermalPhaseChangePhaseSystem<BasePhaseSystem>::massTransfer() const
}
template<class BasePhaseSystem>
Foam::tmp<Foam::volScalarField>
Foam::ThermalPhaseChangePhaseSystem<BasePhaseSystem>::iDmdt
(
const phasePairKey& key
) const
{
const scalar dmdtSign(Pair<word>::compare(iDmdt_.find(key).key(), key));
return dmdtSign**iDmdt_[key];
}
template<class BasePhaseSystem>
Foam::tmp<Foam::volScalarField>
Foam::ThermalPhaseChangePhaseSystem<BasePhaseSystem>::iDmdt
(
const Foam::phaseModel& phase
) const
{
tmp<volScalarField> tiDmdt
(
new volScalarField
(
IOobject
(
IOobject::groupName("iDmdt", phase.name()),
this->mesh_.time().timeName(),
this->mesh_
),
this->mesh_,
dimensionedScalar("zero", dimDensity/dimTime, 0)
)
);
forAllConstIter
(
phaseSystem::phasePairTable,
this->phasePairs_,
phasePairIter
)
{
const phasePair& pair(phasePairIter());
if (pair.ordered())
{
continue;
}
const phaseModel* phase1 = &pair.phase1();
const phaseModel* phase2 = &pair.phase2();
forAllConstIter(phasePair, pair, iter)
{
if (phase1 == &phase)
{
tiDmdt.ref() += this->iDmdt(pair);
}
Swap(phase1, phase2);
}
}
return tiDmdt;
}
template<class BasePhaseSystem>
void Foam::ThermalPhaseChangePhaseSystem<BasePhaseSystem>::correctThermo()
{
......@@ -265,8 +332,6 @@ void Foam::ThermalPhaseChangePhaseSystem<BasePhaseSystem>::correctThermo()
BasePhaseSystem::correctThermo();
forAllConstIter
(
phaseSystem::phasePairTable,
......
......@@ -101,6 +101,12 @@ public:
//- Return the mass transfer matrices
virtual autoPtr<phaseSystem::massTransferTable> massTransfer() const;
//- Return the interfacial mass flow rate
virtual tmp<volScalarField> iDmdt(const phasePairKey& key) const;
//- Return the total interfacial mass transfer rate for phase
virtual tmp<volScalarField> iDmdt(const phaseModel& phase) const;
//- Correct the thermodynamics
virtual void correctThermo();
......
......@@ -257,10 +257,12 @@ void alphatWallBoilingWallFunctionFvPatchScalarField::updateCoeffs()
}
// Lookup the fluid model
const ThermalPhaseChangePhaseSystem<MomentumTransferPhaseSystem
const ThermalPhaseChangePhaseSystem
<
twoPhaseSystem>
>& fluid = refCast
MomentumTransferPhaseSystem
<
twoPhaseSystem>
>& fluid = refCast
<
const ThermalPhaseChangePhaseSystem
<
......
......@@ -61,6 +61,7 @@ Foam::diameterModels::IATEsources::wallBoiling::wallBoiling
Foam::tmp<Foam::fvScalarMatrix>
Foam::diameterModels::IATEsources::wallBoiling::R
(
const volScalarField& alphai,
volScalarField& kappai
) const
{
......@@ -129,7 +130,8 @@ Foam::diameterModels::IATEsources::wallBoiling::R
if (dmdt[facei] > SMALL)
{
const label faceCelli = faceCells[facei];
R[faceCelli] = (dmdt[facei]/rho[faceCelli]);
R[faceCelli] =
dmdt[facei]/(alphai[faceCelli]*rho[faceCelli]);
Rdk[faceCelli] = R[faceCelli]*(6.0/dDep[facei]);
}
}
......
......@@ -77,7 +77,11 @@ public:
// Member Functions
virtual tmp<fvScalarMatrix> R(volScalarField& kappai) const;
virtual tmp<fvScalarMatrix> R
(
const volScalarField& alphai,
volScalarField& kappai
) const;
};
......
......@@ -3,6 +3,7 @@ diameterModels/IATE/IATEsources/IATEsource/IATEsource.C
diameterModels/IATE/IATEsources/wakeEntrainmentCoalescence/wakeEntrainmentCoalescence.C
diameterModels/IATE/IATEsources/turbulentBreakUp/turbulentBreakUp.C
diameterModels/IATE/IATEsources/randomCoalescence/randomCoalescence.C
diameterModels/IATE/IATEsources/phaseChange/phaseChange.C
twoPhaseSystem.C
newTwoPhaseSystem.C
......
......@@ -118,19 +118,21 @@ Foam::tmp<Foam::volScalarField> Foam::diameterModels::IATE::dsm() const
void Foam::diameterModels::IATE::correct()
{
volScalarField alphaAv
(
max
(
fvc::average(phase_ + phase_.oldTime()),
residualAlpha_
)
);
// Initialise the accumulated source term to the dilatation effect
fvScalarMatrix R
(
-fvm::SuSp
(
(
(1.0/3.0)
/max
(
fvc::average(phase_ + phase_.oldTime()),
residualAlpha_
)
)
((1.0/3.0)/alphaAv)
*(
fvc::ddt(phase_) + fvc::div(phase_.alphaPhi())
- phase_.continuityError()/phase_.rho()
......@@ -142,7 +144,7 @@ void Foam::diameterModels::IATE::correct()
// Accumulate the run-time selectable sources
forAll(sources_, j)
{
R += sources_[j].R(kappai_);
R += sources_[j].R(alphaAv, kappai_);
}
fv::options& fvOptions(fv::options::New(phase_.mesh()));
......
......@@ -177,7 +177,11 @@ public:
//- Return the bubble Webber number
tmp<volScalarField> We() const;
virtual tmp<fvScalarMatrix> R(volScalarField& kappai) const = 0;
virtual tmp<fvScalarMatrix> R
(
const volScalarField& alphai,
volScalarField& kappai
) const = 0;
};
......
......@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2013-2015 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2013-2016 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
......@@ -43,23 +43,26 @@ namespace IATEsources
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
Foam::tmp<Foam::volScalarField>
Foam::diameterModels::IATEsources::dummy::R() const
Foam::tmp<Foam::fvScalarMatrix>
Foam::diameterModels::IATEsources::dummy::R
(
const volScalarField& alphai,
volScalarField& kappai
) const
{
return tmp<volScalarField>
volScalarField::Internal R
(
new volScalarField
IOobject
(
IOobject
(
"R",
iate_.phase().U().time().timeName(),
iate_.phase().mesh()
),
iate_.phase().U().mesh(),
dimensionedScalar("R", dimless/dimTime, 0)
)
"dummy:R",
iate_.phase().time().timeName(),
iate_.phase().mesh()
),
iate_.phase().mesh(),
dimensionedScalar("R", kappai.dimensions()/dimTime, 0)
);
return fvm::Su(R, kappai);
}
......
......@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2013-2015 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2013-2016 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
......@@ -79,7 +79,11 @@ public:
// Member Functions
virtual tmp<volScalarField> R() const;
virtual tmp<fvScalarMatrix> R
(
const volScalarField& alphai,
volScalarField& kappai
) const;
};
......
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2016 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 "phaseChange.H"
#include "twoPhaseSystem.H"
#include "phaseSystem.H"
#include "ThermalPhaseChangePhaseSystem.H"
#include "MomentumTransferPhaseSystem.H"
#include "fvmSup.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
namespace diameterModels
{
namespace IATEsources
{
defineTypeNameAndDebug(phaseChange, 0);
addToRunTimeSelectionTable(IATEsource, phaseChange, dictionary);
}
}
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::diameterModels::IATEsources::phaseChange::phaseChange
(
const IATE& iate,
const dictionary& dict
)
:
IATEsource(iate)
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
Foam::tmp<Foam::fvScalarMatrix>
Foam::diameterModels::IATEsources::phaseChange::R
(
const volScalarField& alphai,
volScalarField& kappai
) const
{
const ThermalPhaseChangePhaseSystem
<
MomentumTransferPhaseSystem
<
twoPhaseSystem
>
>& phaseChangeFluid = refCast
<
const ThermalPhaseChangePhaseSystem
<
MomentumTransferPhaseSystem<twoPhaseSystem>
>
>(fluid());
return -fvm::SuSp
(
(1.0/3.0)
*phaseChangeFluid.iDmdt(phase())()()
/(alphai()*phase().rho()()),
kappai
);
}
// ************************************************************************* //
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2016 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::diameterModels::IATEsources::phaseChange
Description
Phase-change IATE source.
SourceFiles
phaseChange.C
\*---------------------------------------------------------------------------*/
#ifndef phaseChange_H
#define phaseChange_H
#include "IATEsource.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace diameterModels
{
namespace IATEsources
{
/*---------------------------------------------------------------------------*\
Class phaseChange Declaration
\*---------------------------------------------------------------------------*/
class phaseChange
:
public IATEsource
{
public:
//- Runtime type information
TypeName("phaseChange");
// Constructors
phaseChange
(
const IATE& iate,
const dictionary& dict
);
//- Destructor
virtual ~phaseChange()
{}
// Member Functions
virtual tmp<fvScalarMatrix> R
(
const volScalarField& alphai,
volScalarField& kappai
) const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace IATEsources
} // End namespace diameterModels
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //
......@@ -63,6 +63,7 @@ randomCoalescence
Foam::tmp<Foam::fvScalarMatrix>
Foam::diameterModels::IATEsources::randomCoalescence::R
(
const volScalarField& alphai,
volScalarField& kappai
) const
{
......
......@@ -89,7 +89,11 @@ public:
// Member Functions
virtual tmp<fvScalarMatrix> R(volScalarField& kappai) const;
virtual tmp<fvScalarMatrix> R
(
const volScalarField& alphai,
volScalarField& kappai
) const;
};
......
......@@ -62,6 +62,7 @@ turbulentBreakUp
Foam::tmp<Foam::fvScalarMatrix>
Foam::diameterModels::IATEsources::turbulentBreakUp::R
(
const volScalarField& alphai,
volScalarField& kappai
) const
{
......
......@@ -87,7 +87,11 @@ public:
// Member Functions
virtual tmp<fvScalarMatrix> R(volScalarField& kappai) const;
virtual tmp<fvScalarMatrix> R
(
const volScalarField& alphai,
volScalarField& kappai
) const;
};
......
......@@ -66,6 +66,7 @@ wakeEntrainmentCoalescence
Foam::tmp<Foam::fvScalarMatrix>
Foam::diameterModels::IATEsources::wakeEntrainmentCoalescence::R
(
const volScalarField& alphai,
volScalarField& kappai
) const
{
......
......@@ -86,7 +86,11 @@ public:
// Member Functions
virtual tmp<fvScalarMatrix> R(volScalarField& kappai) const;
virtual tmp<fvScalarMatrix> R
(
const volScalarField& alphai,
volScalarField& kappai
) const;