Merge branch 'master' of github.com:OpenFOAM/OpenFOAM-2.3.x

This commit is contained in:
andy 2014-03-28 16:00:33 +00:00
commit e9fdb553da
15 changed files with 1145 additions and 147 deletions

View file

@ -87,7 +87,6 @@ int main(int argc, char *argv[])
#include "alphaEqnSubCycle.H"
twoPhaseProperties.correct();
Info<< average(twoPhaseProperties.mu()) << endl;
#include "UEqn.H"

View file

@ -10,8 +10,6 @@ if (turbulence)
dimensionedScalar epsilon0("epsilon0", epsilon.dimensions(), 0);
dimensionedScalar epsilonMin("epsilonMin", epsilon.dimensions(), SMALL);
volScalarField divU(fvc::div(phi));
tmp<volTensorField> tgradU = fvc::grad(U);
volScalarField G(mut*(tgradU() && dev(twoSymm(tgradU()))));
tgradU.clear();
@ -21,7 +19,7 @@ if (turbulence)
Cmu*k/sigmak*(g & fvc::grad(rho))/(epsilon + epsilonMin)
);
volScalarField muc(twoPhaseProperties.nucModel().nu()*rho2);
volScalarField mul(twoPhaseProperties.mu());
#include "wallFunctions.H"
@ -32,12 +30,12 @@ if (turbulence)
+ fvm::div(rhoPhi, epsilon)
- fvm::laplacian
(
mut/sigmaEps + muc, epsilon,
mut/sigmaEps + mul, epsilon,
"laplacian(DepsilonEff,epsilon)"
)
==
C1*G*epsilon/(k + kMin)
- fvm::SuSp(C1*(1.0 - C3)*Gcoef + (2.0/3.0*C1)*rho*divU, epsilon)
- fvm::SuSp(C1*(1.0 - C3)*Gcoef, epsilon)
- fvm::Sp(C2*rho*epsilon/(k + kMin), epsilon)
);
@ -56,12 +54,12 @@ if (turbulence)
+ fvm::div(rhoPhi, k)
- fvm::laplacian
(
mut/sigmak + muc, k,
mut/sigmak + mul, k,
"laplacian(DkEff,k)"
)
==
G
- fvm::SuSp(Gcoef + 2.0/3.0*rho*divU, k)
- fvm::SuSp(Gcoef, k)
- fvm::Sp(rho*epsilon/(k + kMin), k)
);
@ -75,6 +73,10 @@ if (turbulence)
mut = rho*Cmu*sqr(k)/(epsilon + epsilonMin);
#include "wallViscosity.H"
}
muEff = mut + twoPhaseProperties.mu();
muEff = mut + mul;
}
else
{
muEff = mut + twoPhaseProperties.mu();
}

View file

@ -70,8 +70,7 @@ void Foam::relativeVelocityModels::general::correct()
*(
exp(-a_*max(alphad_ - residualAlpha_, scalar(0)))
- exp(-a1_*max(alphad_ - residualAlpha_, scalar(0)))
)
/max(alphac_, residualAlpha_);
);
}

View file

