mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
Merge branch 'develop' of develop.openfoam.com:Development/OpenFOAM-plus into develop
This commit is contained in:
@ -512,7 +512,7 @@ bool Foam::functionObjects::streamLineBase::read(const dictionary& dict)
|
||||
Info<< type() << " " << name() << ":" << nl;
|
||||
|
||||
dict.lookup("fields") >> fields_;
|
||||
dict.lookup("U") >> UName_;
|
||||
UName_ = dict.lookupOrDefault<word>("U", "U");
|
||||
|
||||
if (findIndex(fields_, UName_) == -1)
|
||||
{
|
||||
|
||||
@ -2,8 +2,8 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2013-2016 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
\\ / A nd | Copyright (C) 2013-2015 OpenFOAM Foundation
|
||||
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -52,7 +52,18 @@ namespace fv
|
||||
|
||||
void Foam::fv::effectivenessHeatExchangerSource::initialise()
|
||||
{
|
||||
const faceZone& fZone = mesh_.faceZones()[zoneID_];
|
||||
const label zoneID = mesh_.faceZones().findZoneID(faceZoneName_);
|
||||
|
||||
if (zoneID < 0)
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< type() << " " << this->name() << ": "
|
||||
<< " Unknown face zone name: " << faceZoneName_
|
||||
<< ". Valid face zones are: " << mesh_.faceZones().names()
|
||||
<< nl << exit(FatalError);
|
||||
}
|
||||
|
||||
const faceZone& fZone = mesh_.faceZones()[zoneID];
|
||||
|
||||
faceId_.setSize(fZone.size());
|
||||
facePatchId_.setSize(fZone.size());
|
||||
@ -113,31 +124,6 @@ void Foam::fv::effectivenessHeatExchangerSource::initialise()
|
||||
faceId_.setSize(count);
|
||||
facePatchId_.setSize(count);
|
||||
faceSign_.setSize(count);
|
||||
|
||||
calculateTotalArea(faceZoneArea_);
|
||||
}
|
||||
|
||||
|
||||
void Foam::fv::effectivenessHeatExchangerSource::calculateTotalArea
|
||||
(
|
||||
scalar& area
|
||||
)
|
||||
{
|
||||
area = 0;
|
||||
forAll(faceId_, i)
|
||||
{
|
||||
label facei = faceId_[i];
|
||||
if (facePatchId_[i] != -1)
|
||||
{
|
||||
label patchi = facePatchId_[i];
|
||||
area += mesh_.magSf().boundaryField()[patchi][facei];
|
||||
}
|
||||
else
|
||||
{
|
||||
area += mesh_.magSf()[facei];
|
||||
}
|
||||
}
|
||||
reduce(area, sumOp<scalar>());
|
||||
}
|
||||
|
||||
|
||||
@ -152,28 +138,20 @@ Foam::fv::effectivenessHeatExchangerSource::effectivenessHeatExchangerSource
|
||||
)
|
||||
:
|
||||
cellSetOption(name, modelType, dict, mesh),
|
||||
secondaryMassFlowRate_(readScalar(coeffs_.lookup("secondaryMassFlowRate"))),
|
||||
secondaryInletT_(readScalar(coeffs_.lookup("secondaryInletT"))),
|
||||
primaryInletT_(readScalar(coeffs_.lookup("primaryInletT"))),
|
||||
secondaryMassFlowRate_(0),
|
||||
secondaryInletT_(0),
|
||||
primaryInletT_(0),
|
||||
userPrimaryInletT_(false),
|
||||
eTable_(),
|
||||
UName_(coeffs_.lookupOrDefault<word>("U", "U")),
|
||||
TName_(coeffs_.lookupOrDefault<word>("T", "T")),
|
||||
phiName_(coeffs_.lookupOrDefault<word>("phi", "phi")),
|
||||
faceZoneName_(coeffs_.lookup("faceZone")),
|
||||
zoneID_(mesh_.faceZones().findZoneID(faceZoneName_)),
|
||||
UName_("U"),
|
||||
TName_("T"),
|
||||
phiName_("phi"),
|
||||
faceZoneName_("unknown-faceZone"),
|
||||
faceId_(),
|
||||
facePatchId_(),
|
||||
faceSign_(),
|
||||
faceZoneArea_(0)
|
||||
faceSign_()
|
||||
{
|
||||
if (zoneID_ < 0)
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< type() << " " << this->name() << ": "
|
||||
<< " Unknown face zone name: " << faceZoneName_
|
||||
<< ". Valid face zones are: " << mesh_.faceZones().names()
|
||||
<< nl << exit(FatalError);
|
||||
}
|
||||
read(dict);
|
||||
|
||||
// Set the field name to that of the energy field from which the temperature
|
||||
// is obtained
|
||||
@ -208,35 +186,61 @@ void Foam::fv::effectivenessHeatExchangerSource::addSup
|
||||
const surfaceScalarField& phi =
|
||||
mesh_.lookupObject<surfaceScalarField>(phiName_);
|
||||
|
||||
scalar totalphi = 0;
|
||||
const volScalarField& T = mesh_.lookupObject<volScalarField>(TName_);
|
||||
const surfaceScalarField Tf(fvc::interpolate(T));
|
||||
|
||||
scalar sumPhi = 0;
|
||||
scalar sumMagPhi = 0;
|
||||
scalar CpfMean = 0;
|
||||
scalar primaryInletTfMean = 0;
|
||||
forAll(faceId_, i)
|
||||
{
|
||||
label facei = faceId_[i];
|
||||
if (facePatchId_[i] != -1)
|
||||
{
|
||||
label patchi = facePatchId_[i];
|
||||
totalphi += phi.boundaryField()[patchi][facei]*faceSign_[i];
|
||||
scalar phii = phi.boundaryField()[patchi][facei]*faceSign_[i];
|
||||
|
||||
CpfMean +=
|
||||
Cpf.boundaryField()[patchi][facei]
|
||||
*mesh_.magSf().boundaryField()[patchi][facei];
|
||||
sumPhi += phii;
|
||||
|
||||
scalar Cpfi = Cpf.boundaryField()[patchi][facei];
|
||||
scalar Tfi = Tf.boundaryField()[patchi][facei];
|
||||
scalar magPhii = mag(phii);
|
||||
|
||||
sumMagPhi += magPhii;
|
||||
CpfMean += Cpfi*magPhii;
|
||||
primaryInletTfMean += Tfi*magPhii;
|
||||
}
|
||||
else
|
||||
{
|
||||
totalphi += phi[facei]*faceSign_[i];
|
||||
CpfMean += Cpf[facei]*mesh_.magSf()[facei];
|
||||
scalar phii = phi[facei]*faceSign_[i];
|
||||
scalar magPhii = mag(phii);
|
||||
|
||||
sumPhi += phii;
|
||||
sumMagPhi += magPhii;
|
||||
CpfMean += Cpf[facei]*magPhii;
|
||||
primaryInletTfMean += Tf[facei]*magPhii;
|
||||
}
|
||||
}
|
||||
reduce(CpfMean, sumOp<scalar>());
|
||||
reduce(totalphi, sumOp<scalar>());
|
||||
reduce(sumPhi, sumOp<scalar>());
|
||||
reduce(sumMagPhi, sumOp<scalar>());
|
||||
reduce(primaryInletTfMean, sumOp<scalar>());
|
||||
|
||||
primaryInletTfMean /= sumMagPhi;
|
||||
CpfMean /= sumMagPhi;
|
||||
|
||||
scalar primaryInletT = primaryInletT_;
|
||||
if (!userPrimaryInletT_)
|
||||
{
|
||||
primaryInletT = primaryInletTfMean;
|
||||
}
|
||||
|
||||
scalar Qt =
|
||||
eTable_()(mag(totalphi), secondaryMassFlowRate_)
|
||||
*(secondaryInletT_ - primaryInletT_)
|
||||
*(CpfMean/faceZoneArea_)*mag(totalphi);
|
||||
eTable_()(mag(sumPhi), secondaryMassFlowRate_)
|
||||
*(secondaryInletT_ - primaryInletT)
|
||||
*CpfMean*mag(sumPhi);
|
||||
|
||||
const volScalarField& T = mesh_.lookupObject<volScalarField>(TName_);
|
||||
const scalarField TCells(T, cells_);
|
||||
scalar Tref = 0;
|
||||
if (Qt > 0)
|
||||
@ -268,7 +272,8 @@ void Foam::fv::effectivenessHeatExchangerSource::addSup
|
||||
scalar sumWeight = 0;
|
||||
forAll(cells_, i)
|
||||
{
|
||||
sumWeight += V[cells_[i]]*mag(U[cells_[i]])*deltaTCells[i];
|
||||
label celli = cells_[i];
|
||||
sumWeight += V[celli]*mag(U[celli])*deltaTCells[i];
|
||||
}
|
||||
reduce(sumWeight, sumOp<scalar>());
|
||||
|
||||
@ -278,18 +283,19 @@ void Foam::fv::effectivenessHeatExchangerSource::addSup
|
||||
|
||||
forAll(cells_, i)
|
||||
{
|
||||
heSource[cells_[i]] -=
|
||||
Qt*V[cells_[i]]*mag(U[cells_[i]])*deltaTCells[i]/sumWeight;
|
||||
label celli = cells_[i];
|
||||
heSource[celli] -=
|
||||
Qt*V[celli]*mag(U[celli])*deltaTCells[i]/sumWeight;
|
||||
}
|
||||
}
|
||||
|
||||
if (debug && Pstream::master())
|
||||
{
|
||||
Info<< indent << "Net mass flux [Kg/s] = " << totalphi << nl;
|
||||
Info<< indent << "Total energy exchange [W] = " << Qt << nl;
|
||||
Info<< indent << "Tref [K] = " << Tref << nl;
|
||||
Info<< indent << "Efficiency : "
|
||||
<< eTable_()(mag(totalphi), secondaryMassFlowRate_) << endl;
|
||||
Info<< indent << "Net mass flux [Kg/s] : " << sumPhi << nl;
|
||||
Info<< indent << "Total energy exchange [W] : " << Qt << nl;
|
||||
Info<< indent << "Tref [K] : " << Tref << nl;
|
||||
Info<< indent << "Efficiency : "
|
||||
<< eTable_()(mag(sumPhi), secondaryMassFlowRate_) << endl;
|
||||
}
|
||||
}
|
||||
|
||||
@ -298,9 +304,28 @@ bool Foam::fv::effectivenessHeatExchangerSource::read(const dictionary& dict)
|
||||
{
|
||||
if (cellSetOption::read(dict))
|
||||
{
|
||||
UName_ = coeffs_.lookupOrDefault<word>("UName", "U");
|
||||
TName_ = coeffs_.lookupOrDefault<word>("TName", "T");
|
||||
phiName_ = coeffs_.lookupOrDefault<word>("phiName", "phi");
|
||||
coeffs_.lookup("faceZone") >> faceZoneName_;
|
||||
|
||||
coeffs_.lookup("secondaryMassFlowRate") >> secondaryMassFlowRate_;
|
||||
coeffs_.lookup("secondaryInletT") >> secondaryInletT_;
|
||||
coeffs_.lookup("primaryInletT") >> primaryInletT_;
|
||||
|
||||
if (coeffs_.readIfPresent("primaryInletT", primaryInletT_))
|
||||
{
|
||||
Info<< type() << " " << this->name() << ": "
|
||||
<< "employing user-specified primary flow inlet temperature: "
|
||||
<< primaryInletT_ << endl;
|
||||
|
||||
userPrimaryInletT_ = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
Info<< type() << " " << this->name() << ": "
|
||||
<< "employing flux-weighted primary flow inlet temperature"
|
||||
<< endl;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2013-2016 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -77,7 +77,7 @@ Usage
|
||||
|
||||
secondaryMassFlowRate 1.0;
|
||||
secondaryInletT 336;
|
||||
primaryInletT 293;
|
||||
// primaryInletT 293; // Constrain to this T if present
|
||||
faceZone facesZoneInletOriented;
|
||||
outOfBounds clamp;
|
||||
fileName "effTable";
|
||||
@ -88,16 +88,19 @@ Usage
|
||||
The effectiveness table is described in terms of the primary and secondary
|
||||
mass flow rates. For example, the table:
|
||||
|
||||
\verbatim
|
||||
secondary MFR
|
||||
| 0.1 0.2 0.3
|
||||
-----+-----------------
|
||||
0.02 | A B C
|
||||
primary MFR 0.04 | D E F
|
||||
0.06 | G H I
|
||||
\endverbatim
|
||||
|
||||
|
||||
Is specified by the following:
|
||||
|
||||
\verbatim
|
||||
(
|
||||
0.02
|
||||
(
|
||||
@ -118,7 +121,7 @@ Usage
|
||||
(0.3 I)
|
||||
)
|
||||
);
|
||||
|
||||
\endverbatim
|
||||
|
||||
Note
|
||||
- the table with name "fileName" should have the same units as the
|
||||
@ -169,6 +172,9 @@ protected:
|
||||
//- Primary air temperature at the heat exchanger inlet [K]
|
||||
scalar primaryInletT_;
|
||||
|
||||
//- Flag to use a user-specified primary inlet temperature
|
||||
bool userPrimaryInletT_;
|
||||
|
||||
//- 2D look up table efficiency = function of primary and secondary
|
||||
// mass flow rates [kg/s]
|
||||
autoPtr<interpolation2DTable<scalar>> eTable_;
|
||||
@ -185,9 +191,6 @@ protected:
|
||||
//- Name of the faceZone at the heat exchange inlet
|
||||
word faceZoneName_;
|
||||
|
||||
//- Id for the face zone
|
||||
label zoneID_;
|
||||
|
||||
//- Local list of face IDs
|
||||
labelList faceId_;
|
||||
|
||||
@ -197,9 +200,6 @@ protected:
|
||||
//- List of +1/-1 representing face flip map (1 use as is, -1 negate)
|
||||
labelList faceSign_;
|
||||
|
||||
//- Area of the face zone
|
||||
scalar faceZoneArea_;
|
||||
|
||||
|
||||
private:
|
||||
|
||||
|
||||
@ -1,33 +0,0 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: plus |
|
||||
| \\ / A nd | Web: www.OpenFOAM.com |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
FoamFile
|
||||
{
|
||||
version 2.0;
|
||||
format ascii;
|
||||
class dictionary;
|
||||
location "constant";
|
||||
object boundaryRadiationProperties;
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
|
||||
region0_to_pyrolysisRegion_coupledWall
|
||||
{
|
||||
mode solidRadiation;
|
||||
}
|
||||
|
||||
".*"
|
||||
{
|
||||
mode lookup;
|
||||
emissivity 1.0;
|
||||
absorptivity 1.0;
|
||||
transmissivity 0.0;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1,33 +0,0 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: plus |
|
||||
| \\ / A nd | Web: www.OpenFOAM.com |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
FoamFile
|
||||
{
|
||||
version 2.0;
|
||||
format ascii;
|
||||
class dictionary;
|
||||
location "constant";
|
||||
object boundaryRadiationProperties;
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
|
||||
".*"
|
||||
{
|
||||
type boundaryRadiation;
|
||||
mode lookup;
|
||||
emissivity 1.0;
|
||||
}
|
||||
|
||||
"(region0_to.*)"
|
||||
{
|
||||
type boundaryRadiation;
|
||||
mode solidRadiation;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user