ENH: Correcting righ lib for option file for fvOption source coded in CodedSource.C

Adding contact resistance to turbulentTemperatureCoupledBaffleMixed and turbulentTemperatureRadCoupledMixed
This commit is contained in:
Sergio Ferraris
2013-12-20 17:57:11 +00:00
parent 2d529e0240
commit 944ada0414
5 changed files with 207 additions and 52 deletions

View File

@ -65,14 +65,14 @@ void Foam::fv::CodedSource<Type>::prepare
dynCode.setMakeOptions
(
"EXE_INC = -g \\\n"
"-I$(LIB_SRC)/fieldSources/lnInclude \\\n"
"-I$(LIB_SRC)/fvOptions/lnInclude \\\n"
"-I$(LIB_SRC)/finiteVolume/lnInclude \\\n"
"-I$(LIB_SRC)/meshTools/lnInclude \\\n"
"-I$(LIB_SRC)/sampling/lnInclude \\\n"
+ context.options()
+ "\n\nLIB_LIBS = \\\n"
+ " -lmeshTools \\\n"
+ " -lfieldSources \\\n"
+ " -lfvOptions \\\n"
+ " -lsampling \\\n"
+ " -lfiniteVolume \\\n"
+ context.libs()

View File

@ -101,6 +101,24 @@ turbulentTemperatureCoupledBaffleMixedFvPatchScalarField
<< exit(FatalError);
}
if (dict.found("thicknessLayers"))
{
dict.lookup("thicknessLayers") >> thicknessLayers_;
dict.lookup("kappaLayers") >> kappaLayers_;
if (thicknessLayers_.size() > 0)
{
forAll (thicknessLayers_, iLayer)
{
const scalar l = thicknessLayers_[iLayer];
if (l > 0.0)
{
contactRes_ += kappaLayers_[iLayer]/l;
}
}
}
}
fvPatchScalarField::operator=(scalarField("value", dict, p.size()));
if (dict.found("refValue"))
@ -129,7 +147,10 @@ turbulentTemperatureCoupledBaffleMixedFvPatchScalarField
:
mixedFvPatchScalarField(wtcsf, iF),
temperatureCoupledBase(patch(), wtcsf.KMethod(), wtcsf.kappaName()),
TnbrName_(wtcsf.TnbrName_)
TnbrName_(wtcsf.TnbrName_),
thicknessLayers_(wtcsf.thicknessLayers_),
kappaLayers_(wtcsf.kappaLayers_),
contactRes_(wtcsf.contactRes_)
{}
@ -155,7 +176,7 @@ void turbulentTemperatureCoupledBaffleMixedFvPatchScalarField::updateCoeffs()
const fvPatch& nbrPatch =
refCast<const fvMesh>(nbrMesh).boundary()[samplePatchI];
tmp<scalarField> intFld = patchInternalField();
//tmp<scalarField> intFld = patchInternalField();
// Calculate the temperature by harmonic averaging
@ -174,12 +195,22 @@ void turbulentTemperatureCoupledBaffleMixedFvPatchScalarField::updateCoeffs()
);
// Swap to obtain full local values of neighbour internal field
scalarField nbrIntFld(nbrField.patchInternalField());
mpp.distribute(nbrIntFld);
tmp<scalarField> nbrIntFld(new scalarField(nbrField.size(), 0.0));
tmp<scalarField> nbrKDelta(new scalarField(nbrField.size(), 0.0));
// Swap to obtain full local values of neighbour kappa*delta
scalarField nbrKDelta(nbrField.kappa(nbrField)*nbrPatch.deltaCoeffs());
mpp.distribute(nbrKDelta);
if (contactRes_ == 0.0)
{
nbrIntFld() = nbrField.patchInternalField();
nbrKDelta() = nbrField.kappa(nbrField)*nbrPatch.deltaCoeffs();
}
else
{
nbrIntFld() = nbrField;
nbrKDelta() = contactRes_;
}
mpp.distribute(nbrIntFld());
mpp.distribute(nbrKDelta());
tmp<scalarField> myKDelta = kappa(*this)*patch().deltaCoeffs();
@ -200,11 +231,11 @@ void turbulentTemperatureCoupledBaffleMixedFvPatchScalarField::updateCoeffs()
// - mixFraction = nbrKDelta / (nbrKDelta + myKDelta())
this->refValue() = nbrIntFld;
this->refValue() = nbrIntFld();
this->refGrad() = 0.0;
this->valueFraction() = nbrKDelta/(nbrKDelta + myKDelta());
this->valueFraction() = nbrKDelta()/(nbrKDelta() + myKDelta());
mixedFvPatchScalarField::updateCoeffs();
@ -239,6 +270,11 @@ void turbulentTemperatureCoupledBaffleMixedFvPatchScalarField::write
mixedFvPatchScalarField::write(os);
os.writeKeyword("Tnbr")<< TnbrName_
<< token::END_STATEMENT << nl;
os.writeKeyword("thicknessLayers")<< thicknessLayers_
<< token::END_STATEMENT << nl;
os.writeKeyword("kappaLayers")<< kappaLayers_
<< token::END_STATEMENT << nl;
temperatureCoupledBase::write(os);
}

View File

@ -22,11 +22,20 @@ License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::compressible::turbulentTemperatureCoupledBaffleMixedFvPatchScalarField
Foam::
compressible::
turbulentTemperatureCoupledBaffleMixedFvPatchScalarField
Description
Mixed boundary condition for temperature, to be used for heat-transfer
on back-to-back baffles.
on back-to-back baffles.Optional thin thermal layer
resistances can be specified through thicknessLayers and kappaLayers
entries.
The thermal conductivity, \c kappa, can either be retrieved from the
mesh database using the \c lookup option, or from a \c solidThermo
or \c fluidThermo thermophysical package.
Specifies gradient and temperature such that the equations are the same
on both sides:
@ -36,29 +45,41 @@ Description
where KDelta is heat-transfer coefficient K * deltaCoeffs
Example usage:
myInterfacePatchName
{
type compressible::turbulentTemperatureCoupledBaffleMixed;
Tnbr T;
kappa lookup;
kappaName kappa;
value uniform 300;
}
\heading Patch usage
\table
Property | Description | Required | Default value
kappa | thermal conductivity option | yes |
kappaName | name of thermal conductivity field | no |
Tnbr | name of the field | no | T
thicknessLayers | list of thicknesses per layer [m] | no |
kappaLayers | list of thermal conductivites per layer [W/m/K] | no |
\endtable
Example of the boundary condition specification:
\verbatim
myPatch
{
type compressible::turbulentTemperatureCoupledBaffleMixed;
Tnbr T;
kappa lookup;
KappaName kappa;
thicknessLayers (0.1 0.2 0.3 0.4);
kappaLayers (1 2 3 4)
value uniform 300;
}
Needs to be on underlying mapped(Wall)FvPatch.
Note: kappa : heat conduction at patch. Gets supplied how to lookup
calculate kappa:
- 'lookup' : lookup volScalarField (or volSymmTensorField) with name
- 'fluidThermo' : use fluidThermo and compressible::RASmodel to calculate
kappa
- 'solidThermo' : use solidThermo kappa()
- 'directionalSolidThermo' directionalKappa()
Note: runs in parallel with arbitrary decomposition. Uses mapped
functionality to calculate exchange.
SourceFiles
turbulentTemperatureCoupledBaffleMixedFvPatchScalarField.C
@ -91,6 +112,15 @@ class turbulentTemperatureCoupledBaffleMixedFvPatchScalarField
//- Name of field on the neighbour region
const word TnbrName_;
//- Thickness of layers
scalarField thicknessLayers_;
//- Conductivity of layers
scalarField kappaLayers_;
//- Total contact resistance
scalar contactRes_;
public:

View File

