Merge branch 'feature-turbulence' into 'develop'

Feature turbulence

Turbulence updates from our internal development line:
- Added DESModel base class for DES models
- Moved DES models to separate DES directory
- Added DESModelRegions function object
- Updated porousBafflePressure BC to use DataEntry class for D and I inputs
- Documentation updates

See merge request !17
This commit is contained in:
Mattijs Janssens
2015-11-27 16:59:58 +00:00
37 changed files with 1714 additions and 202 deletions

View File

@ -9,6 +9,7 @@ set -x
wmake $targetType turbulenceModels wmake $targetType turbulenceModels
wmake $targetType incompressible wmake $targetType incompressible
wmake $targetType compressible wmake $targetType compressible
wmake $targetType schemes
wmakeLnInclude phaseIncompressible wmakeLnInclude phaseIncompressible
wmakeLnInclude phaseCompressible wmakeLnInclude phaseCompressible

View File

@ -78,7 +78,7 @@ public:
const volVectorField& U, const volVectorField& U,
const surfaceScalarField& alphaRhoPhi, const surfaceScalarField& alphaRhoPhi,
const surfaceScalarField& phi, const surfaceScalarField& phi,
const transportModel& trasport, const transportModel& transport,
const word& propertiesName const word& propertiesName
); );
@ -91,7 +91,7 @@ public:
const volScalarField& rho, const volScalarField& rho,
const volVectorField& U, const volVectorField& U,
const surfaceScalarField& phi, const surfaceScalarField& phi,
const transportModel& trasportModel, const transportModel& transport,
const word& propertiesName = turbulenceModel::propertiesName const word& propertiesName = turbulenceModel::propertiesName
); );

View File

@ -87,7 +87,7 @@ public:
const volVectorField& U, const volVectorField& U,
const surfaceScalarField& alphaRhoPhi, const surfaceScalarField& alphaRhoPhi,
const surfaceScalarField& phi, const surfaceScalarField& phi,
const transportModel& trasport, const transportModel& transport,
const word& propertiesName const word& propertiesName
); );

View File

@ -69,7 +69,7 @@ public:
const volVectorField& U, const volVectorField& U,
const surfaceScalarField& alphaRhoPhi, const surfaceScalarField& alphaRhoPhi,
const surfaceScalarField& phi, const surfaceScalarField& phi,
const transportModel& trasport, const transportModel& transport,
const word& propertiesName const word& propertiesName
); );
@ -83,7 +83,7 @@ public:
const volScalarField& rho, const volScalarField& rho,
const volVectorField& U, const volVectorField& U,
const surfaceScalarField& phi, const surfaceScalarField& phi,
const transportModel& trasportModel, const transportModel& transportModel,
const word& propertiesName = turbulenceModel::propertiesName const word& propertiesName = turbulenceModel::propertiesName
); );
@ -94,7 +94,7 @@ public:
const volScalarField& rho, const volScalarField& rho,
const volVectorField& U, const volVectorField& U,
const surfaceScalarField& phi, const surfaceScalarField& phi,
const transportModel& trasportModel, const transportModel& transportModel,
const word& propertiesName = turbulenceModel::propertiesName const word& propertiesName = turbulenceModel::propertiesName
); );

View File

@ -136,9 +136,30 @@ externalWallHeatFluxTemperatureFvPatchScalarField
h_ = scalarField("h", dict, p.size()); h_ = scalarField("h", dict, p.size());
Ta_ = scalarField("Ta", dict, p.size()); Ta_ = scalarField("Ta", dict, p.size());
if (dict.found("thicknessLayers")) if (dict.found("thicknessLayers"))
if (dict.readIfPresent("thicknessLayers", thicknessLayers_))
{ {
dict.lookup("thicknessLayers") >> thicknessLayers_;
dict.lookup("kappaLayers") >> kappaLayers_; dict.lookup("kappaLayers") >> kappaLayers_;
if (thicknessLayers_.size() != kappaLayers_.size())
{
FatalIOErrorIn
(
"externalWallHeatFluxTemperatureFvPatchScalarField::"
"externalWallHeatFluxTemperatureFvPatchScalarField\n"
"(\n"
" const fvPatch&,\n"
" const DimensionedField<scalar, volMesh>&,\n"
" const dictionary&\n"
")\n",
dict
) << "\n number of layers for thicknessLayers and "
<< "kappaLayers must be the same"
<< "\n for patch " << p.name()
<< " of field " << dimensionedInternalField().name()
<< " in file " << dimensionedInternalField().objectPath()
<< exit(FatalIOError);
}
} }
} }
else else
@ -148,9 +169,9 @@ externalWallHeatFluxTemperatureFvPatchScalarField
"externalWallHeatFluxTemperatureFvPatchScalarField::" "externalWallHeatFluxTemperatureFvPatchScalarField::"
"externalWallHeatFluxTemperatureFvPatchScalarField\n" "externalWallHeatFluxTemperatureFvPatchScalarField\n"
"(\n" "(\n"
" const fvPatch& p,\n" " const fvPatch&,\n"
" const DimensionedField<scalar, volMesh>& iF,\n" " const DimensionedField<scalar, volMesh>&,\n"
" const dictionary& dict\n" " const dictionary&\n"
")\n" ")\n"
) << "\n patch type '" << p.type() ) << "\n patch type '" << p.type()
<< "' either q or h and Ta were not found '" << "' either q or h and Ta were not found '"
@ -374,7 +395,7 @@ void Foam::externalWallHeatFluxTemperatureFvPatchScalarField::write
( (
"void externalWallHeatFluxTemperatureFvPatchScalarField::write" "void externalWallHeatFluxTemperatureFvPatchScalarField::write"
"(" "("
"Ostream& os" "Ostream&"
") const" ") const"
) << "Illegal heat flux mode " << operationModeNames[mode_] ) << "Illegal heat flux mode " << operationModeNames[mode_]
<< abort(FatalError); << abort(FatalError);

View File

@ -91,7 +91,7 @@ public:
( (
const volVectorField& U, const volVectorField& U,
const surfaceScalarField& phi, const surfaceScalarField& phi,
const TransportModel& trasportModel, const TransportModel& transportModel,
const word& propertiesName = turbulenceModel::propertiesName const word& propertiesName = turbulenceModel::propertiesName
); );

View File

@ -78,7 +78,7 @@ public:
const volVectorField& U, const volVectorField& U,
const surfaceScalarField& alphaRhoPhi, const surfaceScalarField& alphaRhoPhi,
const surfaceScalarField& phi, const surfaceScalarField& phi,
const transportModel& trasport, const transportModel& transport,
const word& propertiesName const word& propertiesName
); );
@ -93,7 +93,7 @@ public:
const volVectorField& U, const volVectorField& U,
const surfaceScalarField& alphaRhoPhi, const surfaceScalarField& alphaRhoPhi,
const surfaceScalarField& phi, const surfaceScalarField& phi,
const transportModel& trasportModel, const transportModel& transportModel,
const word& propertiesName = turbulenceModel::propertiesName const word& propertiesName = turbulenceModel::propertiesName
); );

View File

@ -78,7 +78,7 @@ public:
const volVectorField& U, const volVectorField& U,
const surfaceScalarField& alphaRhoPhi, const surfaceScalarField& alphaRhoPhi,
const surfaceScalarField& phi, const surfaceScalarField& phi,
const TransportModel& trasportModel, const TransportModel& transportModel,
const word& propertiesName const word& propertiesName
); );
@ -92,7 +92,7 @@ public:
const volVectorField& U, const volVectorField& U,
const surfaceScalarField& alphaRhoPhi, const surfaceScalarField& alphaRhoPhi,
const surfaceScalarField& phi, const surfaceScalarField& phi,
const TransportModel& trasportModel, const TransportModel& transportModel,
const word& propertiesName = turbulenceModel::propertiesName const word& propertiesName = turbulenceModel::propertiesName
); );

View File

@ -0,0 +1,36 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2015 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 "fvMesh.H"
#include "DEShybrid.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
makeSurfaceInterpolationScheme(DEShybrid);
}
// ************************************************************************* //

View File