@ -33,7 +33,7 @@
if (isA<wallFvPatch>(curPatch))
{
const scalarField& mutw = mut.boundaryField()[patchi];
const scalarField& mucw = muc.boundaryField()[patchi];
const scalarField& mulw = mul.boundaryField()[patchi];
scalarField magFaceGradU
(
@ -55,7 +55,7 @@
/(kappa_*y[patchi][facei]);
G[faceCelli] +=
(mutw[facei] + mucw[facei])
(mutw[facei] + mulw[facei])
*magFaceGradU[facei]
*Cmu25*::sqrt(k[faceCelli])
/(kappa_*y[patchi][facei]);

View file

@ -12,7 +12,8 @@
if (isA<wallFvPatch>(curPatch))
{
scalarField& mutw = mut.boundaryField()[patchi];
const scalarField& mucw = muc.boundaryField()[patchi];
const scalarField& mulw = mul.boundaryField()[patchi];
const scalarField& rhow = rho.boundaryField()[patchi];
forAll(curPatch, facei)
{
@ -20,12 +21,12 @@
scalar yPlus =
Cmu25*y[patchi][facei]*::sqrt(k[faceCelli])
/(mucw[facei]/rho2.value());
/(mulw[facei]/rhow[facei]);
if (yPlus > 11.6)
{
mutw[facei] =
mucw[facei]*(yPlus*kappa_/::log(E_*yPlus) - 1);
mulw[facei]*(yPlus*kappa_/::log(E_*yPlus) - 1);
}
else
{

View file

@ -32,4 +32,7 @@ kineticTheoryModels/frictionalStressModel/frictionalStressModel/newFrictionalStr
kineticTheoryModels/frictionalStressModel/JohnsonJackson/JohnsonJacksonFrictionalStress.C
kineticTheoryModels/frictionalStressModel/Schaeffer/SchaefferFrictionalStress.C
kineticTheoryModels/derivedFvPatchFields/JohnsonJacksonParticleTheta/JohnsonJacksonParticleThetaFvPatchScalarField.C
kineticTheoryModels/derivedFvPatchFields/JohnsonJacksonParticleSlip/JohnsonJacksonParticleSlipFvPatchVectorField.C
LIB = $(FOAM_LIBBIN)/libphaseIncompressibleTurbulenceModels

View file

@ -0,0 +1,258 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2014 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 "JohnsonJacksonParticleSlipFvPatchVectorField.H"
#include "addToRunTimeSelectionTable.H"
#include "twoPhaseSystem.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
makePatchTypeField
(
fvPatchVectorField,
JohnsonJacksonParticleSlipFvPatchVectorField
);
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::JohnsonJacksonParticleSlipFvPatchVectorField::
JohnsonJacksonParticleSlipFvPatchVectorField
(
const fvPatch& p,
const DimensionedField<vector, volMesh>& iF
)
:
partialSlipFvPatchVectorField(p, iF),
specularityCoefficient_(p.size())
{}
Foam::JohnsonJacksonParticleSlipFvPatchVectorField::
JohnsonJacksonParticleSlipFvPatchVectorField
(
const JohnsonJacksonParticleSlipFvPatchVectorField& ptf,
const fvPatch& p,
const DimensionedField<vector, volMesh>& iF,
const fvPatchFieldMapper& mapper
)
:
partialSlipFvPatchVectorField(ptf, p, iF, mapper),
specularityCoefficient_(ptf.specularityCoefficient_)
{}
Foam::JohnsonJacksonParticleSlipFvPatchVectorField::
JohnsonJacksonParticleSlipFvPatchVectorField
(
const fvPatch& p,
const DimensionedField<vector, volMesh>& iF,
const dictionary& dict
)
:
partialSlipFvPatchVectorField(p, iF),
specularityCoefficient_
(
"specularityCoefficient",
dimless,
dict.lookup("specularityCoefficient")
)
{
if
(
(specularityCoefficient_.value() < 0)
|| (specularityCoefficient_.value() > 1)
)
{
FatalErrorIn
(
"("
"Foam::JohnsonJacksonParticleSlipFvPatchVectorField::"
"JohnsonJacksonParticleSlipFvPatchVectorField"
"const fvPatch& p,"
"const DimensionedField<scalar, volMesh>& iF,"
"const dictionary& dict"
")"
) << "The specularity coefficient has to be between 0 and 1"
<< abort(FatalError);
}
if (dict.found("value"))
{
fvPatchVectorField::operator=
(
vectorField("value", dict, p.size())
);
}
else
{
partialSlipFvPatchVectorField::evaluate();
}
}
Foam::JohnsonJacksonParticleSlipFvPatchVectorField::
JohnsonJacksonParticleSlipFvPatchVectorField
(
const JohnsonJacksonParticleSlipFvPatchVectorField& ptf
)
:
partialSlipFvPatchVectorField(ptf),
specularityCoefficient_(ptf.specularityCoefficient_)
{}
Foam::JohnsonJacksonParticleSlipFvPatchVectorField::
JohnsonJacksonParticleSlipFvPatchVectorField
(
const JohnsonJacksonParticleSlipFvPatchVectorField& ptf,
const DimensionedField<vector, volMesh>& iF
)
:
partialSlipFvPatchVectorField(ptf, iF),
specularityCoefficient_(ptf.specularityCoefficient_)
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::JohnsonJacksonParticleSlipFvPatchVectorField::autoMap
(
const fvPatchFieldMapper& m
)
{
partialSlipFvPatchVectorField::autoMap(m);
}
void Foam::JohnsonJacksonParticleSlipFvPatchVectorField::rmap
(
const fvPatchVectorField& ptf,
const labelList& addr
)
{
partialSlipFvPatchVectorField::rmap(ptf, addr);
}
void Foam::JohnsonJacksonParticleSlipFvPatchVectorField::updateCoeffs()
{
if (updated())
{
return;
}
// lookup the fluid model and the phase
const twoPhaseSystem& fluid = db().lookupObject<twoPhaseSystem>
(
"phaseProperties"
);
const phaseModel& phased
(
fluid.phase1().name() == dimensionedInternalField().group()
? fluid.phase1()
: fluid.phase2()
);
// lookup all the fields on this patch
const fvPatchScalarField& alpha
(
patch().lookupPatchField<volScalarField, scalar>
(
phased.volScalarField::name()
)
);
const fvPatchScalarField& gs0
(
patch().lookupPatchField<volScalarField, scalar>
(
IOobject::groupName("gs0", phased.name())
)
);
const scalarField nu
(
phased.nu()->boundaryField()[patch().index()]
);
word ThetaName(IOobject::groupName("Theta", phased.name()));
const fvPatchScalarField& Theta
(
db().foundObject<volScalarField>(ThetaName)
? patch().lookupPatchField<volScalarField, scalar>(ThetaName)
: alpha
);
// lookup the packed volume fraction
dimensionedScalar alphaMax
(
"alphaMax",
dimless,
db()
.lookupObject<IOdictionary>
(
IOobject::groupName("turbulenceProperties", phased.name())
)
.subDict("RAS")
.subDict("kineticTheoryCoeffs")
.lookup("alphaMax")
);
// calculate the slip value fraction
scalarField c
(
constant::mathematical::pi
*alpha
*gs0
*specularityCoefficient_.value()
*sqrt(3.0*Theta)
/max(6.0*nu*alphaMax.value(), SMALL)
);
this->valueFraction() = c/(c + patch().deltaCoeffs());
partialSlipFvPatchVectorField::updateCoeffs();
}
void Foam::JohnsonJacksonParticleSlipFvPatchVectorField::write
(
Ostream& os
) const
{
fvPatchVectorField::write(os);
os.writeKeyword("specularityCoefficient")
<< specularityCoefficient_ << token::END_STATEMENT << nl;
writeEntry("value", os);
}
// ************************************************************************* //

View file

@ -0,0 +1,177 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2014 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::JohnsonJacksonParticleSlipFvPatchVectorField
Description
Partial slip boundary condition for the particulate velocity.
References:
\verbatim
"Multifluid Eulerian modeling of dense gassolids fluidized bed
hydrodynamics: Influence of the dissipation parameters"
N Reuge
Chemical Engineering Science
Volume 63, Issue 22, Pages 5540-5551, November 2008
\endverbatim
\verbatim
"Frictional-collisional constitutive relations for granular materials,
with application to plane shearing"
P C Johnson and R Jackson
Journal of Fluid Mechanics
Volume 176, Pages 67-93, March 1987
\endverbatim
SourceFiles
JohnsonJacksonParticleSlipFvPatchVectorField.C
\*---------------------------------------------------------------------------*/
#ifndef JohnsonJacksonParticleSlipFvPatchVectorField_H
#define JohnsonJacksonParticleSlipFvPatchVectorField_H
#include "partialSlipFvPatchFields.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class JohnsonJacksonParticleSlipFvPatchVectorField Declaration
\*---------------------------------------------------------------------------*/
class JohnsonJacksonParticleSlipFvPatchVectorField
:
public partialSlipFvPatchVectorField
{
// Private data
//- Specularity coefficient
dimensionedScalar specularityCoefficient_;
public:
//- Runtime type information
TypeName("JohnsonJacksonParticleSlip");
// Constructors
//- Construct from patch and internal field
JohnsonJacksonParticleSlipFvPatchVectorField
(
const fvPatch&,
const DimensionedField<vector, volMesh>&
);
//- Construct from patch, internal field and dictionary
JohnsonJacksonParticleSlipFvPatchVectorField
(
const fvPatch&,
const DimensionedField<vector, volMesh>&,
const dictionary&
);
//- Construct by mapping onto a new patch
JohnsonJacksonParticleSlipFvPatchVectorField
(
const JohnsonJacksonParticleSlipFvPatchVectorField&,
const fvPatch&,
const DimensionedField<vector, volMesh>&,
const fvPatchFieldMapper&
);
//- Construct as copy
JohnsonJacksonParticleSlipFvPatchVectorField
(
const JohnsonJacksonParticleSlipFvPatchVectorField&
);
//- Construct and return a clone
virtual tmp<fvPatchVectorField> clone() const
{
return tmp<fvPatchVectorField>
(
new JohnsonJacksonParticleSlipFvPatchVectorField(*this)
);
}
//- Construct as copy setting internal field reference
JohnsonJacksonParticleSlipFvPatchVectorField
(
const JohnsonJacksonParticleSlipFvPatchVectorField&,
const DimensionedField<vector, volMesh>&
);
//- Construct and return a clone setting internal field reference
virtual tmp<fvPatchVectorField> clone
(
const DimensionedField<vector, volMesh>& iF
) const
{
return tmp<fvPatchVectorField>
(
new JohnsonJacksonParticleSlipFvPatchVectorField(*this, iF)
);
}
// Member functions
// Mapping functions
//- Map (and resize as needed) from self given a mapping object
virtual void autoMap
(
const fvPatchFieldMapper&
);
//- Reverse map the given fvPatchField onto this fvPatchField
virtual void rmap
(
const fvPatchVectorField&,
const labelList&
);
//- Update the coefficients
virtual void updateCoeffs();
//- Write
virtual void write(Ostream&) const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View file

@ -0,0 +1,323 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2014 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 "JohnsonJacksonParticleThetaFvPatchScalarField.H"
#include "addToRunTimeSelectionTable.H"
#include "twoPhaseSystem.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
makePatchTypeField
(
fvPatchScalarField,
JohnsonJacksonParticleThetaFvPatchScalarField
);
}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
Foam::JohnsonJacksonParticleThetaFvPatchScalarField::
JohnsonJacksonParticleThetaFvPatchScalarField
(
const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF
)
:
mixedFvPatchScalarField(p, iF),
restitutionCoefficient_(p.size()),
specularityCoefficient_(p.size())
{}
Foam::JohnsonJacksonParticleThetaFvPatchScalarField::
JohnsonJacksonParticleThetaFvPatchScalarField
(
const JohnsonJacksonParticleThetaFvPatchScalarField& ptf,
const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF,
const fvPatchFieldMapper& mapper
)
:
mixedFvPatchScalarField(ptf, p, iF, mapper),
restitutionCoefficient_(ptf.restitutionCoefficient_),
specularityCoefficient_(ptf.specularityCoefficient_)
{
}
Foam::JohnsonJacksonParticleThetaFvPatchScalarField::
JohnsonJacksonParticleThetaFvPatchScalarField
(
const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF,
const dictionary& dict
)
:
mixedFvPatchScalarField(p, iF),
restitutionCoefficient_
(
"restitutionCoefficient",
dimless,
dict.lookup("restitutionCoefficient")
),
specularityCoefficient_
(
"specularityCoefficient",
dimless,
dict.lookup("specularityCoefficient")
)
{
if
(
(restitutionCoefficient_.value() < 0)
|| (restitutionCoefficient_.value() > 1)
)
{
FatalErrorIn
(
"Foam::JohnsonJacksonParticleThetaFvPatchScalarField::"
"JohnsonJacksonParticleThetaFvPatchScalarField"
"("
"const fvPatch& p,"
"const DimensionedField<scalar, volMesh>& iF,"
"const dictionary& dict"
")"
) << "The restitution coefficient has to be between 0 and 1"
<< abort(FatalError);
}
if
(
(specularityCoefficient_.value() < 0)
|| (specularityCoefficient_.value() > 1)
)
{
FatalErrorIn
(
"Foam::JohnsonJacksonParticleThetaFvPatchScalarField::"
"JohnsonJacksonParticleThetaFvPatchScalarField"
"("
"const fvPatch& p,"
"const DimensionedField<scalar, volMesh>& iF,"
"const dictionary& dict"
")"
) << "The specularity coefficient has to be between 0 and 1"
<< abort(FatalError);
}
if (dict.found("value"))
{
fvPatchScalarField::operator=
(
scalarField("value", dict, p.size())
);
}
else
{
evaluate();
}
}
Foam::JohnsonJacksonParticleThetaFvPatchScalarField::
JohnsonJacksonParticleThetaFvPatchScalarField
(
const JohnsonJacksonParticleThetaFvPatchScalarField& ptf
)
:
mixedFvPatchScalarField(ptf),
restitutionCoefficient_(ptf.restitutionCoefficient_),
specularityCoefficient_(ptf.specularityCoefficient_)
{}
Foam::JohnsonJacksonParticleThetaFvPatchScalarField::
JohnsonJacksonParticleThetaFvPatchScalarField
(
const JohnsonJacksonParticleThetaFvPatchScalarField& ptf,
const DimensionedField<scalar, volMesh>& iF
)
:
mixedFvPatchScalarField(ptf, iF),
restitutionCoefficient_(ptf.restitutionCoefficient_),
specularityCoefficient_(ptf.specularityCoefficient_)
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::JohnsonJacksonParticleThetaFvPatchScalarField::autoMap
(
const fvPatchFieldMapper& m
)
{
mixedFvPatchScalarField::autoMap(m);
}
void Foam::JohnsonJacksonParticleThetaFvPatchScalarField::rmap
(
const fvPatchScalarField& ptf,
const labelList& addr
)
{
mixedFvPatchScalarField::rmap(ptf, addr);
}
void Foam::JohnsonJacksonParticleThetaFvPatchScalarField::updateCoeffs()
{
if (updated())
{
return;
}
// lookup the fluid model and the phase
const twoPhaseSystem& fluid = db().lookupObject<twoPhaseSystem>
(
"phaseProperties"
);
const phaseModel& phased
(
fluid.phase1().name() == dimensionedInternalField().group()
? fluid.phase1()
: fluid.phase2()
);
// lookup all the fields on this patch
const fvPatchScalarField& alpha
(
patch().lookupPatchField<volScalarField, scalar>
(
phased.volScalarField::name()
)
);
const fvPatchVectorField& U
(
patch().lookupPatchField<volVectorField, vector>
(
IOobject::groupName("U", phased.name())
)
);
const fvPatchScalarField& gs0
(
patch().lookupPatchField<volScalarField, scalar>
(
IOobject::groupName("gs0", phased.name())
)
);
const fvPatchScalarField& kappa
(
patch().lookupPatchField<volScalarField, scalar>
(
IOobject::groupName("kappa", phased.name())
)
);
const scalarField Theta(patchInternalField());
// lookup the packed volume fraction
dimensionedScalar alphaMax
(
"alphaMax",
dimless,
db()
.lookupObject<IOdictionary>
(
IOobject::groupName("turbulenceProperties", phased.name())
)
.subDict("RAS")
.subDict("kineticTheoryCoeffs")
.lookup("alphaMax")
);
// calculate the reference value and the value fraction
if (restitutionCoefficient_.value() != 1.0)
{
this->refValue() =
(2.0/3.0)
*specularityCoefficient_.value()
*magSqr(U)
/(scalar(1) - sqr(restitutionCoefficient_.value()));
this->refGrad() = 0.0;
scalarField c
(
constant::mathematical::pi
*alpha
*gs0
*(scalar(1) - sqr(restitutionCoefficient_.value()))
*sqrt(3.0*Theta)
/max(4.0*kappa*alphaMax.value(), SMALL)
);
this->valueFraction() = c/(c + patch().deltaCoeffs());
}
// for a restitution coefficient of 1, the boundary degenerates to a fixed
// gradient condition
else
{
this->refValue() = 0.0;
this->refGrad() =
pos(alpha - SMALL)
*constant::mathematical::pi
*specularityCoefficient_.value()
*alpha
*gs0
*sqrt(3.0*Theta)
*magSqr(U)
/max(6.0*kappa*alphaMax.value(), SMALL);
this->valueFraction() = 0.0;
}
mixedFvPatchScalarField::updateCoeffs();
}
void Foam::JohnsonJacksonParticleThetaFvPatchScalarField::write
(
Ostream& os
) const
{
fvPatchScalarField::write(os);
os.writeKeyword("restitutionCoefficient")
<< restitutionCoefficient_ << token::END_STATEMENT << nl;
os.writeKeyword("specularityCoefficient")
<< specularityCoefficient_ << token::END_STATEMENT << nl;
writeEntry("value", os);
}
// ************************************************************************* //

View file

@ -0,0 +1,179 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2014 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::JohnsonJacksonParticleThetaFvPatchScalarField
Description
Robin condition for the particulate granular temperature.
References:
\verbatim
"Multifluid Eulerian modeling of dense gassolids fluidized bed
hydrodynamics: Influence of the dissipation parameters"
N Reuge
Chemical Engineering Science
Volume 63, Issue 22, Pages 5540-5551, November 2008
\endverbatim
\verbatim
"Frictional-collisional constitutive relations for granular materials,
with application to plane shearing"
P C Johnson and R Jackson
Journal of Fluid Mechanics
Volume 176, Pages 67-93, March 1987
\endverbatim
SourceFiles
JohnsonJacksonParticleThetaFvPatchScalarField.C
\*---------------------------------------------------------------------------*/
#ifndef JohnsonJacksonParticleThetaFvPatchScalarField_H
#define JohnsonJacksonParticleThetaFvPatchScalarField_H
#include "mixedFvPatchFields.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class JohnsonJacksonParticleThetaFvPatchScalarField Declaration
\*---------------------------------------------------------------------------*/
class JohnsonJacksonParticleThetaFvPatchScalarField
:
public mixedFvPatchScalarField
{
// Private data
//- Particle-wall restitution coefficient
dimensionedScalar restitutionCoefficient_;
//- Specularity coefficient
dimensionedScalar specularityCoefficient_;
public:
//- Runtime type information
TypeName("JohnsonJacksonParticleTheta");
// Constructors
//- Construct from patch and internal field
JohnsonJacksonParticleThetaFvPatchScalarField
(
const fvPatch&,
const DimensionedField<scalar, volMesh>&
);
//- Construct from patch, internal field and dictionary
JohnsonJacksonParticleThetaFvPatchScalarField
(
const fvPatch&,
const DimensionedField<scalar, volMesh>&,
const dictionary&
);
//- Construct by mapping onto a new patch
JohnsonJacksonParticleThetaFvPatchScalarField
(
const JohnsonJacksonParticleThetaFvPatchScalarField&,
const fvPatch&,
const DimensionedField<scalar, volMesh>&,
const fvPatchFieldMapper&
);
//- Construct as copy
JohnsonJacksonParticleThetaFvPatchScalarField
(
const JohnsonJacksonParticleThetaFvPatchScalarField&
);
//- Construct and return a clone
virtual tmp<fvPatchScalarField> clone() const
{
return tmp<fvPatchScalarField>
(
new JohnsonJacksonParticleThetaFvPatchScalarField(*this)
);
}
//- Construct as copy setting internal field reference
JohnsonJacksonParticleThetaFvPatchScalarField
(
const JohnsonJacksonParticleThetaFvPatchScalarField&,
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 JohnsonJacksonParticleThetaFvPatchScalarField(*this, iF)
);
}
// Member functions
// Mapping functions
//- Map (and resize as needed) from self given a mapping object
virtual void autoMap
(
const fvPatchFieldMapper&
);
//- Reverse map the given fvPatchField onto this fvPatchField
virtual void rmap
(
const fvPatchScalarField&,
const labelList&
);
//- Update the coefficients
virtual void updateCoeffs();
//- Write
virtual void write(Ostream&) const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View file

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2012-2014 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -25,10 +25,19 @@ License
#include "loadOrCreateMesh.H"
#include "processorPolyPatch.H"
#include "processorCyclicPolyPatch.H"
#include "Time.H"
#include "IOPtrList.H"
// * * * * * * * * * * * * * * * Global Functions * * * * * * * * * * * * * //
namespace Foam
{
defineTemplateTypeNameAndDebug(IOPtrList<entry>, 0);
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// Read mesh if available. Otherwise create empty mesh with same non-proc
// patches as proc0 mesh. Requires all processors to have all patches
// (and in same order).
@ -48,11 +57,68 @@ Foam::autoPtr<Foam::fvMesh> Foam::loadOrCreateMesh
meshSubDir = io.name()/polyMesh::meshSubDir;
}
// Scatter master patches
PtrList<entry> patchEntries;
if (Pstream::master())
{
// Read PtrList of dictionary as dictionary.
const word oldTypeName = IOPtrList<entry>::typeName;
const_cast<word&>(IOPtrList<entry>::typeName) = word::null;
IOPtrList<entry> dictList
(
IOobject
(
"boundary",
io.time().findInstance
(
meshSubDir,
"boundary",
IOobject::MUST_READ
),
meshSubDir,
io.db(),
IOobject::MUST_READ,
IOobject::NO_WRITE,
false
)
);
const_cast<word&>(IOPtrList<entry>::typeName) = oldTypeName;
// Fake type back to what was in field
const_cast<word&>(dictList.type()) = dictList.headerClassName();
patchEntries.transfer(dictList);
// Send patches
for
(
int slave=Pstream::firstSlave();
slave<=Pstream::lastSlave();
slave++
)
{
OPstream toSlave(Pstream::scheduled, slave);
toSlave << patchEntries;
}
}
else
{
// Receive patches
IPstream fromMaster(Pstream::scheduled, Pstream::masterNo());
fromMaster >> patchEntries;
}
// Check who has a mesh
const bool haveMesh = isDir(io.time().path()/io.instance()/meshSubDir);
if (!haveMesh)
{
bool oldParRun = Pstream::parRun();
Pstream::parRun() = false;
// Create dummy mesh. Only used on procs that don't have mesh.
IOobject noReadIO(io);
noReadIO.readOpt() = IOobject::NO_READ;
@ -65,6 +131,39 @@ Foam::autoPtr<Foam::fvMesh> Foam::loadOrCreateMesh
xferCopy(labelList()),
false
);
// Add patches
List<polyPatch*> patches(patchEntries.size());
label nPatches = 0;
forAll(patchEntries, patchI)
{
const entry& e = patchEntries[patchI];
const word type(e.dict().lookup("type"));
const word& name = e.keyword();
if
(
type != processorPolyPatch::typeName
&& type != processorCyclicPolyPatch::typeName
)
{
dictionary patchDict(e.dict());
patchDict.set("nFaces", 0);
patchDict.set("startFace", 0);
patches[patchI] = polyPatch::New
(
name,
patchDict,
nPatches++,
dummyMesh.boundaryMesh()
).ptr();
}
}
patches.setSize(nPatches);
dummyMesh.addFvPatches(patches, false); // no parallel comms
// Add some dummy zones so upon reading it does not read them
// from the undecomposed case. Should be done as extra argument to
// regIOobject::readStream?
@ -106,6 +205,8 @@ Foam::autoPtr<Foam::fvMesh> Foam::loadOrCreateMesh
//Pout<< "Writing dummy mesh to " << dummyMesh.polyMesh::objectPath()
// << endl;
dummyMesh.write();
Pstream::parRun() = oldParRun;
}
//Pout<< "Reading mesh from " << io.objectPath() << endl;
@ -116,118 +217,57 @@ Foam::autoPtr<Foam::fvMesh> Foam::loadOrCreateMesh
// Sync patches
// ~~~~~~~~~~~~
if (Pstream::master())
if (!Pstream::master() && haveMesh)
{
// Send patches
for
(
int slave=Pstream::firstSlave();
slave<=Pstream::lastSlave();
slave++
)
// Check master names against mine
const polyBoundaryMesh& patches = mesh.boundaryMesh();
forAll(patchEntries, patchI)
{
OPstream toSlave(Pstream::scheduled, slave);
toSlave << mesh.boundaryMesh();
}
}
else
{
// Receive patches
IPstream fromMaster(Pstream::scheduled, Pstream::masterNo());
PtrList<entry> patchEntries(fromMaster);
const entry& e = patchEntries[patchI];
const word type(e.dict().lookup("type"));
const word& name = e.keyword();
if (haveMesh)
{
// Check master names against mine
const polyBoundaryMesh& patches = mesh.boundaryMesh();
forAll(patchEntries, patchI)
if (type == processorPolyPatch::typeName)
{
const entry& e = patchEntries[patchI];
const word type(e.dict().lookup("type"));
const word& name = e.keyword();
if (type == processorPolyPatch::typeName)
{
break;
}
if (patchI >= patches.size())
{
FatalErrorIn
(
"createMesh(const Time&, const fileName&, const bool)"
) << "Non-processor patches not synchronised."
<< endl
<< "Processor " << Pstream::myProcNo()
<< " has only " << patches.size()
<< " patches, master has "
<< patchI
<< exit(FatalError);
}
if
(
type != patches[patchI].type()
|| name != patches[patchI].name()
)
{
FatalErrorIn
(
"createMesh(const Time&, const fileName&, const bool)"
) << "Non-processor patches not synchronised."
<< endl
<< "Master patch " << patchI
<< " name:" << type
<< " type:" << type << endl
<< "Processor " << Pstream::myProcNo()
<< " patch " << patchI
<< " has name:" << patches[patchI].name()
<< " type:" << patches[patchI].type()
<< exit(FatalError);
}
break;
}
}
else
{
// Add patch
List<polyPatch*> patches(patchEntries.size());
label nPatches = 0;
forAll(patchEntries, patchI)
if (patchI >= patches.size())
{
const entry& e = patchEntries[patchI];
const word type(e.dict().lookup("type"));
const word& name = e.keyword();
if (type == processorPolyPatch::typeName)
{
break;
}
//Pout<< "Adding patch:" << nPatches
// << " name:" << name << " type:" << type << endl;
dictionary patchDict(e.dict());
patchDict.remove("nFaces");
patchDict.add("nFaces", 0);
patchDict.remove("startFace");
patchDict.add("startFace", 0);
patches[patchI] = polyPatch::New
FatalErrorIn
(
name,
patchDict,
nPatches++,
mesh.boundaryMesh()
).ptr();
"createMesh(const Time&, const fileName&, const bool)"
) << "Non-processor patches not synchronised."
<< endl
<< "Processor " << Pstream::myProcNo()
<< " has only " << patches.size()
<< " patches, master has "
<< patchI
<< exit(FatalError);
}
patches.setSize(nPatches);
mesh.addFvPatches(patches, false); // no parallel comms
//// Write empty mesh now we have correct patches
//meshPtr().write();
if
(
type != patches[patchI].type()
|| name != patches[patchI].name()
)
{
FatalErrorIn
(
"createMesh(const Time&, const fileName&, const bool)"
) << "Non-processor patches not synchronised."
<< endl
<< "Master patch " << patchI
<< " name:" << type
<< " type:" << type << endl
<< "Processor " << Pstream::myProcNo()
<< " patch " << patchI
<< " has name:" << patches[patchI].name()
<< " type:" << patches[patchI].type()
<< exit(FatalError);
}
}
}

View file

@ -194,7 +194,6 @@ tmp<volScalarField> LaheyKEpsilon<BasicTurbulenceModel>::bubbleG() const
tmp<volScalarField> bubbleG
(
Cp_
*liquid*liquid.rho()
*(
pow3(magUr)
+ pow(fluid.drag(gas).CdRe()*liquid.nu()/gas.d(), 4.0/3.0)

View file

@ -124,9 +124,17 @@ void continuousGasKEpsilon<BasicTurbulenceModel>::correctNut()
const transportModel& liquid = fluid.otherPhase(gas);
volScalarField thetal(liquidTurbulence.k()/liquidTurbulence.epsilon());
volScalarField thetag((1.0/(18*liquid.nu()))*sqr(gas.d()));
volScalarField expThetar(exp(min(thetal/thetag, scalar(50))));
volScalarField omega(sqr(expThetar - 1)/(sqr(expThetar) - 1));
volScalarField rhodv(gas.rho() + fluid.virtualMass(gas).Cvm()*liquid.rho());
volScalarField thetag((rhodv/(18*liquid.rho()*liquid.nu()))*sqr(gas.d()));
volScalarField expThetar
(
min
(
exp(min(thetal/thetag, scalar(50))),
scalar(1)
)
);
volScalarField omega((1 - expThetar)/(1 + expThetar));
nutEff_ = omega*liquidTurbulence.nut();
}

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-2014 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -649,22 +649,20 @@ void Foam::refinementHistory::countProc
// Increment parent if whole splitCell moves to same processor
if (splitCellNum[index] == 8)
{
Pout<< "Moving " << splitCellNum[index]
<< " cells originating from cell " << index
<< " from processor " << Pstream::myProcNo()
<< " to processor " << splitCellProc[index]
<< endl;
if (debug)
{
Pout<< "Moving " << splitCellNum[index]
<< " cells originating from cell " << index
<< " from processor " << Pstream::myProcNo()
<< " to processor " << splitCellProc[index]
<< endl;
}
label parent = splitCells_[index].parent_;
if (parent >= 0)
{
string oldPrefix = Pout.prefix();
Pout.prefix() = " " + oldPrefix;
countProc(parent, newProcNo, splitCellProc, splitCellNum);
Pout.prefix() = oldPrefix;
}
}
}
@ -924,7 +922,10 @@ void Foam::refinementHistory::distribute(const mapDistributePolyMesh& map)
forAll(newVisibleCells, i)
{
visibleCells_[constructMap[i]] = newVisibleCells[i] + offset;
if (newVisibleCells[i] >= 0)
{
visibleCells_[constructMap[i]] = newVisibleCells[i] + offset;
}
}
}
splitCells_.shrink();

View file

@ -1,7 +1,7 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 2.3.0 |
| \\ / O peration | Version: 2.3.x |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
@ -33,16 +33,25 @@ boundaryField
}
floatingObject
{
type oscillatingFixedValue;
refValue uniform (0 1 0);
offset (0 -1 0);
amplitude table
(
( 0 0)
( 10 0.025)
(1000 0.025)
);
frequency constant 1;
type fixedNormalInletOutletVelocity;
fixTangentialInflow false;
normalVelocity
{
type oscillatingFixedValue;
refValue uniform (0 1 0);
offset (0 -1 0);
amplitude table
(
( 0 0)
( 10 0.025)
(1000 0.025)
);
frequency constant 1;
value uniform (0 0 0);
}
value uniform (0 0 0);
}
frontAndBack