@ -49,7 +49,10 @@ turbulentTemperatureRadCoupledMixedFvPatchScalarField
temperatureCoupledBase(patch(), "undefined", "undefined-K"),
TnbrName_("undefined-Tnbr"),
QrNbrName_("undefined-QrNbr"),
QrName_("undefined-Qr")
QrName_("undefined-Qr"),
thicknessLayers_(),
kappaLayers_(),
contactRes_(0)
{
this->refValue() = 0.0;
this->refGrad() = 0.0;
@ -70,7 +73,10 @@ turbulentTemperatureRadCoupledMixedFvPatchScalarField
temperatureCoupledBase(patch(), psf.KMethod(), psf.kappaName()),
TnbrName_(psf.TnbrName_),
QrNbrName_(psf.QrNbrName_),
QrName_(psf.QrName_)
QrName_(psf.QrName_),
thicknessLayers_(psf.thicknessLayers_),
kappaLayers_(psf.kappaLayers_),
contactRes_(psf.contactRes_)
{}
@ -86,7 +92,10 @@ turbulentTemperatureRadCoupledMixedFvPatchScalarField
temperatureCoupledBase(patch(), dict),
TnbrName_(dict.lookupOrDefault<word>("Tnbr", "T")),
QrNbrName_(dict.lookupOrDefault<word>("QrNbr", "none")),
QrName_(dict.lookupOrDefault<word>("Qr", "none"))
QrName_(dict.lookupOrDefault<word>("Qr", "none")),
thicknessLayers_(),
kappaLayers_(),
contactRes_(0.0)
{
if (!isA<mappedPatchBase>(this->patch().patch()))
{
@ -107,6 +116,24 @@ turbulentTemperatureRadCoupledMixedFvPatchScalarField
<< exit(FatalError);
}
if (dict.found("thicknessLayers"))
{
dict.lookup("thicknessLayers") >> thicknessLayers_;
dict.lookup("kappaLayers") >> kappaLayers_;
if (thicknessLayers_.size() > 0)
{
forAll (thicknessLayers_, iLayer)
{
const scalar l = thicknessLayers_[iLayer];
if (l > 0.0)
{
contactRes_ += kappaLayers_[iLayer]/l;
}
}
}
}
fvPatchScalarField::operator=(scalarField("value", dict, p.size()));
if (dict.found("refValue"))
@ -137,7 +164,10 @@ turbulentTemperatureRadCoupledMixedFvPatchScalarField
temperatureCoupledBase(patch(), psf.KMethod(), psf.kappaName()),
TnbrName_(psf.TnbrName_),
QrNbrName_(psf.QrNbrName_),
QrName_(psf.QrName_)
QrName_(psf.QrName_),
thicknessLayers_(psf.thicknessLayers_),
kappaLayers_(psf.kappaLayers_),
contactRes_(psf.contactRes_)
{}
@ -180,9 +210,17 @@ void turbulentTemperatureRadCoupledMixedFvPatchScalarField::updateCoeffs()
// Swap to obtain full local values of neighbour K*delta
scalarField KDeltaNbr(nbrField.kappa(nbrField)*nbrPatch.deltaCoeffs());
mpp.distribute(KDeltaNbr);
tmp<scalarField> KDeltaNbr(new scalarField(TcNbr.size(), 0.0));
if (contactRes_ == 0.0)
{
// Swap to obtain full local values of neighbour K*delta
KDeltaNbr() = nbrField.kappa(nbrField)*nbrPatch.deltaCoeffs();
}
else
{
KDeltaNbr() = contactRes_;
}
mpp.distribute(KDeltaNbr());
scalarField KDelta(kappa(*this)*patch().deltaCoeffs());
@ -199,16 +237,34 @@ void turbulentTemperatureRadCoupledMixedFvPatchScalarField::updateCoeffs()
mpp.distribute(QrNbr);
}
scalarField alpha(KDeltaNbr - (Qr + QrNbr)/Tp);
scalarField alpha(KDeltaNbr() - (Qr + QrNbr)/Tp);
valueFraction() = alpha/(alpha + KDelta);
refValue() = (KDeltaNbr*TcNbr)/alpha;
refValue() = (KDeltaNbr()*TcNbr)/alpha;
mixedFvPatchScalarField::updateCoeffs();
if (debug)
{
scalar Q = gSum(kappa(*this)*patch().magSf()*snGrad());
Info<< patch().boundaryMesh().mesh().name() << ':'
<< patch().name() << ':'
<< this->dimensionedInternalField().name() << " <- "
<< nbrMesh.name() << ':'
<< nbrPatch.name() << ':'
<< this->dimensionedInternalField().name() << " :"
<< " heat transfer rate:" << Q
<< " walltemperature "
<< " min:" << gMin(*this)
<< " max:" << gMax(*this)
<< " avg:" << gAverage(*this)
<< endl;
}
// Restore tag
UPstream::msgType() = oldTag;
mixedFvPatchScalarField::updateCoeffs();
}
@ -221,6 +277,11 @@ void turbulentTemperatureRadCoupledMixedFvPatchScalarField::write
os.writeKeyword("Tnbr")<< TnbrName_ << token::END_STATEMENT << nl;
os.writeKeyword("QrNbr")<< QrNbrName_ << token::END_STATEMENT << nl;
os.writeKeyword("Qr")<< QrName_ << token::END_STATEMENT << nl;
os.writeKeyword("Qr")<< QrName_ << token::END_STATEMENT << nl;
os.writeKeyword("thicknessLayers")<< thicknessLayers_
<< token::END_STATEMENT << nl;
os.writeKeyword("kappaLayers")<< kappaLayers_
<< token::END_STATEMENT << nl;
temperatureCoupledBase::write(os);
}

