2010-05-12 13:27:55 +00:00
|
|
|
/*---------------------------------------------------------------------------*\
|
|
|
|
========= |
|
2013-12-11 16:09:41 +00:00
|
|
|
\\ / F ield | foam-extend: Open Source CFD
|
2018-05-29 07:35:20 +00:00
|
|
|
\\ / O peration | Version: 4.1
|
2015-05-17 13:32:07 +00:00
|
|
|
\\ / A nd | Web: http://www.foam-extend.org
|
|
|
|
\\/ M anipulation | For copyright notice see file Copyright
|
2010-05-12 13:27:55 +00:00
|
|
|
-------------------------------------------------------------------------------
|
|
|
|
License
|
2013-12-11 16:09:41 +00:00
|
|
|
This file is part of foam-extend.
|
2010-05-12 13:27:55 +00:00
|
|
|
|
2013-12-11 16:09:41 +00:00
|
|
|
foam-extend is free software: you can redistribute it and/or modify it
|
2010-05-12 13:27:55 +00:00
|
|
|
under the terms of the GNU General Public License as published by the
|
2013-12-11 16:09:41 +00:00
|
|
|
Free Software Foundation, either version 3 of the License, or (at your
|
2010-05-12 13:27:55 +00:00
|
|
|
option) any later version.
|
|
|
|
|
2013-12-11 16:09:41 +00:00
|
|
|
foam-extend 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.
|
2010-05-12 13:27:55 +00:00
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
2013-12-11 16:09:41 +00:00
|
|
|
along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
|
2010-05-12 13:27:55 +00:00
|
|
|
|
|
|
|
\*---------------------------------------------------------------------------*/
|
|
|
|
|
|
|
|
#include "smoluchowskiJumpTFvPatchScalarField.H"
|
|
|
|
#include "addToRunTimeSelectionTable.H"
|
|
|
|
#include "fvPatchFieldMapper.H"
|
|
|
|
#include "volFields.H"
|
|
|
|
#include "mathematicalConstants.H"
|
|
|
|
|
|
|
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
|
|
|
|
|
|
namespace Foam
|
|
|
|
{
|
|
|
|
|
|
|
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
|
|
|
|
|
|
|
smoluchowskiJumpTFvPatchScalarField::smoluchowskiJumpTFvPatchScalarField
|
|
|
|
(
|
|
|
|
const fvPatch& p,
|
|
|
|
const DimensionedField<scalar, volMesh>& iF
|
|
|
|
)
|
|
|
|
:
|
|
|
|
mixedFvPatchScalarField(p, iF),
|
|
|
|
accommodationCoeff_(1.0),
|
|
|
|
Twall_(p.size(), 0.0),
|
|
|
|
gamma_(1.4)
|
|
|
|
{
|
|
|
|
refValue() = 0.0;
|
|
|
|
refGrad() = 0.0;
|
|
|
|
valueFraction() = 0.0;
|
|
|
|
}
|
|
|
|
|
|
|
|
smoluchowskiJumpTFvPatchScalarField::smoluchowskiJumpTFvPatchScalarField
|
|
|
|
(
|
|
|
|
const smoluchowskiJumpTFvPatchScalarField& ptf,
|
|
|
|
const fvPatch& p,
|
|
|
|
const DimensionedField<scalar, volMesh>& iF,
|
|
|
|
const fvPatchFieldMapper& mapper
|
|
|
|
)
|
|
|
|
:
|
|
|
|
mixedFvPatchScalarField(ptf, p, iF, mapper),
|
|
|
|
accommodationCoeff_(ptf.accommodationCoeff_),
|
|
|
|
Twall_(ptf.Twall_),
|
|
|
|
gamma_(ptf.gamma_)
|
|
|
|
{}
|
|
|
|
|
|
|
|
|
|
|
|
smoluchowskiJumpTFvPatchScalarField::smoluchowskiJumpTFvPatchScalarField
|
|
|
|
(
|
|
|
|
const fvPatch& p,
|
|
|
|
const DimensionedField<scalar, volMesh>& iF,
|
|
|
|
const dictionary& dict
|
|
|
|
)
|
|
|
|
:
|
|
|
|
mixedFvPatchScalarField(p, iF),
|
|
|
|
accommodationCoeff_(readScalar(dict.lookup("accommodationCoeff"))),
|
2013-12-03 16:48:51 +00:00
|
|
|
Twall_("Twall", dict, p.size()),
|
|
|
|
gamma_(readScalar(dict.lookup("gamma")))
|
2010-05-12 13:27:55 +00:00
|
|
|
{
|
|
|
|
if
|
|
|
|
(
|
|
|
|
mag(accommodationCoeff_) < SMALL
|
2010-08-26 14:22:03 +00:00
|
|
|
|| mag(accommodationCoeff_) > 2.0
|
2010-05-12 13:27:55 +00:00
|
|
|
)
|
|
|
|
{
|
|
|
|
FatalIOErrorIn
|
|
|
|
(
|
|
|
|
"smoluchowskiJumpTFvPatchScalarField::"
|
|
|
|
"smoluchowskiJumpTFvPatchScalarField"
|
|
|
|
"("
|
|
|
|
" const fvPatch&,"
|
|
|
|
" const DimensionedField<scalar, volMesh>&,"
|
|
|
|
" const dictionary&"
|
|
|
|
")",
|
|
|
|
dict
|
2010-08-26 14:22:03 +00:00
|
|
|
) << "unphysical accommodationCoeff specified"
|
|
|
|
<< "(0 < accommodationCoeff <= 1)" << endl
|
2010-05-12 13:27:55 +00:00
|
|
|
<< exit(FatalError);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (dict.found("value"))
|
|
|
|
{
|
|
|
|
fvPatchField<scalar>::operator=
|
|
|
|
(
|
|
|
|
scalarField("value", dict, p.size())
|
|
|
|
);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
fvPatchField<scalar>::operator=(patchInternalField());
|
|
|
|
}
|
|
|
|
|
|
|
|
refValue() = *this;
|
|
|
|
refGrad() = 0.0;
|
|
|
|
valueFraction() = 0.0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
smoluchowskiJumpTFvPatchScalarField::smoluchowskiJumpTFvPatchScalarField
|
|
|
|
(
|
|
|
|
const smoluchowskiJumpTFvPatchScalarField& ptpsf,
|
|
|
|
const DimensionedField<scalar, volMesh>& iF
|
|
|
|
)
|
|
|
|
:
|
|
|
|
mixedFvPatchScalarField(ptpsf, iF),
|
|
|
|
accommodationCoeff_(ptpsf.accommodationCoeff_),
|
|
|
|
Twall_(ptpsf.Twall_),
|
|
|
|
gamma_(ptpsf.gamma_)
|
|
|
|
{}
|
|
|
|
|
|
|
|
|
|
|
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
|
|
|
|
|
|
|
// Map from self
|
|
|
|
void smoluchowskiJumpTFvPatchScalarField::autoMap
|
|
|
|
(
|
|
|
|
const fvPatchFieldMapper& m
|
|
|
|
)
|
|
|
|
{
|
|
|
|
mixedFvPatchScalarField::autoMap(m);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Reverse-map the given fvPatchField onto this fvPatchField
|
|
|
|
void smoluchowskiJumpTFvPatchScalarField::rmap
|
|
|
|
(
|
|
|
|
const fvPatchField<scalar>& ptf,
|
|
|
|
const labelList& addr
|
|
|
|
)
|
|
|
|
{
|
|
|
|
mixedFvPatchField<scalar>::rmap(ptf, addr);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Update the coefficients associated with the patch field
|
|
|
|
void smoluchowskiJumpTFvPatchScalarField::updateCoeffs()
|
|
|
|
{
|
|
|
|
if (updated())
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
const fvPatchScalarField& pmu =
|
2010-11-15 19:08:57 +00:00
|
|
|
lookupPatchField<volScalarField, scalar>("mu");
|
2010-05-12 13:27:55 +00:00
|
|
|
const fvPatchScalarField& prho =
|
2010-11-15 19:08:57 +00:00
|
|
|
lookupPatchField<volScalarField, scalar>("rho");
|
2010-05-12 13:27:55 +00:00
|
|
|
const fvPatchField<scalar>& ppsi =
|
2010-11-15 19:08:57 +00:00
|
|
|
lookupPatchField<volScalarField, scalar>("psi");
|
2010-05-12 13:27:55 +00:00
|
|
|
const fvPatchVectorField& pU =
|
2010-11-15 19:08:57 +00:00
|
|
|
lookupPatchField<volVectorField, vector>("U");
|
2010-05-12 13:27:55 +00:00
|
|
|
|
|
|
|
// Prandtl number reading consistent with rhoCentralFoam
|
|
|
|
const dictionary& thermophysicalProperties =
|
|
|
|
db().lookupObject<IOdictionary>("thermophysicalProperties");
|
|
|
|
dimensionedScalar Pr = dimensionedScalar("Pr", dimless, 1.0);
|
|
|
|
if (thermophysicalProperties.found("Pr"))
|
|
|
|
{
|
|
|
|
Pr = dimensionedScalar(thermophysicalProperties.lookup("Pr"));
|
|
|
|
}
|
|
|
|
|
|
|
|
Field<scalar> C2 = pmu/prho
|
|
|
|
*sqrt(ppsi*mathematicalConstant::pi/2.0)
|
|
|
|
*2.0*gamma_/Pr.value()/(gamma_ + 1.0)
|
|
|
|
*(2.0 - accommodationCoeff_)/accommodationCoeff_;
|
|
|
|
|
|
|
|
Field<scalar> aCoeff = prho.snGrad() - prho/C2;
|
|
|
|
Field<scalar> KEbyRho = 0.5*magSqr(pU);
|
|
|
|
|
|
|
|
valueFraction() = (1.0/(1.0 + patch().deltaCoeffs()*C2));
|
|
|
|
refValue() = Twall_;
|
|
|
|
refGrad() = 0.0;
|
|
|
|
|
|
|
|
mixedFvPatchScalarField::updateCoeffs();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Write
|
|
|
|
void smoluchowskiJumpTFvPatchScalarField::write(Ostream& os) const
|
|
|
|
{
|
|
|
|
fvPatchScalarField::write(os);
|
|
|
|
os.writeKeyword("accommodationCoeff")
|
|
|
|
<< accommodationCoeff_ << token::END_STATEMENT << nl;
|
|
|
|
Twall_.writeEntry("Twall", os);
|
|
|
|
os.writeKeyword("gamma")
|
|
|
|
<< gamma_ << token::END_STATEMENT << nl;
|
|
|
|
writeEntry("value", os);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
|
|
|
|
|
|
makePatchTypeField(fvPatchScalarField, smoluchowskiJumpTFvPatchScalarField);
|
|
|
|
|
|
|
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
|
|
|
|
|
|
} // End namespace Foam
|
|
|
|
|
|
|
|
// ************************************************************************* //
|