mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: Re-locating externalWallHeatFluxTemperature
This commit is contained in:
@ -1,3 +0,0 @@
|
||||
externalWallHeatFluxTemperature/externalWallHeatFluxTemperatureFvPatchScalarField.C
|
||||
|
||||
LIB = $(FOAM_LIBBIN)/libcoupledDerivedFvPatchFields
|
||||
@ -1,12 +0,0 @@
|
||||
EXE_INC = \
|
||||
-I$(LIB_SRC)/finiteVolume/lnInclude \
|
||||
-I$(LIB_SRC)/meshTools/lnInclude \
|
||||
-I$(LIB_SRC)/thermophysicalModels/basicSolidThermo/lnInclude \
|
||||
-I$(LIB_SRC)/turbulenceModels/compressible/turbulenceModel/lnInclude \
|
||||
-I$(LIB_SRC)/thermophysicalModels/radiationModels/lnInclude
|
||||
|
||||
LIB_LIBS = \
|
||||
-lmeshTools \
|
||||
-lbasicThermophysicalModels \
|
||||
-lfiniteVolume \
|
||||
-lradiationModels
|
||||
@ -1,271 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "externalWallHeatFluxTemperatureFvPatchScalarField.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
#include "fvPatchFieldMapper.H"
|
||||
#include "volFields.H"
|
||||
#include "directMappedPatchBase.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
template<>
|
||||
const char*
|
||||
NamedEnum
|
||||
<externalWallHeatFluxTemperatureFvPatchScalarField::operationMode, 3>::names[]=
|
||||
{
|
||||
"fixed_heat_flux",
|
||||
"fixed_heat_transfer_coefficient",
|
||||
"unknown"
|
||||
};
|
||||
|
||||
const NamedEnum
|
||||
<
|
||||
externalWallHeatFluxTemperatureFvPatchScalarField::operationMode, 3
|
||||
>
|
||||
externalWallHeatFluxTemperatureFvPatchScalarField::operationModeNames;
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::externalWallHeatFluxTemperatureFvPatchScalarField::
|
||||
externalWallHeatFluxTemperatureFvPatchScalarField
|
||||
(
|
||||
const fvPatch& p,
|
||||
const DimensionedField<scalar, volMesh>& iF
|
||||
)
|
||||
:
|
||||
mixedFvPatchScalarField(p, iF),
|
||||
temperatureCoupledBase(patch(), "undefined", "undefined-K"),
|
||||
oldMode_(unknown),
|
||||
q_(p.size(), 0.0),
|
||||
h_(p.size(), 0.0),
|
||||
Ta_(p.size(), 0.0)
|
||||
{
|
||||
this->refValue() = 0.0;
|
||||
this->refGrad() = 0.0;
|
||||
this->valueFraction() = 1.0;
|
||||
}
|
||||
|
||||
|
||||
Foam::externalWallHeatFluxTemperatureFvPatchScalarField::
|
||||
externalWallHeatFluxTemperatureFvPatchScalarField
|
||||
(
|
||||
const externalWallHeatFluxTemperatureFvPatchScalarField& ptf,
|
||||
const fvPatch& p,
|
||||
const DimensionedField<scalar, volMesh>& iF,
|
||||
const fvPatchFieldMapper& mapper
|
||||
)
|
||||
:
|
||||
mixedFvPatchScalarField(ptf, p, iF, mapper),
|
||||
temperatureCoupledBase(patch(), ptf.KMethod(), ptf.KName()),
|
||||
oldMode_(unknown),
|
||||
q_(ptf.q_, mapper),
|
||||
h_(ptf.h_, mapper),
|
||||
Ta_(ptf.Ta_, mapper)
|
||||
{}
|
||||
|
||||
|
||||
Foam::externalWallHeatFluxTemperatureFvPatchScalarField::
|
||||
externalWallHeatFluxTemperatureFvPatchScalarField
|
||||
(
|
||||
const fvPatch& p,
|
||||
const DimensionedField<scalar, volMesh>& iF,
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
mixedFvPatchScalarField(p, iF),
|
||||
temperatureCoupledBase(patch(), dict),
|
||||
oldMode_(unknown),
|
||||
q_(p.size(), 0.0),
|
||||
h_(p.size(), 0.0),
|
||||
Ta_(p.size(), 0.0)
|
||||
{
|
||||
if (dict.found("q") && !dict.found("h") && !dict.found("Ta"))
|
||||
{
|
||||
oldMode_ = fixedHeatFlux;
|
||||
q_ = scalarField("q", dict, p.size());
|
||||
}
|
||||
else if(dict.found("h") && dict.found("Ta") && !dict.found("q"))
|
||||
{
|
||||
oldMode_ = fixedHeatTransferCoeff;
|
||||
h_ = scalarField("h", dict, p.size());
|
||||
Ta_ = scalarField("Ta", dict, p.size());
|
||||
}
|
||||
else
|
||||
{
|
||||
FatalErrorIn
|
||||
(
|
||||
"externalWallHeatFluxTemperatureFvPatchScalarField::"
|
||||
"externalWallHeatFluxTemperatureFvPatchScalarField\n"
|
||||
"(\n"
|
||||
" const fvPatch& p,\n"
|
||||
" const DimensionedField<scalar, volMesh>& iF,\n"
|
||||
" const dictionary& dict\n"
|
||||
")\n"
|
||||
) << "\n patch type '" << p.type()
|
||||
<< "' either q or h and Ta were not found '"
|
||||
<< "\n for patch " << p.name()
|
||||
<< " of field " << dimensionedInternalField().name()
|
||||
<< " in file " << dimensionedInternalField().objectPath()
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
fvPatchScalarField::operator=(scalarField("value", dict, p.size()));
|
||||
|
||||
if (dict.found("refValue"))
|
||||
{
|
||||
// Full restart
|
||||
refValue() = scalarField("refValue", dict, p.size());
|
||||
refGrad() = scalarField("refGradient", dict, p.size());
|
||||
valueFraction() = scalarField("valueFraction", dict, p.size());
|
||||
}
|
||||
else
|
||||
{
|
||||
// Start from user entered data. Assume fixedValue.
|
||||
refValue() = *this;
|
||||
refGrad() = 0.0;
|
||||
valueFraction() = 1.0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Foam::externalWallHeatFluxTemperatureFvPatchScalarField::
|
||||
externalWallHeatFluxTemperatureFvPatchScalarField
|
||||
(
|
||||
const externalWallHeatFluxTemperatureFvPatchScalarField& tppsf
|
||||
)
|
||||
:
|
||||
mixedFvPatchScalarField(tppsf),
|
||||
temperatureCoupledBase(tppsf),
|
||||
oldMode_(unknown),
|
||||
q_(tppsf.q_),
|
||||
h_(tppsf.h_),
|
||||
Ta_(tppsf.Ta_)
|
||||
{}
|
||||
|
||||
|
||||
Foam::externalWallHeatFluxTemperatureFvPatchScalarField::
|
||||
externalWallHeatFluxTemperatureFvPatchScalarField
|
||||
(
|
||||
const externalWallHeatFluxTemperatureFvPatchScalarField& tppsf,
|
||||
const DimensionedField<scalar, volMesh>& iF
|
||||
)
|
||||
:
|
||||
mixedFvPatchScalarField(tppsf, iF),
|
||||
temperatureCoupledBase(patch(), tppsf.KMethod(), tppsf.KName()),
|
||||
oldMode_(tppsf.oldMode_),
|
||||
q_(tppsf.q_),
|
||||
h_(tppsf.h_),
|
||||
Ta_(tppsf.Ta_)
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
void Foam::externalWallHeatFluxTemperatureFvPatchScalarField::updateCoeffs()
|
||||
{
|
||||
if (updated())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (oldMode_ == fixedHeatFlux)
|
||||
{
|
||||
this->refGrad() = q_/K(*this);
|
||||
this->refValue() = 0.0;
|
||||
this->valueFraction() = 0.0;
|
||||
}
|
||||
else if(oldMode_ == fixedHeatTransferCoeff)
|
||||
{
|
||||
this->refGrad() = (Ta_ - *this)*h_/K(*this);
|
||||
this->refValue() = 0.0;
|
||||
this->valueFraction() = 0.0;
|
||||
}
|
||||
else
|
||||
{
|
||||
FatalErrorIn
|
||||
(
|
||||
"externalWallHeatFluxTemperatureFvPatchScalarField"
|
||||
"::updateCoeffs()"
|
||||
) << "Illegal mode " << operationModeNames[oldMode_]
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
mixedFvPatchScalarField::updateCoeffs();
|
||||
|
||||
if (debug)
|
||||
{
|
||||
scalar Q = gSum(K(*this)*patch().magSf()*snGrad());
|
||||
|
||||
Info<< patch().boundaryMesh().mesh().name() << ':'
|
||||
<< patch().name() << ':'
|
||||
<< this->dimensionedInternalField().name() << " :"
|
||||
<< " heatFlux:" << Q
|
||||
<< " walltemperature "
|
||||
<< " min:" << gMin(*this)
|
||||
<< " max:" << gMax(*this)
|
||||
<< " avg:" << gAverage(*this)
|
||||
<< endl;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Foam::externalWallHeatFluxTemperatureFvPatchScalarField::write
|
||||
(
|
||||
Ostream& os
|
||||
) const
|
||||
{
|
||||
mixedFvPatchScalarField::write(os);
|
||||
temperatureCoupledBase::write(os);
|
||||
q_.writeEntry("q", os);
|
||||
h_.writeEntry("h", os);
|
||||
Ta_.writeEntry("Ta", os);
|
||||
this->writeEntry("value", os);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
makePatchTypeField
|
||||
(
|
||||
fvPatchScalarField,
|
||||
externalWallHeatFluxTemperatureFvPatchScalarField
|
||||
);
|
||||
}
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1,196 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
Class
|
||||
externalWallHeatFluxTemperatureFvPatchScalarField
|
||||
|
||||
Description
|
||||
Heat flux boundary condition for temperature on external wall.
|
||||
|
||||
If h and Ta are specified then fixed_heat_transfer_coefficient mode is used
|
||||
If q is specified then fixed_heat_flux is used.
|
||||
|
||||
Example usage:
|
||||
myWallPatch
|
||||
{
|
||||
type externalWallHeatFluxTemperature;
|
||||
K solidThermo; // solidThermo or lookup
|
||||
q uniform 1000; // Heat flux / [W/m2]
|
||||
Ta uniform 300.0; // Tambient temperature /[K]
|
||||
h uniform 10.0; // Heat transfer coeff /[W/Km2]
|
||||
value uniform 300.0; // Initial temperature / [K]
|
||||
KName none;
|
||||
}
|
||||
|
||||
Note:
|
||||
Only the pair h, Ta or q can be specified in the dictionary.
|
||||
|
||||
|
||||
SourceFiles
|
||||
externalWallHeatFluxTemperatureFvPatchScalarField.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef solidWallHeatFluxTemperatureFvPatchScalarField_H
|
||||
#define solidWallHeatFluxTemperatureFvPatchScalarField_H
|
||||
|
||||
#include "mixedFvPatchFields.H"
|
||||
#include "temperatureCoupledBase.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class externalWallHeatFluxTemperatureFvPatchScalarField Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class externalWallHeatFluxTemperatureFvPatchScalarField
|
||||
:
|
||||
public mixedFvPatchScalarField,
|
||||
public temperatureCoupledBase
|
||||
{
|
||||
public:
|
||||
|
||||
// Public data
|
||||
|
||||
//- Operation mode enumeration
|
||||
enum operationMode
|
||||
{
|
||||
fixedHeatFlux,
|
||||
fixedHeatTransferCoeff,
|
||||
unknown
|
||||
};
|
||||
static const NamedEnum<operationMode, 3> operationModeNames;
|
||||
|
||||
|
||||
private:
|
||||
|
||||
// Private data
|
||||
|
||||
//- Operation mode
|
||||
operationMode oldMode_;
|
||||
|
||||
//- Heat flux / [W/m2]
|
||||
scalarField q_;
|
||||
|
||||
//- Heat transfer coefficient / [W/m2K]
|
||||
scalarField h_;
|
||||
|
||||
//- Ambient temperature / [K]
|
||||
scalarField Ta_;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("externalWallHeatFluxTemperature");
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from patch and internal field
|
||||
externalWallHeatFluxTemperatureFvPatchScalarField
|
||||
(
|
||||
const fvPatch&,
|
||||
const DimensionedField<scalar, volMesh>&
|
||||
);
|
||||
|
||||
//- Construct from patch, internal field and dictionary
|
||||
externalWallHeatFluxTemperatureFvPatchScalarField
|
||||
(
|
||||
const fvPatch&,
|
||||
const DimensionedField<scalar, volMesh>&,
|
||||
const dictionary&
|
||||
);
|
||||
|
||||
//- Construct by mapping given
|
||||
// externalWallHeatFluxTemperatureFvPatchScalarField
|
||||
// onto a new patch
|
||||
externalWallHeatFluxTemperatureFvPatchScalarField
|
||||
(
|
||||
const externalWallHeatFluxTemperatureFvPatchScalarField&,
|
||||
const fvPatch&,
|
||||
const DimensionedField<scalar, volMesh>&,
|
||||
const fvPatchFieldMapper&
|
||||
);
|
||||
|
||||
//- Construct as copy
|
||||
externalWallHeatFluxTemperatureFvPatchScalarField
|
||||
(
|
||||
const externalWallHeatFluxTemperatureFvPatchScalarField&
|
||||
);
|
||||
|
||||
//- Construct and return a clone
|
||||
virtual tmp<fvPatchScalarField> clone() const
|
||||
{
|
||||
return tmp<fvPatchScalarField>
|
||||
(
|
||||
new externalWallHeatFluxTemperatureFvPatchScalarField(*this)
|
||||
);
|
||||
}
|
||||
|
||||
//- Construct as copy setting internal field reference
|
||||
externalWallHeatFluxTemperatureFvPatchScalarField
|
||||
(
|
||||
const externalWallHeatFluxTemperatureFvPatchScalarField&,
|
||||
const DimensionedField<scalar, volMesh>&
|
||||
);
|
||||
|
||||
//- Construct and return a clone setting internal field reference
|
||||
virtual tmp<fvPatchScalarField> clone
|
||||
(
|
||||
const DimensionedField<scalar, volMesh>& iF
|
||||
) const
|
||||
{
|
||||
return tmp<fvPatchScalarField>
|
||||
(
|
||||
new externalWallHeatFluxTemperatureFvPatchScalarField(*this, iF)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// Member functions
|
||||
|
||||
// Evaluation functions
|
||||
|
||||
//- Update the coefficients associated with the patch field
|
||||
virtual void updateCoeffs();
|
||||
|
||||
// I-O
|
||||
|
||||
//- Write
|
||||
void write(Ostream&) const;
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
Reference in New Issue
Block a user