mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: configurable output temperature for externalCoupled mixed T BC (#1072)
- Uses the user-specified value for outputTemperature:
{
type externalCoupledTemperature;
outputTemperture fluid; // or wall;
}
Otherwises uses 'wall' as a default (for compatibility) and emits a
warning.
The T.out header now reflects the type of output. Eg,
# Values: area Tfluid qDot htc
This commit is contained in:
@ -95,14 +95,6 @@ externalCoupledMixedFvPatchField
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
template<class Type>
|
||||
Foam::externalCoupledMixedFvPatchField<Type>::
|
||||
~externalCoupledMixedFvPatchField()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
template<class Type>
|
||||
|
||||
@ -146,19 +146,19 @@ public:
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~externalCoupledMixedFvPatchField();
|
||||
virtual ~externalCoupledMixedFvPatchField() = default;
|
||||
|
||||
|
||||
// Member functions
|
||||
|
||||
//- Write header
|
||||
virtual void writeHeader(Ostream&) const;
|
||||
virtual void writeHeader(Ostream& os) const;
|
||||
|
||||
//- Write data
|
||||
virtual void writeData(Ostream&) const;
|
||||
virtual void writeData(Ostream& os) const;
|
||||
|
||||
//- Read data
|
||||
virtual void readData(Istream&);
|
||||
virtual void readData(Istream& is);
|
||||
};
|
||||
|
||||
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2013-2016 OpenFOAM Foundation
|
||||
\\/ M anipulation | Copyright (C) 2017 OpenCFD Ltd.
|
||||
\\/ M anipulation | Copyright (C) 2017-2018 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -28,6 +28,21 @@ License
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
#include "fvPatchFieldMapper.H"
|
||||
#include "volFields.H"
|
||||
#include "Enum.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
const Foam::Enum
|
||||
<
|
||||
Foam::externalCoupledTemperatureMixedFvPatchScalarField::
|
||||
outputTemperatureType
|
||||
>
|
||||
Foam::externalCoupledTemperatureMixedFvPatchScalarField::outputTemperatureNames
|
||||
({
|
||||
{ outputTemperatureType::FLUID, "fluid" },
|
||||
{ outputTemperatureType::WALL, "wall" },
|
||||
});
|
||||
|
||||
|
||||
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
|
||||
|
||||
@ -36,7 +51,14 @@ void Foam::externalCoupledTemperatureMixedFvPatchScalarField::writeHeader
|
||||
Ostream& os
|
||||
) const
|
||||
{
|
||||
os << "# Values: magSf T qDot htc" << endl;
|
||||
if (outputTemperature_ == outputTemperatureType::FLUID)
|
||||
{
|
||||
os << "# Values: area Tfluid qDot htc" << endl;
|
||||
}
|
||||
else
|
||||
{
|
||||
os << "# Values: area Twall qDot htc" << endl;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -49,7 +71,8 @@ externalCoupledTemperatureMixedFvPatchScalarField
|
||||
const DimensionedField<scalar, volMesh>& iF
|
||||
)
|
||||
:
|
||||
externalCoupledMixedFvPatchField<scalar>(p, iF)
|
||||
externalCoupledMixedFvPatchField<scalar>(p, iF),
|
||||
outputTemperature_(outputTemperatureType::WALL)
|
||||
{}
|
||||
|
||||
|
||||
@ -62,7 +85,8 @@ externalCoupledTemperatureMixedFvPatchScalarField
|
||||
const fvPatchFieldMapper& mapper
|
||||
)
|
||||
:
|
||||
externalCoupledMixedFvPatchField<scalar>(ptf, p, iF, mapper)
|
||||
externalCoupledMixedFvPatchField<scalar>(ptf, p, iF, mapper),
|
||||
outputTemperature_(ptf.outputTemperature_)
|
||||
{}
|
||||
|
||||
|
||||
@ -75,8 +99,23 @@ externalCoupledTemperatureMixedFvPatchScalarField
|
||||
)
|
||||
:
|
||||
//externalCoupledMixedFvPatchField<scalar>(p, iF, dict)
|
||||
externalCoupledMixedFvPatchField<scalar>(p, iF)
|
||||
externalCoupledMixedFvPatchField<scalar>(p, iF),
|
||||
outputTemperature_(outputTemperatureType::WALL)
|
||||
{
|
||||
if (dict.found("outputTemperature"))
|
||||
{
|
||||
outputTemperature_ =
|
||||
outputTemperatureNames.get("outputTemperature", dict);
|
||||
}
|
||||
else
|
||||
{
|
||||
WarningInFunction
|
||||
<< "outputTemperature not specified "
|
||||
<< flatOutput(outputTemperatureNames) << nl
|
||||
<< "using 'wall' as compatibility default" << nl
|
||||
<< endl;
|
||||
}
|
||||
|
||||
if (dict.found("refValue"))
|
||||
{
|
||||
// Initialise same way as mixed
|
||||
@ -116,7 +155,8 @@ externalCoupledTemperatureMixedFvPatchScalarField
|
||||
const externalCoupledTemperatureMixedFvPatchScalarField& ecmpf
|
||||
)
|
||||
:
|
||||
externalCoupledMixedFvPatchField<scalar>(ecmpf)
|
||||
externalCoupledMixedFvPatchField<scalar>(ecmpf),
|
||||
outputTemperature_(ecmpf.outputTemperature_)
|
||||
{}
|
||||
|
||||
|
||||
@ -127,14 +167,8 @@ externalCoupledTemperatureMixedFvPatchScalarField
|
||||
const DimensionedField<scalar, volMesh>& iF
|
||||
)
|
||||
:
|
||||
externalCoupledMixedFvPatchField<scalar>(ecmpf, iF)
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::externalCoupledTemperatureMixedFvPatchScalarField::
|
||||
~externalCoupledTemperatureMixedFvPatchScalarField()
|
||||
externalCoupledMixedFvPatchField<scalar>(ecmpf, iF),
|
||||
outputTemperature_(ecmpf.outputTemperature_)
|
||||
{}
|
||||
|
||||
|
||||
@ -148,7 +182,7 @@ void Foam::externalCoupledTemperatureMixedFvPatchScalarField::writeData
|
||||
const label patchi = patch().index();
|
||||
|
||||
// Heat flux [W/m2]
|
||||
scalarField qDot(this->patch().size(), 0.0);
|
||||
scalarField qDot(this->patch().size(), Zero);
|
||||
|
||||
typedef compressible::turbulenceModel cmpTurbModelType;
|
||||
|
||||
@ -189,10 +223,11 @@ void Foam::externalCoupledTemperatureMixedFvPatchScalarField::writeData
|
||||
<< "thermo model to be available" << exit(FatalError);
|
||||
}
|
||||
|
||||
// Patch temperature [K]
|
||||
|
||||
// Patch (wall) temperature [K]
|
||||
const scalarField& Tp(*this);
|
||||
|
||||
// Near wall cell temperature [K]
|
||||
// Near wall cell (fluid) temperature [K]
|
||||
const scalarField Tc(patchInternalField());
|
||||
|
||||
// Heat transfer coefficient [W/m2/K]
|
||||
@ -200,13 +235,19 @@ void Foam::externalCoupledTemperatureMixedFvPatchScalarField::writeData
|
||||
|
||||
const Field<scalar>& magSf(this->patch().magSf());
|
||||
|
||||
const UList<scalar>& Tout =
|
||||
(
|
||||
outputTemperature_ == outputTemperatureType::FLUID
|
||||
? Tc
|
||||
: Tp
|
||||
);
|
||||
|
||||
forAll(patch(), facei)
|
||||
{
|
||||
os << magSf[facei] << token::SPACE
|
||||
<< Tp[facei] << token::SPACE
|
||||
<< Tout[facei] << token::SPACE
|
||||
<< qDot[facei] << token::SPACE
|
||||
<< htc[facei] << token::SPACE
|
||||
<< nl;
|
||||
<< htc[facei] << nl;
|
||||
}
|
||||
}
|
||||
|
||||
@ -235,6 +276,20 @@ void Foam::externalCoupledTemperatureMixedFvPatchScalarField::readData
|
||||
}
|
||||
|
||||
|
||||
void Foam::externalCoupledTemperatureMixedFvPatchScalarField::write
|
||||
(
|
||||
Ostream& os
|
||||
) const
|
||||
{
|
||||
externalCoupledMixedFvPatchField::write(os);
|
||||
os.writeEntry
|
||||
(
|
||||
"outputTemperature",
|
||||
outputTemperatureNames[outputTemperature_]
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
|
||||
@ -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) 2018 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -87,6 +87,14 @@ Description
|
||||
To be used in combination with the functionObjects::externalCoupled
|
||||
functionObject.
|
||||
|
||||
Usage
|
||||
\table
|
||||
Property | Description | Required | Default
|
||||
outputTemperature | The output temperature: fluid/wall | yes |
|
||||
\endtable
|
||||
|
||||
Note the
|
||||
|
||||
SeeAlso
|
||||
externalCoupledFunctionObject
|
||||
mixedFvPatchField
|
||||
@ -101,6 +109,7 @@ SourceFiles
|
||||
#define externalCoupledTemperatureMixedFvPatchScalarField_H
|
||||
|
||||
#include "externalCoupledMixedFvPatchFields.H"
|
||||
#include "Enum.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -115,6 +124,24 @@ class externalCoupledTemperatureMixedFvPatchScalarField
|
||||
:
|
||||
public externalCoupledMixedFvPatchField<scalar>
|
||||
{
|
||||
// Data Types
|
||||
|
||||
//- Location for the ouput temperature
|
||||
enum outputTemperatureType
|
||||
{
|
||||
FLUID, //!< Use fluid (cell) temperature
|
||||
WALL //!< Use wall (patch) temperature
|
||||
};
|
||||
|
||||
//- Names for outputTemperatureType
|
||||
static const Enum<outputTemperatureType> outputTemperatureNames;
|
||||
|
||||
|
||||
// Private Data
|
||||
|
||||
//- Location for the ouput temperature
|
||||
enum outputTemperatureType outputTemperature_;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
@ -189,19 +216,22 @@ public:
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~externalCoupledTemperatureMixedFvPatchScalarField();
|
||||
virtual ~externalCoupledTemperatureMixedFvPatchScalarField() = default;
|
||||
|
||||
|
||||
// Member functions
|
||||
|
||||
//- Write header
|
||||
virtual void writeHeader(Ostream&) const;
|
||||
virtual void writeHeader(Ostream& os) const;
|
||||
|
||||
//- Write data
|
||||
virtual void writeData(Ostream&) const;
|
||||
virtual void writeData(Ostream& os) const;
|
||||
|
||||
//- Read data
|
||||
virtual void readData(Istream&);
|
||||
virtual void readData(Istream& is);
|
||||
|
||||
//- Write
|
||||
virtual void write(Ostream& os) const;
|
||||
};
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user