@ -0,0 +1,413 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2015 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 2 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, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Class
Foam::DEShybrid
Description
Hybrid convection scheme of Travin et al. for hybrid RAS/LES calculations.
The scheme blends between a low-dissipative convection scheme within the
LES region (e.g. linear) and a numerically more robust convection scheme in
the RAS region (e.g. upwind-biased schemes).
The routine calculates the blending factor denoted as "sigma" in the
literature reference, where 0 <= sigma <= sigmaMax, which is then employed
to set the weights:
\f[
weight = (1-sigma) w_1 + sigma w_2
\f]
where
\vartable
sigma | blending factor
w_1 | scheme 1 weights
w_2 | scheme 2 weights
\endvartable
Reference:
\verbatim
A. Travin, M. Shur, M. Strelets, P. Spalart (2000).
Physical and numerical upgrades in the detached-eddy simulation of
complex turbulent flows.
In Proceedings of the 412th Euromech Colloquium on LES and Complex
Transition and Turbulent Flows, Munich, Germany
\endverbatim
Example of the DEShybrid scheme specification using linear within the LES
region and linearUpwind within the RAS region:
\verbatim
divSchemes
{
.
.
div(phi,U) Gauss DEShybrid
linear // scheme 1
linearUpwind grad(U) // scheme 2
0.65 // DES coefficient, typically = 0.65
10 // Reference time scale (Uref/Lref)
1; // Maximum sigma limit (0-1)
.
.
}
\endverbatim
Notes
- Scheme 1 should be linear (or other low-dissipative schemes) which will
be used in the detached/vortex shedding regions.
- Scheme 2 should be an upwind/deferred correction/TVD scheme which will
be used in the free-stream/Euler/boundary layer regions.
SourceFiles
DEShybrid.C
\*---------------------------------------------------------------------------*/
#ifndef DEShybrid_H
#define DEShybrid_H
#include "surfaceInterpolationScheme.H"
#include "surfaceInterpolate.H"
#include "fvcGrad.H"
#include "blendedSchemeBase.H"
#include "turbulentTransportModel.H"
#include "turbulentFluidThermoModel.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
class DEShybrid Declaration
\*---------------------------------------------------------------------------*/
template<class Type>
class DEShybrid
:
public surfaceInterpolationScheme<Type>,
public blendedSchemeBase<Type>
{
// Private Data
//- Scheme 1
tmp<surfaceInterpolationScheme<Type> > tScheme1_;
//- Scheme 2
tmp<surfaceInterpolationScheme<Type> > tScheme2_;
//- DES Coefficient
scalar CDES_;
//- Time scale coefficient [1/s]
dimensionedScalar invTau_;
//- Maximum bound for sigma (limited to 1)
scalar sigmaMax_;
//- Lower limit for `B' coefficient
dimensionedScalar B0_;
//- Small length scale to avoid division by zero
dimensionedScalar d0_;
//- Disallow default bitwise copy construct
DEShybrid(const DEShybrid&);
//- Disallow default bitwise assignment
void operator=(const DEShybrid&);
// Private Member Functions
//- Calculate the blending factor
tmp<surfaceScalarField> calcBlendingFactor
(
const GeometricField<Type, fvPatchField, volMesh>& vf,
const volScalarField& nuEff,
const volVectorField& U,
const volScalarField& delta
) const
{
tmp<volTensorField> gradU(fvc::grad(U));
const volScalarField S(sqrt(2.0)*mag(symm(gradU())));
const volScalarField Omega(sqrt(2.0)*mag(skew(gradU())));
const volScalarField magSqrGradU(magSqr(gradU));
const volScalarField B
(
0.5*Omega*max(S, Omega)
/max(0.5*magSqrGradU, B0_)
);
const volScalarField K
(
max(Foam::sqrt(0.5*magSqrGradU), 0.1*invTau_)
);
const volScalarField lTurb(Foam::sqrt(nuEff/(pow(0.09, 1.5)*K)));
const volScalarField g(tanh(pow4(B)));
const volScalarField A
(
max(scalar(0), CDES_*delta/max(lTurb*g, d0_) - 0.5)
);
const surfaceScalarField Af(fvc::interpolate(A));
return tmp<surfaceScalarField>
(
new surfaceScalarField
(
vf.name() + "BlendingFactor",
max(sigmaMax_*tanh(pow3(Af)), scalar(0))
)
);
}
public:
//- Runtime type information
TypeName("DEShybrid");
// Constructors
//- Construct from mesh and Istream.
// The name of the flux field is read from the Istream and looked-up
// from the mesh objectRegistry
DEShybrid(const fvMesh& mesh, Istream& is)
:
surfaceInterpolationScheme<Type>(mesh),
tScheme1_
(
surfaceInterpolationScheme<Type>::New(mesh, is)
),
tScheme2_
(
surfaceInterpolationScheme<Type>::New(mesh, is)
),
CDES_(readScalar(is)),
invTau_("invTau", dimless/dimTime, readScalar(is)),
sigmaMax_(readScalar(is)),
B0_("B0", dimless/sqr(dimTime), 1e-20),
d0_("d0", dimLength, SMALL)
{
if (invTau_.value() <= 0)
{
FatalErrorIn("DEShybrid(const fvMesh&, Istream&)")
<< "invTau coefficient must be greater than 0. "
<< "Current value: " << invTau_ << exit(FatalError);
}
if (sigmaMax_ > 1)
{
FatalErrorIn("DEShybrid(const fvMesh&, Istream&)")
<< "sigmaMax coefficient must be less than or equal to 1. "
<< "Current value: " << sigmaMax_ << exit(FatalError);
}
}
//- Construct from mesh, faceFlux and Istream
DEShybrid
(
const fvMesh& mesh,
const surfaceScalarField& faceFlux,
Istream& is
)
:
surfaceInterpolationScheme<Type>(mesh),
tScheme1_
(
surfaceInterpolationScheme<Type>::New(mesh, faceFlux, is)
),
tScheme2_
(
surfaceInterpolationScheme<Type>::New(mesh, faceFlux, is)
),
CDES_(readScalar(is)),
invTau_("invTau", dimless/dimTime, readScalar(is)),
sigmaMax_(readScalar(is)),
B0_("B0", dimless/sqr(dimTime), 1e-20),
d0_("d0", dimLength, SMALL)
{
if (invTau_.value() <= 0)
{
FatalErrorIn("DEShybrid(const fvMesh&, Istream&)")
<< "invTau coefficient must be greater than 0. "
<< "Current value: " << invTau_ << exit(FatalError);
}
if (sigmaMax_ > 1)
{
FatalErrorIn("DEShybrid(const fvMesh&, Istream&)")
<< "sigmaMax coefficient must be less than or equal to 1. "
<< "Current value: " << sigmaMax_ << exit(FatalError);
}
}
// Member Functions
//- Return the face-based blending factor
virtual tmp<surfaceScalarField> blendingFactor
(
const GeometricField<Type, fvPatchField, volMesh>& vf
) const
{
const fvMesh& mesh = this->mesh();
typedef compressible::turbulenceModel cmpModel;
typedef incompressible::turbulenceModel icoModel;
// Assuming that LES delta field is called "delta"
const volScalarField& delta = this->mesh().template
lookupObject<const volScalarField>("delta");
// Could avoid the compressible/incompressible case by looking
// up all fields from the database - but retrieving from model
// ensures consistent fields are being employed e.g. for multiphase
// where group name is used
if (mesh.foundObject<icoModel>(icoModel::propertiesName))
{
const icoModel& model =
mesh.lookupObject<icoModel>(icoModel::propertiesName);
return calcBlendingFactor(vf, model.nuEff(), model.U(), delta);
}
else if (mesh.foundObject<cmpModel>(cmpModel::propertiesName))
{
const cmpModel& model =
mesh.lookupObject<cmpModel>(cmpModel::propertiesName);
return calcBlendingFactor
(
vf, model.muEff()/model.rho(), model.U(), delta
);
}
else
{
FatalErrorIn
(
"virtual tmp<surfaceScalarField> DEShybrid::blendingFactor"
"("
"const GeometricField<Type, fvPatchField, volMesh>&"
") const"
)
<< "Scheme requires a turbulence model to be present. "
<< "Unable to retrieve turbulence model from the mesh "
<< "database" << exit(FatalError);
return tmp<surfaceScalarField>(NULL);
}
}
//- Return the interpolation weighting factors
tmp<surfaceScalarField> weights
(
const GeometricField<Type, fvPatchField, volMesh>& vf
) const
{
surfaceScalarField bf(blendingFactor(vf));
return
(scalar(1) - bf)*tScheme1_().weights(vf)
+ bf*tScheme2_().weights(vf);
}
//- Return the face-interpolate of the given cell field
// with explicit correction
tmp<GeometricField<Type, fvsPatchField, surfaceMesh> >
interpolate
(
const GeometricField<Type, fvPatchField, volMesh>& vf
) const
{
surfaceScalarField bf(blendingFactor(vf));
return
(scalar(1) - bf)*tScheme1_().interpolate(vf)
+ bf*tScheme2_().interpolate(vf);
}
//- Return true if this scheme uses an explicit correction
virtual bool corrected() const
{
return tScheme1_().corrected() || tScheme2_().corrected();
}
//- Return the explicit correction to the face-interpolate
// for the given field
virtual tmp<GeometricField<Type, fvsPatchField, surfaceMesh> >
correction
(
const GeometricField<Type, fvPatchField, volMesh>& vf
) const
{
surfaceScalarField bf(blendingFactor(vf));
if (tScheme1_().corrected())
{
if (tScheme2_().corrected())
{
return
(
(scalar(1) - bf)
* tScheme1_().correction(vf)
+ bf
* tScheme2_().correction(vf)
);
}
else
{
return
(
(scalar(1) - bf)
* tScheme1_().correction(vf)
);
}
}
else if (tScheme2_().corrected())
{
return (bf*tScheme2_().correction(vf));
}
else
{
return tmp<GeometricField<Type, fvsPatchField, surfaceMesh> >
(
NULL
);
}
}
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,3 @@
DEShybrid/DEShybrid.C
LIB = $(FOAM_LIBBIN)/libturbulenceModelSchemes

View File

@ -0,0 +1,17 @@
EXE_INC = \
-I$(LIB_SRC)/transportModels \
-I$(LIB_SRC)/transportModels/compressible/lnInclude \
-I$(LIB_SRC)/TurbulenceModels/turbulenceModels/lnInclude \
-I$(LIB_SRC)/TurbulenceModels/incompressible/lnInclude \
-I$(LIB_SRC)/TurbulenceModels/compressible/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
-I$(LIB_SRC)/finiteVolume/lnInclude
LIB_LIBS = \
-lcompressibleTransportModels \
-lturbulenceModels \
-lincompressibleTurbulenceModels \
-lincompressibleTransportModels \
-lcompressibleTurbulenceModels \
-lfluidThermophysicalModels \
-lfiniteVolume

View File

@ -0,0 +1,76 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2012-2015 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 "DESModel.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace LESModels
{
// * * * * * * * * * * * * * * * Constructor * * * * * * * * * * * * * * * * //
template<class BasicTurbulenceModel>
DESModel<BasicTurbulenceModel>::DESModel
(
const word& type,
const alphaField& alpha,
const rhoField& rho,
const volVectorField& U,
const surfaceScalarField& alphaRhoPhi,
const surfaceScalarField& phi,
const transportModel& transport,
const word& propertiesName
)
:
LESeddyViscosity<BasicTurbulenceModel>
(
type,
alpha,
rho,
U,
alphaRhoPhi,
phi,
transport,
propertiesName
)
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
template<class BasicTurbulenceModel>
DESModel<BasicTurbulenceModel>::~DESModel()
{}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace LESModels
} // End namespace Foam
// ************************************************************************* //

View File

@ -0,0 +1,117 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2012-2015 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::DESModel
Description
Templated abstract base class for DES models
SourceFiles
DESModel.C
\*---------------------------------------------------------------------------*/
#ifndef DESModel_H
#define DESModel_H
#include "DESModelBase.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace LESModels
{
/*---------------------------------------------------------------------------*\
Class DESModel Declaration
\*---------------------------------------------------------------------------*/
template<class BasicTurbulenceModel>
class DESModel
:
public DESModelBase,
public LESeddyViscosity<BasicTurbulenceModel>
{
private:
// Private Member Functions
//- Disallow default bitwise copy construct
DESModel(const DESModel&);
//- Disallow default bitwise assignment
DESModel& operator=(const DESModel&);
public:
typedef typename BasicTurbulenceModel::alphaField alphaField;
typedef typename BasicTurbulenceModel::rhoField rhoField;
typedef typename BasicTurbulenceModel::transportModel transportModel;
// Constructors
//- Construct from components
DESModel
(
const word& type,
const alphaField& alpha,
const rhoField& rho,
const volVectorField& U,
const surfaceScalarField& alphaRhoPhi,
const surfaceScalarField& phi,
const transportModel& transport,
const word& propertiesName = turbulenceModel::propertiesName
);
//- Destructor
virtual ~DESModel();
// Public Member Functions
//- Return the LES field indicator
virtual tmp<volScalarField> LESRegion() const = 0;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace LESModels
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
#include "DESModel.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,46 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2015 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::DESModelBase
Description
Base class for DES models providing an interfaces to the LESRegion
function.
SourceFiles
DESModelBase.C
\*---------------------------------------------------------------------------*/
#include "DESModelBase.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
defineTypeNameAndDebug(DESModelBase, 0);
}
// ************************************************************************* //

View File

@ -0,0 +1,81 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2015 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::DESModelBase
Description
Base class for DES models providing an interfaces to the LESRegion
function.
SourceFiles
DESModelBase.C
\*---------------------------------------------------------------------------*/
#ifndef DESModelBase_H
#define DESModelBase_H
#include "className.H"
#include "tmp.H"
#include "volFieldsFwd.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
class DESModelBase Declaration
\*---------------------------------------------------------------------------*/
class DESModelBase
{
public:
//- Constructor
DESModelBase()
{}
//- Destructor
virtual ~DESModelBase()
{}
ClassName("DESModelBase");
// Public Member Functions
//- Return the LES field indicator
virtual tmp<volScalarField> LESRegion() const = 0;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,32 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2015 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/>.
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
\defgroup grpDESTurbulence DES
@{
\ingroup grpTurbulence
This group contains DES turbulence models.
@}
\*---------------------------------------------------------------------------*/

View File

@ -68,7 +68,7 @@ tmp<volScalarField> SpalartAllmarasDDES<BasicTurbulenceModel>::fd
const volScalarField& magGradU const volScalarField& magGradU
) const ) const
{ {
return 1 - tanh(pow3(8*rd(magGradU))); return 1 - tanh(pow(fdFactor_*rd(magGradU), fdExponent_));
} }
@ -120,10 +120,46 @@ SpalartAllmarasDDES<BasicTurbulenceModel>::SpalartAllmarasDDES
phi, phi,
transport, transport,
propertiesName propertiesName
),
fdFactor_
(
dimensioned<scalar>::lookupOrAddToDict
(
"fdFactor",
this->coeffDict_,
8
)
),
fdExponent_
(
dimensioned<scalar>::lookupOrAddToDict
(
"fdExponent",
this->coeffDict_,
3
)
) )
{} {}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class BasicTurbulenceModel>
bool SpalartAllmarasDDES<BasicTurbulenceModel>::read()
{
if (SpalartAllmarasDES<BasicTurbulenceModel>::read())
{
fdFactor_.readIfPresent(this->coeffDict());
fdExponent_.readIfPresent(this->coeffDict());
return true;
}
else
{
return false;
}
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace LESModels } // End namespace LESModels

View File

@ -79,6 +79,15 @@ class SpalartAllmarasDDES
protected: protected:
// Protected data
//- fd function pre-factor
dimensionedScalar fdFactor_;
//- fd function exponent
dimensionedScalar fdExponent_;
// Protected Member Functions // Protected Member Functions
//- Length scale //- Length scale
@ -120,6 +129,12 @@ public:
//- Destructor //- Destructor
virtual ~SpalartAllmarasDDES() virtual ~SpalartAllmarasDDES()
{} {}
// Member Functions
//- Read from dictionary
virtual bool read();
}; };

View File

@ -197,7 +197,7 @@ SpalartAllmarasDES<BasicTurbulenceModel>::SpalartAllmarasDES
const word& type const word& type
) )
: :
LESeddyViscosity<BasicTurbulenceModel> DESModel<BasicTurbulenceModel>
( (
type, type,
alpha, alpha,
@ -329,7 +329,7 @@ SpalartAllmarasDES<BasicTurbulenceModel>::SpalartAllmarasDES
template<class BasicTurbulenceModel> template<class BasicTurbulenceModel>
bool SpalartAllmarasDES<BasicTurbulenceModel>::read() bool SpalartAllmarasDES<BasicTurbulenceModel>::read()
{ {
if (LESeddyViscosity<BasicTurbulenceModel>::read()) if (DESModel<BasicTurbulenceModel>::read())
{ {
sigmaNut_.readIfPresent(this->coeffDict()); sigmaNut_.readIfPresent(this->coeffDict());
kappa_.readIfPresent(*this); kappa_.readIfPresent(*this);
@ -414,7 +414,7 @@ void SpalartAllmarasDES<BasicTurbulenceModel>::correct()
const surfaceScalarField& alphaRhoPhi = this->alphaRhoPhi_; const surfaceScalarField& alphaRhoPhi = this->alphaRhoPhi_;
const volVectorField& U = this->U_; const volVectorField& U = this->U_;
LESeddyViscosity<BasicTurbulenceModel>::correct(); DESModel<BasicTurbulenceModel>::correct();
const volScalarField chi(this->chi()); const volScalarField chi(this->chi());
const volScalarField fv1(this->fv1(chi)); const volScalarField fv1(this->fv1(chi));

View File

@ -47,7 +47,7 @@ SourceFiles
#ifndef SpalartAllmarasDES_H #ifndef SpalartAllmarasDES_H
#define SpalartAllmarasDES_H #define SpalartAllmarasDES_H
#include "LESeddyViscosity.H" #include "DESModel.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -63,7 +63,7 @@ namespace LESModels
template<class BasicTurbulenceModel> template<class BasicTurbulenceModel>
class SpalartAllmarasDES class SpalartAllmarasDES
: :
public LESeddyViscosity<BasicTurbulenceModel> public DESModel<BasicTurbulenceModel>
{ {
// Private Member Functions // Private Member Functions

View File

@ -20,6 +20,10 @@ $(LESfilters)/laplaceFilter/laplaceFilter.C
$(LESfilters)/anisotropicFilter/anisotropicFilter.C $(LESfilters)/anisotropicFilter/anisotropicFilter.C
/* Base class for DES models */
DES/DESModel/DESModelBase.C
/* Turbulence BCs */ /* Turbulence BCs */
derivedFvPatchFields/fixedShearStress/fixedShearStressFvPatchVectorField.C derivedFvPatchFields/fixedShearStress/fixedShearStressFvPatchVectorField.C
derivedFvPatchFields/porousBafflePressure/porousBafflePressureFvPatchField.C derivedFvPatchFields/porousBafflePressure/porousBafflePressureFvPatchField.C

View File

@ -113,7 +113,8 @@ kOmegaSSTSAS<BasicTurbulenceModel>::kOmegaSSTSAS
alphaRhoPhi, alphaRhoPhi,
phi, phi,
transport, transport,
propertiesName propertiesName,
type
), ),
Cs_ Cs_
@ -171,7 +172,12 @@ kOmegaSSTSAS<BasicTurbulenceModel>::kOmegaSSTSAS
this->coeffDict_ this->coeffDict_
) )
) )
{} {
if (type == typeName)
{
this->printCoeffs(type);
}
}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //

View File

@ -39,9 +39,10 @@ Foam::porousBafflePressureFvPatchField::porousBafflePressureFvPatchField
fixedJumpFvPatchField<scalar>(p, iF), fixedJumpFvPatchField<scalar>(p, iF),
phiName_("phi"), phiName_("phi"),
rhoName_("rho"), rhoName_("rho"),
D_(0), D_(),
I_(0), I_(),
length_(0) length_(0),
uniformJump_(false)
{} {}
@ -55,9 +56,10 @@ Foam::porousBafflePressureFvPatchField::porousBafflePressureFvPatchField
fixedJumpFvPatchField<scalar>(p, iF), fixedJumpFvPatchField<scalar>(p, iF),
phiName_(dict.lookupOrDefault<word>("phi", "phi")), phiName_(dict.lookupOrDefault<word>("phi", "phi")),
rhoName_(dict.lookupOrDefault<word>("rho", "rho")), rhoName_(dict.lookupOrDefault<word>("rho", "rho")),
D_(readScalar(dict.lookup("D"))), D_(DataEntry<scalar>::New("D", dict)),
I_(readScalar(dict.lookup("I"))), I_(DataEntry<scalar>::New("I", dict)),
length_(readScalar(dict.lookup("length"))) length_(readScalar(dict.lookup("length"))),
uniformJump_(dict.lookupOrDefault<bool>("uniformJump", false))
{ {
fvPatchField<scalar>::operator= fvPatchField<scalar>::operator=
( (
@ -77,9 +79,10 @@ Foam::porousBafflePressureFvPatchField::porousBafflePressureFvPatchField
fixedJumpFvPatchField<scalar>(ptf, p, iF, mapper), fixedJumpFvPatchField<scalar>(ptf, p, iF, mapper),
phiName_(ptf.phiName_), phiName_(ptf.phiName_),
rhoName_(ptf.rhoName_), rhoName_(ptf.rhoName_),
D_(ptf.D_), D_(ptf.D_, false),
I_(ptf.I_), I_(ptf.I_, false),
length_(ptf.length_) length_(ptf.length_),
uniformJump_(ptf.uniformJump_)
{} {}
@ -92,9 +95,10 @@ Foam::porousBafflePressureFvPatchField::porousBafflePressureFvPatchField
fixedJumpFvPatchField<scalar>(ptf), fixedJumpFvPatchField<scalar>(ptf),
phiName_(ptf.phiName_), phiName_(ptf.phiName_),
rhoName_(ptf.rhoName_), rhoName_(ptf.rhoName_),
D_(ptf.D_), D_(ptf.D_, false),
I_(ptf.I_), I_(ptf.I_, false),
length_(ptf.length_) length_(ptf.length_),
uniformJump_(ptf.uniformJump_)
{} {}
@ -107,9 +111,10 @@ Foam::porousBafflePressureFvPatchField::porousBafflePressureFvPatchField
fixedJumpFvPatchField<scalar>(ptf, iF), fixedJumpFvPatchField<scalar>(ptf, iF),
phiName_(ptf.phiName_), phiName_(ptf.phiName_),
rhoName_(ptf.rhoName_), rhoName_(ptf.rhoName_),
D_(ptf.D_), D_(ptf.D_, false),
I_(ptf.I_), I_(ptf.I_, false),
length_(ptf.length_) length_(ptf.length_),
uniformJump_(ptf.uniformJump_)
{} {}
@ -130,11 +135,15 @@ void Foam::porousBafflePressureFvPatchField::updateCoeffs()
scalarField Un(phip/patch().magSf()); scalarField Un(phip/patch().magSf());
if (phi.dimensions() == dimensionSet(0, 3, -1, 0, 0)) if (phi.dimensions() == dimMass/dimTime)
{ {
Un /= patch().lookupPatchField<volScalarField, scalar>(rhoName_); Un /= patch().lookupPatchField<volScalarField, scalar>(rhoName_);
} }
if (uniformJump_)
{
Un = gAverage(Un);
}
scalarField magUn(mag(Un)); scalarField magUn(mag(Un));
const turbulenceModel& turbModel = db().lookupObject<turbulenceModel> const turbulenceModel& turbModel = db().lookupObject<turbulenceModel>
@ -146,11 +155,15 @@ void Foam::porousBafflePressureFvPatchField::updateCoeffs()
) )
); );
const scalar t = db().time().timeOutputValue();
const scalar D = D_->value(t);
const scalar I = I_->value(t);
jump_ = jump_ =
-sign(Un) -sign(Un)
*( *(
D_*turbModel.nu(patch().index()) D*turbModel.nu(patch().index())
+ I_*0.5*magUn + I*0.5*magUn
)*magUn*length_; )*magUn*length_;
if (dimensionedInternalField().dimensions() == dimPressure) if (dimensionedInternalField().dimensions() == dimPressure)
@ -161,7 +174,7 @@ void Foam::porousBafflePressureFvPatchField::updateCoeffs()
if (debug) if (debug)
{ {
scalar avePressureJump = gAverage(jump_); scalar avePressureJump = gAverage(jump_);
scalar aveVelocity = gAverage(mag(Un)); scalar aveVelocity = gAverage(Un);
Info<< patch().boundaryMesh().mesh().name() << ':' Info<< patch().boundaryMesh().mesh().name() << ':'
<< patch().name() << ':' << patch().name() << ':'
@ -179,9 +192,11 @@ void Foam::porousBafflePressureFvPatchField::write(Ostream& os) const
fixedJumpFvPatchField<scalar>::write(os); fixedJumpFvPatchField<scalar>::write(os);
writeEntryIfDifferent<word>(os, "phi", "phi", phiName_); writeEntryIfDifferent<word>(os, "phi", "phi", phiName_);
writeEntryIfDifferent<word>(os, "rho", "rho", rhoName_); writeEntryIfDifferent<word>(os, "rho", "rho", rhoName_);
os.writeKeyword("D") << D_ << token::END_STATEMENT << nl; D_->writeData(os);
os.writeKeyword("I") << I_ << token::END_STATEMENT << nl; I_->writeData(os);
os.writeKeyword("length") << length_ << token::END_STATEMENT << nl; os.writeKeyword("length") << length_ << token::END_STATEMENT << nl;
os.writeKeyword("uniformJump") << uniformJump_
<< token::END_STATEMENT << nl;
} }

View File

@ -59,6 +59,8 @@ Description
D | Darcy coefficient | yes | D | Darcy coefficient | yes |
I | inertial coefficient | yes | I | inertial coefficient | yes |
L | porous media length in the flow direction | yes | L | porous media length in the flow direction | yes |
uniformJump | applies a uniform pressure drop on the patch based on the
net velocity across the baffle | no | no
\endtable \endtable
Example of the boundary condition specification: Example of the boundary condition specification:
@ -71,6 +73,7 @@ Description
D 0.001; D 0.001;
I 1000000; I 1000000;
L 0.1; L 0.1;
uniformJump false;
value uniform 0; value uniform 0;
} }
\endverbatim \endverbatim
@ -87,6 +90,7 @@ SourceFiles
#define porousBafflePressureFvPatchField_H #define porousBafflePressureFvPatchField_H
#include "fixedJumpFvPatchField.H" #include "fixedJumpFvPatchField.H"
#include "DataEntry.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -110,14 +114,17 @@ class porousBafflePressureFvPatchField
const word rhoName_; const word rhoName_;
//- Darcy pressure loss coefficient //- Darcy pressure loss coefficient
scalar D_; autoPtr<DataEntry<scalar> > D_;
//- Inertia pressure lost coefficient //- Inertia pressure lost coefficient
scalar I_; autoPtr<DataEntry<scalar> > I_;
//- Porous media length //- Porous media length
scalar length_; scalar length_;
//- Aplies uniform pressure drop
bool uniformJump_;
public: public:

View File

@ -34,11 +34,10 @@ Description
phase change is added as an enthalpy contribution. phase change is added as an enthalpy contribution.
Based on the references: Based on the references:
-# V.R. Voller and C. Prakash, A fixed grid numerical modelling
1. V.R. Voller and C. Prakash, A fixed grid numerical modelling
methodology for convection-diffusion mushy phase-change problems, methodology for convection-diffusion mushy phase-change problems,
Int. J. Heat Mass Transfer 30(8):17091719, 1987. Int. J. Heat Mass Transfer 30(8):17091719, 1987.
2. C.R. Swaminathan. and V.R. Voller, A general enthalpy model for -# C.R. Swaminathan. and V.R. Voller, A general enthalpy model for
modeling solidification processes, Metallurgical Transactions modeling solidification processes, Metallurgical Transactions
23B:651664, 1992. 23B:651664, 1992.

View File

@ -0,0 +1,217 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2013-2015 OpenFOAM Foundation
\\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd.
-------------------------------------------------------------------------------
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 "DESModelRegions.H"
#include "volFields.H"
#include "DESModelBase.H"
#include "turbulenceModel.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
defineTypeNameAndDebug(DESModelRegions, 0);
}
// * * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * //
void Foam::DESModelRegions::writeFileHeader(Ostream& os) const
{
writeHeader(os, "DES model region coverage (% volume)");
writeCommented(os, "Time");
writeTabbed(os, "LES");
writeTabbed(os, "RAS");
os << endl;
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::DESModelRegions::DESModelRegions
(
const word& name,
const objectRegistry& obr,
const dictionary& dict,
const bool loadFromFiles
)
:
functionObjectFile(obr, name, typeName, dict),
name_(name),
obr_(obr),
active_(true),
resultName_(name),
log_(true)
{
// Check if the available mesh is an fvMesh, otherwise deactivate
if (!isA<fvMesh>(obr_))
{
active_ = false;
WarningIn
(
"DESModelRegions::DESModelRegions"
"("
"const word&, "
"const objectRegistry&, "
"const dictionary&, "
"const bool"
")"
) << "No fvMesh available, deactivating " << name_ << nl
<< endl;
}
read(dict);
if (active_)
{
const fvMesh& mesh = refCast<const fvMesh>(obr_);
volScalarField* DESModelRegionsPtr
(
new volScalarField
(
IOobject
(
resultName_,
mesh.time().timeName(),
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE
),
mesh,
dimensionedScalar("0", dimless, 0.0)
)
);
mesh.objectRegistry::store(DESModelRegionsPtr);
writeFileHeader(file());
}
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::DESModelRegions::~DESModelRegions()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::DESModelRegions::read(const dictionary& dict)
{
if (active_)
{
functionObjectFile::read(dict);
log_.readIfPresent("log", dict);
dict.readIfPresent("resultName", resultName_);
}
}
void Foam::DESModelRegions::execute()
{
if (active_)
{
const fvMesh& mesh = refCast<const fvMesh>(obr_);
if (log_) Info<< type() << " " << name_ << " output:" << nl;
volScalarField& DESModelRegions =
const_cast<volScalarField&>
(
mesh.lookupObject<volScalarField>(resultName_)
);
if (mesh.foundObject<DESModelBase>(turbulenceModel::propertiesName))
{
const DESModelBase& model =
mesh.lookupObject<DESModelBase>
(
turbulenceModel::propertiesName
);
DESModelRegions == model.LESRegion();
scalar prc =
gSum(DESModelRegions.internalField()*mesh.V())
/gSum(mesh.V())*100.0;
file() << obr_.time().value()
<< token::TAB << prc
<< token::TAB << 100.0 - prc
<< endl;
if (log_) Info
<< " LES = " << prc << " % (volume)" << nl
<< " RAS = " << 100.0 - prc << " % (volume)" << nl
<< endl;
}
else
{
if (log_) Info
<< " No DES turbulence model found in database" << nl
<< endl;
}
}
}
void Foam::DESModelRegions::end()
{
if (active_)
{
execute();
}
}
void Foam::DESModelRegions::timeSet()
{
// Do nothing
}
void Foam::DESModelRegions::write()
{
if (active_)
{
const volScalarField& DESModelRegions =
obr_.lookupObject<volScalarField>(resultName_);
if (log_) Info
<< type() << " " << name_ << " output:" << nl
<< " writing field " << DESModelRegions.name() << nl
<< endl;
DESModelRegions.write();
}
}
// ************************************************************************* //

View File

@ -0,0 +1,186 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2013-2015 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::DESModelRegions
Group
grpUtilitiesFunctionObjects
Description
This function object writes out an indicator field for DES turbulence
calculations, that is:
- 0 for RAS regions
- 1 for LES regions
The field is stored on the mesh database so that it can be retrieved and
used for other applications.
Example of function object specification to generate DES indicator field:
\verbatim
DESModelRegions1
{
type DESModelRegions;
functionObjectLibs ("libutilityFunctionObjects.so");
...
}
\endverbatim
\heading Function object usage
\table
Property | Description | Required | Default value
type | type name: DESModelRegions| yes |
resultName | Name of DES indicator field | no | <function name>
log | log to standard output | no | yes
\endtable
SourceFiles
DESModelRegions.C
IODESModelRegions.H
\*---------------------------------------------------------------------------*/
#ifndef DESModelRegions_H
#define DESModelRegions_H
#include "functionObjectFile.H"
#include "volFieldsFwd.H"
#include "Switch.H"
#include "OFstream.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// Forward declaration of classes
class objectRegistry;
class dictionary;
class polyMesh;
class mapPolyMesh;
class fvMesh;
/*---------------------------------------------------------------------------*\
Class DESModelRegions Declaration
\*---------------------------------------------------------------------------*/
class DESModelRegions
:
public functionObjectFile
{
protected:
// Protected data
//- Name of this set of DESModelRegions object
word name_;
const objectRegistry& obr_;
//- on/off switch
bool active_;
//- Result name
word resultName_;
//- Switch to send output to Info as well as to file
Switch log_;
// Protected Member Functions
//- File header information
virtual void writeFileHeader(Ostream& os) const;
//- Disallow default bitwise copy construct
DESModelRegions(const DESModelRegions&);
//- Disallow default bitwise assignment
void operator=(const DESModelRegions&);
public:
//- Runtime type information
TypeName("DESModelRegions");
// Constructors
//- Construct for given objectRegistry and dictionary.
// Allow the possibility to load fields from files
DESModelRegions
(
const word& name,
const objectRegistry&,
const dictionary&,
const bool loadFromFiles = false
);
//- Destructor
virtual ~DESModelRegions();
// Member Functions
//- Return name of the set of DESModelRegions
virtual const word& name() const
{
return name_;
}
//- Read the DESModelRegions data
virtual void read(const dictionary&);
//- Execute, currently does nothing
virtual void execute();
//- Execute at the final time-loop, currently does nothing
virtual void end();
//- Called when time was set at the end of the Time::operator++
virtual void timeSet();
//- Calculate the DESModelRegions and write
virtual void write();
//- Update for changes of mesh
virtual void updateMesh(const mapPolyMesh&)
{}
//- Update for changes of mesh
virtual void movePoints(const polyMesh&)
{}
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,42 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2012 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 "DESModelRegionsFunctionObject.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
defineNamedTemplateTypeNameAndDebug(DESModelRegionsFunctionObject, 0);
addToRunTimeSelectionTable
(
functionObject,
DESModelRegionsFunctionObject,
dictionary
);
}
// ************************************************************************* //

View File

@ -0,0 +1,54 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2012 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/>.
Typedef
Foam::DESModelRegionsFunctionObject
Description
FunctionObject wrapper around DESModelRegions to allow it to be created
via the functions entry within controlDict.
SourceFiles
DESModelRegionsFunctionObject.C
\*---------------------------------------------------------------------------*/
#ifndef DESModelRegionsFunctionObject_H
#define DESModelRegionsFunctionObject_H
#include "DESModelRegions.H"
#include "OutputFilterFunctionObject.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
typedef OutputFilterFunctionObject<DESModelRegions>
DESModelRegionsFunctionObject;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,49 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2012 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/>.
Typedef
Foam::IODESModelRegions
Description
Instance of the generic IOOutputFilter for DESModelRegions.
\*---------------------------------------------------------------------------*/
#ifndef IODESModelRegions_H
#define IODESModelRegions_H
#include "DESModelRegions.H"
#include "IOOutputFilter.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
typedef IOOutputFilter<DESModelRegions> IODESModelRegions;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -6,6 +6,9 @@ codedFunctionObject/codedFunctionObject.C
CourantNo/CourantNo.C CourantNo/CourantNo.C
CourantNo/CourantNoFunctionObject.C CourantNo/CourantNoFunctionObject.C
DESModelRegions/DESModelRegions.C
DESModelRegions/DESModelRegionsFunctionObject.C
dsmcFields/dsmcFields.C dsmcFields/dsmcFields.C
dsmcFields/dsmcFieldsFunctionObject.C dsmcFields/dsmcFieldsFunctionObject.C

View File

@ -53,11 +53,9 @@ namespace Foam
const Foam::NamedEnum const Foam::NamedEnum
< <
Foam:: Foam::humidityTemperatureCoupledMixedFvPatchScalarField::massTransferMode,
humidityTemperatureCoupledMixedFvPatchScalarField::
massTransferMode,
4 4
> Foam::humidityTemperatureCoupledMixedFvPatchScalarField::MassModeTypeNames_; > Foam::humidityTemperatureCoupledMixedFvPatchScalarField::massModeTypeNames_;
// * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * // // * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * //
@ -145,11 +143,15 @@ humidityTemperatureCoupledMixedFvPatchScalarField
: :
mixedFvPatchScalarField(p, iF), mixedFvPatchScalarField(p, iF),
temperatureCoupledBase(patch(), "fluidThermo", "undefined", "undefined-K"), temperatureCoupledBase(patch(), "fluidThermo", "undefined", "undefined-K"),
mode_(mConstantMass), mode_(mtConstantMass),
TnbrName_("undefined-Tnbr"), pName_("p"),
QrNbrName_("undefined-Qr"), UName_("U"),
QrName_("undefined-Qr"), rhoName_("rho"),
specieName_("undefined"), muName_("thermo:mu"),
TnbrName_("T"),
QrNbrName_("none"),
QrName_("none"),
specieName_("none"),
liquid_(NULL), liquid_(NULL),
liquidDict_(NULL), liquidDict_(NULL),
mass_(patch().size(), 0.0), mass_(patch().size(), 0.0),
@ -182,6 +184,10 @@ humidityTemperatureCoupledMixedFvPatchScalarField
mixedFvPatchScalarField(psf, p, iF, mapper), mixedFvPatchScalarField(psf, p, iF, mapper),
temperatureCoupledBase(patch(), psf), temperatureCoupledBase(patch(), psf),
mode_(psf.mode_), mode_(psf.mode_),
pName_(psf.pName_),
UName_(psf.UName_),
rhoName_(psf.rhoName_),
muName_(psf.muName_),
TnbrName_(psf.TnbrName_), TnbrName_(psf.TnbrName_),
QrNbrName_(psf.QrNbrName_), QrNbrName_(psf.QrNbrName_),
QrName_(psf.QrName_), QrName_(psf.QrName_),
@ -212,7 +218,11 @@ humidityTemperatureCoupledMixedFvPatchScalarField
: :
mixedFvPatchScalarField(p, iF), mixedFvPatchScalarField(p, iF),
temperatureCoupledBase(patch(), dict), temperatureCoupledBase(patch(), dict),
mode_(mCondensationAndEvaporation), mode_(mtCondensationAndEvaporation),
pName_(dict.lookupOrDefault<word>("p", "p")),
UName_(dict.lookupOrDefault<word>("U", "U")),
rhoName_(dict.lookupOrDefault<word>("rho", "rho")),
muName_(dict.lookupOrDefault<word>("mu", "thermo:mu")),
TnbrName_(dict.lookupOrDefault<word>("Tnbr", "T")), TnbrName_(dict.lookupOrDefault<word>("Tnbr", "T")),
QrNbrName_(dict.lookupOrDefault<word>("QrNbr", "none")), QrNbrName_(dict.lookupOrDefault<word>("QrNbr", "none")),
QrName_(dict.lookupOrDefault<word>("Qr", "none")), QrName_(dict.lookupOrDefault<word>("Qr", "none")),
@ -255,7 +265,7 @@ humidityTemperatureCoupledMixedFvPatchScalarField
if (dict.found("mode")) if (dict.found("mode"))
{ {
mode_ = MassModeTypeNames_.read(dict.lookup("mode")); mode_ = massModeTypeNames_.read(dict.lookup("mode"));
fluid_ = true; fluid_ = true;
} }
@ -263,7 +273,7 @@ humidityTemperatureCoupledMixedFvPatchScalarField
{ {
switch(mode_) switch(mode_)
{ {
case mConstantMass: case mtConstantMass:
{ {
thickness_ = scalarField("thickness", dict, p.size()); thickness_ = scalarField("thickness", dict, p.size());
cp_ = scalarField("cp", dict, p.size()); cp_ = scalarField("cp", dict, p.size());
@ -271,9 +281,9 @@ humidityTemperatureCoupledMixedFvPatchScalarField
break; break;
} }
case mCondensation: case mtCondensation:
case mEvaporation: case mtEvaporation:
case mCondensationAndEvaporation: case mtCondensationAndEvaporation:
{ {
Mcomp_ = readScalar(dict.lookup("carrierMolWeight")); Mcomp_ = readScalar(dict.lookup("carrierMolWeight"));
L_ = readScalar(dict.lookup("L")); L_ = readScalar(dict.lookup("L"));
@ -286,6 +296,7 @@ humidityTemperatureCoupledMixedFvPatchScalarField
{ {
scalarField& Tp = *this; scalarField& Tp = *this;
const scalarField& magSf = patch().magSf(); const scalarField& magSf = patch().magSf();
// Assume initially standard pressure for rho calculation // Assume initially standard pressure for rho calculation
scalar pf = 1e5; scalar pf = 1e5;
thickness_ = scalarField("thickness", dict, p.size()); thickness_ = scalarField("thickness", dict, p.size());
@ -316,7 +327,7 @@ humidityTemperatureCoupledMixedFvPatchScalarField
<< " on patch " << patch().name() << " on patch " << patch().name()
<< nl << nl
<< "Please set 'mode' to one of " << "Please set 'mode' to one of "
<< MassModeTypeNames_.sortedToc() << massModeTypeNames_.sortedToc()
<< exit(FatalIOError); << exit(FatalIOError);
} }
} }
@ -351,6 +362,10 @@ humidityTemperatureCoupledMixedFvPatchScalarField
mixedFvPatchScalarField(psf, iF), mixedFvPatchScalarField(psf, iF),
temperatureCoupledBase(patch(), psf), temperatureCoupledBase(patch(), psf),
mode_(psf.mode_), mode_(psf.mode_),
pName_(psf.pName_),
UName_(psf.UName_),
rhoName_(psf.rhoName_),
muName_(psf.muName_),
TnbrName_(psf.TnbrName_), TnbrName_(psf.TnbrName_),
QrNbrName_(psf.QrNbrName_), QrNbrName_(psf.QrNbrName_),
QrName_(psf.QrName_), QrName_(psf.QrName_),
@ -458,7 +473,7 @@ void Foam::humidityTemperatureCoupledMixedFvPatchScalarField::updateCoeffs()
const scalarField K(this->kappa(*this)); const scalarField K(this->kappa(*this));
// nrb kappa is done separately because I need kappa solid for // Neighbour kappa done separately because we need kappa solid for the
// htc correlation // htc correlation
scalarField nbrK(nbrField.kappa(*this)); scalarField nbrK(nbrField.kappa(*this));
mpp.distribute(nbrK); mpp.distribute(nbrK);
@ -480,7 +495,7 @@ void Foam::humidityTemperatureCoupledMixedFvPatchScalarField::updateCoeffs()
const scalarField myDelta(patch().deltaCoeffs()); const scalarField myDelta(patch().deltaCoeffs());
if (mode_ != mConstantMass) if (mode_ != mtConstantMass)
{ {
scalarField cp(patch().size(), 0.0); scalarField cp(patch().size(), 0.0);
scalarField hfg(patch().size(), 0.0); scalarField hfg(patch().size(), 0.0);
@ -503,16 +518,16 @@ void Foam::humidityTemperatureCoupledMixedFvPatchScalarField::updateCoeffs()
); );
const fvPatchScalarField& pp = const fvPatchScalarField& pp =
patch().lookupPatchField<volScalarField, scalar>("p"); patch().lookupPatchField<volScalarField, scalar>(pName_);
const fvPatchVectorField& Up = const fvPatchVectorField& Up =
patch().lookupPatchField<volVectorField, vector>("U"); patch().lookupPatchField<volVectorField, vector>(UName_);
const fvPatchScalarField& rhop = const fvPatchScalarField& rhop =
patch().lookupPatchField<volScalarField, scalar>("rho"); patch().lookupPatchField<volScalarField, scalar>(rhoName_);
const fvPatchScalarField& mup = const fvPatchScalarField& mup =
patch().lookupPatchField<volScalarField, scalar>("thermo:mu"); patch().lookupPatchField<volScalarField, scalar>(muName_);
const vectorField Ui(Up.patchInternalField()); const vectorField Ui(Up.patchInternalField());
const scalarField Yi(Yp.patchInternalField()); const scalarField Yi(Yp.patchInternalField());
@ -550,15 +565,8 @@ void Foam::humidityTemperatureCoupledMixedFvPatchScalarField::updateCoeffs()
scalar c = 17.65; scalar c = 17.65;
scalar TintDeg = Tint - 273; scalar TintDeg = Tint - 273;
Tdew = Tdew =
b* b*(log(RH) + (c*TintDeg)/(b + TintDeg))
( /(c - log(RH) - ((c*TintDeg)/(b + TintDeg))) + 273;
log(RH)
+ (c*TintDeg)/(b + TintDeg)
)
/
(
c - log(RH) - ((c*TintDeg)/(b + TintDeg))
) + 273;
} }
if if
@ -566,18 +574,17 @@ void Foam::humidityTemperatureCoupledMixedFvPatchScalarField::updateCoeffs()
Tf < Tdew Tf < Tdew
&& RH > RHmin && RH > RHmin
&& ( && (
mode_ == mCondensation mode_ == mtCondensation
|| mode_ == mCondensationAndEvaporation || mode_ == mtCondensationAndEvaporation
) )
) )
{ {
htc[faceI] = htc[faceI] = htcCondensation(TSat, Re)*nbrK[faceI]/L_;
this->htcCondensation(TSat, Re)*nbrK[faceI]/L_;
scalar htcTotal = scalar htcTotal =
1.0/((1.0/myKDelta_[faceI]) + (1.0/htc[faceI])); 1.0/((1.0/myKDelta_[faceI]) + (1.0/htc[faceI]));
// Heat flux W (>0 heat is converted into mass) // Heat flux [W] (>0 heat is converted into mass)
const scalar q = (Tint - Tf)*htcTotal*magSf[faceI]; const scalar q = (Tint - Tf)*htcTotal*magSf[faceI];
// Mass flux rate [Kg/s/m2] // Mass flux rate [Kg/s/m2]
@ -595,8 +602,8 @@ void Foam::humidityTemperatureCoupledMixedFvPatchScalarField::updateCoeffs()
Tf > Tvap_ Tf > Tvap_
&& mass_[faceI] > 0.0 && mass_[faceI] > 0.0
&& ( && (
mode_ == mEvaporation mode_ == mtEvaporation
|| mode_ == mCondensationAndEvaporation || mode_ == mtCondensationAndEvaporation
) )
) )
{ {
@ -606,6 +613,7 @@ void Foam::humidityTemperatureCoupledMixedFvPatchScalarField::updateCoeffs()
const scalar Sh = this->Sh(Re, Sc); const scalar Sh = this->Sh(Re, Sc);
const scalar Ys = Mv*pSat/(Mv*pSat + Mcomp_*(pf - pSat)); const scalar Ys = Mv*pSat/(Mv*pSat + Mcomp_*(pf - pSat));
// Mass transfer coefficient [m/s] // Mass transfer coefficient [m/s]
const scalar hm = Dab*Sh/L_; const scalar hm = Dab*Sh/L_;
@ -620,12 +628,11 @@ void Foam::humidityTemperatureCoupledMixedFvPatchScalarField::updateCoeffs()
// Total mass accumulated [Kg] // Total mass accumulated [Kg]
mass_[faceI] += dm[faceI]*magSf[faceI]*dt; mass_[faceI] += dm[faceI]*magSf[faceI]*dt;
htc[faceI] = htc[faceI] = htcCondensation(TSat, Re)*nbrK[faceI]/L_;
this->htcCondensation(TSat, Re)*nbrK[faceI]/L_;
} }
else if (Tf > Tdew && Tf < Tvap_ && mass_[faceI] > 0.0) else if (Tf > Tdew && Tf < Tvap_ && mass_[faceI] > 0.0)
{ {
htc[faceI] = this->htcCondensation(TSat, Re)*nbrK[faceI]/L_; htc[faceI] = htcCondensation(TSat, Re)*nbrK[faceI]/L_;
} }
else if (mass_[faceI] == 0.0) else if (mass_[faceI] == 0.0)
{ {
@ -722,10 +729,10 @@ void Foam::humidityTemperatureCoupledMixedFvPatchScalarField::updateCoeffs()
Info<< mesh.name() << ':' Info<< mesh.name() << ':'
<< patch().name() << ':' << patch().name() << ':'
<< this->dimensionedInternalField().name() << " <- " << dimensionedInternalField().name() << " <- "
<< nbrMesh.name() << ':' << nbrMesh.name() << ':'
<< nbrPatch.name() << ':' << nbrPatch.name() << ':'
<< this->dimensionedInternalField().name() << " :" << nl << dimensionedInternalField().name() << " :" << nl
<< " Total mass flux [Kg/s] : " << Qdm << nl << " Total mass flux [Kg/s] : " << Qdm << nl
<< " Total mass on the wall [Kg] : " << QMass << nl << " Total mass on the wall [Kg] : " << QMass << nl
<< " Total heat (>0 leaving the wall to the fluid) [W] : " << " Total heat (>0 leaving the wall to the fluid) [W] : "
@ -748,15 +755,21 @@ void Foam::humidityTemperatureCoupledMixedFvPatchScalarField::write
) const ) const
{ {
mixedFvPatchScalarField::write(os); mixedFvPatchScalarField::write(os);
os.writeKeyword("QrNbr")<< QrNbrName_ << token::END_STATEMENT << nl; writeEntryIfDifferent<word>(os, "p", "p", pName_);
os.writeKeyword("Qr")<< QrName_ << token::END_STATEMENT << nl; writeEntryIfDifferent<word>(os, "U", "U", UName_);
writeEntryIfDifferent<word>(os, "rho", "rho", rhoName_);
writeEntryIfDifferent<word>(os, "mu", "thermo:mu", muName_);
writeEntryIfDifferent<word>(os, "Tnbr", "T", TnbrName_);
writeEntryIfDifferent<word>(os, "QrNbr", "none", QrNbrName_);
writeEntryIfDifferent<word>(os, "Qr", "none", QrName_);
if (fluid_) if (fluid_)
{ {
os.writeKeyword("mode")<< MassModeTypeNames_[mode_] os.writeKeyword("mode")<< massModeTypeNames_[mode_]
<< token::END_STATEMENT <<nl;
os.writeKeyword("specieName")<< specieName_
<< token::END_STATEMENT <<nl; << token::END_STATEMENT <<nl;
writeEntryIfDifferent<word>(os, "specieName", "none", specieName_);
os.writeKeyword("carrierMolWeight")<< Mcomp_ os.writeKeyword("carrierMolWeight")<< Mcomp_
<< token::END_STATEMENT <<nl; << token::END_STATEMENT <<nl;
@ -765,7 +778,7 @@ void Foam::humidityTemperatureCoupledMixedFvPatchScalarField::write
os.writeKeyword("fluid")<< fluid_ << token::END_STATEMENT << nl; os.writeKeyword("fluid")<< fluid_ << token::END_STATEMENT << nl;
mass_.writeEntry("mass", os); mass_.writeEntry("mass", os);
if (mode_ == mConstantMass) if (mode_ == mtConstantMass)
{ {
cp_.writeEntry("cp", os); cp_.writeEntry("cp", os);
rho_.writeEntry("rho", os); rho_.writeEntry("rho", os);

View File

@ -28,62 +28,69 @@ Class
humidityTemperatureCoupledMixedFvPatchScalarField humidityTemperatureCoupledMixedFvPatchScalarField
Description Description
Mixed boundary condition for temperature to be used on coupling flow and Mixed boundary condition for temperature to be used at the coupling
solid regions. This BC can operate in four modes: interface between fluid solid regions.
1) 'inert' : thermal inertia is important and no condensation/evaporation This boundary condition can operate in four modes:
is taken place. - \c constantMass: thermal inertia only
2) 'condensation' : just condensation is taken place - requires \c rho, \c thickness and \cp
3) 'vaporization' : just evaporation is take place - \c condensation: condensation only
4) 'condEvap' : both condensation and evaporation take place - when the wall temperature (Tw) is below the dew temperature (Tdew)
condesation takes place and the resulting condensed mass is stored
on the wall
- \c evaporation: evaporation only
- initial mass is vaporized when Tw is above the input vaporization
temperature (Tvap).
- \c condensationAndEvaporation : condensation and evaporation take place
simultaneously.
For 'inert' operation the 'rho', 'thickness' and 'cp' entries are needed. There is no mass flow on the wall, i.e. the mass condensed on a face
remains on that face. It uses a 'lumped mass' model to include thermal
In 'condensation' mode when the wall temperature (Tw) is bellow the dew
temperature (Tdew) condesation takes place and the resulting condensed mass
is stored on the wall.
In 'vaporization' the initial mass is vaporized when Tw is above the
input vaporization temperature (Tvap).
In 'condEvap', condensation and evaporation take place simultaneously.
The BC assumes no mass flow on the wall.i.e the mass condensed on a face
remains on that face. It uses a 'lump mass' model to include thermal
inertia effects. inertia effects.
It assumes a drop-wise type of condensation and its heat transfer Nu number It assumes a drop-wise type of condensation, whereby its heat transfer
is: Nusselt number is calculated using:
\f{eqnarray*}{
51104 + 2044 T & T > 295 & T < 373 \\
255510 & T > 373 &
\f}
51104 + 2044*T T > 295 T < 373 Reference:
255510 T > 373 - T. Bergam, A.Lavine, F. Incropera and D. Dewitt. Heat and Mass Transfer.
T. Bergam, A.Lavine, F. Incropera and D. Dewitt. Heat and Mass Transfer.
7th Edition. Chapter 10. 7th Edition. Chapter 10.
The mass transfer correlation used is hm = Dab*Sh/L The mass transfer correlation used is:
\f[ h_m = D_{ab} \frac{Sc}{L} \f]
where: where:
\vartable
D_{ab} | mass vapour difussivity
L | characteristic length
Sc | Schmidt number
\endvartable
Dab is the mass vapor difussivity The Schmidt number is calculated using:
L is the characteristic lenght
Sc the Schmidt number and it is calculated as:
0.664*sqrt(Re)*cbrt(Sc) Re < 5.0E+05 \f{eqnarray*}{
0.037*pow(Re, 0.8)*cbrt(Sc) Re > 5.0E+05 0.664 Re^\frac{1}{2} Sc^\frac{1}{3} & Re < 5.0E+05 \\
0.037 Re^\frac{4}{5} Sc^\frac{1}{3} & Re > 5.0E+05
\f}
NOTE: The correclation used to calculate Tdew is for water vapor. NOTE:
In addition a scalar transport for the carrier specie have to be specified - The correlation used to calculate Tdew is for water vapour.
via function objects or in the main solver. This specie transports the - A scalar transport equation for the carrier specie is required, e.g.
vapour phase in the main ragion. The BC of this specie on the coupled wall supplied via a function object or in the main solver. This specie
has to fixedGradient in order to allow condensation or evaporation of the transports the vapour phase in the main ragion.
vapor in or out of this wall - The boundary condition of this specie on the coupled wall must be
fixedGradient in order to allow condensation or evaporation of the
vapour in or out of this wall
Example usage: Example usage:
On the fluid side On the fluid side
\verbatim
myInterfacePatchName myInterfacePatchName
{ {
type thermalHumidityCoupledMixed; type thermalHumidityCoupledMixed;
@ -123,10 +130,10 @@ Description
value $internalField; value $internalField;
} }
\endverbatim
On the solid side: On the solid side:
\verbatim
myInterfacePatchName myInterfacePatchName
{ {
type thermalInertiaMassTransferCoupledMixed; type thermalInertiaMassTransferCoupledMixed;
@ -134,6 +141,7 @@ Description
kappaName none; kappaName none;
value uniform 260; value uniform 260;
} }
\endverbatim
SourceFiles SourceFiles
@ -170,10 +178,10 @@ public:
//- Modes of mass transfer //- Modes of mass transfer
enum massTransferMode enum massTransferMode
{ {
mConstantMass, mtConstantMass,
mCondensation, mtCondensation,
mEvaporation, mtEvaporation,
mCondensationAndEvaporation mtCondensationAndEvaporation
}; };
@ -181,23 +189,39 @@ private:
// Private data // Private data
static const NamedEnum<massTransferMode, 4> MassModeTypeNames_; static const NamedEnum<massTransferMode, 4> massModeTypeNames_;
//- BC mode //- Operating mode
massTransferMode mode_; massTransferMode mode_;
//- Name of field on the neighbour region
// Field names
//- Name of the pressure field
const word pName_;
//- Name of the velocity field
const word UName_;
//- Name of the density field
const word rhoName_;
//- Name of the dynamic viscosity field
const word muName_;
//- Name of temperature field on the neighbour region
const word TnbrName_; const word TnbrName_;
//- Name of the radiative heat flux in the neighbout region //- Name of the radiative heat flux in the neighbout region
const word QrNbrName_; const word QrNbrName_;
//- Name of the radiative heat flux //- Name of the radiative heat flux field
const word QrName_; const word QrName_;
//- Name of the species on which the mass transfered (default H2O) //- Name of the species on which the mass transfered (default H2O)
const word specieName_; const word specieName_;
//- Liquid properties //- Liquid properties
autoPtr<liquidProperties> liquid_; autoPtr<liquidProperties> liquid_;
@ -345,7 +369,7 @@ public:
return myKDelta_; return myKDelta_;
} }
//- Return mpCpdTpd //- Return mpCpTp
const scalarField mpCpTp() const const scalarField mpCpTp() const
{ {
return mpCpTp_; return mpCpTp_;
@ -357,7 +381,6 @@ public:
return dmHfg_; return dmHfg_;
} }
//- Update the coefficients associated with the patch field //- Update the coefficients associated with the patch field
virtual void updateCoeffs(); virtual void updateCoeffs();