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