Skip to content
Snippets Groups Projects
Commit 4ff31e73 authored by Henry's avatar Henry
Browse files

multiphaseEulerFoam: Added support for MRF and different schemes for each phase-fraction

Corrected tutorials
parent 612150de
No related branches found
No related tags found
No related merge requests found
Showing
with 24 additions and 355 deletions
...@@ -3,8 +3,8 @@ cd ${0%/*} || exit 1 # run from this directory ...@@ -3,8 +3,8 @@ cd ${0%/*} || exit 1 # run from this directory
set -x set -x
wmake libso phaseModel wmake libso phaseModel
wmake libso multiphaseSystem
wmake libso interfacialModels wmake libso interfacialModels
wmake libso multiphaseSystem
wmake libso kineticTheoryModels wmake libso kineticTheoryModels
wmake wmake
......
EXE_INC = -ggdb3 \ EXE_INC = \
-IphaseModel/lnInclude \ -IphaseModel/lnInclude \
-ImultiphaseSystem/lnInclude \ -ImultiphaseSystem/lnInclude \
/*-IkineticTheoryModels/lnInclude*/ \ /*-IkineticTheoryModels/lnInclude*/ \
......
...@@ -33,7 +33,7 @@ forAllIter(PtrDictionary<phaseModel>, fluid.phases(), iter) ...@@ -33,7 +33,7 @@ forAllIter(PtrDictionary<phaseModel>, fluid.phases(), iter)
+ (alpha/phase.rho())*fluid.Svm(phase) + (alpha/phase.rho())*fluid.Svm(phase)
) )
); );
mrfZones.addCoriolis(UEqns[phasei]); mrfZones.addCoriolis(alpha, UEqns[phasei]);
UEqns[phasei].relax(); UEqns[phasei].relax();
phasei++; phasei++;
......
EXE_INC = -ggdb3 \ EXE_INC = \
-I../phaseModel/lnInclude \ -I../phaseModel/lnInclude \
-I../interfacialModels/lnInclude \ -I../interfacialModels/lnInclude \
-IalphaContactAngle \ -IalphaContactAngle \
......
...@@ -56,9 +56,6 @@ void Foam::multiphaseSystem::calcAlphas() ...@@ -56,9 +56,6 @@ void Foam::multiphaseSystem::calcAlphas()
void Foam::multiphaseSystem::solveAlphas() void Foam::multiphaseSystem::solveAlphas()
{ {
word alphaScheme("div(phi,alpha)");
word alpharScheme("div(phirb,alpha)");
surfaceScalarField phic(mag(phi_/mesh_.magSf())); surfaceScalarField phic(mag(phi_/mesh_.magSf()));
PtrList<surfaceScalarField> phiAlphaCorrs(phases_.size()); PtrList<surfaceScalarField> phiAlphaCorrs(phases_.size());
...@@ -67,6 +64,7 @@ void Foam::multiphaseSystem::solveAlphas() ...@@ -67,6 +64,7 @@ void Foam::multiphaseSystem::solveAlphas()
forAllIter(PtrDictionary<phaseModel>, phases_, iter) forAllIter(PtrDictionary<phaseModel>, phases_, iter)
{ {
phaseModel& phase1 = iter(); phaseModel& phase1 = iter();
volScalarField& alpha1 = phase1;
phase1.phiAlpha() = phase1.phiAlpha() =
dimensionedScalar("0", dimensionSet(0, 3, -1, 0, 0), 0); dimensionedScalar("0", dimensionSet(0, 3, -1, 0, 0), 0);
...@@ -80,7 +78,7 @@ void Foam::multiphaseSystem::solveAlphas() ...@@ -80,7 +78,7 @@ void Foam::multiphaseSystem::solveAlphas()
( (
phi_, phi_,
phase1, phase1,
alphaScheme "div(phi," + alpha1.name() + ')'
) )
) )
); );
...@@ -90,6 +88,7 @@ void Foam::multiphaseSystem::solveAlphas() ...@@ -90,6 +88,7 @@ void Foam::multiphaseSystem::solveAlphas()
forAllIter(PtrDictionary<phaseModel>, phases_, iter2) forAllIter(PtrDictionary<phaseModel>, phases_, iter2)
{ {
phaseModel& phase2 = iter2(); phaseModel& phase2 = iter2();
volScalarField& alpha2 = phase2;
if (&phase2 == &phase1) continue; if (&phase2 == &phase1) continue;
...@@ -100,11 +99,13 @@ void Foam::multiphaseSystem::solveAlphas() ...@@ -100,11 +99,13 @@ void Foam::multiphaseSystem::solveAlphas()
*nHatf(phase1, phase2) *nHatf(phase1, phase2)
); );
word phirScheme("div(phir," + alpha2.name() + ',' + alpha1.name() + ')');
phiAlphaCorr += fvc::flux phiAlphaCorr += fvc::flux
( (
-fvc::flux(-phir, phase2, alpharScheme), -fvc::flux(-phir, phase2, phirScheme),
phase1, phase1,
alpharScheme phirScheme
); );
} }
......
...@@ -133,7 +133,6 @@ $(derivedFvPatchFields)/fan/fanFvPatchFields.C ...@@ -133,7 +133,6 @@ $(derivedFvPatchFields)/fan/fanFvPatchFields.C
$(derivedFvPatchFields)/fanPressure/fanPressureFvPatchScalarField.C $(derivedFvPatchFields)/fanPressure/fanPressureFvPatchScalarField.C
$(derivedFvPatchFields)/buoyantPressure/buoyantPressureFvPatchScalarField.C $(derivedFvPatchFields)/buoyantPressure/buoyantPressureFvPatchScalarField.C
$(derivedFvPatchFields)/fixedFluxPressure/fixedFluxPressureFvPatchScalarField.C $(derivedFvPatchFields)/fixedFluxPressure/fixedFluxPressureFvPatchScalarField.C
$(derivedFvPatchFields)/multiphaseFixedFluxPressure/multiphaseFixedFluxPressureFvPatchScalarField.C
$(derivedFvPatchFields)/fixedInternalValueFvPatchField/fixedInternalValueFvPatchFields.C $(derivedFvPatchFields)/fixedInternalValueFvPatchField/fixedInternalValueFvPatchFields.C
$(derivedFvPatchFields)/fixedNormalSlip/fixedNormalSlipFvPatchFields.C $(derivedFvPatchFields)/fixedNormalSlip/fixedNormalSlipFvPatchFields.C
$(derivedFvPatchFields)/fixedPressureCompressibleDensity/fixedPressureCompressibleDensityFvPatchScalarField.C $(derivedFvPatchFields)/fixedPressureCompressibleDensity/fixedPressureCompressibleDensityFvPatchScalarField.C
......
/*---------------------------------------------------------------------------*\
========= |
\\ / 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/>.
\*---------------------------------------------------------------------------*/
#include "multiphaseFixedFluxPressureFvPatchScalarField.H"
#include "fvPatchFieldMapper.H"
#include "volFields.H"
#include "surfaceFields.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::multiphaseFixedFluxPressureFvPatchScalarField::
multiphaseFixedFluxPressureFvPatchScalarField
(
const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF
)
:
fixedGradientFvPatchScalarField(p, iF),
UName_("U"),
phiName_("phi"),
rhoName_("rho")
{}
Foam::multiphaseFixedFluxPressureFvPatchScalarField::
multiphaseFixedFluxPressureFvPatchScalarField
(
const multiphaseFixedFluxPressureFvPatchScalarField& ptf,
const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF,
const fvPatchFieldMapper& mapper
)
:
fixedGradientFvPatchScalarField(ptf, p, iF, mapper),
UName_(ptf.UName_),
phiName_(ptf.phiName_),
rhoName_(ptf.rhoName_)
{}
Foam::multiphaseFixedFluxPressureFvPatchScalarField::
multiphaseFixedFluxPressureFvPatchScalarField
(
const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF,
const dictionary& dict
)
:
fixedGradientFvPatchScalarField(p, iF),
UName_(dict.lookupOrDefault<word>("U", "U")),
phiName_(dict.lookupOrDefault<word>("phi", "phi")),
rhoName_(dict.lookupOrDefault<word>("rho", "rho"))
{
if (dict.found("gradient"))
{
gradient() = scalarField("gradient", dict, p.size());
fixedGradientFvPatchScalarField::updateCoeffs();
fixedGradientFvPatchScalarField::evaluate();
}
else
{
fvPatchField<scalar>::operator=(patchInternalField());
gradient() = 0.0;
}
}
Foam::multiphaseFixedFluxPressureFvPatchScalarField::
multiphaseFixedFluxPressureFvPatchScalarField
(
const multiphaseFixedFluxPressureFvPatchScalarField& wbppsf
)
:
fixedGradientFvPatchScalarField(wbppsf),
UName_(wbppsf.UName_),
phiName_(wbppsf.phiName_),
rhoName_(wbppsf.rhoName_)
{}
Foam::multiphaseFixedFluxPressureFvPatchScalarField::
multiphaseFixedFluxPressureFvPatchScalarField
(
const multiphaseFixedFluxPressureFvPatchScalarField& wbppsf,
const DimensionedField<scalar, volMesh>& iF
)
:
fixedGradientFvPatchScalarField(wbppsf, iF),
UName_(wbppsf.UName_),
phiName_(wbppsf.phiName_),
rhoName_(wbppsf.rhoName_)
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::multiphaseFixedFluxPressureFvPatchScalarField::updateCoeffs()
{
if (updated())
{
return;
}
const fvPatchField<vector>& Up =
patch().lookupPatchField<volVectorField, vector>(UName_);
const surfaceScalarField& phi =
db().lookupObject<surfaceScalarField>(phiName_);
fvsPatchField<scalar> phip =
patch().patchField<surfaceScalarField, scalar>(phi);
if (phi.dimensions() == dimDensity*dimVelocity*dimArea)
{
const fvPatchField<scalar>& rhop =
patch().lookupPatchField<volScalarField, scalar>(rhoName_);
phip /= rhop;
}
const fvsPatchField<scalar>& Dpp =
patch().lookupPatchField<surfaceScalarField, scalar>("Dp");
gradient() = (phip - (patch().Sf() & Up))/patch().magSf()/Dpp;
fixedGradientFvPatchScalarField::updateCoeffs();
}
void Foam::multiphaseFixedFluxPressureFvPatchScalarField::write
(
Ostream& os
) const
{
fvPatchScalarField::write(os);
writeEntryIfDifferent<word>(os, "U", "U", UName_);
writeEntryIfDifferent<word>(os, "phi", "phi", phiName_);
writeEntryIfDifferent<word>(os, "rho", "rho", rhoName_);
gradient().writeEntry("gradient", os);
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
makePatchTypeField
(
fvPatchScalarField,
multiphaseFixedFluxPressureFvPatchScalarField
);
}
// ************************************************************************* //
/*---------------------------------------------------------------------------*\
========= |
\\ / 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::multiphaseFixedFluxPressureFvPatchScalarField
Description
Foam::multiphaseFixedFluxPressureFvPatchScalarField
SourceFiles
multiphaseFixedFluxPressureFvPatchScalarField.C
\*---------------------------------------------------------------------------*/
#ifndef multiphaseFixedFluxPressureFvPatchScalarFields_H
#define multiphaseFixedFluxPressureFvPatchScalarFields_H
#include "fvPatchFields.H"
#include "fixedGradientFvPatchFields.H"
#include "Switch.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class multiphaseFixedFluxPressureFvPatch Declaration
\*---------------------------------------------------------------------------*/
class multiphaseFixedFluxPressureFvPatchScalarField
:
public fixedGradientFvPatchScalarField
{
// Private data
//- Name of the velocity field
word UName_;
//- Name of the flux transporting the field
word phiName_;
//- Name of the density field used to normalise the mass flux
// if neccessary
word rhoName_;
public:
//- Runtime type information
TypeName("multiphaseFixedFluxPressure");
// Constructors
//- Construct from patch and internal field
multiphaseFixedFluxPressureFvPatchScalarField
(
const fvPatch&,
const DimensionedField<scalar, volMesh>&
);
//- Construct from patch, internal field and dictionary
multiphaseFixedFluxPressureFvPatchScalarField
(
const fvPatch&,
const DimensionedField<scalar, volMesh>&,
const dictionary&
);
//- Construct by mapping given
// multiphaseFixedFluxPressureFvPatchScalarField onto a new patch
multiphaseFixedFluxPressureFvPatchScalarField
(
const multiphaseFixedFluxPressureFvPatchScalarField&,
const fvPatch&,
const DimensionedField<scalar, volMesh>&,
const fvPatchFieldMapper&
);
//- Construct as copy
multiphaseFixedFluxPressureFvPatchScalarField
(
const multiphaseFixedFluxPressureFvPatchScalarField&
);
//- Construct and return a clone
virtual tmp<fvPatchScalarField> clone() const
{
return tmp<fvPatchScalarField>
(
new multiphaseFixedFluxPressureFvPatchScalarField(*this)
);
}
//- Construct as copy setting internal field reference
multiphaseFixedFluxPressureFvPatchScalarField
(
const multiphaseFixedFluxPressureFvPatchScalarField&,
const DimensionedField<scalar, volMesh>&
);
//- Construct and return a clone setting internal field reference
virtual tmp<fvPatchScalarField> clone
(
const DimensionedField<scalar, volMesh>& iF
) const
{
return tmp<fvPatchScalarField>
(
new multiphaseFixedFluxPressureFvPatchScalarField(*this, iF)
);
}
// Member functions
//- Update the coefficients associated with the patch field
virtual void updateCoeffs();
//- Write
virtual void write(Ostream&) const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //
...@@ -17,7 +17,7 @@ FoamFile ...@@ -17,7 +17,7 @@ FoamFile
dimensions [0 0 0 0 0 0 0]; dimensions [0 0 0 0 0 0 0];
internalField nonuniform List<scalar> internalField nonuniform List<scalar>
1875 1875
( (
1 1
......
...@@ -29,8 +29,8 @@ divSchemes ...@@ -29,8 +29,8 @@ divSchemes
{ {
default none; default none;
div(phi,alpha) Gauss upwind; //limitedLinear01 1; "div\(phi,alpha.*\)" Gauss vanLeer;
div(phirb,alpha) Gauss upwind; "div\(phir,alpha.*,alpha.*\)" Gauss vanLeer;
"div\(phiAlpha.*,U.*\)" Gauss limitedLinearV 1; "div\(phiAlpha.*,U.*\)" Gauss limitedLinearV 1;
div(Rc) Gauss linear; div(Rc) Gauss linear;
...@@ -39,7 +39,7 @@ divSchemes ...@@ -39,7 +39,7 @@ divSchemes
laplacianSchemes laplacianSchemes
{ {
default Gauss linear uncorrected; default Gauss linear corrected;
} }
interpolationSchemes interpolationSchemes
...@@ -49,7 +49,7 @@ interpolationSchemes ...@@ -49,7 +49,7 @@ interpolationSchemes
snGradSchemes snGradSchemes
{ {
default uncorrected; default corrected;
} }
fluxRequired fluxRequired
......
...@@ -22,25 +22,25 @@ boundaryField ...@@ -22,25 +22,25 @@ boundaryField
{ {
leftWall leftWall
{ {
type buoyantPressure; type multiphaseFixedFluxPressure;
value uniform 0; value uniform 0;
} }
rightWall rightWall
{ {
type buoyantPressure; type multiphaseFixedFluxPressure;
value uniform 0; value uniform 0;
} }
lowerWall lowerWall
{ {
type buoyantPressure; type multiphaseFixedFluxPressure;
value uniform 0; value uniform 0;
} }
atmosphere atmosphere
{ {
type fixedValue; //totalPressure; type totalPressure;
p0 uniform 0; p0 uniform 0;
U Uair; U Uair;
phi phiair; phi phiair;
......
...@@ -27,12 +27,12 @@ gradSchemes ...@@ -27,12 +27,12 @@ gradSchemes
divSchemes divSchemes
{ {
div(phi,alpha) Gauss vanLeer; "div\(phi,alpha.*\)" Gauss vanLeer;
div(phirb,alpha) Gauss vanLeer; "div\(phir,alpha.*,alpha.*\)" Gauss vanLeer;
"div\(phiAlpha.*,U.*\)" Gauss upwind; "div\(phiAlpha.*,U.*\)" Gauss limitedLinearV 1;
div(Rc) Gauss linear; div(Rc) Gauss linear;
"div\(phi.*,U.*\)" Gauss upwind; "div\(phi.*,U.*\)" Gauss limitedLinearV 1;
} }
laplacianSchemes laplacianSchemes
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment