ENH: mmore modification to the radiation model

This commit is contained in:
sergio 2011-02-10 18:06:13 +00:00
parent 9a74ca1a19
commit abbf00eff0
18 changed files with 1314 additions and 75 deletions

View File

@ -2,6 +2,7 @@
cd ${0%/*} || exit 1 # run from this directory
set -x
wclean libso coupledDerivedFvPatch
wclean
wclean chtMultiRegionSimpleFoam

View File

@ -2,6 +2,7 @@
cd ${0%/*} || exit 1 # run from this directory
set -x
wmake libso coupledDerivedFvPatch
wmake
wmake chtMultiRegionSimpleFoam

View File

@ -1,5 +1,3 @@
derivedFvPatchFields/solidWallHeatFluxTemperature/solidWallHeatFluxTemperatureFvPatchScalarField.C
fluid/compressibleCourantNo.C
solid/solidRegionDiffNo.C

View File

@ -19,4 +19,5 @@ EXE_LIBS = \
-lcompressibleLESModels \
-lmeshTools \
-lfiniteVolume \
-lradiationModels
-lradiationModels \
-lcoupledDerivedFvPatch

View File

@ -1,6 +1,4 @@
chtMultiRegionSimpleFoam.C
../derivedFvPatchFields/turbulentTemperatureCoupledMixedST/turbulentTemperatureCoupledMixedSTFvPatchScalarField.C
../derivedFvPatchFields/externalWallHeatFluxTemperature/externalWallHeatFluxTemperatureFvPatchScalarField.C
EXE = $(FOAM_APPBIN)/chtMultiRegionSimpleFoam

View File

@ -1,7 +1,5 @@
EXE_INC = \
/* -DFULLDEBUG -O0 -g */ \
-I.. \
-I../derivedFvPatchFields \
-Ifluid \
-Isolid \
-I$(LIB_SRC)/finiteVolume/lnInclude \
@ -22,4 +20,5 @@ EXE_LIBS = \
-lcompressibleTurbulenceModel \
-lcompressibleRASModels \
-lcompressibleLESModels \
-lradiationModels
-lradiationModels \
-lcoupledDerivedFvPatch

View File

@ -10,12 +10,6 @@
+ rad.Sh(thermo)
);
/*
fvScalarMatrix hEqn
(
- fvm::laplacian(turb.alphaEff(), h)
);
*/
hEqn.relax();
hEqn.solve();

View File

@ -0,0 +1,4 @@
turbulentTemperatureRadCoupledMixed/turbulentTemperatureRadCoupledMixedFvPatchScalarField.C
externalWallHeatFluxTemperature/externalWallHeatFluxTemperatureFvPatchScalarField.C
LIB = $(FOAM_LIBBIN)/libcoupledDerivedFvPatch

View File

@ -0,0 +1,12 @@
EXE_INC = \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/basicSolidThermo/lnInclude \
-I$(LIB_SRC)/turbulenceModels/compressible/turbulenceModel/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/radiationModels/lnInclude
EXE_LIBS = \
-lmeshTools \
-lbasicThermophysicalModels \
-lfiniteVolume \
-lradiationModels

View File

@ -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
);
}
// ************************************************************************* //

View File

@ -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
// ************************************************************************* //

View File

@ -0,0 +1,258 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / 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 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 "turbulentTemperatureRadCoupledMixedFvPatchScalarField.H"
#include "addToRunTimeSelectionTable.H"
#include "fvPatchFieldMapper.H"
#include "volFields.H"
#include "directMappedPatchBase.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace compressible
{
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
turbulentTemperatureRadCoupledMixedFvPatchScalarField::
turbulentTemperatureRadCoupledMixedFvPatchScalarField
(
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;
}
turbulentTemperatureRadCoupledMixedFvPatchScalarField::
turbulentTemperatureRadCoupledMixedFvPatchScalarField
(
const turbulentTemperatureRadCoupledMixedFvPatchScalarField& 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_)
{}
turbulentTemperatureRadCoupledMixedFvPatchScalarField::
turbulentTemperatureRadCoupledMixedFvPatchScalarField
(
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
(
"turbulentTemperatureRadCoupledMixedFvPatchScalarField::"
"turbulentTemperatureRadCoupledMixedFvPatchScalarField\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;
}
}
turbulentTemperatureRadCoupledMixedFvPatchScalarField::
turbulentTemperatureRadCoupledMixedFvPatchScalarField
(
const turbulentTemperatureRadCoupledMixedFvPatchScalarField& 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 turbulentTemperatureRadCoupledMixedFvPatchScalarField::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 turbulentTemperatureRadCoupledMixedFvPatchScalarField&
nbrField = refCast
<const turbulentTemperatureRadCoupledMixedFvPatchScalarField>
(
nbrPatch.lookupPatchField<volScalarField, scalar>(TnbrName_)
);
// Swap to obtain full local values of neighbour internal field
scalarField TcNbr = nbrField.patchInternalField();
mpp.map().distribute(TcNbr);
/*
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();
mpp.map().distribute(KDeltaNbr);
/*
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 turbulentTemperatureRadCoupledMixedFvPatchScalarField::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);
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
makePatchTypeField
(
fvPatchScalarField,
turbulentTemperatureRadCoupledMixedFvPatchScalarField
);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace compressible
} // End namespace Foam
// ************************************************************************* //

View File

@ -0,0 +1,185 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / 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
Foam::
compressible::
turbulentTemperatureRadCoupledMixedFvPatchScalarField
Description
Mixed boundary condition for temperature and radiation heat transfer
to be used for in multiregion cases
Example usage:
myInterfacePatchName
{
type compressible::turbulentTemperatureRadCoupledMixed;
TNbr T; // name of T field on neighbour region
K lookup;
KName K;
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: K : heat conduction at patch. Gets supplied how to lookup/calculate K:
- 'lookup' : lookup volScalarField (or volSymmTensorField) with name
- 'basicThermo' : use basicThermo and compressible::RASmodel to calculate K
- 'solidThermo' : use basicSolidThermo K()
- 'directionalSolidThermo' directionalK()
Note: runs in parallel with arbitrary decomposition. Uses directMapped
functionality to calculate exchange.
SourceFiles
turbulentTemperatureRadCoupledMixedFvPatchScalarField.C
\*---------------------------------------------------------------------------*/
#ifndef turbulentTemperatureRadCoupledMixedFvPatchScalarField_H
#define turbulentTemperatureRadCoupledMixedFvPatchScalarField_H
#include "mixedFvPatchFields.H"
#include "temperatureCoupledBase.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace compressible
{
/*---------------------------------------------------------------------------*\
Class turbulentTemperatureRadCoupledMixedFvPatchScalarField Declaration
\*---------------------------------------------------------------------------*/
class turbulentTemperatureRadCoupledMixedFvPatchScalarField
:
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_;
public:
//- Runtime type information
TypeName("compressible::turbulentTemperatureRadCoupledMixed");
// Constructors
//- Construct from patch and internal field
turbulentTemperatureRadCoupledMixedFvPatchScalarField
(
const fvPatch&,
const DimensionedField<scalar, volMesh>&
);
//- Construct from patch, internal field and dictionary
turbulentTemperatureRadCoupledMixedFvPatchScalarField
(
const fvPatch&,
const DimensionedField<scalar, volMesh>&,
const dictionary&
);
//- Construct by mapping given
// turbulentTemperatureCoupledBaffleMixedFvPatchScalarField onto a
// new patch
turbulentTemperatureRadCoupledMixedFvPatchScalarField
(
const
turbulentTemperatureRadCoupledMixedFvPatchScalarField&,
const fvPatch&,
const DimensionedField<scalar, volMesh>&,
const fvPatchFieldMapper&
);
//- Construct and return a clone
virtual tmp<fvPatchScalarField> clone() const
{
return tmp<fvPatchScalarField>
(
new turbulentTemperatureRadCoupledMixedFvPatchScalarField
(
*this
)
);
}
//- Construct as copy setting internal field reference
turbulentTemperatureRadCoupledMixedFvPatchScalarField
(
const turbulentTemperatureRadCoupledMixedFvPatchScalarField&,
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 turbulentTemperatureRadCoupledMixedFvPatchScalarField
(
*this,
iF
)
);
}
// Member functions
//- Update the coefficients associated with the patch field
virtual void updateCoeffs();
//- Write
virtual void write(Ostream&) const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace compressible
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -30,5 +30,6 @@ derivedFvPatchFields/MarshakRadiationFixedT/MarshakRadiationFixedTMixedFvPatchSc
derivedFvPatchFields/greyDiffusiveRadiation/greyDiffusiveRadiationMixedFvPatchScalarField.C
derivedFvPatchFields/wideBandDiffusiveRadiation/wideBandDiffusiveRadiationMixedFvPatchScalarField.C
derivedFvPatchFields/radiationCoupledBase/radiationCoupledBase.C
derivedFvPatchFields/greyDiffusiveViewFactor/greyDiffusiveViewFactorFixedValueFvPatchScalarField.C
LIB = $(FOAM_LIBBIN)/libradiationModels

View File

@ -0,0 +1,182 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / 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 "greyDiffusiveViewFactorFixedValueFvPatchScalarField.H"
#include "addToRunTimeSelectionTable.H"
#include "fvPatchFieldMapper.H"
#include "volFields.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::radiation::greyDiffusiveViewFactorFixedValueFvPatchScalarField::
greyDiffusiveViewFactorFixedValueFvPatchScalarField
(
const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF
)
:
fixedValueFvPatchScalarField(p, iF),
radiationCoupledBase(patch(), "undefined", scalarField::null()),
Qro_(p.size(), 0.0)
{}
Foam::radiation::greyDiffusiveViewFactorFixedValueFvPatchScalarField::
greyDiffusiveViewFactorFixedValueFvPatchScalarField
(
const greyDiffusiveViewFactorFixedValueFvPatchScalarField& ptf,
const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF,
const fvPatchFieldMapper& mapper
)
:
fixedValueFvPatchScalarField(ptf, p, iF, mapper),
radiationCoupledBase
(
patch(),
ptf.emissivityMethod(),
ptf.emissivity_
),
Qro_(ptf.Qro_)
{}
Foam::radiation::greyDiffusiveViewFactorFixedValueFvPatchScalarField::
greyDiffusiveViewFactorFixedValueFvPatchScalarField
(
const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF,
const dictionary& dict
)
:
fixedValueFvPatchScalarField(p, iF),
radiationCoupledBase(p, dict),
Qro_("Qro", dict, p.size())
{
if (dict.found("value"))
{
fvPatchScalarField::operator=
(
scalarField("value", dict, p.size())
);
}
else
{
fvPatchScalarField::operator=(0.0);
}
}
Foam::radiation::greyDiffusiveViewFactorFixedValueFvPatchScalarField::
greyDiffusiveViewFactorFixedValueFvPatchScalarField
(
const greyDiffusiveViewFactorFixedValueFvPatchScalarField& ptf
)
:
fixedValueFvPatchScalarField(ptf),
radiationCoupledBase
(
ptf.patch(),
ptf.emissivityMethod(),
ptf.emissivity_
),
Qro_(ptf.Qro_)
{}
Foam::radiation::greyDiffusiveViewFactorFixedValueFvPatchScalarField::
greyDiffusiveViewFactorFixedValueFvPatchScalarField
(
const greyDiffusiveViewFactorFixedValueFvPatchScalarField& ptf,
const DimensionedField<scalar, volMesh>& iF
)
:
fixedValueFvPatchScalarField(ptf, iF),
radiationCoupledBase
(
ptf.patch(),
ptf.emissivityMethod(),
ptf.emissivity_
),
Qro_(ptf.Qro_)
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::radiation::greyDiffusiveViewFactorFixedValueFvPatchScalarField::
updateCoeffs()
{
//Do nothing
if (debug)
{
scalar Q = gSum((*this)*patch().magSf());
Info<< patch().boundaryMesh().mesh().name() << ':'
<< patch().name() << ':'
<< this->dimensionedInternalField().name() << " <- "
<< " heat[W]:" << Q
<< " wall radiative heat flux "
<< " min:" << gMin(*this)
<< " max:" << gMax(*this)
<< " avg:" << gAverage(*this)
<< endl;
}
}
void Foam::radiation::greyDiffusiveViewFactorFixedValueFvPatchScalarField::
write
(
Ostream& os
) const
{
fixedValueFvPatchScalarField::write(os);
radiationCoupledBase::write(os);
Qro_.writeEntry("Qro", os);
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace radiation
{
makePatchTypeField
(
fvPatchScalarField,
greyDiffusiveViewFactorFixedValueFvPatchScalarField
);
}
}
// ************************************************************************* //

View File

@ -0,0 +1,167 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / 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
Foam::greyDiffusiveViewFactorFixedValueFvPatchScalarField
Description
Radiation temperature specified
SourceFiles
greyDiffusiveViewFactorFixedValueFvPatchScalarField.C
\*---------------------------------------------------------------------------*/
#ifndef greyDiffusiveViewFactorFixedValueFvPatchScalarField_H
#define greyDiffusiveViewFactorFixedValueFvPatchScalarField_H
#include "radiationCoupledBase.H"
#include "fixedValueFvPatchFields.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace radiation
{
/*---------------------------------------------------------------------------*\
Class greyDiffusiveViewFactorFixedValueFvPatchScalarField declaration
\*---------------------------------------------------------------------------*/
class greyDiffusiveViewFactorFixedValueFvPatchScalarField
:
public fixedValueFvPatchScalarField,
public radiationCoupledBase
{
// Private data
//- External radiative heat flux
scalarField Qro_;
public:
//- Runtime type information
TypeName("greyDiffusiveRadiationViewFactor");
// Constructors
//- Construct from patch and internal field
greyDiffusiveViewFactorFixedValueFvPatchScalarField
(
const fvPatch&,
const DimensionedField<scalar, volMesh>&
);
//- Construct from patch, internal field and dictionary
greyDiffusiveViewFactorFixedValueFvPatchScalarField
(
const fvPatch&,
const DimensionedField<scalar, volMesh>&,
const dictionary&
);
//- Construct by mapping given a
// greyDiffusiveViewFactorFixedValueFvPatchScalarField onto a new patch
greyDiffusiveViewFactorFixedValueFvPatchScalarField
(
const greyDiffusiveViewFactorFixedValueFvPatchScalarField&,
const fvPatch&,
const DimensionedField<scalar, volMesh>&,
const fvPatchFieldMapper&
);
//- Construct as copy
greyDiffusiveViewFactorFixedValueFvPatchScalarField
(
const greyDiffusiveViewFactorFixedValueFvPatchScalarField&
);
//- Construct and return a clone
virtual tmp<fvPatchScalarField> clone() const
{
return tmp<fvPatchScalarField>
(
new greyDiffusiveViewFactorFixedValueFvPatchScalarField(*this)
);
}
//- Construct as copy setting internal field reference
greyDiffusiveViewFactorFixedValueFvPatchScalarField
(
const greyDiffusiveViewFactorFixedValueFvPatchScalarField&,
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 greyDiffusiveViewFactorFixedValueFvPatchScalarField
(
*this,
iF
)
);
}
// Member functions
// Access
//- Return external radiative heat flux
const scalarList& Qro()
{
return Qro_;
}
// Evaluation functions
//- Update the coefficients associated with the patch field
virtual void updateCoeffs();
// I-O
//- Write
virtual void write(Ostream&) const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -56,12 +56,13 @@ const Foam::NamedEnum<Foam::radiationCoupledBase::emissivityMethodType, 2>
Foam::radiationCoupledBase::radiationCoupledBase
(
const fvPatch& patch,
const word& calculationType
const word& calculationType,
const scalarField& emissivity
)
:
patch_(patch),
method_(emissivityMethodTypeNames_[calculationType]),
emissivity_(patch.size(), 0.0)
emissivity_(emissivity)
{}
@ -93,35 +94,7 @@ Foam::radiationCoupledBase::radiationCoupledBase
<< 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);
}
emissivity_ = scalarField(patch_.size(), 0.0);
}
break;
@ -136,9 +109,8 @@ Foam::radiationCoupledBase::radiationCoupledBase
" const fvPatch& p,\n"
" const dictionary& dict\n"
")\n"
) << "\n emissivity key"
<< "\n does not exist "
<< "\n for patch " << patch_.name()
) << "\n emissivity key does not exist for patch "
<< patch_.name()
<< exit(FatalError);
}
else
@ -159,7 +131,6 @@ Foam::tmp<Foam::scalarField> Foam::radiationCoupledBase::emissivity() const
{
case SOLIDTHERMO:
{
// Get the coupling information from the directMappedPatchBase
const directMappedPatchBase& mpp =
refCast<const directMappedPatchBase>
@ -168,25 +139,36 @@ Foam::tmp<Foam::scalarField> Foam::radiationCoupledBase::emissivity() const
);
const polyMesh& nbrMesh = mpp.sampleMesh();
const fvPatch& nbrPatch = refCast<const fvMesh>
(
nbrMesh
).boundary()[mpp.samplePolyPatch().index()];
scalarField emissivity
(
nbrPatch.lookupPatchField<volScalarField, scalar>("emissivity")
);
if (nbrMesh.foundObject<volScalarField>("emissivity"))
{
tmp<scalarField> temissivity
(
new scalarField
(
nbrPatch.lookupPatchField<volScalarField, scalar>
(
"emissivity"
)
)
);
// Force recalculation of mapping and schedule
const mapDistribute& distMap = mpp.map();
scalarField& emissivity = temissivity();
distMap.distribute(emissivity);
// Use direct map mapping to exchange data
mpp.map().distribute(emissivity);
return tmp<scalarField>
(
new scalarField(emissivity)
);
return temissivity;
}
else
{
return scalarField(0);
}
}
break;
@ -219,8 +201,7 @@ void Foam::radiationCoupledBase::write(Ostream& os) const
{
os.writeKeyword("emissivityMode") << emissivityMethodTypeNames_[method_]
<< token::END_STATEMENT << nl;
os.writeKeyword("emissivity") << emissivity_
<< token::END_STATEMENT << nl;
emissivity_.writeEntry("emissivity", os);
}

View File

@ -25,9 +25,8 @@ 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:
Common functions to emissivity. It gets supplied from lookup into a
dictionary or calculated by the solidThermo:
- 'lookup' : lookup volScalarField with name
- 'solidThermo' : use basicSolidThermo emissivity()
@ -73,11 +72,15 @@ private:
//- Underlying patch
const fvPatch& patch_;
protected:
// Protected data
//- How to get emissivity
const emissivityMethodType method_;
//- Emissivity
// Cached locally when is read from dictionary
// Cached locally when is read from dictionary (lookup mode)
scalarField emissivity_;
@ -85,11 +88,12 @@ public:
// Constructors
//- Construct from patch and emissivity name
//- Construct from patch, emissivity mode and emissivity
radiationCoupledBase
(
const fvPatch& patch,
const word& calculationMethod
const word& calculationMethod,
const scalarField& emissivity
);
//- Construct from patch and dictionary
@ -108,13 +112,7 @@ public:
return emissivityMethodTypeNames_[method_];
}
/*
//- Name of thermal conductivity field
const word& emissivityName() const
{
return emissivityName_;
}
*/
//- Calculate corresponding emissivity field
tmp<scalarField> emissivity() const;