mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: Added region coupling (film/pyrolysis) lib
This commit is contained in:
@ -7,7 +7,7 @@ wmake $makeType regionModel
|
|||||||
wmake $makeType pyrolysisModels
|
wmake $makeType pyrolysisModels
|
||||||
wmake $makeType surfaceFilmModels
|
wmake $makeType surfaceFilmModels
|
||||||
wmake $makeType thermoBaffleModels
|
wmake $makeType thermoBaffleModels
|
||||||
#wmake $makeType regionCoupling
|
wmake $makeType regionCoupling
|
||||||
|
|
||||||
|
|
||||||
# ----------------------------------------------------------------- end-of-file
|
# ----------------------------------------------------------------- end-of-file
|
||||||
|
|||||||
5
src/regionModels/regionCoupling/Make/files
Normal file
5
src/regionModels/regionCoupling/Make/files
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
derivedFvPatchFields/filmPyrolysisVelocityCoupled/filmPyrolysisVelocityCoupledFvPatchVectorField.C
|
||||||
|
derivedFvPatchFields/filmPyrolysisTemperatureCoupled/filmPyrolysisTemperatureCoupledFvPatchScalarField.C
|
||||||
|
|
||||||
|
|
||||||
|
LIB = $(FOAM_LIBBIN)/libregionCoupling
|
||||||
29
src/regionModels/regionCoupling/Make/options
Normal file
29
src/regionModels/regionCoupling/Make/options
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
|
||||||
|
EXE_INC = \
|
||||||
|
-I$(LIB_SRC)/finiteVolume/lnInclude \
|
||||||
|
-I$(LIB_SRC)/meshTools/lnInclude \
|
||||||
|
-I$(LIB_SRC)/thermophysicalModels/chemistryModel/lnInclude \
|
||||||
|
-I$(LIB_SRC)/thermophysicalModels/specie/lnInclude \
|
||||||
|
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
|
||||||
|
-I$(LIB_SRC)/thermophysicalModels/solid/lnInclude \
|
||||||
|
-I$(LIB_SRC)/thermophysicalModels/basicSolidThermo/lnInclude \
|
||||||
|
-I$(LIB_SRC)/thermophysicalModels/solidChemistryModel/lnInclude \
|
||||||
|
-I$(LIB_SRC)/turbulenceModels \
|
||||||
|
-I$(LIB_SRC)/turbulenceModels/compressible/turbulenceModel/lnInclude \
|
||||||
|
-I$(LIB_SRC)/turbulenceModels/compressible/RAS/lnInclude \
|
||||||
|
-I$(LIB_SRC)/turbulenceModels/compressible/LES/lnInclude \
|
||||||
|
-I$(LIB_SRC)/turbulenceModels/LES/LESdeltas/lnInclude \
|
||||||
|
-I$(LIB_SRC)/regionModels/regionModel/lnInclude \
|
||||||
|
-I$(LIB_SRC)/regionModels/pyrolysisModels/lnInclude \
|
||||||
|
-I$(LIB_SRC)/regionModels/surfaceFilmModels/lnInclude \
|
||||||
|
|
||||||
|
|
||||||
|
EXE_LIBS = \
|
||||||
|
-lregionModels \
|
||||||
|
-lpyrolysisModels \
|
||||||
|
-lsurfaceFilmModels \
|
||||||
|
-lsolidChemistryModel \
|
||||||
|
-lfiniteVolume \
|
||||||
|
-lmeshTools \
|
||||||
|
-lcompressibleRASModels \
|
||||||
|
-lcompressibleLESModels
|
||||||
@ -0,0 +1,213 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2010-2011 OpenCFD Ltd.
|
||||||
|
\\/ 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 "filmPyrolysisTemperatureCoupledFvPatchScalarField.H"
|
||||||
|
#include "addToRunTimeSelectionTable.H"
|
||||||
|
#include "surfaceFields.H"
|
||||||
|
#include "pyrolysisModel.H"
|
||||||
|
#include "surfaceFilmModel.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::filmPyrolysisTemperatureCoupledFvPatchScalarField::
|
||||||
|
filmPyrolysisTemperatureCoupledFvPatchScalarField
|
||||||
|
(
|
||||||
|
const fvPatch& p,
|
||||||
|
const DimensionedField<scalar, volMesh>& iF
|
||||||
|
)
|
||||||
|
:
|
||||||
|
fixedValueFvPatchScalarField(p, iF),
|
||||||
|
phiName_("phi"),
|
||||||
|
rhoName_("rho"),
|
||||||
|
deltaWet_(1e-6)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::filmPyrolysisTemperatureCoupledFvPatchScalarField::
|
||||||
|
filmPyrolysisTemperatureCoupledFvPatchScalarField
|
||||||
|
(
|
||||||
|
const filmPyrolysisTemperatureCoupledFvPatchScalarField& ptf,
|
||||||
|
const fvPatch& p,
|
||||||
|
const DimensionedField<scalar, volMesh>& iF,
|
||||||
|
const fvPatchFieldMapper& mapper
|
||||||
|
)
|
||||||
|
:
|
||||||
|
fixedValueFvPatchScalarField(ptf, p, iF, mapper),
|
||||||
|
phiName_(ptf.phiName_),
|
||||||
|
rhoName_(ptf.rhoName_),
|
||||||
|
deltaWet_(ptf.deltaWet_)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::filmPyrolysisTemperatureCoupledFvPatchScalarField::
|
||||||
|
filmPyrolysisTemperatureCoupledFvPatchScalarField
|
||||||
|
(
|
||||||
|
const fvPatch& p,
|
||||||
|
const DimensionedField<scalar, volMesh>& iF,
|
||||||
|
const dictionary& dict
|
||||||
|
)
|
||||||
|
:
|
||||||
|
fixedValueFvPatchScalarField(p, iF),
|
||||||
|
phiName_(dict.lookupOrDefault<word>("phi", "phi")),
|
||||||
|
rhoName_(dict.lookupOrDefault<word>("rho", "rho")),
|
||||||
|
deltaWet_(dict.lookupOrDefault<scalar>("deltaWet", 1e-6))
|
||||||
|
{
|
||||||
|
fvPatchScalarField::operator=(scalarField("value", dict, p.size()));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::filmPyrolysisTemperatureCoupledFvPatchScalarField::
|
||||||
|
filmPyrolysisTemperatureCoupledFvPatchScalarField
|
||||||
|
(
|
||||||
|
const filmPyrolysisTemperatureCoupledFvPatchScalarField& fptpsf
|
||||||
|
)
|
||||||
|
:
|
||||||
|
fixedValueFvPatchScalarField(fptpsf),
|
||||||
|
phiName_(fptpsf.phiName_),
|
||||||
|
rhoName_(fptpsf.rhoName_),
|
||||||
|
deltaWet_(fptpsf.deltaWet_)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::filmPyrolysisTemperatureCoupledFvPatchScalarField::
|
||||||
|
filmPyrolysisTemperatureCoupledFvPatchScalarField
|
||||||
|
(
|
||||||
|
const filmPyrolysisTemperatureCoupledFvPatchScalarField& fptpsf,
|
||||||
|
const DimensionedField<scalar, volMesh>& iF
|
||||||
|
)
|
||||||
|
:
|
||||||
|
fixedValueFvPatchScalarField(fptpsf, iF),
|
||||||
|
phiName_(fptpsf.phiName_),
|
||||||
|
rhoName_(fptpsf.rhoName_),
|
||||||
|
deltaWet_(fptpsf.deltaWet_)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
void Foam::filmPyrolysisTemperatureCoupledFvPatchScalarField::updateCoeffs()
|
||||||
|
{
|
||||||
|
if (updated())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
typedef regionModels::surfaceFilmModels::surfaceFilmModel filmModelType;
|
||||||
|
typedef regionModels::pyrolysisModels::pyrolysisModel pyrModelType;
|
||||||
|
|
||||||
|
bool filmOk =
|
||||||
|
db().objectRegistry::foundObject<filmModelType>
|
||||||
|
(
|
||||||
|
"surfaceFilmProperties"
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
bool pyrOk =
|
||||||
|
db().objectRegistry::foundObject<pyrModelType>
|
||||||
|
(
|
||||||
|
"pyrolysisProperties"
|
||||||
|
);
|
||||||
|
|
||||||
|
if (!filmOk || !pyrOk)
|
||||||
|
{
|
||||||
|
// do nothing on construction - film model doesn't exist yet
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
scalarField& Tp = *this;
|
||||||
|
|
||||||
|
const label patchI = patch().index();
|
||||||
|
|
||||||
|
// Retrieve film model
|
||||||
|
const filmModelType& filmModel =
|
||||||
|
db().lookupObject<filmModelType>("surfaceFilmProperties");
|
||||||
|
|
||||||
|
const label filmPatchI = filmModel.regionPatchID(patchI);
|
||||||
|
|
||||||
|
const mapDistribute& filmMap = filmModel.mappedPatches()[filmPatchI].map();
|
||||||
|
|
||||||
|
scalarField deltaFilm = filmModel.delta().boundaryField()[filmPatchI];
|
||||||
|
filmMap.distribute(deltaFilm);
|
||||||
|
|
||||||
|
scalarField TFilm = filmModel.Ts().boundaryField()[filmPatchI];
|
||||||
|
filmMap.distribute(TFilm);
|
||||||
|
|
||||||
|
|
||||||
|
// Retrieve pyrolysis model
|
||||||
|
const pyrModelType& pyrModel =
|
||||||
|
db().lookupObject<pyrModelType>("pyrolysisProperties");
|
||||||
|
|
||||||
|
const label pyrPatchI = pyrModel.regionPatchID(patchI);
|
||||||
|
|
||||||
|
const mapDistribute& pyrMap = pyrModel.mappedPatches()[pyrPatchI].map();
|
||||||
|
|
||||||
|
scalarField TPyr = pyrModel.T().boundaryField()[pyrPatchI];
|
||||||
|
pyrMap.distribute(TPyr);
|
||||||
|
|
||||||
|
|
||||||
|
forAll(deltaFilm, i)
|
||||||
|
{
|
||||||
|
if (deltaFilm[i] > deltaWet_)
|
||||||
|
{
|
||||||
|
// temperature set by film
|
||||||
|
Tp[i] = TFilm[i];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// temperature set by pyrolysis model
|
||||||
|
Tp[i] = TPyr[i];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fixedValueFvPatchScalarField::updateCoeffs();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::filmPyrolysisTemperatureCoupledFvPatchScalarField::write
|
||||||
|
(
|
||||||
|
Ostream& os
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
fvPatchScalarField::write(os);
|
||||||
|
writeEntryIfDifferent<word>(os, "phi", "phi", phiName_);
|
||||||
|
writeEntryIfDifferent<word>(os, "rho", "rho", rhoName_);
|
||||||
|
os.writeKeyword("deltaWet") << deltaWet_ << token::END_STATEMENT << nl;
|
||||||
|
writeEntry("value", os);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
makePatchTypeField
|
||||||
|
(
|
||||||
|
fvPatchScalarField,
|
||||||
|
filmPyrolysisTemperatureCoupledFvPatchScalarField
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,183 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2010-2011 OpenCFD Ltd.
|
||||||
|
\\/ 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::filmPyrolysisTemperatureCoupledFvPatchScalarField
|
||||||
|
|
||||||
|
Description
|
||||||
|
Temperature boundary condition for patches on the primary region:
|
||||||
|
|
||||||
|
- where the film height > height threshold value:
|
||||||
|
apply film surface temperature values
|
||||||
|
- else
|
||||||
|
apply pyrolysis surface temperature values
|
||||||
|
|
||||||
|
SourceFiles
|
||||||
|
filmPyrolysisTemperatureCoupledFvPatchScalarField.C
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef filmPyrolysisTemperatureCoupledFvPatchScalarField_H
|
||||||
|
#define filmPyrolysisTemperatureCoupledFvPatchScalarField_H
|
||||||
|
|
||||||
|
#include "fixedValueFvPatchFields.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
Class filmPyrolysisTemperatureCoupledFvPatchScalarField Declaration
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
class filmPyrolysisTemperatureCoupledFvPatchScalarField
|
||||||
|
:
|
||||||
|
public fixedValueFvPatchScalarField
|
||||||
|
{
|
||||||
|
// Private data
|
||||||
|
|
||||||
|
//- Name of flux field
|
||||||
|
word phiName_;
|
||||||
|
|
||||||
|
//- Name of density field
|
||||||
|
word rhoName_;
|
||||||
|
|
||||||
|
//- Film height threshold beyond which it is considered 'wet'
|
||||||
|
scalar deltaWet_;
|
||||||
|
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
//- Runtime type information
|
||||||
|
TypeName("filmPyrolysisTemperatureCoupled");
|
||||||
|
|
||||||
|
|
||||||
|
// Constructors
|
||||||
|
|
||||||
|
//- Construct from patch and internal field
|
||||||
|
filmPyrolysisTemperatureCoupledFvPatchScalarField
|
||||||
|
(
|
||||||
|
const fvPatch&,
|
||||||
|
const DimensionedField<scalar, volMesh>&
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Construct from patch, internal field and dictionary
|
||||||
|
filmPyrolysisTemperatureCoupledFvPatchScalarField
|
||||||
|
(
|
||||||
|
const fvPatch&,
|
||||||
|
const DimensionedField<scalar, volMesh>&,
|
||||||
|
const dictionary&
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Construct by mapping given
|
||||||
|
// filmPyrolysisTemperatureCoupledFvPatchScalarField onto a new patch
|
||||||
|
filmPyrolysisTemperatureCoupledFvPatchScalarField
|
||||||
|
(
|
||||||
|
const filmPyrolysisTemperatureCoupledFvPatchScalarField&,
|
||||||
|
const fvPatch&,
|
||||||
|
const DimensionedField<scalar, volMesh>&,
|
||||||
|
const fvPatchFieldMapper&
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Construct as copy
|
||||||
|
filmPyrolysisTemperatureCoupledFvPatchScalarField
|
||||||
|
(
|
||||||
|
const filmPyrolysisTemperatureCoupledFvPatchScalarField&
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Construct and return a clone
|
||||||
|
virtual tmp<fvPatchScalarField> clone() const
|
||||||
|
{
|
||||||
|
return tmp<fvPatchScalarField>
|
||||||
|
(
|
||||||
|
new filmPyrolysisTemperatureCoupledFvPatchScalarField(*this)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
//- Construct as copy setting internal field reference
|
||||||
|
filmPyrolysisTemperatureCoupledFvPatchScalarField
|
||||||
|
(
|
||||||
|
const filmPyrolysisTemperatureCoupledFvPatchScalarField&,
|
||||||
|
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 filmPyrolysisTemperatureCoupledFvPatchScalarField(*this, iF)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Member functions
|
||||||
|
|
||||||
|
// Access
|
||||||
|
|
||||||
|
//- Return the name of phi
|
||||||
|
const word& phiName() const
|
||||||
|
{
|
||||||
|
return phiName_;
|
||||||
|
}
|
||||||
|
|
||||||
|
//- Return reference to the name of phi to allow adjustment
|
||||||
|
word& phiName()
|
||||||
|
{
|
||||||
|
return phiName_;
|
||||||
|
}
|
||||||
|
|
||||||
|
//- Return the name of rho
|
||||||
|
const word& rhoName() const
|
||||||
|
{
|
||||||
|
return rhoName_;
|
||||||
|
}
|
||||||
|
|
||||||
|
//- Return reference to the name of rho to allow adjustment
|
||||||
|
word& rhoName()
|
||||||
|
{
|
||||||
|
return rhoName_;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//- Update the coefficients associated with the patch field
|
||||||
|
virtual void updateCoeffs();
|
||||||
|
|
||||||
|
//- Write
|
||||||
|
virtual void write(Ostream&) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,248 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2010-2011 OpenCFD Ltd.
|
||||||
|
\\/ 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 "filmPyrolysisVelocityCoupledFvPatchVectorField.H"
|
||||||
|
#include "addToRunTimeSelectionTable.H"
|
||||||
|
#include "surfaceFields.H"
|
||||||
|
#include "pyrolysisModel.H"
|
||||||
|
#include "surfaceFilmModel.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::filmPyrolysisVelocityCoupledFvPatchVectorField::
|
||||||
|
filmPyrolysisVelocityCoupledFvPatchVectorField
|
||||||
|
(
|
||||||
|
const fvPatch& p,
|
||||||
|
const DimensionedField<vector, volMesh>& iF
|
||||||
|
)
|
||||||
|
:
|
||||||
|
fixedValueFvPatchVectorField(p, iF),
|
||||||
|
phiName_("phi"),
|
||||||
|
rhoName_("rho"),
|
||||||
|
deltaWet_(1e-6)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::filmPyrolysisVelocityCoupledFvPatchVectorField::
|
||||||
|
filmPyrolysisVelocityCoupledFvPatchVectorField
|
||||||
|
(
|
||||||
|
const filmPyrolysisVelocityCoupledFvPatchVectorField& ptf,
|
||||||
|
const fvPatch& p,
|
||||||
|
const DimensionedField<vector, volMesh>& iF,
|
||||||
|
const fvPatchFieldMapper& mapper
|
||||||
|
)
|
||||||
|
:
|
||||||
|
fixedValueFvPatchVectorField(ptf, p, iF, mapper),
|
||||||
|
phiName_(ptf.phiName_),
|
||||||
|
rhoName_(ptf.rhoName_),
|
||||||
|
deltaWet_(ptf.deltaWet_)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::filmPyrolysisVelocityCoupledFvPatchVectorField::
|
||||||
|
filmPyrolysisVelocityCoupledFvPatchVectorField
|
||||||
|
(
|
||||||
|
const fvPatch& p,
|
||||||
|
const DimensionedField<vector, volMesh>& iF,
|
||||||
|
const dictionary& dict
|
||||||
|
)
|
||||||
|
:
|
||||||
|
fixedValueFvPatchVectorField(p, iF),
|
||||||
|
phiName_(dict.lookupOrDefault<word>("phi", "phi")),
|
||||||
|
rhoName_(dict.lookupOrDefault<word>("rho", "rho")),
|
||||||
|
deltaWet_(dict.lookupOrDefault<scalar>("deltaWet", 1e-6))
|
||||||
|
{
|
||||||
|
fvPatchVectorField::operator=(vectorField("value", dict, p.size()));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::filmPyrolysisVelocityCoupledFvPatchVectorField::
|
||||||
|
filmPyrolysisVelocityCoupledFvPatchVectorField
|
||||||
|
(
|
||||||
|
const filmPyrolysisVelocityCoupledFvPatchVectorField& fpvpvf
|
||||||
|
)
|
||||||
|
:
|
||||||
|
fixedValueFvPatchVectorField(fpvpvf),
|
||||||
|
phiName_(fpvpvf.phiName_),
|
||||||
|
rhoName_(fpvpvf.rhoName_),
|
||||||
|
deltaWet_(fpvpvf.deltaWet_)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::filmPyrolysisVelocityCoupledFvPatchVectorField::
|
||||||
|
filmPyrolysisVelocityCoupledFvPatchVectorField
|
||||||
|
(
|
||||||
|
const filmPyrolysisVelocityCoupledFvPatchVectorField& fpvpvf,
|
||||||
|
const DimensionedField<vector, volMesh>& iF
|
||||||
|
)
|
||||||
|
:
|
||||||
|
fixedValueFvPatchVectorField(fpvpvf, iF),
|
||||||
|
phiName_(fpvpvf.phiName_),
|
||||||
|
rhoName_(fpvpvf.rhoName_),
|
||||||
|
deltaWet_(fpvpvf.deltaWet_)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
void Foam::filmPyrolysisVelocityCoupledFvPatchVectorField::updateCoeffs()
|
||||||
|
{
|
||||||
|
if (updated())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
typedef regionModels::surfaceFilmModels::surfaceFilmModel filmModelType;
|
||||||
|
typedef regionModels::pyrolysisModels::pyrolysisModel pyrModelType;
|
||||||
|
|
||||||
|
bool filmOk =
|
||||||
|
db().objectRegistry::foundObject<filmModelType>
|
||||||
|
(
|
||||||
|
"surfaceFilmProperties"
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
bool pyrOk =
|
||||||
|
db().objectRegistry::foundObject<pyrModelType>
|
||||||
|
(
|
||||||
|
"pyrolysisProperties"
|
||||||
|
);
|
||||||
|
|
||||||
|
if (!filmOk || !pyrOk)
|
||||||
|
{
|
||||||
|
// do nothing on construction - film model doesn't exist yet
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
vectorField& Up = *this;
|
||||||
|
|
||||||
|
const label patchI = patch().index();
|
||||||
|
|
||||||
|
// Retrieve film model
|
||||||
|
const filmModelType& filmModel =
|
||||||
|
db().objectRegistry::lookupObject<filmModelType>
|
||||||
|
(
|
||||||
|
"surfaceFilmProperties"
|
||||||
|
);
|
||||||
|
|
||||||
|
const label filmPatchI = filmModel.regionPatchID(patchI);
|
||||||
|
|
||||||
|
const mapDistribute& filmMap = filmModel.mappedPatches()[filmPatchI].map();
|
||||||
|
|
||||||
|
scalarField deltaFilm = filmModel.delta().boundaryField()[filmPatchI];
|
||||||
|
filmMap.distribute(deltaFilm);
|
||||||
|
|
||||||
|
vectorField UFilm = filmModel.Us().boundaryField()[filmPatchI];
|
||||||
|
filmMap.distribute(UFilm);
|
||||||
|
|
||||||
|
|
||||||
|
// Retrieve pyrolysis model
|
||||||
|
const pyrModelType& pyrModel =
|
||||||
|
db().objectRegistry::lookupObject<pyrModelType>
|
||||||
|
(
|
||||||
|
"pyrolysisProperties"
|
||||||
|
);
|
||||||
|
|
||||||
|
const label pyrPatchI = pyrModel.regionPatchID(patchI);
|
||||||
|
|
||||||
|
const mapDistribute& pyrMap = pyrModel.mappedPatches()[pyrPatchI].map();
|
||||||
|
|
||||||
|
scalarField phiPyr = pyrModel.phiGas().boundaryField()[pyrPatchI];
|
||||||
|
pyrMap.distribute(phiPyr);
|
||||||
|
|
||||||
|
|
||||||
|
const surfaceScalarField& phi =
|
||||||
|
db().lookupObject<surfaceScalarField>(phiName_);
|
||||||
|
|
||||||
|
if (phi.dimensions() == dimVelocity*dimArea)
|
||||||
|
{
|
||||||
|
// do nothing
|
||||||
|
}
|
||||||
|
else if (phi.dimensions() == dimDensity*dimVelocity*dimArea)
|
||||||
|
{
|
||||||
|
const fvPatchField<scalar>& rhop =
|
||||||
|
patch().lookupPatchField<volScalarField, scalar>(rhoName_);
|
||||||
|
phiPyr /= rhop;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
FatalErrorIn
|
||||||
|
(
|
||||||
|
"filmPyrolysisVelocityCoupledFvPatchVectorField::updateCoeffs()"
|
||||||
|
) << "Unable to process flux field phi with dimensions "
|
||||||
|
<< phi.dimensions() << nl
|
||||||
|
<< " on patch " << patch().name()
|
||||||
|
<< " of field " << dimensionedInternalField().name()
|
||||||
|
<< " in file " << dimensionedInternalField().objectPath()
|
||||||
|
<< exit(FatalError);
|
||||||
|
}
|
||||||
|
|
||||||
|
const scalarField UAvePyr = -phiPyr/patch().magSf();
|
||||||
|
const vectorField& nf = patch().nf();
|
||||||
|
|
||||||
|
forAll(deltaFilm, i)
|
||||||
|
{
|
||||||
|
if (deltaFilm[i] > deltaWet_)
|
||||||
|
{
|
||||||
|
// velocity set by film
|
||||||
|
Up[i] = UFilm[i];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// velocity set by pyrolysis model
|
||||||
|
Up[i] = UAvePyr[i]*nf[i];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fixedValueFvPatchVectorField::updateCoeffs();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::filmPyrolysisVelocityCoupledFvPatchVectorField::write
|
||||||
|
(
|
||||||
|
Ostream& os
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
fvPatchVectorField::write(os);
|
||||||
|
writeEntryIfDifferent<word>(os, "phi", "phi", phiName_);
|
||||||
|
writeEntryIfDifferent<word>(os, "rho", "rho", rhoName_);
|
||||||
|
os.writeKeyword("deltaWet") << deltaWet_ << token::END_STATEMENT << nl;
|
||||||
|
writeEntry("value", os);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
makePatchTypeField
|
||||||
|
(
|
||||||
|
fvPatchVectorField,
|
||||||
|
filmPyrolysisVelocityCoupledFvPatchVectorField
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,183 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2010-2011 OpenCFD Ltd.
|
||||||
|
\\/ 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::filmPyrolysisVelocityCoupledFvPatchVectorField
|
||||||
|
|
||||||
|
Description
|
||||||
|
Velocity boundary condition for patches on the primary region:
|
||||||
|
|
||||||
|
- where the film height > height threshold value:
|
||||||
|
apply film surface velocity values
|
||||||
|
- else
|
||||||
|
apply pyrolysis out-gassing velocity values
|
||||||
|
|
||||||
|
SourceFiles
|
||||||
|
filmPyrolysisVelocityCoupledFvPatchVectorField.C
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef filmPyrolysisVelocityCoupledFvPatchVectorField_H
|
||||||
|
#define filmPyrolysisVelocityCoupledFvPatchVectorField_H
|
||||||
|
|
||||||
|
#include "fixedValueFvPatchFields.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
Class filmPyrolysisVelocityCoupledFvPatchVectorField Declaration
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
class filmPyrolysisVelocityCoupledFvPatchVectorField
|
||||||
|
:
|
||||||
|
public fixedValueFvPatchVectorField
|
||||||
|
{
|
||||||
|
// Private data
|
||||||
|
|
||||||
|
//- Name of flux field
|
||||||
|
word phiName_;
|
||||||
|
|
||||||
|
//- Name of density field
|
||||||
|
word rhoName_;
|
||||||
|
|
||||||
|
//- Film height threshold beyond which it is considered 'wet'
|
||||||
|
scalar deltaWet_;
|
||||||
|
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
//- Runtime type information
|
||||||
|
TypeName("filmPyrolysisVelocityCoupled");
|
||||||
|
|
||||||
|
|
||||||
|
// Constructors
|
||||||
|
|
||||||
|
//- Construct from patch and internal field
|
||||||
|
filmPyrolysisVelocityCoupledFvPatchVectorField
|
||||||
|
(
|
||||||
|
const fvPatch&,
|
||||||
|
const DimensionedField<vector, volMesh>&
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Construct from patch, internal field and dictionary
|
||||||
|
filmPyrolysisVelocityCoupledFvPatchVectorField
|
||||||
|
(
|
||||||
|
const fvPatch&,
|
||||||
|
const DimensionedField<vector, volMesh>&,
|
||||||
|
const dictionary&
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Construct by mapping given
|
||||||
|
// filmPyrolysisVelocityCoupledFvPatchVectorField onto a new patch
|
||||||
|
filmPyrolysisVelocityCoupledFvPatchVectorField
|
||||||
|
(
|
||||||
|
const filmPyrolysisVelocityCoupledFvPatchVectorField&,
|
||||||
|
const fvPatch&,
|
||||||
|
const DimensionedField<vector, volMesh>&,
|
||||||
|
const fvPatchFieldMapper&
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Construct as copy
|
||||||
|
filmPyrolysisVelocityCoupledFvPatchVectorField
|
||||||
|
(
|
||||||
|
const filmPyrolysisVelocityCoupledFvPatchVectorField&
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Construct and return a clone
|
||||||
|
virtual tmp<fvPatchVectorField> clone() const
|
||||||
|
{
|
||||||
|
return tmp<fvPatchVectorField>
|
||||||
|
(
|
||||||
|
new filmPyrolysisVelocityCoupledFvPatchVectorField(*this)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
//- Construct as copy setting internal field reference
|
||||||
|
filmPyrolysisVelocityCoupledFvPatchVectorField
|
||||||
|
(
|
||||||
|
const filmPyrolysisVelocityCoupledFvPatchVectorField&,
|
||||||
|
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 filmPyrolysisVelocityCoupledFvPatchVectorField(*this, iF)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Member functions
|
||||||
|
|
||||||
|
// Access
|
||||||
|
|
||||||
|
//- Return the name of phi
|
||||||
|
const word& phiName() const
|
||||||
|
{
|
||||||
|
return phiName_;
|
||||||
|
}
|
||||||
|
|
||||||
|
//- Return reference to the name of phi to allow adjustment
|
||||||
|
word& phiName()
|
||||||
|
{
|
||||||
|
return phiName_;
|
||||||
|
}
|
||||||
|
|
||||||
|
//- Return the name of rho
|
||||||
|
const word& rhoName() const
|
||||||
|
{
|
||||||
|
return rhoName_;
|
||||||
|
}
|
||||||
|
|
||||||
|
//- Return reference to the name of rho to allow adjustment
|
||||||
|
word& rhoName()
|
||||||
|
{
|
||||||
|
return rhoName_;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//- Update the coefficients associated with the patch field
|
||||||
|
virtual void updateCoeffs();
|
||||||
|
|
||||||
|
//- Write
|
||||||
|
virtual void write(Ostream&) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
Reference in New Issue
Block a user