Merge branch 'master' of /home/noisy3/OpenFOAM/OpenFOAM-dev

This commit is contained in:
andy
2011-06-06 11:09:34 +01:00
29 changed files with 178 additions and 1427 deletions

View File

@ -1,5 +1,5 @@
EXE_INC = \
-I./combustionModels/lnInclude \
-IcombustionModels/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/specie/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/reactionThermo/lnInclude \

View File

@ -7,15 +7,18 @@ fvVectorMatrix UEqn
UEqn.relax();
solve
(
UEqn
==
fvc::reconstruct
if (pimple.momentumPredictor())
{
solve
(
UEqn
==
fvc::reconstruct
(
- ghf*fvc::snGrad(rho)
- fvc::snGrad(p_rgh)
)*mesh.magSf()
)
);
(
- ghf*fvc::snGrad(rho)
- fvc::snGrad(p_rgh)
)*mesh.magSf()
)
);
}

View File

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

View File

@ -202,7 +202,7 @@ void Foam::externalWallHeatFluxTemperatureFvPatchScalarField::updateCoeffs()
return;
}
if(oldMode_ == fixedHeatFlux)
if (oldMode_ == fixedHeatFlux)
{
this->refGrad() = q_/K(*this);
this->refValue() = 0.0;

View File

@ -54,8 +54,6 @@ SourceFiles
#ifndef solidWallHeatFluxTemperatureFvPatchScalarField_H
#define solidWallHeatFluxTemperatureFvPatchScalarField_H
//#include "fixedGradientFvPatchFields.H"
#include "mixedFvPatchFields.H"
#include "temperatureCoupledBase.H"

View File

@ -21,7 +21,7 @@ tmp<fv::convectionScheme<scalar> > mvConvection
volScalarField& Yi = Y[i];
fvScalarMatrix R = combustion->R(Yi);
solve
fvScalarMatrix YiEqn
(
fvm::ddt(rho, Yi)
+ mvConvection->fvmDiv(phi, Yi)
@ -29,10 +29,12 @@ tmp<fv::convectionScheme<scalar> > mvConvection
==
parcels.SYi(i, Yi)
+ surfaceFilm.Srho(i)
+ R,
mesh.solver("Yi")
+ R
);
YiEqn.relax();
YiEqn.solve(mesh.solver("Yi"));
Yi.max(0.0);
Yt += Yi;
}

View File

@ -25,7 +25,7 @@ Application
reactingParcelFilmPyrolysisFoam
Description
Transient PISO solver for compressible, laminar or turbulent flow with
Transient PIMPLE solver for Fires and turbulent diffusion flames with
reacting Lagrangian parcels, surface film and pyrolysis modelling.
\*---------------------------------------------------------------------------*/

View File

@ -1302,13 +1302,32 @@ int main(int argc, char *argv[])
if (oneD)
{
// Reuse single empty patch.
word patchName = "oneDWedgePatch";
zoneSidePatch[zoneI] = addPatch<wedgePolyPatch>
(
mesh,
patchName
);
word patchType = dict.lookup("oneDPolyPatchType");
word patchName;
if (patchType == "emptyPolyPatch")
{
patchName = "oneDEmptyPatch";
zoneSidePatch[zoneI] = addPatch<emptyPolyPatch>
(
mesh,
patchName
);
}
else if (patchType == "wedgePolyPatch")
{
patchName = "oneDWedgePatch";
zoneSidePatch[zoneI] = addPatch<wedgePolyPatch>
(
mesh,
patchName
);
}
else
{
FatalErrorIn(args.executable())
<< "Type " << patchType << " does not exist "
<< exit(FatalError);
}
Info<< zoneSidePatch[zoneI] << '\t' << patchName << nl;
@ -1427,6 +1446,10 @@ int main(int argc, char *argv[])
{
ePatches[i] = zoneSidePatch[zoneID[eFaces[i]]];
}
if (eFaces.size() != 2)
{
nonManifoldEdge[edgeI] = 1;
}
}
else if (eFaces.size() == 2)
{

View File

@ -61,7 +61,14 @@ runParallel()
nProcs=$1
shift
echo "Running $APP_RUN in parallel on $PWD using $nProcs processes"
( mpirun -np $nProcs $APP_RUN -parallel $* < /dev/null > log.$APP_NAME 2>&1 )
if [ "$WM_SCHEDULER" ]
then
echo "$PWD: $WM_SCHEDULER -np $nProcs" 1>&2
$WM_SCHEDULER -np $nProcs "( mpirun -np $nProcs $APP_RUN -parallel $* < /dev/null > log.$APP_NAME 2>&1 )"
else
( mpirun -np $nProcs $APP_RUN -parallel $* < /dev/null > log.$APP_NAME 2>&1 )
fi
fi
}

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

@ -409,11 +409,32 @@ Foam::label Foam::scotchDecomp::decomposeOneProc
<< exit(FatalError);
}
scalar velotabSum = sum(cWeights)/minWeights;
scalar rangeScale(1.0);
if (velotabSum > scalar(INT_MAX - 1))
{
// 0.9 factor of safety to avoid floating point round-off in
// rangeScale tipping the subsequent sum over the integer limit.
rangeScale = 0.9*scalar(INT_MAX - 1)/velotabSum;
WarningIn
(
"scotchDecomp::decompose"
"(const pointField&, const scalarField&)"
) << "Sum of weights has overflowed integer: " << velotabSum
<< ", compressing weight scale by a factor of " << rangeScale
<< endl;
}
// Convert to integers.
velotab.setSize(cWeights.size());
forAll(velotab, i)
{
velotab[i] = int(cWeights[i]/minWeights);
velotab[i] =
int((cWeights[i]/minWeights - 1)*rangeScale) + 1;
}
}

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,190 +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::LESModels
turbulentTemperatureCoupledBaffleMixedFvPatchScalarField2
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::turbulentTemperatureCoupledBaffleMixed;
nbrFieldName T;
K K; // or none
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: 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
\*---------------------------------------------------------------------------*/
#ifndef turbulentTemperatureCoupledBaffleMixedFvPatchScalarField2_H
#define turbulentTemperatureCoupledBaffleMixedFvPatchScalarField2_H
#include "mixedFvPatchFields.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace compressible
{
namespace LESModels
{
/*---------------------------------------------------------------------------*\
Class turbulentTemperatureCoupledBaffleMixedFvPatchScalarField2 Declaration
\*---------------------------------------------------------------------------*/
class turbulentTemperatureCoupledBaffleMixedFvPatchScalarField2
:
public mixedFvPatchScalarField
{
// Private data
//- Name of field on the neighbour region
const word nbrFieldName_;
//- Name of thermal conductivity field
const word KName_;
public:
//- Runtime type information
TypeName("compressible::turbulentTemperatureCoupledBaffleMixed2");
// Constructors
//- Construct from patch and internal field
turbulentTemperatureCoupledBaffleMixedFvPatchScalarField2
(
const fvPatch&,
const DimensionedField<scalar, volMesh>&
);
//- Construct from patch, internal field and dictionary
turbulentTemperatureCoupledBaffleMixedFvPatchScalarField2
(
const fvPatch&,
const DimensionedField<scalar, volMesh>&,
const dictionary&
);
//- Construct by mapping given
// turbulentTemperatureCoupledBaffleMixedFvPatchScalarField2 onto a
// new patch
turbulentTemperatureCoupledBaffleMixedFvPatchScalarField2
(
const turbulentTemperatureCoupledBaffleMixedFvPatchScalarField2&,
const fvPatch&,
const DimensionedField<scalar, volMesh>&,
const fvPatchFieldMapper&
);
//- Construct and return a clone
virtual tmp<fvPatchScalarField> clone() const
{
return tmp<fvPatchScalarField>
(
new turbulentTemperatureCoupledBaffleMixedFvPatchScalarField2
(
*this
)
);
}
//- Construct as copy setting internal field reference
turbulentTemperatureCoupledBaffleMixedFvPatchScalarField2
(
const turbulentTemperatureCoupledBaffleMixedFvPatchScalarField2&,
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 turbulentTemperatureCoupledBaffleMixedFvPatchScalarField2
(
*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 LESModels
} // End namespace compressible
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

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

@ -10,6 +10,6 @@ EXE_INC = \
LIB_LIBS = \
-chemistryModel \
-lchemistryModel \
-lfiniteVolume \
-lODE

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

@ -16,47 +16,49 @@ FoamFile
convertToMeters 1;
vertices
(
(0.5 0 -0.5)
(1 0 -0.5)
(2 0 -0.5)
(2 0.707107 -0.5)
(0.707107 0.707107 -0.5)
(0.353553 0.353553 -0.5)
(2 2 -0.5)
(0.707107 2 -0.5)
(0 2 -0.5)
(0 1 -0.5)
(0 0.5 -0.5)
(-0.5 0 -0.5)
(-1 0 -0.5)
(-2 0 -0.5)
(-2 0.707107 -0.5)
(-0.707107 0.707107 -0.5)
(-0.353553 0.353553 -0.5)
(-2 2 -0.5)
(-0.707107 2 -0.5)
(0.5 0 0.5)
(1 0 0.5)
(2 0 0.5)
(2 0.707107 0.5)
(0.707107 0.707107 0.5)
(0.353553 0.353553 0.5)
(2 2 0.5)
(0.707107 2 0.5)
(0 2 0.5)
(0 1 0.5)
(0 0.5 0.5)
(-0.5 0 0.5)
(-1 0 0.5)
(-2 0 0.5)
(-2 0.707107 0.5)
(-0.707107 0.707107 0.5)
(-0.353553 0.353553 0.5)
(-2 2 0.5)
(-0.707107 2 0.5)
);
vertices #codeStream
{
codeInclude
#{
#include "pointField.H"
#};
code
#{
pointField points(19);
points[0] = point(0.5, 0, -0.5);
points[1] = point(1, 0, -0.5);
points[2] = point(2, 0, -0.5);
points[3] = point(2, 0.707107, -0.5);
points[4] = point(0.707107, 0.707107, -0.5);
points[5] = point(0.353553, 0.353553, -0.5);
points[6] = point(2, 2, -0.5);
points[7] = point(0.707107, 2, -0.5);
points[8] = point(0, 2, -0.5);
points[9] = point(0, 1, -0.5);
points[10] = point(0, 0.5, -0.5);
points[11] = point(-0.5, 0, -0.5);
points[12] = point(-1, 0, -0.5);
points[13] = point(-2, 0, -0.5);
points[14] = point(-2, 0.707107, -0.5);
points[15] = point(-0.707107, 0.707107, -0.5);
points[16] = point(-0.353553, 0.353553, -0.5);
points[17] = point(-2, 2, -0.5);
points[18] = point(-0.707107, 2, -0.5);
// Duplicate z points
label sz = points.size();
points.setSize(2*sz);
for (label i = 0; i < sz; i++)
{
const point& pt = points[i];
points[i+sz] = point(pt.x(), pt.y(), -pt.z());
}
os << points;
#};
};
blocks
(

View File

@ -49,8 +49,10 @@ functions
{
difference
{
// Load the library containing the 'coded' functionObject
functionObjectLibs ("libutilityFunctionObjects.so");
type coded;
// Name of on-the-fly generated functionObject
redirectType error;
code
#{