STY: Reordering FvPathces and libs

This commit is contained in:
sergio
2011-06-03 13:45:14 +01:00
parent f1685c92d3
commit 5c8056886a
23 changed files with 73 additions and 1376 deletions

View File

@ -120,6 +120,7 @@ $(derivedFvPatchFields)/directMappedFixedInternalValue/directMappedFixedInternal
$(derivedFvPatchFields)/directMappedFixedPushedInternalValue/directMappedFixedPushedInternalValueFvPatchFields.C
$(derivedFvPatchFields)/directMappedFixedValue/directMappedFixedValueFvPatchFields.C
$(derivedFvPatchFields)/directMappedVelocityFluxFixedValue/directMappedVelocityFluxFixedValueFvPatchField.C
$(derivedFvPatchFields)/directMappedFlowRate/directMappedFlowRateFvPatchVectorField.C
$(derivedFvPatchFields)/fan/fanFvPatchFields.C
$(derivedFvPatchFields)/buoyantPressure/buoyantPressureFvPatchScalarField.C
$(derivedFvPatchFields)/fixedFluxPressure/fixedFluxPressureFvPatchScalarField.C

View File

@ -23,20 +23,18 @@ License
\*---------------------------------------------------------------------------*/
#include "flowRateInletVelocityCoupledFvPatchVectorField.H"
#include "directMappedFlowRateFvPatchVectorField.H"
#include "volFields.H"
#include "addToRunTimeSelectionTable.H"
#include "fvPatchFieldMapper.H"
#include "directMappedPatchBase.H"
#include "mapDistribute.H"
#include "regionProperties.H"
#include "basicThermo.H"
#include "surfaceFields.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::flowRateInletVelocityCoupledFvPatchVectorField::
flowRateInletVelocityCoupledFvPatchVectorField
Foam::directMappedFlowRateFvPatchVectorField::
directMappedFlowRateFvPatchVectorField
(
const fvPatch& p,
const DimensionedField<vector, volMesh>& iF
@ -49,10 +47,10 @@ flowRateInletVelocityCoupledFvPatchVectorField
{}
Foam::flowRateInletVelocityCoupledFvPatchVectorField::
flowRateInletVelocityCoupledFvPatchVectorField
Foam::directMappedFlowRateFvPatchVectorField::
directMappedFlowRateFvPatchVectorField
(
const flowRateInletVelocityCoupledFvPatchVectorField& ptf,
const directMappedFlowRateFvPatchVectorField& ptf,
const fvPatch& p,
const DimensionedField<vector, volMesh>& iF,
const fvPatchFieldMapper& mapper
@ -65,8 +63,8 @@ flowRateInletVelocityCoupledFvPatchVectorField
{}
Foam::flowRateInletVelocityCoupledFvPatchVectorField::
flowRateInletVelocityCoupledFvPatchVectorField
Foam::directMappedFlowRateFvPatchVectorField::
directMappedFlowRateFvPatchVectorField
(
const fvPatch& p,
const DimensionedField<vector, volMesh>& iF,
@ -80,10 +78,10 @@ flowRateInletVelocityCoupledFvPatchVectorField
{}
Foam::flowRateInletVelocityCoupledFvPatchVectorField::
flowRateInletVelocityCoupledFvPatchVectorField
Foam::directMappedFlowRateFvPatchVectorField::
directMappedFlowRateFvPatchVectorField
(
const flowRateInletVelocityCoupledFvPatchVectorField& ptf
const directMappedFlowRateFvPatchVectorField& ptf
)
:
fixedValueFvPatchField<vector>(ptf),
@ -93,10 +91,10 @@ flowRateInletVelocityCoupledFvPatchVectorField
{}
Foam::flowRateInletVelocityCoupledFvPatchVectorField::
flowRateInletVelocityCoupledFvPatchVectorField
Foam::directMappedFlowRateFvPatchVectorField::
directMappedFlowRateFvPatchVectorField
(
const flowRateInletVelocityCoupledFvPatchVectorField& ptf,
const directMappedFlowRateFvPatchVectorField& ptf,
const DimensionedField<vector, volMesh>& iF
)
:
@ -109,7 +107,7 @@ flowRateInletVelocityCoupledFvPatchVectorField
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::flowRateInletVelocityCoupledFvPatchVectorField::updateCoeffs()
void Foam::directMappedFlowRateFvPatchVectorField::updateCoeffs()
{
if (updated())
{
@ -127,35 +125,19 @@ void Foam::flowRateInletVelocityCoupledFvPatchVectorField::updateCoeffs()
nbrMesh
).boundary()[mpp.samplePolyPatch().index()];
// Force recalculation of mapping and schedule
const mapDistribute& distMap = mpp.map();
scalarList phi =
nbrPatch.lookupPatchField<surfaceScalarField, scalar>(nbrPhiName_);
mapDistribute::distribute
(
Pstream::defaultCommsType,
distMap.schedule(),
distMap.constructSize(),
distMap.subMap(), // what to send
distMap.constructMap(), // what to receive
phi
);
mpp.map().distribute(phi);
const surfaceScalarField& phiName =
db().lookupObject<surfaceScalarField>(phiName_);
// a simpler way of doing this would be nice
//scalar avgU = -flowRate_/gSum(patch().magSf());
scalarField U = -phi/patch().magSf();
vectorField n = patch().nf();
// const surfaceScalarField& phi =
// db().lookupObject<surfaceScalarField>(phiName_);
if (phiName.dimensions() == dimVelocity*dimArea)
{
// volumetric flow-rate
@ -186,7 +168,7 @@ void Foam::flowRateInletVelocityCoupledFvPatchVectorField::updateCoeffs()
{
FatalErrorIn
(
"flowRateInletVelocityCoupledFvPatchVectorField::updateCoeffs()"
"directMappedFlowRateFvPatchVectorField::updateCoeffs()"
) << "dimensions of " << phiName_ << " are incorrect" << nl
<< " on patch " << this->patch().name()
<< " of field " << this->dimensionedInternalField().name()
@ -198,7 +180,7 @@ void Foam::flowRateInletVelocityCoupledFvPatchVectorField::updateCoeffs()
}
void Foam::flowRateInletVelocityCoupledFvPatchVectorField::write
void Foam::directMappedFlowRateFvPatchVectorField::write
(
Ostream& os
) const
@ -218,7 +200,7 @@ namespace Foam
makePatchTypeField
(
fvPatchVectorField,
flowRateInletVelocityCoupledFvPatchVectorField
directMappedFlowRateFvPatchVectorField
);
}

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2006-2011 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2011-2011 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -22,7 +22,7 @@ License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::flowRateInletVelocityCoupledFvPatchVectorField
Foam::directMappedFlowRateFvPatchVectorField
Description
Describes a volumetric/mass flow normal vector boundary condition by its
@ -41,7 +41,7 @@ Description
@verbatim
inlet
{
type flowRateInletVelocityCoupled;
type directMappedFlowRate;
phi phi;
rho rho;
neigPhi neigPhiName_; // Volumetric/mass flow rate
@ -50,18 +50,13 @@ Description
}
@endverbatim
Note
- The value is positive inwards
- May not work correctly for transonic inlets
- Strange behaviour with potentialFoam since the U equation is not solved
SourceFiles
flowRateInletVelocityCoupledFvPatchVectorField.C
directMappedFlowRateFvPatchVectorField.C
\*---------------------------------------------------------------------------*/
#ifndef flowRateInletVelocityCoupledFvPatchVectorField_H
#define flowRateInletVelocityCoupledFvPatchVectorField_H
#ifndef directMappedFlowRateFvPatchVectorField_H
#define directMappedFlowRateFvPatchVectorField_H
#include "fixedValueFvPatchFields.H"
@ -73,7 +68,7 @@ namespace Foam
Class flowRateInletVelocityFvPatch Declaration
\*---------------------------------------------------------------------------*/
class flowRateInletVelocityCoupledFvPatchVectorField
class directMappedFlowRateFvPatchVectorField
:
public fixedValueFvPatchVectorField
{
@ -92,20 +87,20 @@ class flowRateInletVelocityCoupledFvPatchVectorField
public:
//- Runtime type information
TypeName("flowRateInletVelocityCoupled");
TypeName("directMappedFlowRate");
// Constructors
//- Construct from patch and internal field
flowRateInletVelocityCoupledFvPatchVectorField
directMappedFlowRateFvPatchVectorField
(
const fvPatch&,
const DimensionedField<vector, volMesh>&
);
//- Construct from patch, internal field and dictionary
flowRateInletVelocityCoupledFvPatchVectorField
directMappedFlowRateFvPatchVectorField
(
const fvPatch&,
const DimensionedField<vector, volMesh>&,
@ -113,20 +108,20 @@ public:
);
//- Construct by mapping given
// flowRateInletVelocityCoupledFvPatchVectorField
// directMappedFlowRateFvPatchVectorField
// onto a new patch
flowRateInletVelocityCoupledFvPatchVectorField
directMappedFlowRateFvPatchVectorField
(
const flowRateInletVelocityCoupledFvPatchVectorField&,
const directMappedFlowRateFvPatchVectorField&,
const fvPatch&,
const DimensionedField<vector, volMesh>&,
const fvPatchFieldMapper&
);
//- Construct as copy
flowRateInletVelocityCoupledFvPatchVectorField
directMappedFlowRateFvPatchVectorField
(
const flowRateInletVelocityCoupledFvPatchVectorField&
const directMappedFlowRateFvPatchVectorField&
);
//- Construct and return a clone
@ -134,14 +129,14 @@ public:
{
return tmp<fvPatchVectorField>
(
new flowRateInletVelocityCoupledFvPatchVectorField(*this)
new directMappedFlowRateFvPatchVectorField(*this)
);
}
//- Construct as copy setting internal field reference
flowRateInletVelocityCoupledFvPatchVectorField
directMappedFlowRateFvPatchVectorField
(
const flowRateInletVelocityCoupledFvPatchVectorField&,
const directMappedFlowRateFvPatchVectorField&,
const DimensionedField<vector, volMesh>&
);
@ -153,7 +148,7 @@ public:
{
return tmp<fvPatchVectorField>
(
new flowRateInletVelocityCoupledFvPatchVectorField(*this, iF)
new directMappedFlowRateFvPatchVectorField(*this, iF)
);
}

View File

@ -1,11 +1,3 @@
/* derived patches */
derivedFvPatchFields/turbulentTemperatureCoupledBaffleMixed/turbulentTemperatureCoupledBaffleMixedFvPatchScalarField2.C
derivedFvPatchFields/flowRateInletVelocityCoupled/flowRateInletVelocityCoupledFvPatchVectorField.C
derivedFvPatchFields/totalFlowRateAdvectiveDiffusiveFvPatchScalarField/totalFlowRateAdvectiveDiffusiveFvPatchScalarField.C
derivedFvPatchFields/turbulentTemperatureRadiativeCoupledMixed/turbulentTemperatureRadiationCoupledMixedSTFvPatchScalarField.C
/* Pyrolysis models */
pyrolysisModel/pyrolysisModel.C
pyrolysisModel/pyrolysisModelNew.C

View File

@ -1,327 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2010-2011 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "turbulentTemperatureCoupledBaffleMixedFvPatchScalarField2.H"
#include "addToRunTimeSelectionTable.H"
#include "fvPatchFieldMapper.H"
#include "volFields.H"
#include "directMappedPatchBase.H"
#include "mapDistribute.H"
#include "basicThermo.H"
#include "LESModel.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace compressible
{
namespace LESModels
{
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
turbulentTemperatureCoupledBaffleMixedFvPatchScalarField2::
turbulentTemperatureCoupledBaffleMixedFvPatchScalarField2
(
const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF
)
:
mixedFvPatchScalarField(p, iF),
nbrFieldName_("undefined-nbrFieldName"),
KName_("undefined-K")
{
this->refValue() = 0.0;
this->refGrad() = 0.0;
this->valueFraction() = 1.0;
}
turbulentTemperatureCoupledBaffleMixedFvPatchScalarField2::
turbulentTemperatureCoupledBaffleMixedFvPatchScalarField2
(
const turbulentTemperatureCoupledBaffleMixedFvPatchScalarField2& ptf,
const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF,
const fvPatchFieldMapper& mapper
)
:
mixedFvPatchScalarField(ptf, p, iF, mapper),
nbrFieldName_(ptf.nbrFieldName_),
KName_(ptf.KName_)
{}
turbulentTemperatureCoupledBaffleMixedFvPatchScalarField2::
turbulentTemperatureCoupledBaffleMixedFvPatchScalarField2
(
const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF,
const dictionary& dict
)
:
mixedFvPatchScalarField(p, iF),
nbrFieldName_(dict.lookup("nbrFieldName")),
KName_(dict.lookup("K"))
{
if (!isA<directMappedPatchBase>(this->patch().patch()))
{
FatalErrorIn
(
"turbulentTemperatureCoupledBaffleMixedFvPatchScalarField2::"
"turbulentTemperatureCoupledBaffleMixedFvPatchScalarField2\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;
}
}
turbulentTemperatureCoupledBaffleMixedFvPatchScalarField2::
turbulentTemperatureCoupledBaffleMixedFvPatchScalarField2
(
const turbulentTemperatureCoupledBaffleMixedFvPatchScalarField2& wtcsf,
const DimensionedField<scalar, volMesh>& iF
)
:
mixedFvPatchScalarField(wtcsf, iF),
nbrFieldName_(wtcsf.nbrFieldName_),
KName_(wtcsf.KName_)
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
tmp<scalarField>
turbulentTemperatureCoupledBaffleMixedFvPatchScalarField2::K() const
{
const fvMesh& mesh = patch().boundaryMesh().mesh();
if (KName_ == "none")
{
const LESModel& model = db().lookupObject<LESModel>("LESProperties");
const basicThermo& thermo =
db().lookupObject<basicThermo>("thermophysicalProperties");
return
model.alphaEff()().boundaryField()[patch().index()]
*thermo.Cp()().boundaryField()[patch().index()];
}
else if (mesh.objectRegistry::foundObject<volScalarField>(KName_))
{
return patch().lookupPatchField<volScalarField, scalar>(KName_);
}
else if (mesh.objectRegistry::foundObject<volSymmTensorField>(KName_))
{
const symmTensorField& KWall =
patch().lookupPatchField<volSymmTensorField, scalar>(KName_);
vectorField n = patch().nf();
return n & KWall & n;
}
else
{
FatalErrorIn
(
"turbulentTemperatureCoupledBaffleMixedFvPatchScalarField2::K()"
" const"
) << "Did not find field " << KName_
<< " on mesh " << mesh.name() << " patch " << patch().name()
<< endl
<< "Please set 'K' to 'none', a valid volScalarField"
<< " or a valid volSymmTensorField." << exit(FatalError);
return scalarField(0);
}
}
void turbulentTemperatureCoupledBaffleMixedFvPatchScalarField2::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 fvPatch& nbrPatch = refCast<const fvMesh>
(
nbrMesh
).boundary()[mpp.samplePolyPatch().index()];
// Force recalculation of mapping and schedule
const mapDistribute& distMap = mpp.map();
tmp<scalarField> intFld = patchInternalField();
// Calculate the temperature by harmonic averaging
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
const turbulentTemperatureCoupledBaffleMixedFvPatchScalarField2& nbrField =
refCast
<
const turbulentTemperatureCoupledBaffleMixedFvPatchScalarField2
>
(
nbrPatch.lookupPatchField<volScalarField, scalar>
(
nbrFieldName_
)
);
// Swap to obtain full local values of neighbour internal field
scalarField nbrIntFld = nbrField.patchInternalField();
mapDistribute::distribute
(
Pstream::defaultCommsType,
distMap.schedule(),
distMap.constructSize(),
distMap.subMap(), // what to send
distMap.constructMap(), // what to receive
nbrIntFld
);
// Swap to obtain full local values of neighbour K*delta
scalarField nbrKDelta = nbrField.K()*nbrPatch.deltaCoeffs();
mapDistribute::distribute
(
Pstream::defaultCommsType,
distMap.schedule(),
distMap.constructSize(),
distMap.subMap(), // what to send
distMap.constructMap(), // what to receive
nbrKDelta
);
tmp<scalarField> myKDelta = K()*patch().deltaCoeffs();
// Both sides agree on
// - temperature : (myKDelta*fld + nbrKDelta*nbrFld)/(myKDelta+nbrKDelta)
// - gradient : (temperature-fld)*delta
// We've got a degree of freedom in how to implement this in a mixed bc.
// (what gradient, what fixedValue and mixing coefficient)
// Two reasonable choices:
// 1. specify above temperature on one side (preferentially the high side)
// and above gradient on the other. So this will switch between pure
// fixedvalue and pure fixedgradient
// 2. specify gradient and temperature such that the equations are the
// same on both sides. This leads to the choice of
// - refGradient = zero gradient
// - refValue = neighbour value
// - mixFraction = nbrKDelta / (nbrKDelta + myKDelta())
this->refValue() = nbrIntFld;
this->refGrad() = 0.0;
this->valueFraction() = nbrKDelta / (nbrKDelta + myKDelta());
mixedFvPatchScalarField::updateCoeffs();
if (debug)
{
scalar Q = gSum(K()*patch().magSf()*snGrad());
Info<< patch().boundaryMesh().mesh().name() << ':'
<< patch().name() << ':'
<< this->dimensionedInternalField().name() << " <- "
<< nbrMesh.name() << ':'
<< nbrPatch.name() << ':'
<< this->dimensionedInternalField().name() << " :"
<< " heat[W]:" << Q
<< " walltemperature "
<< " min:" << gMin(*this)
<< " max:" << gMax(*this)
<< " avg:" << gAverage(*this)
<< endl;
}
}
void turbulentTemperatureCoupledBaffleMixedFvPatchScalarField2::write
(
Ostream& os
) const
{
mixedFvPatchScalarField::write(os);
os.writeKeyword("nbrFieldName")<< nbrFieldName_
<< token::END_STATEMENT << nl;
os.writeKeyword("K") << KName_ << token::END_STATEMENT << nl;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
makePatchTypeField
(
fvPatchScalarField,
turbulentTemperatureCoupledBaffleMixedFvPatchScalarField2
);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace compressible
} // End namespace Foam
} // End namespace LESModels
// ************************************************************************* //

View File

@ -1,539 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2010-2011 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "turbulentTemperatureRadiationCoupledMixedSTFvPatchScalarField.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
{
template<>
const char*
NamedEnum
<
turbulentTemperatureRadiationCoupledMixedSTFvPatchScalarField::
operationMode,
4
>::names[] =
{
"radiative_flux_from_neighbouring_region",
"radiative_flux_from_this_region",
"no_radiation_contribution",
"unknown"
};
const NamedEnum
<
turbulentTemperatureRadiationCoupledMixedSTFvPatchScalarField::
operationMode,
4
>
turbulentTemperatureRadiationCoupledMixedSTFvPatchScalarField::
operationModeNames;
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
turbulentTemperatureRadiationCoupledMixedSTFvPatchScalarField::
turbulentTemperatureRadiationCoupledMixedSTFvPatchScalarField
(
const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF
)
:
mixedFvPatchScalarField(p, iF),
neighbourFieldName_("undefined-neighbourFieldName"),
neighbourFieldRadiativeName_("undefined-neigbourFieldRadiativeName"),
fieldRadiativeName_("undefined-fieldRadiativeName"),
KName_("undefined-K"),
oldMode_(unknown)
{
this->refValue() = 0.0;
this->refGrad() = 0.0;
this->valueFraction() = 1.0;
}
turbulentTemperatureRadiationCoupledMixedSTFvPatchScalarField::
turbulentTemperatureRadiationCoupledMixedSTFvPatchScalarField
(
const turbulentTemperatureRadiationCoupledMixedSTFvPatchScalarField& ptf,
const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF,
const fvPatchFieldMapper& mapper
)
:
mixedFvPatchScalarField(ptf, p, iF, mapper),
neighbourFieldName_(ptf.neighbourFieldName_),
neighbourFieldRadiativeName_(ptf.neighbourFieldRadiativeName_),
fieldRadiativeName_(ptf.fieldRadiativeName_),
KName_(ptf.KName_),
oldMode_(ptf.oldMode_)
{}
turbulentTemperatureRadiationCoupledMixedSTFvPatchScalarField::
turbulentTemperatureRadiationCoupledMixedSTFvPatchScalarField
(
const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF,
const dictionary& dict
)
:
mixedFvPatchScalarField(p, iF),
neighbourFieldName_(dict.lookup("neighbourFieldName")),
neighbourFieldRadiativeName_(dict.lookup("neighbourFieldRadiativeName")),
fieldRadiativeName_(dict.lookup("fieldRadiativeName")),
KName_(dict.lookup("K")),
oldMode_(unknown)
{
if (!isA<directMappedPatchBase>(this->patch().patch()))
{
FatalErrorIn
(
"turbulentTemperatureRadiationCoupledMixedSTFvPatchScalarField::"
"turbulentTemperatureRadiationCoupledMixedSTFvPatchScalarField\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;
}
}
turbulentTemperatureRadiationCoupledMixedSTFvPatchScalarField::
turbulentTemperatureRadiationCoupledMixedSTFvPatchScalarField
(
const turbulentTemperatureRadiationCoupledMixedSTFvPatchScalarField&
wtcsf,
const DimensionedField<scalar, volMesh>& iF
)
:
mixedFvPatchScalarField(wtcsf, iF),
neighbourFieldName_(wtcsf.neighbourFieldName_),
neighbourFieldRadiativeName_(wtcsf.neighbourFieldRadiativeName_),
fieldRadiativeName_(wtcsf.fieldRadiativeName_),
KName_(wtcsf.KName_),
oldMode_(wtcsf.oldMode_)
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
tmp<scalarField>
turbulentTemperatureRadiationCoupledMixedSTFvPatchScalarField::K() const
{
const fvMesh& mesh = patch().boundaryMesh().mesh();
if (KName_ == "none")
{
const compressible::LESModel& model =
db().lookupObject<compressible::LESModel>("LESProperties");
const basicThermo& thermo =
db().lookupObject<basicThermo>("thermophysicalProperties");
return
model.alphaEff()().boundaryField()[patch().index()]
*thermo.Cp()().boundaryField()[patch().index()];
}
else if (mesh.objectRegistry::foundObject<volScalarField>(KName_))
{
return patch().lookupPatchField<volScalarField, scalar>(KName_);
}
else if (mesh.objectRegistry::foundObject<volSymmTensorField>(KName_))
{
const symmTensorField& KWall =
patch().lookupPatchField<volSymmTensorField, scalar>(KName_);
vectorField n = patch().nf();
return n & KWall & n;
}
else
{
FatalErrorIn
(
"turbulentTemperatureCoupledBaffleMixedFvPatchScalarField::K()"
" const"
) << "Did not find field " << KName_
<< " on mesh " << mesh.name() << " patch " << patch().name()
<< endl
<< "Please set 'K' to 'none', a valid volScalarField"
<< " or a valid volSymmTensorField." << exit(FatalError);
return scalarField(0);
}
}
void turbulentTemperatureRadiationCoupledMixedSTFvPatchScalarField::
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 fvPatch& nbrPatch = refCast<const fvMesh>
(
nbrMesh
).boundary()[mpp.samplePolyPatch().index()];
// Force recalculation of mapping and schedule
const mapDistribute& distMap = mpp.map();
scalarField intFld = patchInternalField();
const turbulentTemperatureRadiationCoupledMixedSTFvPatchScalarField&
nbrField =
refCast
<
const turbulentTemperatureRadiationCoupledMixedSTFvPatchScalarField
>
(
nbrPatch.lookupPatchField<volScalarField, scalar>
(
neighbourFieldName_
)
);
// Swap to obtain full local values of neighbour internal field
scalarField nbrIntFld = nbrField.patchInternalField();
mapDistribute::distribute
(
Pstream::defaultCommsType,
distMap.schedule(),
distMap.constructSize(),
distMap.subMap(), // what to send
distMap.constructMap(), // what to receive
nbrIntFld
);
if (debug)
{
Info<< patch().boundaryMesh().mesh().name() << ':'
<< patch().name() << ':'
<< this->dimensionedInternalField().name() << " :"
<< " internalT "
<< " min:" << gMin(*this)
<< " max:" << gMax(*this)
<< " avg:" << gAverage(*this)
<< endl;
Info<< nbrMesh.name() << ':'
<< nbrPatch.name() << ':'
<< this->dimensionedInternalField().name() << " :"
<< " internalT "
<< " min:" << gMin(nbrIntFld)
<< " max:" << gMax(nbrIntFld)
<< " avg:" << gAverage(nbrIntFld)
<< endl;
}
// Check how to operate
operationMode mode = unknown;
{
if (neighbourFieldRadiativeName_ != "none")
{
if
(
nbrMesh.foundObject<volScalarField>
(
neighbourFieldRadiativeName_
)
)
{
mode = radFromNeighbour;
}
else
{
mode = noRad;
}
}
else
{
if
(
patch().boundaryMesh().mesh().foundObject<volScalarField>
(
fieldRadiativeName_
)
)
{
mode = radFromMe;
}
else
{
mode = noRad;
}
}
// Do some warnings if change of mode.
if (mode != oldMode_)
{
WarningIn
(
"turbulentTemperatureRadiationCoupledMixedSTFvPatchScalarField"
"::updateCoeffs()"
) << "Switched from mode " << operationModeNames[oldMode_]
<< " to mode " << operationModeNames[mode]
<< endl;
}
oldMode_ = mode;
}
// Swap to obtain full local values of neighbour K*delta
scalarField nbrKDelta = nbrField.K()*nbrPatch.deltaCoeffs();
mapDistribute::distribute
(
Pstream::defaultCommsType,
distMap.schedule(),
distMap.constructSize(),
distMap.subMap(), // what to send
distMap.constructMap(), // what to receive
nbrKDelta
);
scalarField myKDelta = K()*patch().deltaCoeffs();
scalarField nbrConvFlux = nbrKDelta*(*this - nbrIntFld);
scalarField nbrTotalFlux = nbrConvFlux;
scalarList nbrRadField(nbrPatch.size(), 0.0);
scalarList myRadField(patch().size(), 0.0);
// solid
if (mode == radFromNeighbour)
{
nbrRadField =
nbrPatch.lookupPatchField<volScalarField, scalar>
(
neighbourFieldRadiativeName_
);
// Note: the Qr radiative flux is positive outgoing.
// For a hot solid radiating into a cold fluid Qr will be negative.
// Swap to obtain full local values of neighbour radiative heat flux
// field
mapDistribute::distribute
(
Pstream::defaultCommsType,
distMap.schedule(),
distMap.constructSize(),
distMap.subMap(), // what to send
distMap.constructMap(), // what to receive
nbrRadField
);
nbrTotalFlux -= nbrRadField;
const scalarField Twall =
(nbrRadField + myKDelta*intFld + nbrKDelta*nbrIntFld)
/(myKDelta + nbrKDelta);
if (debug)
{
scalar Qr = gSum(nbrRadField*patch().magSf());
Info<< patch().boundaryMesh().mesh().name() << ':'
<< patch().name() << ':'
<< this->dimensionedInternalField().name() << " :" << nl
<< " radiative heat [W] : " << Qr << nl
<< " predicted wallT [K] : " << gAverage(Twall) << nl
<< endl;
}
label nFixed = 0;
forAll(*this, i)
{
this->refValue()[i] = Twall[i];
this->refGrad()[i] = 0.0; // not used
this->valueFraction()[i] = 1.0;
nFixed++;
}
if (debug)
{
Pout<< "Using " << nFixed << " fixedValue out of " << this->size()
<< endl;
}
}
else if (mode == radFromMe) //fluid
{
const scalarField& myRadField =
patch().lookupPatchField<volScalarField, scalar>
(
fieldRadiativeName_
);
const scalarField Twall =
(myRadField + myKDelta*intFld + nbrKDelta*nbrIntFld)
/(myKDelta + nbrKDelta);
if (debug)
{
scalar Qr = gSum(myRadField*patch().magSf());
Info<< patch().boundaryMesh().mesh().name() << ':'
<< patch().name() << ':'
<< this->dimensionedInternalField().name() << " :" << nl
<< " radiative heat [W] : " << Qr << nl
<< " predicted wallT [K] : " << gAverage(Twall) << nl
<< endl;
}
this->refValue() = Twall;
this->refGrad() = 0.0; // not used
this->valueFraction() = 1.0;
}
else if (mode == noRad)
{
this->refValue() = nbrIntFld;
this->refGrad() = 0.0;
this->valueFraction() = nbrKDelta / (nbrKDelta + myKDelta);
}
else
{
FatalErrorIn
(
"turbulentTemperatureRadiationCoupledMixedSTFvPatchScalarField"
"::updateCoeffs()"
) << "Illegal mode " << operationModeNames[mode]
<< exit(FatalError);
}
mixedFvPatchScalarField::updateCoeffs();
if (debug)
{
scalar Qc = gSum(nbrConvFlux*patch().magSf());
scalar Qr = gSum(nbrRadField*patch().magSf());
scalar Qt = gSum(nbrTotalFlux*patch().magSf());
Info<< patch().boundaryMesh().mesh().name() << ':'
<< patch().name() << ':'
<< this->dimensionedInternalField().name() << " <- "
<< nbrMesh.name() << ':'
<< nbrPatch.name() << ':'
<< this->dimensionedInternalField().name() << " :" << nl
<< " convective heat[W] : " << Qc << nl
<< " radiative heat [W] : " << Qr << nl
<< " total heat [W] : " << Qt << nl
<< " walltemperature "
<< " min:" << gMin(*this)
<< " max:" << gMax(*this)
<< " avg:" << gAverage(*this)
<< endl;
}
}
void turbulentTemperatureRadiationCoupledMixedSTFvPatchScalarField::write
(
Ostream& os
) const
{
mixedFvPatchScalarField::write(os);
os.writeKeyword("neighbourFieldName")<< neighbourFieldName_
<< token::END_STATEMENT << nl;
os.writeKeyword("neighbourFieldRadiativeName")<<
neighbourFieldRadiativeName_ << token::END_STATEMENT << nl;
os.writeKeyword("fieldRadiativeName")<< fieldRadiativeName_
<< token::END_STATEMENT << nl;
os.writeKeyword("K") << KName_ << token::END_STATEMENT << nl;
// temperatureCoupledBase::write(os);
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
makePatchTypeField
(
fvPatchScalarField,
turbulentTemperatureRadiationCoupledMixedSTFvPatchScalarField
);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace compressible
} // End namespace Foam
// ************************************************************************* //

View File

@ -1,221 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / 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::
turbulentTemperatureRadiationCoupledMixedSTFvPatchScalarField
Description
Mixed boundary condition for temperature, to be used for heat-transfer
on back-to-back baffles.
If my temperature is T1, neighbour is T2:
T1 > T2: my side becomes fixedValue T2 bc, other side becomes fixedGradient.
Example usage:
myInterfacePatchName
{
type compressible::turbulentTemperatureRadiationCoupledMixedST;
neighbourFieldName T;
K lookup;
KName K;
neighbourFieldRadiativeName Qr; // or none. Use on solid side
fieldRadiativeName Qr; // fluid. Use on fluid side
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.
Note: lags interface data so both sides use same data.
- problem: schedule to calculate average would interfere
with standard processor swaps.
- so: updateCoeffs sets both to same Twall. Only need to do
this for last outer iteration but don't have access to this.
SourceFiles
turbulentTemperatureRadiationCoupledMixedSTFvPatchScalarField.C
\*---------------------------------------------------------------------------*/
#ifndef turbulentTemperatureRadiationCoupledMixedSTFvPatchScalarField_H
#define turbulentTemperatureRadiationCoupledMixedSTFvPatchScalarField_H
#include "mixedFvPatchFields.H"
//#include "temperatureCoupledBase.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace compressible
{
/*---------------------------------------------------------------------------*\
Class turbulentTemperatureRadiationCoupledMixedSTFvPatchScalarField
Declaration
\*---------------------------------------------------------------------------*/
class turbulentTemperatureRadiationCoupledMixedSTFvPatchScalarField
:
public mixedFvPatchScalarField
// public temperatureCoupledBase
{
// Private data
//- Name of field on the neighbour region
const word neighbourFieldName_;
//- Name of the radiative heat flux in the neighbout region
const word neighbourFieldRadiativeName_;
//- Name of the radiative heat flux in the my region
const word fieldRadiativeName_;
//- Name of thermal conductivity field
const word KName_;
//- how to obtain radiative flux
enum operationMode
{
radFromNeighbour,
radFromMe,
noRad,
unknown
};
static const NamedEnum<operationMode, 4> operationModeNames;
//- Previous iteration mode
operationMode oldMode_;
public:
//- Runtime type information
TypeName("compressible::turbulentTemperatureRadiationCoupledMixedST");
// Constructors
//- Construct from patch and internal field
turbulentTemperatureRadiationCoupledMixedSTFvPatchScalarField
(
const fvPatch&,
const DimensionedField<scalar, volMesh>&
);
//- Construct from patch, internal field and dictionary
turbulentTemperatureRadiationCoupledMixedSTFvPatchScalarField
(
const fvPatch&,
const DimensionedField<scalar, volMesh>&,
const dictionary&
);
//- Construct by mapping given
// turbulentTemperatureCoupledBaffleMixedFvPatchScalarField onto a
// new patch
turbulentTemperatureRadiationCoupledMixedSTFvPatchScalarField
(
const
turbulentTemperatureRadiationCoupledMixedSTFvPatchScalarField&,
const fvPatch&,
const DimensionedField<scalar, volMesh>&,
const fvPatchFieldMapper&
);
//- Construct and return a clone
virtual tmp<fvPatchScalarField> clone() const
{
return tmp<fvPatchScalarField>
(
new
turbulentTemperatureRadiationCoupledMixedSTFvPatchScalarField
(
*this
)
);
}
//- Construct as copy setting internal field reference
turbulentTemperatureRadiationCoupledMixedSTFvPatchScalarField
(
const
turbulentTemperatureRadiationCoupledMixedSTFvPatchScalarField&,
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
turbulentTemperatureRadiationCoupledMixedSTFvPatchScalarField
(
*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
// ************************************************************************* //

View File

@ -1,5 +1,4 @@
derivedFvPatchFields/filmPyrolysisVelocityCoupled/filmPyrolysisVelocityCoupledFvPatchVectorField.C
derivedFvPatchFields/filmPyrolysisTemperatureCoupled/filmPyrolysisTemperatureCoupledFvPatchScalarField.C
LIB = $(FOAM_LIBBIN)/libregionCoupling

View File

@ -8,6 +8,7 @@ EXE_INC = \
-I$(LIB_SRC)/thermophysicalModels/solid/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/basicSolidThermo/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/solidChemistryModel/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/radiationModels/lnInclude \
-I$(LIB_SRC)/turbulenceModels \
-I$(LIB_SRC)/turbulenceModels/compressible/turbulenceModel/lnInclude \
-I$(LIB_SRC)/turbulenceModels/compressible/RAS/lnInclude \

View File

@ -7,5 +7,7 @@ derivedFvPatchFields/turbulentTemperatureCoupledBaffle/turbulentTemperatureCoupl
derivedFvPatchFields/turbulentTemperatureCoupledBaffleMixed/turbulentTemperatureCoupledBaffleMixedFvPatchScalarField.C
derivedFvPatchFields/turbulentTemperatureCoupledBaffle/regionProperties.C
derivedFvPatchFields/temperatureThermoBaffle1D/temperatureThermoBaffle1DFvPatchScalarFields.C
derivedFvPatchFields/totalFlowRateAdvectiveDiffusive/totalFlowRateAdvectiveDiffusiveFvPatchScalarField.C
derivedFvPatchFields/turbulentTemperatureRadCoupledMixed/turbulentTemperatureRadCoupledMixedFvPatchScalarField.C
LIB = $(FOAM_LIBBIN)/libcompressibleTurbulenceModel

View File

@ -13,5 +13,6 @@ LIB_LIBS = \
-lspecie \
-lfiniteVolume \
-lmeshTools \
-lsolid
-lsolid \
-lradiationModels

View File

@ -29,7 +29,7 @@ License
#include "volFields.H"
#include "surfaceFields.H"
#include "IOobjectList.H"
#include "LESModel.H"
#include "turbulenceModel.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
@ -149,10 +149,10 @@ void Foam::totalFlowRateAdvectiveDiffusiveFvPatchScalarField::updateCoeffs()
const label patchI = patch().index();
const compressible::LESModel& turbulence =
db().lookupObject<compressible::LESModel>
const compressible::turbulenceModel& turbulence =
db().lookupObject<compressible::turbulenceModel>
(
"LESProperties"
"turbulenceModel"
);
const fvsPatchField<scalar>& phip =
@ -175,7 +175,7 @@ void Foam::totalFlowRateAdvectiveDiffusiveFvPatchScalarField::updateCoeffs()
if (debug)
{
scalar phi = gSum(-phip*(*this));// + alphap*snGrad());
scalar phi = gSum(-phip*(*this));
Info<< patch().boundaryMesh().mesh().name() << ':'
<< patch().name() << ':'

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2010-2011 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2011-2011 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -179,8 +179,6 @@ public:
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,234 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / 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 "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];
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);
// Swap to obtain full local values of neighbour K*delta
scalarField KDeltaNbr(nbrField.K(TcNbr)*nbrPatch.deltaCoeffs());
mpp.map().distribute(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_);
mpp.map().distribute(QrNbr);
}
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

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2010-2011 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2011-2011 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -22,51 +22,48 @@ License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::compressible::LESModels
turbulentTemperatureCoupledBaffleMixedFvPatchScalarField2
Foam::
compressible::
turbulentTemperatureRadCoupledMixedFvPatchScalarField
Description
Mixed boundary condition for temperature, to be used for heat-transfer
on back-to-back baffles.
If my temperature is T1, neighbour is T2:
T1 > T2: my side becomes fixedValue T2 bc, other side becomes fixedGradient.
Mixed boundary condition for temperature and radiation heat transfer
to be used for in multiregion cases
Example usage:
myInterfacePatchName
{
type compressible::turbulentTemperatureCoupledBaffleMixed;
nbrFieldName T;
K K; // or none
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: if K is "none" looks up RASModel and basicThermo, otherwise expects
the solver to calculate a 'K' field.
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.
Note: lags interface data so both sides use same data.
- problem: schedule to calculate average would interfere
with standard processor swaps.
- so: updateCoeffs sets both to same Twall. Only need to do
this for last outer iteration but don't have access to this.
SourceFiles
turbulentTemperatureCoupledBaffleMixedFvPatchScalarField2.C
turbulentTemperatureRadCoupledMixedFvPatchScalarField.C
\*---------------------------------------------------------------------------*/
#ifndef turbulentTemperatureCoupledBaffleMixedFvPatchScalarField2_H
#define turbulentTemperatureCoupledBaffleMixedFvPatchScalarField2_H
#ifndef turbulentTemperatureRadCoupledMixedFvPatchScalarField_H
#define turbulentTemperatureRadCoupledMixedFvPatchScalarField_H
#include "mixedFvPatchFields.H"
#include "temperatureCoupledBase.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -74,43 +71,45 @@ namespace Foam
{
namespace compressible
{
namespace LESModels
{
/*---------------------------------------------------------------------------*\
Class turbulentTemperatureCoupledBaffleMixedFvPatchScalarField2 Declaration
Class turbulentTemperatureRadCoupledMixedFvPatchScalarField Declaration
\*---------------------------------------------------------------------------*/
class turbulentTemperatureCoupledBaffleMixedFvPatchScalarField2
class turbulentTemperatureRadCoupledMixedFvPatchScalarField
:
public mixedFvPatchScalarField
public mixedFvPatchScalarField,
public temperatureCoupledBase
{
// Private data
//- Name of field on the neighbour region
const word nbrFieldName_;
const word TnbrName_;
//- Name of thermal conductivity field
const word KName_;
//- 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::turbulentTemperatureCoupledBaffleMixed2");
TypeName("compressible::turbulentTemperatureRadCoupledMixed");
// Constructors
//- Construct from patch and internal field
turbulentTemperatureCoupledBaffleMixedFvPatchScalarField2
turbulentTemperatureRadCoupledMixedFvPatchScalarField
(
const fvPatch&,
const DimensionedField<scalar, volMesh>&
);
//- Construct from patch, internal field and dictionary
turbulentTemperatureCoupledBaffleMixedFvPatchScalarField2
turbulentTemperatureRadCoupledMixedFvPatchScalarField
(
const fvPatch&,
const DimensionedField<scalar, volMesh>&,
@ -118,11 +117,12 @@ public:
);
//- Construct by mapping given
// turbulentTemperatureCoupledBaffleMixedFvPatchScalarField2 onto a
// turbulentTemperatureCoupledBaffleMixedFvPatchScalarField onto a
// new patch
turbulentTemperatureCoupledBaffleMixedFvPatchScalarField2
turbulentTemperatureRadCoupledMixedFvPatchScalarField
(
const turbulentTemperatureCoupledBaffleMixedFvPatchScalarField2&,
const
turbulentTemperatureRadCoupledMixedFvPatchScalarField&,
const fvPatch&,
const DimensionedField<scalar, volMesh>&,
const fvPatchFieldMapper&
@ -133,7 +133,7 @@ public:
{
return tmp<fvPatchScalarField>
(
new turbulentTemperatureCoupledBaffleMixedFvPatchScalarField2
new turbulentTemperatureRadCoupledMixedFvPatchScalarField
(
*this
)
@ -141,9 +141,9 @@ public:
}
//- Construct as copy setting internal field reference
turbulentTemperatureCoupledBaffleMixedFvPatchScalarField2
turbulentTemperatureRadCoupledMixedFvPatchScalarField
(
const turbulentTemperatureCoupledBaffleMixedFvPatchScalarField2&,
const turbulentTemperatureRadCoupledMixedFvPatchScalarField&,
const DimensionedField<scalar, volMesh>&
);
@ -155,7 +155,7 @@ public:
{
return tmp<fvPatchScalarField>
(
new turbulentTemperatureCoupledBaffleMixedFvPatchScalarField2
new turbulentTemperatureRadCoupledMixedFvPatchScalarField
(
*this,
iF
@ -166,9 +166,6 @@ public:
// Member functions
//- Get corresponding K field
tmp<scalarField> K() const;
//- Update the coefficients associated with the patch field
virtual void updateCoeffs();
@ -179,7 +176,6 @@ public:
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace LESModels
} // End namespace compressible
} // End namespace Foam