mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: adding radiation to multi region solvers, radiotionCouple, etc
This commit is contained in:
@ -7,7 +7,8 @@ EXE_INC = \
|
|||||||
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
|
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
|
||||||
-I$(LIB_SRC)/thermophysicalModels/specie/lnInclude \
|
-I$(LIB_SRC)/thermophysicalModels/specie/lnInclude \
|
||||||
-I$(LIB_SRC)/thermophysicalModels/basicSolidThermo/lnInclude \
|
-I$(LIB_SRC)/thermophysicalModels/basicSolidThermo/lnInclude \
|
||||||
-I$(LIB_SRC)/turbulenceModels/compressible/turbulenceModel/lnInclude
|
-I$(LIB_SRC)/turbulenceModels/compressible/turbulenceModel/lnInclude \
|
||||||
|
-I$(LIB_SRC)/thermophysicalModels/radiationModels/lnInclude
|
||||||
|
|
||||||
EXE_LIBS = \
|
EXE_LIBS = \
|
||||||
-lbasicThermophysicalModels \
|
-lbasicThermophysicalModels \
|
||||||
@ -17,4 +18,5 @@ EXE_LIBS = \
|
|||||||
-lcompressibleRASModels \
|
-lcompressibleRASModels \
|
||||||
-lcompressibleLESModels \
|
-lcompressibleLESModels \
|
||||||
-lmeshTools \
|
-lmeshTools \
|
||||||
-lfiniteVolume
|
-lfiniteVolume \
|
||||||
|
-lradiationModels
|
||||||
|
|||||||
@ -38,6 +38,7 @@ Description
|
|||||||
#include "compressibleCourantNo.H"
|
#include "compressibleCourantNo.H"
|
||||||
#include "solidRegionDiffNo.H"
|
#include "solidRegionDiffNo.H"
|
||||||
#include "basicSolidThermo.H"
|
#include "basicSolidThermo.H"
|
||||||
|
#include "radiationModel.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
|||||||
@ -1,4 +1,6 @@
|
|||||||
chtMultiRegionSimpleFoam.C
|
chtMultiRegionSimpleFoam.C
|
||||||
|
../derivedFvPatchFields/turbulentTemperatureCoupledMixedST/turbulentTemperatureCoupledMixedSTFvPatchScalarField.C
|
||||||
|
../derivedFvPatchFields/externalWallHeatFluxTemperature/externalWallHeatFluxTemperatureFvPatchScalarField.C
|
||||||
|
|
||||||
EXE = $(FOAM_APPBIN)/chtMultiRegionSimpleFoam
|
EXE = $(FOAM_APPBIN)/chtMultiRegionSimpleFoam
|
||||||
|
|
||||||
|
|||||||
@ -9,6 +9,7 @@ EXE_INC = \
|
|||||||
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
|
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
|
||||||
-I$(LIB_SRC)/thermophysicalModels/specie/lnInclude \
|
-I$(LIB_SRC)/thermophysicalModels/specie/lnInclude \
|
||||||
-I$(LIB_SRC)/thermophysicalModels/basicSolidThermo/lnInclude \
|
-I$(LIB_SRC)/thermophysicalModels/basicSolidThermo/lnInclude \
|
||||||
|
-I$(LIB_SRC)/thermophysicalModels/radiationModels/lnInclude \
|
||||||
-I$(LIB_SRC)/turbulenceModels \
|
-I$(LIB_SRC)/turbulenceModels \
|
||||||
-I$(LIB_SRC)/turbulenceModels/compressible/turbulenceModel/lnInclude \
|
-I$(LIB_SRC)/turbulenceModels/compressible/turbulenceModel/lnInclude \
|
||||||
-I$(LIB_SRC)/turbulenceModels/compressible/RAS/lnInclude
|
-I$(LIB_SRC)/turbulenceModels/compressible/RAS/lnInclude
|
||||||
@ -20,4 +21,5 @@ EXE_LIBS = \
|
|||||||
-lspecie \
|
-lspecie \
|
||||||
-lcompressibleTurbulenceModel \
|
-lcompressibleTurbulenceModel \
|
||||||
-lcompressibleRASModels \
|
-lcompressibleRASModels \
|
||||||
-lcompressibleLESModels
|
-lcompressibleLESModels \
|
||||||
|
-lradiationModels
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
|
\\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -35,6 +35,7 @@ Description
|
|||||||
#include "fixedGradientFvPatchFields.H"
|
#include "fixedGradientFvPatchFields.H"
|
||||||
#include "regionProperties.H"
|
#include "regionProperties.H"
|
||||||
#include "basicSolidThermo.H"
|
#include "basicSolidThermo.H"
|
||||||
|
#include "radiationModel.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
|||||||
@ -9,6 +9,7 @@
|
|||||||
PtrList<volScalarField> p_rghFluid(fluidRegions.size());
|
PtrList<volScalarField> p_rghFluid(fluidRegions.size());
|
||||||
PtrList<volScalarField> ghFluid(fluidRegions.size());
|
PtrList<volScalarField> ghFluid(fluidRegions.size());
|
||||||
PtrList<surfaceScalarField> ghfFluid(fluidRegions.size());
|
PtrList<surfaceScalarField> ghfFluid(fluidRegions.size());
|
||||||
|
PtrList<radiation::radiationModel> radiation(fluidRegions.size());
|
||||||
|
|
||||||
List<scalar> initialMassFluid(fluidRegions.size());
|
List<scalar> initialMassFluid(fluidRegions.size());
|
||||||
List<label> pRefCellFluid(fluidRegions.size(),0);
|
List<label> pRefCellFluid(fluidRegions.size(),0);
|
||||||
@ -168,6 +169,12 @@
|
|||||||
// Force p_rgh to be consistent with p
|
// Force p_rgh to be consistent with p
|
||||||
p_rghFluid[i] = thermoFluid[i].p() - rhoFluid[i]*ghFluid[i];
|
p_rghFluid[i] = thermoFluid[i].p() - rhoFluid[i]*ghFluid[i];
|
||||||
|
|
||||||
|
radiation.set
|
||||||
|
(
|
||||||
|
i,
|
||||||
|
radiation::radiationModel::New(thermoFluid[i].T())
|
||||||
|
);
|
||||||
|
|
||||||
initialMassFluid[i] = fvc::domainIntegrate(rhoFluid[i]).value();
|
initialMassFluid[i] = fvc::domainIntegrate(rhoFluid[i]).value();
|
||||||
|
|
||||||
setRefCell
|
setRefCell
|
||||||
|
|||||||
@ -7,14 +7,23 @@
|
|||||||
==
|
==
|
||||||
fvc::div(phi/fvc::interpolate(rho), rho/psi, "div(U,p)")
|
fvc::div(phi/fvc::interpolate(rho), rho/psi, "div(U,p)")
|
||||||
- (rho/psi)*fvc::div(phi/fvc::interpolate(rho))
|
- (rho/psi)*fvc::div(phi/fvc::interpolate(rho))
|
||||||
|
+ rad.Sh(thermo)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
/*
|
||||||
|
fvScalarMatrix hEqn
|
||||||
|
(
|
||||||
|
- fvm::laplacian(turb.alphaEff(), h)
|
||||||
|
);
|
||||||
|
*/
|
||||||
hEqn.relax();
|
hEqn.relax();
|
||||||
|
|
||||||
hEqn.solve();
|
hEqn.solve();
|
||||||
|
|
||||||
thermo.correct();
|
thermo.correct();
|
||||||
|
|
||||||
|
rad.correct();
|
||||||
|
|
||||||
Info<< "Min/max T:" << min(thermo.T()).value() << ' '
|
Info<< "Min/max T:" << min(thermo.T()).value() << ' '
|
||||||
<< max(thermo.T()).value() << endl;
|
<< max(thermo.T()).value() << endl;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -19,6 +19,8 @@
|
|||||||
initialMassFluid[i]
|
initialMassFluid[i]
|
||||||
);
|
);
|
||||||
|
|
||||||
|
radiation::radiationModel& rad = radiation[i];
|
||||||
|
|
||||||
const label pRefCell = pRefCellFluid[i];
|
const label pRefCell = pRefCellFluid[i];
|
||||||
const scalar pRefValue = pRefValueFluid[i];
|
const scalar pRefValue = pRefValueFluid[i];
|
||||||
|
|
||||||
|
|||||||
@ -0,0 +1,271 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2011-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 "externalWallHeatFluxTemperatureFvPatchScalarField.H"
|
||||||
|
#include "addToRunTimeSelectionTable.H"
|
||||||
|
#include "fvPatchFieldMapper.H"
|
||||||
|
#include "volFields.H"
|
||||||
|
#include "directMappedPatchBase.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
template<>
|
||||||
|
const char*
|
||||||
|
NamedEnum
|
||||||
|
<externalWallHeatFluxTemperatureFvPatchScalarField::operationMode, 3>::names[]=
|
||||||
|
{
|
||||||
|
"fixed_heat_flux",
|
||||||
|
"fixed_heat_transfer_coefficient",
|
||||||
|
"unknown"
|
||||||
|
};
|
||||||
|
|
||||||
|
const NamedEnum
|
||||||
|
<
|
||||||
|
externalWallHeatFluxTemperatureFvPatchScalarField::operationMode, 3
|
||||||
|
>
|
||||||
|
externalWallHeatFluxTemperatureFvPatchScalarField::operationModeNames;
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::externalWallHeatFluxTemperatureFvPatchScalarField::
|
||||||
|
externalWallHeatFluxTemperatureFvPatchScalarField
|
||||||
|
(
|
||||||
|
const fvPatch& p,
|
||||||
|
const DimensionedField<scalar, volMesh>& iF
|
||||||
|
)
|
||||||
|
:
|
||||||
|
mixedFvPatchScalarField(p, iF),
|
||||||
|
temperatureCoupledBase(patch(), "undefined", "undefined-K"),
|
||||||
|
oldMode_(unknown),
|
||||||
|
q_(p.size(), 0.0),
|
||||||
|
h_(p.size(), 0.0),
|
||||||
|
Ta_(p.size(), 0.0)
|
||||||
|
{
|
||||||
|
this->refValue() = 0.0;
|
||||||
|
this->refGrad() = 0.0;
|
||||||
|
this->valueFraction() = 1.0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::externalWallHeatFluxTemperatureFvPatchScalarField::
|
||||||
|
externalWallHeatFluxTemperatureFvPatchScalarField
|
||||||
|
(
|
||||||
|
const externalWallHeatFluxTemperatureFvPatchScalarField& ptf,
|
||||||
|
const fvPatch& p,
|
||||||
|
const DimensionedField<scalar, volMesh>& iF,
|
||||||
|
const fvPatchFieldMapper& mapper
|
||||||
|
)
|
||||||
|
:
|
||||||
|
mixedFvPatchScalarField(ptf, p, iF, mapper),
|
||||||
|
temperatureCoupledBase(patch(), ptf.KMethod(), ptf.KName()),
|
||||||
|
oldMode_(unknown),
|
||||||
|
q_(ptf.q_, mapper),
|
||||||
|
h_(ptf.h_, mapper),
|
||||||
|
Ta_(ptf.Ta_, mapper)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::externalWallHeatFluxTemperatureFvPatchScalarField::
|
||||||
|
externalWallHeatFluxTemperatureFvPatchScalarField
|
||||||
|
(
|
||||||
|
const fvPatch& p,
|
||||||
|
const DimensionedField<scalar, volMesh>& iF,
|
||||||
|
const dictionary& dict
|
||||||
|
)
|
||||||
|
:
|
||||||
|
mixedFvPatchScalarField(p, iF),
|
||||||
|
temperatureCoupledBase(patch(), dict),
|
||||||
|
oldMode_(unknown),
|
||||||
|
q_(p.size(), 0.0),
|
||||||
|
h_(p.size(), 0.0),
|
||||||
|
Ta_(p.size(), 0.0)
|
||||||
|
{
|
||||||
|
if (dict.found("q") && !dict.found("h") && !dict.found("Ta"))
|
||||||
|
{
|
||||||
|
oldMode_ = fixedHeatFlux;
|
||||||
|
q_ = scalarField("q", dict, p.size());
|
||||||
|
}
|
||||||
|
else if(dict.found("h") && dict.found("Ta") && !dict.found("q"))
|
||||||
|
{
|
||||||
|
oldMode_ = fixedHeatTransferCoeff;
|
||||||
|
h_ = scalarField("h", dict, p.size());
|
||||||
|
Ta_ = scalarField("Ta", dict, p.size());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
FatalErrorIn
|
||||||
|
(
|
||||||
|
"externalWallHeatFluxTemperatureFvPatchScalarField::"
|
||||||
|
"externalWallHeatFluxTemperatureFvPatchScalarField\n"
|
||||||
|
"(\n"
|
||||||
|
" const fvPatch& p,\n"
|
||||||
|
" const DimensionedField<scalar, volMesh>& iF,\n"
|
||||||
|
" const dictionary& dict\n"
|
||||||
|
")\n"
|
||||||
|
) << "\n patch type '" << p.type()
|
||||||
|
<< "' either q or h and Ta were not found '"
|
||||||
|
<< "\n for patch " << p.name()
|
||||||
|
<< " of field " << dimensionedInternalField().name()
|
||||||
|
<< " in file " << dimensionedInternalField().objectPath()
|
||||||
|
<< exit(FatalError);
|
||||||
|
}
|
||||||
|
|
||||||
|
fvPatchScalarField::operator=(scalarField("value", dict, p.size()));
|
||||||
|
|
||||||
|
if (dict.found("refValue"))
|
||||||
|
{
|
||||||
|
// Full restart
|
||||||
|
refValue() = scalarField("refValue", dict, p.size());
|
||||||
|
refGrad() = scalarField("refGradient", dict, p.size());
|
||||||
|
valueFraction() = scalarField("valueFraction", dict, p.size());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Start from user entered data. Assume fixedValue.
|
||||||
|
refValue() = *this;
|
||||||
|
refGrad() = 0.0;
|
||||||
|
valueFraction() = 1.0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::externalWallHeatFluxTemperatureFvPatchScalarField::
|
||||||
|
externalWallHeatFluxTemperatureFvPatchScalarField
|
||||||
|
(
|
||||||
|
const externalWallHeatFluxTemperatureFvPatchScalarField& tppsf
|
||||||
|
)
|
||||||
|
:
|
||||||
|
mixedFvPatchScalarField(tppsf),
|
||||||
|
temperatureCoupledBase(tppsf),
|
||||||
|
oldMode_(unknown),
|
||||||
|
q_(tppsf.q_),
|
||||||
|
h_(tppsf.h_),
|
||||||
|
Ta_(tppsf.Ta_)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::externalWallHeatFluxTemperatureFvPatchScalarField::
|
||||||
|
externalWallHeatFluxTemperatureFvPatchScalarField
|
||||||
|
(
|
||||||
|
const externalWallHeatFluxTemperatureFvPatchScalarField& tppsf,
|
||||||
|
const DimensionedField<scalar, volMesh>& iF
|
||||||
|
)
|
||||||
|
:
|
||||||
|
mixedFvPatchScalarField(tppsf, iF),
|
||||||
|
temperatureCoupledBase(patch(), tppsf.KMethod(), tppsf.KName()),
|
||||||
|
oldMode_(tppsf.oldMode_),
|
||||||
|
q_(tppsf.q_),
|
||||||
|
h_(tppsf.h_),
|
||||||
|
Ta_(tppsf.Ta_)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
void Foam::externalWallHeatFluxTemperatureFvPatchScalarField::updateCoeffs()
|
||||||
|
{
|
||||||
|
if (updated())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(oldMode_ == fixedHeatFlux)
|
||||||
|
{
|
||||||
|
this->refGrad() = q_/K(*this);
|
||||||
|
this->refValue() = 0.0;
|
||||||
|
this->valueFraction() = 0.0;
|
||||||
|
}
|
||||||
|
else if(oldMode_ == fixedHeatTransferCoeff)
|
||||||
|
{
|
||||||
|
this->refGrad() = (Ta_ - *this)*h_/K(*this);
|
||||||
|
this->refValue() = 0.0;
|
||||||
|
this->valueFraction() = 0.0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
FatalErrorIn
|
||||||
|
(
|
||||||
|
"externalWallHeatFluxTemperatureFvPatchScalarField"
|
||||||
|
"::updateCoeffs()"
|
||||||
|
) << "Illegal mode " << operationModeNames[oldMode_]
|
||||||
|
<< exit(FatalError);
|
||||||
|
}
|
||||||
|
|
||||||
|
mixedFvPatchScalarField::updateCoeffs();
|
||||||
|
|
||||||
|
if (debug)
|
||||||
|
{
|
||||||
|
scalar Q = gSum(K(*this)*patch().magSf()*snGrad());
|
||||||
|
|
||||||
|
Info<< patch().boundaryMesh().mesh().name() << ':'
|
||||||
|
<< patch().name() << ':'
|
||||||
|
<< this->dimensionedInternalField().name() << " :"
|
||||||
|
<< " heatFlux:" << Q
|
||||||
|
<< " walltemperature "
|
||||||
|
<< " min:" << gMin(*this)
|
||||||
|
<< " max:" << gMax(*this)
|
||||||
|
<< " avg:" << gAverage(*this)
|
||||||
|
<< endl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::externalWallHeatFluxTemperatureFvPatchScalarField::write
|
||||||
|
(
|
||||||
|
Ostream& os
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
mixedFvPatchScalarField::write(os);
|
||||||
|
temperatureCoupledBase::write(os);
|
||||||
|
q_.writeEntry("q", os);
|
||||||
|
h_.writeEntry("h", os);
|
||||||
|
Ta_.writeEntry("Ta", os);
|
||||||
|
this->writeEntry("value", os);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
makePatchTypeField
|
||||||
|
(
|
||||||
|
fvPatchScalarField,
|
||||||
|
externalWallHeatFluxTemperatureFvPatchScalarField
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,188 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2011-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
|
||||||
|
externalWallHeatFluxTemperatureFvPatchScalarField
|
||||||
|
|
||||||
|
Description
|
||||||
|
Heat flux boundary condition for temperature on external wall.
|
||||||
|
|
||||||
|
If h and Ta are specified then fixed_heat_transfer_coefficient mode is used
|
||||||
|
If q is specified then fixed_heat_flux is used.
|
||||||
|
|
||||||
|
Example usage:
|
||||||
|
myWallPatch
|
||||||
|
{
|
||||||
|
type externalWallHeatFluxTemperature;
|
||||||
|
K solidThermo; // solidThermo or lookup
|
||||||
|
q uniform 1000; // Heat flux / [W/m2]
|
||||||
|
Ta uniform 300.0; // Tambient temperature /[K]
|
||||||
|
h uniform 10.0; // Heat transfer coeff /[W/Km2]
|
||||||
|
value uniform 300.0; // Initial temperature / [K]
|
||||||
|
KName none;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
SourceFiles
|
||||||
|
externalWallHeatFluxTemperatureFvPatchScalarField.C
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef solidWallHeatFluxTemperatureFvPatchScalarField_H
|
||||||
|
#define solidWallHeatFluxTemperatureFvPatchScalarField_H
|
||||||
|
|
||||||
|
//#include "fixedGradientFvPatchFields.H"
|
||||||
|
|
||||||
|
#include "mixedFvPatchFields.H"
|
||||||
|
#include "temperatureCoupledBase.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
Class externalWallHeatFluxTemperatureFvPatchScalarField Declaration
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
class externalWallHeatFluxTemperatureFvPatchScalarField
|
||||||
|
:
|
||||||
|
public mixedFvPatchScalarField,
|
||||||
|
public temperatureCoupledBase
|
||||||
|
{
|
||||||
|
// Private data
|
||||||
|
|
||||||
|
//- how to operate the BC
|
||||||
|
enum operationMode
|
||||||
|
{
|
||||||
|
fixedHeatFlux,
|
||||||
|
fixedHeatTransferCoeff,
|
||||||
|
unknown
|
||||||
|
};
|
||||||
|
static const NamedEnum<operationMode, 3> operationModeNames;
|
||||||
|
|
||||||
|
//- Operation mode
|
||||||
|
operationMode oldMode_;
|
||||||
|
|
||||||
|
//- Heat flux / [W/m2]
|
||||||
|
scalarField q_;
|
||||||
|
|
||||||
|
//- Heat transfer coefficient / [W/m2K]
|
||||||
|
scalarField h_;
|
||||||
|
|
||||||
|
//- Ambient temperature / [K]
|
||||||
|
scalarField Ta_;
|
||||||
|
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
//- Runtime type information
|
||||||
|
TypeName("externalWallHeatFluxTemperature");
|
||||||
|
|
||||||
|
|
||||||
|
// Constructors
|
||||||
|
|
||||||
|
//- Construct from patch and internal field
|
||||||
|
externalWallHeatFluxTemperatureFvPatchScalarField
|
||||||
|
(
|
||||||
|
const fvPatch&,
|
||||||
|
const DimensionedField<scalar, volMesh>&
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Construct from patch, internal field and dictionary
|
||||||
|
externalWallHeatFluxTemperatureFvPatchScalarField
|
||||||
|
(
|
||||||
|
const fvPatch&,
|
||||||
|
const DimensionedField<scalar, volMesh>&,
|
||||||
|
const dictionary&
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Construct by mapping given
|
||||||
|
// externalWallHeatFluxTemperatureFvPatchScalarField
|
||||||
|
// onto a new patch
|
||||||
|
externalWallHeatFluxTemperatureFvPatchScalarField
|
||||||
|
(
|
||||||
|
const externalWallHeatFluxTemperatureFvPatchScalarField&,
|
||||||
|
const fvPatch&,
|
||||||
|
const DimensionedField<scalar, volMesh>&,
|
||||||
|
const fvPatchFieldMapper&
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Construct as copy
|
||||||
|
externalWallHeatFluxTemperatureFvPatchScalarField
|
||||||
|
(
|
||||||
|
const externalWallHeatFluxTemperatureFvPatchScalarField&
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Construct and return a clone
|
||||||
|
virtual tmp<fvPatchScalarField> clone() const
|
||||||
|
{
|
||||||
|
return tmp<fvPatchScalarField>
|
||||||
|
(
|
||||||
|
new externalWallHeatFluxTemperatureFvPatchScalarField(*this)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
//- Construct as copy setting internal field reference
|
||||||
|
externalWallHeatFluxTemperatureFvPatchScalarField
|
||||||
|
(
|
||||||
|
const externalWallHeatFluxTemperatureFvPatchScalarField&,
|
||||||
|
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 externalWallHeatFluxTemperatureFvPatchScalarField(*this, iF)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Member functions
|
||||||
|
|
||||||
|
// Evaluation functions
|
||||||
|
|
||||||
|
//- Update the coefficients associated with the patch field
|
||||||
|
virtual void updateCoeffs();
|
||||||
|
|
||||||
|
// I-O
|
||||||
|
|
||||||
|
//- Write
|
||||||
|
void write(Ostream&) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,257 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / 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 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
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "turbulentTemperatureCoupledMixedSTFvPatchScalarField.H"
|
||||||
|
#include "addToRunTimeSelectionTable.H"
|
||||||
|
#include "fvPatchFieldMapper.H"
|
||||||
|
#include "volFields.H"
|
||||||
|
#include "directMappedPatchBase.H"
|
||||||
|
/*
|
||||||
|
#include "mapDistribute.H"
|
||||||
|
#include "regionProperties.H"
|
||||||
|
#include "basicThermo.H"
|
||||||
|
#include "LESModel.H"
|
||||||
|
*/
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
namespace compressible
|
||||||
|
{
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
turbulentTemperatureCoupledMixedSTFvPatchScalarField::
|
||||||
|
turbulentTemperatureCoupledMixedSTFvPatchScalarField
|
||||||
|
(
|
||||||
|
const fvPatch& p,
|
||||||
|
const DimensionedField<scalar, volMesh>& iF
|
||||||
|
)
|
||||||
|
:
|
||||||
|
mixedFvPatchScalarField(p, iF),
|
||||||
|
temperatureCoupledBase(patch(), "undefined", "undefined-K"),
|
||||||
|
TnbrName_("undefined-Tnbr"),
|
||||||
|
QrNbrName_("undefined-QrNbr"),
|
||||||
|
QrName_("undefined-Qr")
|
||||||
|
{
|
||||||
|
this->refValue() = 0.0;
|
||||||
|
this->refGrad() = 0.0;
|
||||||
|
this->valueFraction() = 1.0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
turbulentTemperatureCoupledMixedSTFvPatchScalarField::
|
||||||
|
turbulentTemperatureCoupledMixedSTFvPatchScalarField
|
||||||
|
(
|
||||||
|
const turbulentTemperatureCoupledMixedSTFvPatchScalarField& psf,
|
||||||
|
const fvPatch& p,
|
||||||
|
const DimensionedField<scalar, volMesh>& iF,
|
||||||
|
const fvPatchFieldMapper& mapper
|
||||||
|
)
|
||||||
|
:
|
||||||
|
mixedFvPatchScalarField(psf, p, iF, mapper),
|
||||||
|
temperatureCoupledBase(patch(), psf.KMethod(), psf.KName()),
|
||||||
|
TnbrName_(psf.TnbrName_),
|
||||||
|
QrNbrName_(psf.QrNbrName_),
|
||||||
|
QrName_(psf.QrName_)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
turbulentTemperatureCoupledMixedSTFvPatchScalarField::
|
||||||
|
turbulentTemperatureCoupledMixedSTFvPatchScalarField
|
||||||
|
(
|
||||||
|
const fvPatch& p,
|
||||||
|
const DimensionedField<scalar, volMesh>& iF,
|
||||||
|
const dictionary& dict
|
||||||
|
)
|
||||||
|
:
|
||||||
|
mixedFvPatchScalarField(p, iF),
|
||||||
|
temperatureCoupledBase(patch(), dict),
|
||||||
|
TnbrName_(dict.lookup("Tnbr")),
|
||||||
|
QrNbrName_(dict.lookup("QrNbr")),
|
||||||
|
QrName_(dict.lookup("Qr"))
|
||||||
|
{
|
||||||
|
if (!isA<directMappedPatchBase>(this->patch().patch()))
|
||||||
|
{
|
||||||
|
FatalErrorIn
|
||||||
|
(
|
||||||
|
"turbulentTemperatureCoupledMixedSTFvPatchScalarField::"
|
||||||
|
"turbulentTemperatureCoupledMixedSTFvPatchScalarField\n"
|
||||||
|
"(\n"
|
||||||
|
" const fvPatch& p,\n"
|
||||||
|
" const DimensionedField<scalar, volMesh>& iF,\n"
|
||||||
|
" const dictionary& dict\n"
|
||||||
|
")\n"
|
||||||
|
) << "\n patch type '" << p.type()
|
||||||
|
<< "' not type '" << directMappedPatchBase::typeName << "'"
|
||||||
|
<< "\n for patch " << p.name()
|
||||||
|
<< " of field " << dimensionedInternalField().name()
|
||||||
|
<< " in file " << dimensionedInternalField().objectPath()
|
||||||
|
<< exit(FatalError);
|
||||||
|
}
|
||||||
|
|
||||||
|
fvPatchScalarField::operator=(scalarField("value", dict, p.size()));
|
||||||
|
|
||||||
|
if (dict.found("refValue"))
|
||||||
|
{
|
||||||
|
// Full restart
|
||||||
|
refValue() = scalarField("refValue", dict, p.size());
|
||||||
|
refGrad() = scalarField("refGradient", dict, p.size());
|
||||||
|
valueFraction() = scalarField("valueFraction", dict, p.size());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Start from user entered data. Assume fixedValue.
|
||||||
|
refValue() = *this;
|
||||||
|
refGrad() = 0.0;
|
||||||
|
valueFraction() = 1.0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
turbulentTemperatureCoupledMixedSTFvPatchScalarField::
|
||||||
|
turbulentTemperatureCoupledMixedSTFvPatchScalarField
|
||||||
|
(
|
||||||
|
const turbulentTemperatureCoupledMixedSTFvPatchScalarField& psf,
|
||||||
|
const DimensionedField<scalar, volMesh>& iF
|
||||||
|
)
|
||||||
|
:
|
||||||
|
mixedFvPatchScalarField(psf, iF),
|
||||||
|
temperatureCoupledBase(patch(), psf.KMethod(), psf.KName()),
|
||||||
|
TnbrName_(psf.TnbrName_),
|
||||||
|
QrNbrName_(psf.QrNbrName_),
|
||||||
|
QrName_(psf.QrName_)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
void turbulentTemperatureCoupledMixedSTFvPatchScalarField::updateCoeffs()
|
||||||
|
{
|
||||||
|
if (updated())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get the coupling information from the directMappedPatchBase
|
||||||
|
const directMappedPatchBase& mpp =
|
||||||
|
refCast<const directMappedPatchBase>(patch().patch());
|
||||||
|
const polyMesh& nbrMesh = mpp.sampleMesh();
|
||||||
|
const label samplePatchI = mpp.samplePolyPatch().index();
|
||||||
|
const fvPatch& nbrPatch =
|
||||||
|
refCast<const fvMesh>(nbrMesh).boundary()[samplePatchI];
|
||||||
|
|
||||||
|
// Force recalculation of mapping and schedule
|
||||||
|
const mapDistribute& distMap = mpp.map();
|
||||||
|
|
||||||
|
scalarField Tc = patchInternalField();
|
||||||
|
scalarField& Tp = *this;
|
||||||
|
|
||||||
|
const turbulentTemperatureCoupledMixedSTFvPatchScalarField&
|
||||||
|
nbrField = refCast
|
||||||
|
<const turbulentTemperatureCoupledMixedSTFvPatchScalarField>
|
||||||
|
(
|
||||||
|
nbrPatch.lookupPatchField<volScalarField, scalar>(TnbrName_)
|
||||||
|
);
|
||||||
|
|
||||||
|
// Swap to obtain full local values of neighbour internal field
|
||||||
|
scalarField TcNbr = nbrField.patchInternalField();
|
||||||
|
mapDistribute::distribute
|
||||||
|
(
|
||||||
|
Pstream::defaultCommsType,
|
||||||
|
distMap.schedule(),
|
||||||
|
distMap.constructSize(),
|
||||||
|
distMap.subMap(), // what to send
|
||||||
|
distMap.constructMap(), // what to receive
|
||||||
|
TcNbr
|
||||||
|
);
|
||||||
|
|
||||||
|
// Swap to obtain full local values of neighbour K*delta
|
||||||
|
scalarField KDeltaNbr = nbrField.K(TcNbr)*nbrPatch.deltaCoeffs();
|
||||||
|
mapDistribute::distribute
|
||||||
|
(
|
||||||
|
Pstream::defaultCommsType,
|
||||||
|
distMap.schedule(),
|
||||||
|
distMap.constructSize(),
|
||||||
|
distMap.subMap(), // what to send
|
||||||
|
distMap.constructMap(), // what to receive
|
||||||
|
KDeltaNbr
|
||||||
|
);
|
||||||
|
|
||||||
|
scalarField KDelta = K(*this)*patch().deltaCoeffs();
|
||||||
|
|
||||||
|
scalarField Qr(Tp.size(), 0.0);
|
||||||
|
if (QrName_ != "none")
|
||||||
|
{
|
||||||
|
Qr = patch().lookupPatchField<volScalarField, scalar>(QrName_);
|
||||||
|
}
|
||||||
|
|
||||||
|
scalarField QrNbr(Tp.size(), 0.0);
|
||||||
|
if (QrNbrName_ != "none")
|
||||||
|
{
|
||||||
|
QrNbr = nbrPatch.lookupPatchField<volScalarField, scalar>(QrNbrName_);
|
||||||
|
}
|
||||||
|
|
||||||
|
scalarField alpha(KDeltaNbr - (Qr + QrNbr)/Tp);
|
||||||
|
|
||||||
|
valueFraction() = alpha/(alpha + KDelta);
|
||||||
|
|
||||||
|
refValue() = (KDeltaNbr*TcNbr)/alpha;
|
||||||
|
|
||||||
|
mixedFvPatchScalarField::updateCoeffs();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void turbulentTemperatureCoupledMixedSTFvPatchScalarField::write
|
||||||
|
(
|
||||||
|
Ostream& os
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
mixedFvPatchScalarField::write(os);
|
||||||
|
os.writeKeyword("Tnbr")<< TnbrName_ << token::END_STATEMENT << nl;
|
||||||
|
os.writeKeyword("QrNbr")<< QrNbrName_ << token::END_STATEMENT << nl;
|
||||||
|
os.writeKeyword("Qr")<< QrName_ << token::END_STATEMENT << nl;
|
||||||
|
temperatureCoupledBase::write(os);
|
||||||
|
//os.writeKeyword("K") << KName_ << token::END_STATEMENT << nl;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
makePatchTypeField
|
||||||
|
(
|
||||||
|
fvPatchScalarField,
|
||||||
|
turbulentTemperatureCoupledMixedSTFvPatchScalarField
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace compressible
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,187 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / 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::
|
||||||
|
compressible::
|
||||||
|
turbulentTemperatureCoupledMixedSTFvPatchScalarField
|
||||||
|
|
||||||
|
Description
|
||||||
|
Mixed boundary condition for temperature, to be used for heat-transfer
|
||||||
|
on back-to-back baffles.
|
||||||
|
|
||||||
|
Example usage:
|
||||||
|
myInterfacePatchName
|
||||||
|
{
|
||||||
|
type compressible::turbulentTemperatureCoupledMixedST;
|
||||||
|
TNbr T; // name of T field on neighbour region
|
||||||
|
K K; // or none. Name of thermal conductivity field.
|
||||||
|
Calculated from database if equal to 'none'
|
||||||
|
|
||||||
|
QrNbr Qr; // or none. Name of Qr field on neighbour region
|
||||||
|
Qr Qr; // or none. Name of Qr field on local region
|
||||||
|
|
||||||
|
value uniform 300;
|
||||||
|
}
|
||||||
|
|
||||||
|
Needs to be on underlying directMapped(Wall)FvPatch.
|
||||||
|
|
||||||
|
Note: runs in parallel with arbitrary decomposition. Uses directMapped
|
||||||
|
functionality to calculate exchange.
|
||||||
|
|
||||||
|
SourceFiles
|
||||||
|
turbulentTemperatureCoupledMixedSTFvPatchScalarField.C
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef turbulentTemperatureCoupledMixedSTFvPatchScalarField_H
|
||||||
|
#define turbulentTemperatureCoupledMixedSTFvPatchScalarField_H
|
||||||
|
|
||||||
|
#include "mixedFvPatchFields.H"
|
||||||
|
#include "temperatureCoupledBase.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
namespace compressible
|
||||||
|
{
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
Class turbulentTemperatureCoupledMixedSTFvPatchScalarField Declaration
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
class turbulentTemperatureCoupledMixedSTFvPatchScalarField
|
||||||
|
:
|
||||||
|
public mixedFvPatchScalarField,
|
||||||
|
public temperatureCoupledBase
|
||||||
|
{
|
||||||
|
// Private data
|
||||||
|
|
||||||
|
//- Name of field on the neighbour region
|
||||||
|
const word TnbrName_;
|
||||||
|
|
||||||
|
//- Name of the radiative heat flux in the neighbout region
|
||||||
|
const word QrNbrName_;
|
||||||
|
|
||||||
|
//- Name of the radiative heat flux in local region
|
||||||
|
const word QrName_;
|
||||||
|
|
||||||
|
//- Name of thermal conductivity field
|
||||||
|
//const word KName_;
|
||||||
|
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
//- Runtime type information
|
||||||
|
TypeName("compressible::turbulentTemperatureCoupledMixedST");
|
||||||
|
|
||||||
|
|
||||||
|
// Constructors
|
||||||
|
|
||||||
|
//- Construct from patch and internal field
|
||||||
|
turbulentTemperatureCoupledMixedSTFvPatchScalarField
|
||||||
|
(
|
||||||
|
const fvPatch&,
|
||||||
|
const DimensionedField<scalar, volMesh>&
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Construct from patch, internal field and dictionary
|
||||||
|
turbulentTemperatureCoupledMixedSTFvPatchScalarField
|
||||||
|
(
|
||||||
|
const fvPatch&,
|
||||||
|
const DimensionedField<scalar, volMesh>&,
|
||||||
|
const dictionary&
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Construct by mapping given
|
||||||
|
// turbulentTemperatureCoupledBaffleMixedFvPatchScalarField onto a
|
||||||
|
// new patch
|
||||||
|
turbulentTemperatureCoupledMixedSTFvPatchScalarField
|
||||||
|
(
|
||||||
|
const
|
||||||
|
turbulentTemperatureCoupledMixedSTFvPatchScalarField&,
|
||||||
|
const fvPatch&,
|
||||||
|
const DimensionedField<scalar, volMesh>&,
|
||||||
|
const fvPatchFieldMapper&
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Construct and return a clone
|
||||||
|
virtual tmp<fvPatchScalarField> clone() const
|
||||||
|
{
|
||||||
|
return tmp<fvPatchScalarField>
|
||||||
|
(
|
||||||
|
new turbulentTemperatureCoupledMixedSTFvPatchScalarField
|
||||||
|
(
|
||||||
|
*this
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
//- Construct as copy setting internal field reference
|
||||||
|
turbulentTemperatureCoupledMixedSTFvPatchScalarField
|
||||||
|
(
|
||||||
|
const turbulentTemperatureCoupledMixedSTFvPatchScalarField&,
|
||||||
|
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 turbulentTemperatureCoupledMixedSTFvPatchScalarField
|
||||||
|
(
|
||||||
|
*this,
|
||||||
|
iF
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Member functions
|
||||||
|
|
||||||
|
//- Get corresponding K field
|
||||||
|
//tmp<scalarField> K() const;
|
||||||
|
|
||||||
|
//- Update the coefficients associated with the patch field
|
||||||
|
virtual void updateCoeffs();
|
||||||
|
|
||||||
|
//- Write
|
||||||
|
virtual void write(Ostream&) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace compressible
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -9,6 +9,7 @@
|
|||||||
PtrList<volScalarField> p_rghFluid(fluidRegions.size());
|
PtrList<volScalarField> p_rghFluid(fluidRegions.size());
|
||||||
PtrList<volScalarField> ghFluid(fluidRegions.size());
|
PtrList<volScalarField> ghFluid(fluidRegions.size());
|
||||||
PtrList<surfaceScalarField> ghfFluid(fluidRegions.size());
|
PtrList<surfaceScalarField> ghfFluid(fluidRegions.size());
|
||||||
|
PtrList<radiation::radiationModel> radiation(fluidRegions.size());
|
||||||
PtrList<volScalarField> DpDtFluid(fluidRegions.size());
|
PtrList<volScalarField> DpDtFluid(fluidRegions.size());
|
||||||
|
|
||||||
List<scalar> initialMassFluid(fluidRegions.size());
|
List<scalar> initialMassFluid(fluidRegions.size());
|
||||||
@ -166,6 +167,12 @@
|
|||||||
// Force p_rgh to be consistent with p
|
// Force p_rgh to be consistent with p
|
||||||
p_rghFluid[i] = thermoFluid[i].p() - rhoFluid[i]*ghFluid[i];
|
p_rghFluid[i] = thermoFluid[i].p() - rhoFluid[i]*ghFluid[i];
|
||||||
|
|
||||||
|
radiation.set
|
||||||
|
(
|
||||||
|
i,
|
||||||
|
radiation::radiationModel::New(thermoFluid[i].T())
|
||||||
|
);
|
||||||
|
|
||||||
initialMassFluid[i] = fvc::domainIntegrate(rhoFluid[i]).value();
|
initialMassFluid[i] = fvc::domainIntegrate(rhoFluid[i]).value();
|
||||||
|
|
||||||
Info<< " Adding to DpDtFluid\n" << endl;
|
Info<< " Adding to DpDtFluid\n" << endl;
|
||||||
|
|||||||
@ -6,13 +6,16 @@
|
|||||||
- fvm::laplacian(turb.alphaEff(), h)
|
- fvm::laplacian(turb.alphaEff(), h)
|
||||||
==
|
==
|
||||||
DpDt
|
DpDt
|
||||||
|
+ rad.Sh(thermo)
|
||||||
);
|
);
|
||||||
|
|
||||||
hEqn.relax();
|
hEqn.relax();
|
||||||
hEqn.solve(mesh.solver(h.select(finalIter)));
|
hEqn.solve(mesh.solver(h.select(finalIter)));
|
||||||
|
|
||||||
thermo.correct();
|
thermo.correct();
|
||||||
|
|
||||||
|
rad.correct();
|
||||||
|
|
||||||
Info<< "Min/max T:" << min(thermo.T()).value() << ' '
|
Info<< "Min/max T:" << min(thermo.T()).value() << ' '
|
||||||
<< max(thermo.T()).value() << endl;
|
<< max(thermo.T()).value() << endl;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -17,6 +17,8 @@
|
|||||||
const volScalarField& gh = ghFluid[i];
|
const volScalarField& gh = ghFluid[i];
|
||||||
const surfaceScalarField& ghf = ghfFluid[i];
|
const surfaceScalarField& ghf = ghfFluid[i];
|
||||||
|
|
||||||
|
radiation::radiationModel& rad = radiation[i];
|
||||||
|
|
||||||
const dimensionedScalar initialMass
|
const dimensionedScalar initialMass
|
||||||
(
|
(
|
||||||
"initialMass",
|
"initialMass",
|
||||||
|
|||||||
@ -0,0 +1,227 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2011-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 "radiationCoupledBase.H"
|
||||||
|
#include "volFields.H"
|
||||||
|
#include "basicSolidThermo.H"
|
||||||
|
|
||||||
|
#include "directMappedPatchBase.H"
|
||||||
|
#include "fvPatchFieldMapper.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * Static Member Data * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
template<>
|
||||||
|
const char* Foam::NamedEnum
|
||||||
|
<
|
||||||
|
Foam::radiationCoupledBase::emissivityMethodType,
|
||||||
|
2
|
||||||
|
>::names[] =
|
||||||
|
{
|
||||||
|
"solidThermo",
|
||||||
|
"lookup"
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
const Foam::NamedEnum<Foam::radiationCoupledBase::emissivityMethodType, 2>
|
||||||
|
Foam::radiationCoupledBase::emissivityMethodTypeNames_;
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::radiationCoupledBase::radiationCoupledBase
|
||||||
|
(
|
||||||
|
const fvPatch& patch,
|
||||||
|
const word& calculationType
|
||||||
|
)
|
||||||
|
:
|
||||||
|
patch_(patch),
|
||||||
|
method_(emissivityMethodTypeNames_[calculationType]),
|
||||||
|
emissivity_(patch.size(), 0.0)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::radiationCoupledBase::radiationCoupledBase
|
||||||
|
(
|
||||||
|
const fvPatch& patch,
|
||||||
|
const dictionary& dict
|
||||||
|
)
|
||||||
|
:
|
||||||
|
patch_(patch),
|
||||||
|
method_(emissivityMethodTypeNames_.read(dict.lookup("emissivityMode")))
|
||||||
|
{
|
||||||
|
switch (method_)
|
||||||
|
{
|
||||||
|
case SOLIDTHERMO:
|
||||||
|
{
|
||||||
|
if (!isA<directMappedPatchBase>(patch_.patch()))
|
||||||
|
{
|
||||||
|
FatalErrorIn
|
||||||
|
(
|
||||||
|
"radiationCoupledBase::radiationCoupledBase\n"
|
||||||
|
"(\n"
|
||||||
|
" const fvPatch& p,\n"
|
||||||
|
" const dictionary& dict\n"
|
||||||
|
")\n"
|
||||||
|
) << "\n patch type '" << patch_.type()
|
||||||
|
<< "' not type '" << directMappedPatchBase::typeName << "'"
|
||||||
|
<< "\n for patch " << patch_.name()
|
||||||
|
<< exit(FatalError);
|
||||||
|
}
|
||||||
|
|
||||||
|
const directMappedPatchBase& mpp = refCast
|
||||||
|
<
|
||||||
|
const directMappedPatchBase
|
||||||
|
>
|
||||||
|
(
|
||||||
|
patch_.patch()
|
||||||
|
);
|
||||||
|
|
||||||
|
const polyMesh& nbrMesh = mpp.sampleMesh();
|
||||||
|
|
||||||
|
if
|
||||||
|
(
|
||||||
|
!nbrMesh.foundObject<basicSolidThermo>
|
||||||
|
(
|
||||||
|
"solidThermophysicalProperties"
|
||||||
|
)
|
||||||
|
)
|
||||||
|
{
|
||||||
|
FatalErrorIn
|
||||||
|
(
|
||||||
|
"radiationCoupledBase::radiationCoupledBase\n"
|
||||||
|
"(\n"
|
||||||
|
" const fvPatch& p,\n"
|
||||||
|
" const dictionary& dict\n"
|
||||||
|
")\n"
|
||||||
|
) << "\n solidThermophysicalProperties does not exist "
|
||||||
|
<< "\n in mesh ' " << nbrMesh.name() << "'"
|
||||||
|
<< exit(FatalError);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case LOOKUP:
|
||||||
|
{
|
||||||
|
if(!dict.found("emissivity"))
|
||||||
|
{
|
||||||
|
FatalErrorIn
|
||||||
|
(
|
||||||
|
"radiationCoupledBase::radiationCoupledBase\n"
|
||||||
|
"(\n"
|
||||||
|
" const fvPatch& p,\n"
|
||||||
|
" const dictionary& dict\n"
|
||||||
|
")\n"
|
||||||
|
) << "\n emissivity key"
|
||||||
|
<< "\n does not exist "
|
||||||
|
<< "\n for patch " << patch_.name()
|
||||||
|
<< exit(FatalError);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
emissivity_ = scalarField("emissivity", dict, patch_.size());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::tmp<Foam::scalarField> Foam::radiationCoupledBase::emissivity() const
|
||||||
|
{
|
||||||
|
switch (method_)
|
||||||
|
{
|
||||||
|
case SOLIDTHERMO:
|
||||||
|
{
|
||||||
|
|
||||||
|
// Get the coupling information from the directMappedPatchBase
|
||||||
|
const directMappedPatchBase& mpp =
|
||||||
|
refCast<const directMappedPatchBase>
|
||||||
|
(
|
||||||
|
patch_.patch()
|
||||||
|
);
|
||||||
|
|
||||||
|
const polyMesh& nbrMesh = mpp.sampleMesh();
|
||||||
|
const fvPatch& nbrPatch = refCast<const fvMesh>
|
||||||
|
(
|
||||||
|
nbrMesh
|
||||||
|
).boundary()[mpp.samplePolyPatch().index()];
|
||||||
|
|
||||||
|
scalarField emissivity
|
||||||
|
(
|
||||||
|
nbrPatch.lookupPatchField<volScalarField, scalar>("emissivity")
|
||||||
|
);
|
||||||
|
|
||||||
|
// Force recalculation of mapping and schedule
|
||||||
|
const mapDistribute& distMap = mpp.map();
|
||||||
|
|
||||||
|
distMap.distribute(emissivity);
|
||||||
|
|
||||||
|
return tmp<scalarField>
|
||||||
|
(
|
||||||
|
new scalarField(emissivity)
|
||||||
|
);
|
||||||
|
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case LOOKUP:
|
||||||
|
{
|
||||||
|
// return local value
|
||||||
|
return emissivity_;
|
||||||
|
}
|
||||||
|
|
||||||
|
default:
|
||||||
|
{
|
||||||
|
FatalErrorIn
|
||||||
|
(
|
||||||
|
"radiationCoupledBase::emissivity(const scalarField&)"
|
||||||
|
)
|
||||||
|
<< "Unimplemented method " << method_ << endl
|
||||||
|
<< "Please set 'emissivity' to one of "
|
||||||
|
<< emissivityMethodTypeNames_.toc()
|
||||||
|
<< " and 'emissivityName' to the name of the volScalar"
|
||||||
|
<< exit(FatalError);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return scalarField(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::radiationCoupledBase::write(Ostream& os) const
|
||||||
|
{
|
||||||
|
os.writeKeyword("emissivityMode") << emissivityMethodTypeNames_[method_]
|
||||||
|
<< token::END_STATEMENT << nl;
|
||||||
|
os.writeKeyword("emissivity") << emissivity_
|
||||||
|
<< token::END_STATEMENT << nl;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,134 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2011-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
|
||||||
|
radiationCoupledBase
|
||||||
|
|
||||||
|
Description
|
||||||
|
Common functions for use in temperature coupled boundaries when
|
||||||
|
radiation is used. For now only emissivity() : emissivity
|
||||||
|
gets supplied from lookup or calculate:
|
||||||
|
|
||||||
|
- 'lookup' : lookup volScalarField with name
|
||||||
|
- 'solidThermo' : use basicSolidThermo emissivity()
|
||||||
|
|
||||||
|
SourceFiles
|
||||||
|
radiationCoupledBase.C
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef radiationCoupledBase_H
|
||||||
|
#define radiationCoupledBase_H
|
||||||
|
|
||||||
|
#include "scalarField.H"
|
||||||
|
#include "NamedEnum.H"
|
||||||
|
#include "fvPatch.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
Class radiationCoupledBase Declaration
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
class radiationCoupledBase
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
//- Type of supplied emissivity
|
||||||
|
enum emissivityMethodType
|
||||||
|
{
|
||||||
|
SOLIDTHERMO,
|
||||||
|
LOOKUP
|
||||||
|
};
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
// Private data
|
||||||
|
|
||||||
|
static const NamedEnum<emissivityMethodType, 2>
|
||||||
|
emissivityMethodTypeNames_;
|
||||||
|
|
||||||
|
//- Underlying patch
|
||||||
|
const fvPatch& patch_;
|
||||||
|
|
||||||
|
//- How to get emissivity
|
||||||
|
const emissivityMethodType method_;
|
||||||
|
|
||||||
|
//- Emissivity
|
||||||
|
// Cached locally when is read from dictionary
|
||||||
|
scalarField emissivity_;
|
||||||
|
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
// Constructors
|
||||||
|
|
||||||
|
//- Construct from patch and emissivity name
|
||||||
|
radiationCoupledBase
|
||||||
|
(
|
||||||
|
const fvPatch& patch,
|
||||||
|
const word& calculationMethod
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Construct from patch and dictionary
|
||||||
|
radiationCoupledBase
|
||||||
|
(
|
||||||
|
const fvPatch& patch,
|
||||||
|
const dictionary& dict
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
// Member functions
|
||||||
|
|
||||||
|
//- Method to obtain emissivity
|
||||||
|
word emissivityMethod() const
|
||||||
|
{
|
||||||
|
return emissivityMethodTypeNames_[method_];
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
//- Name of thermal conductivity field
|
||||||
|
const word& emissivityName() const
|
||||||
|
{
|
||||||
|
return emissivityName_;
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
//- Calculate corresponding emissivity field
|
||||||
|
tmp<scalarField> emissivity() const;
|
||||||
|
|
||||||
|
//- Write
|
||||||
|
void write(Ostream&) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
Reference in New Issue
Block a user