ENH: support time-varying Tref for externalCoupledTemperature (#1729)
This commit is contained in:
parent
c21c5e070a
commit
458cec60b1
@ -89,23 +89,23 @@ externalCoupledTemperatureMixedFvPatchScalarField
|
||||
externalCoupledMixedFvPatchField<scalar>(p, iF),
|
||||
outTempType_(outputTemperatureType::WALL),
|
||||
refTempType_(refTemperatureType::CELL),
|
||||
Tref_(Zero)
|
||||
Tref_(nullptr)
|
||||
{}
|
||||
|
||||
|
||||
Foam::externalCoupledTemperatureMixedFvPatchScalarField::
|
||||
externalCoupledTemperatureMixedFvPatchScalarField
|
||||
(
|
||||
const externalCoupledTemperatureMixedFvPatchScalarField& ptf,
|
||||
const externalCoupledTemperatureMixedFvPatchScalarField& rhs,
|
||||
const fvPatch& p,
|
||||
const DimensionedField<scalar, volMesh>& iF,
|
||||
const fvPatchFieldMapper& mapper
|
||||
)
|
||||
:
|
||||
externalCoupledMixedFvPatchField<scalar>(ptf, p, iF, mapper),
|
||||
outTempType_(ptf.outTempType_),
|
||||
refTempType_(ptf.refTempType_),
|
||||
Tref_(ptf.Tref_)
|
||||
externalCoupledMixedFvPatchField<scalar>(rhs, p, iF, mapper),
|
||||
outTempType_(rhs.outTempType_),
|
||||
refTempType_(rhs.refTempType_),
|
||||
Tref_(rhs.Tref_.clone())
|
||||
{}
|
||||
|
||||
|
||||
@ -129,7 +129,7 @@ externalCoupledTemperatureMixedFvPatchScalarField
|
||||
refTemperatureType::CELL
|
||||
)
|
||||
),
|
||||
Tref_(Zero)
|
||||
Tref_(nullptr)
|
||||
{
|
||||
if (dict.found("outputTemperature"))
|
||||
{
|
||||
@ -146,7 +146,7 @@ externalCoupledTemperatureMixedFvPatchScalarField
|
||||
|
||||
if (refTempType_ == refTemperatureType::USER)
|
||||
{
|
||||
Tref_ = dict.get<scalar>("Tref");
|
||||
Tref_ = Function1<scalar>::New("Tref", dict);
|
||||
}
|
||||
|
||||
if (dict.found("refValue"))
|
||||
@ -185,27 +185,27 @@ externalCoupledTemperatureMixedFvPatchScalarField
|
||||
Foam::externalCoupledTemperatureMixedFvPatchScalarField::
|
||||
externalCoupledTemperatureMixedFvPatchScalarField
|
||||
(
|
||||
const externalCoupledTemperatureMixedFvPatchScalarField& ecmpf
|
||||
const externalCoupledTemperatureMixedFvPatchScalarField& rhs
|
||||
)
|
||||
:
|
||||
externalCoupledMixedFvPatchField<scalar>(ecmpf),
|
||||
outTempType_(ecmpf.outTempType_),
|
||||
refTempType_(ecmpf.refTempType_),
|
||||
Tref_(ecmpf.Tref_)
|
||||
externalCoupledMixedFvPatchField<scalar>(rhs),
|
||||
outTempType_(rhs.outTempType_),
|
||||
refTempType_(rhs.refTempType_),
|
||||
Tref_(rhs.Tref_.clone())
|
||||
{}
|
||||
|
||||
|
||||
Foam::externalCoupledTemperatureMixedFvPatchScalarField::
|
||||
externalCoupledTemperatureMixedFvPatchScalarField
|
||||
(
|
||||
const externalCoupledTemperatureMixedFvPatchScalarField& ecmpf,
|
||||
const externalCoupledTemperatureMixedFvPatchScalarField& rhs,
|
||||
const DimensionedField<scalar, volMesh>& iF
|
||||
)
|
||||
:
|
||||
externalCoupledMixedFvPatchField<scalar>(ecmpf, iF),
|
||||
outTempType_(ecmpf.outTempType_),
|
||||
refTempType_(ecmpf.refTempType_),
|
||||
Tref_(ecmpf.Tref_)
|
||||
externalCoupledMixedFvPatchField<scalar>(rhs, iF),
|
||||
outTempType_(rhs.outTempType_),
|
||||
refTempType_(rhs.refTempType_),
|
||||
Tref_(rhs.Tref_.clone())
|
||||
{}
|
||||
|
||||
|
||||
@ -270,7 +270,10 @@ void Foam::externalCoupledTemperatureMixedFvPatchScalarField::writeData
|
||||
if (refTempType_ == refTemperatureType::USER)
|
||||
{
|
||||
// User-specified reference temperature
|
||||
tfluid = tmp<scalarField>::New(size(), Tref_);
|
||||
const scalar currTref =
|
||||
Tref_->value(this->db().time().timeOutputValue());
|
||||
|
||||
tfluid = tmp<scalarField>::New(size(), currTref);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -344,9 +347,9 @@ void Foam::externalCoupledTemperatureMixedFvPatchScalarField::write
|
||||
refTemperatureNames[refTempType_]
|
||||
);
|
||||
|
||||
if (refTempType_ == refTemperatureType::USER)
|
||||
if (Tref_)
|
||||
{
|
||||
os.writeEntry("Tref", Tref_);
|
||||
Tref_->writeData(os);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2013-2016 OpenFOAM Foundation
|
||||
Copyright (C) 2018-2019 OpenCFD Ltd.
|
||||
Copyright (C) 2018-2020 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -98,6 +98,9 @@ Usage
|
||||
Tref | Reference temperature [K] for htc | conditional |
|
||||
\endtable
|
||||
|
||||
The user-specified reference temperature Tref is specified as
|
||||
a Foam::Function1 of time but spatially uniform.
|
||||
|
||||
SeeAlso
|
||||
externalCoupledFunctionObject
|
||||
mixedFvPatchField
|
||||
@ -112,6 +115,7 @@ SourceFiles
|
||||
#define externalCoupledTemperatureMixedFvPatchScalarField_H
|
||||
|
||||
#include "externalCoupledMixedFvPatchFields.H"
|
||||
#include "Function1.H"
|
||||
#include "Enum.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
@ -159,7 +163,7 @@ class externalCoupledTemperatureMixedFvPatchScalarField
|
||||
enum refTemperatureType refTempType_;
|
||||
|
||||
//- User-specified reference temperature for HTC calculation
|
||||
scalar Tref_;
|
||||
autoPtr<Function1<scalar>> Tref_;
|
||||
|
||||
|
||||
public:
|
||||
@ -238,7 +242,7 @@ public:
|
||||
virtual ~externalCoupledTemperatureMixedFvPatchScalarField() = default;
|
||||
|
||||
|
||||
// Member functions
|
||||
// Member Functions
|
||||
|
||||
//- Write header
|
||||
virtual void writeHeader(Ostream& os) const;
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: v1912 |
|
||||
| \\ / O peration | Version: v2006 |
|
||||
| \\ / A nd | Website: www.openfoam.com |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
@ -29,7 +29,16 @@ T
|
||||
inletWalls
|
||||
{
|
||||
type externalCoupledTemperature;
|
||||
// outputTemperature fluid; // fluid|wall
|
||||
outputTemperature fluid; // (fluid|wall)
|
||||
htcRefTemperature user; // (cell|user)
|
||||
|
||||
Tref
|
||||
{
|
||||
type expression;
|
||||
|
||||
// arg() means time here
|
||||
expression #{ arg() <= 0.1 ? 300 : 320 #};
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user