View File

@ -28,23 +28,45 @@ Class
Description
Mixed boundary condition for temperature and radiation heat transfer
to be used for in multiregion cases
to be used for in multiregion cases. Optional thin thermal layer
resistances can be specified through thicknessLayers and kappaLayers
entries.
Example usage:
myInterfacePatchName
{
type compressible::turbulentTemperatureRadCoupledMixed;
Tnbr T; // name of T field on neighbour region
kappa lookup;
KappaName kappa;
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;
}
The thermal conductivity, \c kappa, can either be retrieved from the
mesh database using the \c lookup option, or from a \c solidThermo
or \c fluidThermo thermophysical package.
\heading Patch usage
\table
Property | Description | Required | Default value
kappa | thermal conductivity option | yes |
kappaName | name of thermal conductivity field | no |
Tnbr | name of the field | no | T
QrNbr | name of the radiative flux in the nbr region | no | none
Qr | name of the radiative flux in this region | no | none
thicknessLayers | list of thicknesses per layer [m] | no |
kappaLayers | list of thermal conductivites per layer [W/m/K] | no |
\endtable
Example of the boundary condition specification:
\verbatim
myPatch
{
type compressible::turbulentTemperatureRadCoupledMixed;
Tnbr T;
kappa lookup;
KappaName kappa;
QrNbr Qr; // or none. Name of Qr field on neighbour region
Qr Qr; // or none. Name of Qr field on local region
thicknessLayers (0.1 0.2 0.3 0.4);
kappaLayers (1 2 3 4)
value uniform 300;
}
Needs to be on underlying mapped(Wall)FvPatch.
Note: kappa : heat conduction at patch. Gets supplied how to
Note: kappa : heat conduction at patch. Gets supplied how to
lookup/calculate
kappa:
- 'lookup' : lookup volScalarField (or volSymmTensorField) with name
@ -52,9 +74,6 @@ Description
- 'solidThermo' : use solidThermo kappa()
- 'directionalSolidThermo' directionalKappa()
Note: runs in parallel with arbitrary decomposition. Uses mapped
functionality to calculate exchange.
SourceFiles
turbulentTemperatureRadCoupledMixedFvPatchScalarField.C
@ -93,6 +112,15 @@ class turbulentTemperatureRadCoupledMixedFvPatchScalarField
//- Name of the radiative heat flux in local region
const word QrName_;
//- Thickness of layers
scalarField thicknessLayers_;
//- Conductivity of layers
scalarField kappaLayers_;
//- Total contact resistance
scalar contactRes_;
public: