/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2026 OpenFOAM Foundation
\\/ 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 .
Class
Foam::externalTemperatureFvPatchScalarField
Description
This boundary condition applies a heat flux condition to temperature
on an external wall. Heat flux can be specified in the following ways:
- Fixed power: requires \c Q
- Fixed heat flux: requires \c q
- Fixed heat transfer coefficient: requires \c h and \c Ta
where:
\vartable
Q | Power Function1 of time [W]
q | Heat flux Function1 of time [W/m^2]
h | Heat transfer coefficient DimensionedFieldFunction [W/m^2/K]
Ta | Ambient temperature Function1 of time [K]
\endvartable
Only one of \c Q or \c q may be specified, if \c h and \c Ta are also
specified the corresponding heat-flux is added.
The patch thermal conductivity \c kappa is obtained from the region
thermophysicalTransportModel so that this boundary condition can be applied
directly to either fluid or solid regions.
Usage
\table
Property | Description | Required | Default value
Q | Power [W] | no |
q | Heat flux [W/m^2] | no |
h | Heat transfer coefficient [W/m^2/K] | no |
Ta | Ambient temperature [K] | if h is given |
relaxation | Relaxation for the wall temperature | no | 1
emissivity | Surface emissivity for radiative flux to ambient | no | 0
qr | Name of the radiative field | no | none
qrRelaxation | Relaxation factor for radiative field | no | 1
\endtable
Example of the boundary condition specification:
\verbatim
{
type externalTemperature;
Ta constant 300.0;
h uniform 10.0;
value $internalField;
}
\endverbatim
See also
Foam::mixedFvPatchScalarField
Foam::Function1
SourceFiles
externalTemperatureFvPatchScalarField.C
\*---------------------------------------------------------------------------*/
#ifndef externalTemperatureFvPatchScalarField_H
#define externalTemperatureFvPatchScalarField_H
#include "mixedFvPatchFields.H"
#include "Function1.H"
#include "FunctionalDimensionedFieldFwd.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class externalTemperatureFvPatchScalarField Declaration
\*---------------------------------------------------------------------------*/
class externalTemperatureFvPatchScalarField
:
public mixedFvPatchScalarField
{
// Private Data
// Heat power
//- Do we have a heat power?
bool haveQ_;
//- Heat power [W]
autoPtr> Q_;
// Heat flux
//- Do we have a heat flux?
bool haveq_;
//- Heat flux [W/m^2]
autoPtr> q_;
// Heat transfer coefficient
//- Heat transfer coefficient [W/m^2K]
autoPtr> h_;
//- Do we have an emissivity?
const bool haveEmissivity_;
//- Optional surface emissivity for radiative transfer to ambient
scalar emissivity_;
//- Ambient temperature [K]
autoPtr> Ta_;
//- Relaxation factor for the wall temperature (thermal inertia)
scalar relax_;
// Radiation
//- Name of the radiative heat flux
const word qrName_;
//- Relaxation factor for qr
scalar qrRelax_;
//- Cache qr for relaxation
scalarField qrPrevious_;
protected:
// Protected Member Functions
//- Plus-equals op for a tmp field. Will initialise the tmp if empty.
void addEqOp(tmp& tf, const scalar d) const;
//- Plus-equals op for a tmp field. Will initialise the tmp if empty.
void addEqOp(tmp& tf, const tmp& tdf) const;
//- Get the patch kappa, kappa*Tc/delta, kappa/delta,
// reference T, current wall T and also the
// heat-flux/delta obtained from the sum heat-flux provided
virtual void getKappa
(
scalarField& kappa,
tmp& sumKappaTcByDelta,
tmp& sumKappaByDelta,
tmp& T,
tmp& sumq
) const;
public:
//- Runtime type information
TypeName("externalTemperature");
// Constructors
//- Construct from patch, internal field and dictionary
externalTemperatureFvPatchScalarField
(
const fvPatch&,
const DimensionedField&,
const dictionary&
);
//- Construct by mapping given
// externalTemperatureFvPatchScalarField
// onto a new patch
externalTemperatureFvPatchScalarField
(
const externalTemperatureFvPatchScalarField&,
const fvPatch&,
const DimensionedField&,
const fieldMapper&
);
//- Disallow copy without setting internal field reference
externalTemperatureFvPatchScalarField
(
const externalTemperatureFvPatchScalarField&
) = delete;
//- Copy constructor setting internal field reference
externalTemperatureFvPatchScalarField
(
const externalTemperatureFvPatchScalarField&,
const DimensionedField&
);
//- Construct and return a clone setting internal field reference
virtual tmp clone
(
const DimensionedField& iF
) const;
//- Destructor
virtual ~externalTemperatureFvPatchScalarField();
// Member Functions
// Access
//- Disallow manipulation of the boundary values
// The boundary temperature is evaluated only by
// this boundary condition
virtual bool fixesValue() const
{
return true;
}
// Mapping functions
//- Map the given fvPatchField onto this fvPatchField
virtual void map(const fvPatchScalarField&, const fieldMapper&);
//- Reset the fvPatchField to the given fvPatchField
// Used for mesh to mesh mapping
virtual void reset(const fvPatchScalarField&);
// Evaluation functions
//- Update the coefficients associated with the patch field
virtual void updateCoeffs();
// I-O
//- Write
void write(Ostream&) const;
// Member Operators
//- Inherit assignment
using mixedFvPatchScalarField::operator=;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //