COM: Separate htc FO from general FO and reactingEuler solvers (#1714)
The phase systems tables for multiphase solvers create conflict between each other as they are defined in the same namespace and using similar class names. Therefore a special htc function object for reactingEulerSolver was added (reactingEulerHtcModel), located under src/phaseSystemModels/reactingEulerFoam/functionObjects/ This commit includes the following: - Relocate solvers/reactingEulerFoam functionObjects to src/phaseSystemModels - Remove links for fieldFunctionObject to multiphase libs to avoid conflicts - New FO for htc for reactingEulerFoam called reactingEulerHtcModel
This commit is contained in:
parent
cf09b67b28
commit
95f7ed0342
@ -3,6 +3,5 @@ cd "${0%/*}" || exit # Run from this directory
|
|||||||
|
|
||||||
wclean reactingTwoPhaseEulerFoam
|
wclean reactingTwoPhaseEulerFoam
|
||||||
wclean reactingMultiphaseEulerFoam
|
wclean reactingMultiphaseEulerFoam
|
||||||
wclean libso functionObjects
|
|
||||||
|
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
|
@ -16,6 +16,5 @@ esac
|
|||||||
|
|
||||||
reactingTwoPhaseEulerFoam/Allwmake $targetType $*
|
reactingTwoPhaseEulerFoam/Allwmake $targetType $*
|
||||||
reactingMultiphaseEulerFoam/Allwmake $targetType $*
|
reactingMultiphaseEulerFoam/Allwmake $targetType $*
|
||||||
wmake $targetType functionObjects
|
|
||||||
|
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
|
@ -100,8 +100,8 @@ wmake $targetType engine
|
|||||||
|
|
||||||
conversion/Allwmake $targetType $*
|
conversion/Allwmake $targetType $*
|
||||||
|
|
||||||
phaseSystemModels/Allwmake $targetType $*
|
|
||||||
functionObjects/Allwmake $targetType $*
|
functionObjects/Allwmake $targetType $*
|
||||||
|
phaseSystemModels/Allwmake $targetType $*
|
||||||
|
|
||||||
wmake $targetType lumpedPointMotion
|
wmake $targetType lumpedPointMotion
|
||||||
wmake $targetType sixDoFRigidBodyMotion
|
wmake $targetType sixDoFRigidBodyMotion
|
||||||
|
@ -38,6 +38,4 @@ LIB_LIBS = \
|
|||||||
-lcompressibleTurbulenceModels \
|
-lcompressibleTurbulenceModels \
|
||||||
-lchemistryModel \
|
-lchemistryModel \
|
||||||
-lreactionThermophysicalModels \
|
-lreactionThermophysicalModels \
|
||||||
-lpairPatchAgglomeration \
|
-lpairPatchAgglomeration
|
||||||
-ltwoPhaseReactingTurbulenceModels \
|
|
||||||
-lreactingPhaseSystem
|
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
\\ / A nd | www.openfoam.com
|
\\ / A nd | www.openfoam.com
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2017 OpenCFD Ltd.
|
Copyright (C) 2017-2020 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -47,7 +47,7 @@ bool Foam::functionObjects::heatTransferCoeff::calc()
|
|||||||
{
|
{
|
||||||
volScalarField& htc = mesh_.lookupObjectRef<volScalarField>(resultName_);
|
volScalarField& htc = mesh_.lookupObjectRef<volScalarField>(resultName_);
|
||||||
|
|
||||||
htcModelPtr_->calc(htc);
|
htcModelPtr_->calc(htc, htcModelPtr_->q());
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -63,14 +63,13 @@ Foam::functionObjects::heatTransferCoeff::heatTransferCoeff
|
|||||||
)
|
)
|
||||||
:
|
:
|
||||||
fieldExpression(name, runTime, dict),
|
fieldExpression(name, runTime, dict),
|
||||||
htcModelPtr_()
|
htcModelPtr_(nullptr)
|
||||||
{
|
{
|
||||||
read(dict);
|
read(dict);
|
||||||
|
|
||||||
setResultName(typeName, name + ":htc:" + htcModelPtr_->type());
|
setResultName(typeName, name + ":htc:" + htcModelPtr_->type());
|
||||||
|
|
||||||
volScalarField* heatTransferCoeffPtr
|
volScalarField* heatTransferCoeffPtr =
|
||||||
(
|
|
||||||
new volScalarField
|
new volScalarField
|
||||||
(
|
(
|
||||||
IOobject
|
IOobject
|
||||||
@ -83,8 +82,7 @@ Foam::functionObjects::heatTransferCoeff::heatTransferCoeff
|
|||||||
),
|
),
|
||||||
mesh_,
|
mesh_,
|
||||||
dimensionedScalar(dimPower/dimArea/dimTemperature, Zero)
|
dimensionedScalar(dimPower/dimArea/dimTemperature, Zero)
|
||||||
)
|
);
|
||||||
);
|
|
||||||
|
|
||||||
mesh_.objectRegistry::store(heatTransferCoeffPtr);
|
mesh_.objectRegistry::store(heatTransferCoeffPtr);
|
||||||
}
|
}
|
||||||
|
@ -122,6 +122,7 @@ SourceFiles
|
|||||||
namespace Foam
|
namespace Foam
|
||||||
{
|
{
|
||||||
|
|
||||||
|
// Forward Declarations
|
||||||
class heatTransferCoeffModel;
|
class heatTransferCoeffModel;
|
||||||
|
|
||||||
namespace functionObjects
|
namespace functionObjects
|
||||||
@ -135,16 +136,19 @@ class heatTransferCoeff
|
|||||||
:
|
:
|
||||||
public fieldExpression
|
public fieldExpression
|
||||||
{
|
{
|
||||||
|
// Private Data
|
||||||
private:
|
|
||||||
|
|
||||||
// Private data
|
|
||||||
|
|
||||||
//- Heat transfer coefficient model
|
//- Heat transfer coefficient model
|
||||||
autoPtr<heatTransferCoeffModel> htcModelPtr_;
|
autoPtr<heatTransferCoeffModel> htcModelPtr_;
|
||||||
|
|
||||||
|
|
||||||
// Private Member Functions
|
protected:
|
||||||
|
|
||||||
|
// Protected Member Functions
|
||||||
|
|
||||||
|
//- Calculate the heat transfer coefficient field
|
||||||
|
// \return true on success
|
||||||
|
virtual bool calc();
|
||||||
|
|
||||||
//- No copy construct
|
//- No copy construct
|
||||||
heatTransferCoeff(const heatTransferCoeff&) = delete;
|
heatTransferCoeff(const heatTransferCoeff&) = delete;
|
||||||
@ -153,13 +157,6 @@ private:
|
|||||||
void operator=(const heatTransferCoeff&) = delete;
|
void operator=(const heatTransferCoeff&) = delete;
|
||||||
|
|
||||||
|
|
||||||
protected:
|
|
||||||
|
|
||||||
//- Calculate the heat transfer coefficient field and return true
|
|
||||||
// if successful
|
|
||||||
virtual bool calc();
|
|
||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
//- Runtime type information
|
//- Runtime type information
|
||||||
@ -185,7 +182,7 @@ public:
|
|||||||
// Member Functions
|
// Member Functions
|
||||||
|
|
||||||
//- Read the heatTransferCoeff data
|
//- Read the heatTransferCoeff data
|
||||||
virtual bool read(const dictionary&);
|
virtual bool read(const dictionary& dict);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -243,7 +243,11 @@ bool Foam::heatTransferCoeffModels::ReynoldsAnalogy::read
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Foam::heatTransferCoeffModels::ReynoldsAnalogy::htc(volScalarField& htc)
|
void Foam::heatTransferCoeffModels::ReynoldsAnalogy::htc
|
||||||
|
(
|
||||||
|
volScalarField& htc,
|
||||||
|
const FieldField<Field, scalar>& q
|
||||||
|
)
|
||||||
{
|
{
|
||||||
const FieldField<Field, scalar> CfBf(Cf());
|
const FieldField<Field, scalar> CfBf(Cf());
|
||||||
const scalar magU = mag(URef_);
|
const scalar magU = mag(URef_);
|
||||||
|
@ -131,7 +131,11 @@ protected:
|
|||||||
tmp<FieldField<Field, scalar>> Cf() const;
|
tmp<FieldField<Field, scalar>> Cf() const;
|
||||||
|
|
||||||
//- Set the heat transfer coefficient
|
//- Set the heat transfer coefficient
|
||||||
virtual void htc(volScalarField& htc);
|
virtual void htc
|
||||||
|
(
|
||||||
|
volScalarField& htc,
|
||||||
|
const FieldField<Field, scalar>& q
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
//- No copy construct
|
//- No copy construct
|
||||||
|
@ -81,10 +81,11 @@ bool Foam::heatTransferCoeffModels::fixedReferenceTemperature::read
|
|||||||
|
|
||||||
void Foam::heatTransferCoeffModels::fixedReferenceTemperature::htc
|
void Foam::heatTransferCoeffModels::fixedReferenceTemperature::htc
|
||||||
(
|
(
|
||||||
volScalarField& htc
|
volScalarField& htc,
|
||||||
|
const FieldField<Field, scalar>& q
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
const FieldField<Field, scalar> qBf(q());
|
//const FieldField<Field, scalar> qBf(q());
|
||||||
const volScalarField& T = mesh_.lookupObject<volScalarField>(TName_);
|
const volScalarField& T = mesh_.lookupObject<volScalarField>(TName_);
|
||||||
const volScalarField::Boundary& Tbf = T.boundaryField();
|
const volScalarField::Boundary& Tbf = T.boundaryField();
|
||||||
const scalar eps = ROOTVSMALL;
|
const scalar eps = ROOTVSMALL;
|
||||||
@ -92,7 +93,7 @@ void Foam::heatTransferCoeffModels::fixedReferenceTemperature::htc
|
|||||||
volScalarField::Boundary& htcBf = htc.boundaryFieldRef();
|
volScalarField::Boundary& htcBf = htc.boundaryFieldRef();
|
||||||
for (const label patchi : patchSet_)
|
for (const label patchi : patchSet_)
|
||||||
{
|
{
|
||||||
htcBf[patchi] = qBf[patchi]/(TRef_ - Tbf[patchi] + eps);
|
htcBf[patchi] = q[patchi]/(TRef_ - Tbf[patchi] + eps);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -94,7 +94,11 @@ protected:
|
|||||||
// Protected Member Functions
|
// Protected Member Functions
|
||||||
|
|
||||||
//- Set the heat transfer coefficient
|
//- Set the heat transfer coefficient
|
||||||
virtual void htc(volScalarField& htc);
|
virtual void htc
|
||||||
|
(
|
||||||
|
volScalarField& htc,
|
||||||
|
const FieldField<Field, scalar>& q
|
||||||
|
);
|
||||||
|
|
||||||
//- No copy construct
|
//- No copy construct
|
||||||
fixedReferenceTemperature(const fixedReferenceTemperature&) = delete;
|
fixedReferenceTemperature(const fixedReferenceTemperature&) = delete;
|
||||||
|
@ -30,7 +30,6 @@ License
|
|||||||
#include "fluidThermo.H"
|
#include "fluidThermo.H"
|
||||||
#include "turbulentTransportModel.H"
|
#include "turbulentTransportModel.H"
|
||||||
#include "turbulentFluidThermoModel.H"
|
#include "turbulentFluidThermoModel.H"
|
||||||
#include "phaseSystem.H"
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -91,32 +90,10 @@ Foam::heatTransferCoeffModel::q() const
|
|||||||
q[patchi] = alphabf[patchi]*hebf[patchi].snGrad();
|
q[patchi] = alphabf[patchi]*hebf[patchi].snGrad();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (mesh_.foundObject<phaseSystem>("phaseProperties"))
|
|
||||||
{
|
|
||||||
const phaseSystem& fluid =
|
|
||||||
(
|
|
||||||
mesh_.lookupObject<phaseSystem>("phaseProperties")
|
|
||||||
);
|
|
||||||
|
|
||||||
for (label patchi : patchSet_)
|
|
||||||
{
|
|
||||||
forAll(fluid.phases(), phasei)
|
|
||||||
{
|
|
||||||
const phaseModel& phase = fluid.phases()[phasei];
|
|
||||||
const fvPatchScalarField& alpha =
|
|
||||||
phase.boundaryField()[patchi];
|
|
||||||
const volScalarField& he = phase.thermo().he();
|
|
||||||
const volScalarField::Boundary& hebf = he.boundaryField();
|
|
||||||
|
|
||||||
q[patchi] +=
|
|
||||||
alpha*phase.alphaEff(patchi)()*hebf[patchi].snGrad();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
FatalErrorInFunction
|
FatalErrorInFunction
|
||||||
<< "Unable to find a valid thermo model to evaluate q"
|
<< "Unable to find a valid thermo model to evaluate q" << nl
|
||||||
<< exit(FatalError);
|
<< exit(FatalError);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -158,11 +135,7 @@ Foam::heatTransferCoeffModel::heatTransferCoeffModel
|
|||||||
|
|
||||||
bool Foam::heatTransferCoeffModel::read(const dictionary& dict)
|
bool Foam::heatTransferCoeffModel::read(const dictionary& dict)
|
||||||
{
|
{
|
||||||
patchSet_ =
|
patchSet_ = mesh_.boundaryMesh().patchSet(dict.get<wordRes>("patches"));
|
||||||
mesh_.boundaryMesh().patchSet
|
|
||||||
(
|
|
||||||
dict.get<wordRes>("patches")
|
|
||||||
);
|
|
||||||
|
|
||||||
dict.readIfPresent("qr", qrName_);
|
dict.readIfPresent("qr", qrName_);
|
||||||
|
|
||||||
@ -170,9 +143,13 @@ bool Foam::heatTransferCoeffModel::read(const dictionary& dict)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool Foam::heatTransferCoeffModel::calc(volScalarField& result)
|
bool Foam::heatTransferCoeffModel::calc
|
||||||
|
(
|
||||||
|
volScalarField& result,
|
||||||
|
const FieldField<Field, scalar>& q
|
||||||
|
)
|
||||||
{
|
{
|
||||||
htc(result);
|
htc(result, q);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -47,7 +47,6 @@ SourceFiles
|
|||||||
#include "dictionary.H"
|
#include "dictionary.H"
|
||||||
#include "HashSet.H"
|
#include "HashSet.H"
|
||||||
#include "volFields.H"
|
#include "volFields.H"
|
||||||
|
|
||||||
#include "runTimeSelectionTables.H"
|
#include "runTimeSelectionTables.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
@ -66,7 +65,7 @@ class heatTransferCoeffModel
|
|||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
// Protected Data
|
// Public Data
|
||||||
|
|
||||||
//- Mesh reference
|
//- Mesh reference
|
||||||
const fvMesh& mesh_;
|
const fvMesh& mesh_;
|
||||||
@ -77,16 +76,20 @@ protected:
|
|||||||
//- Temperature name
|
//- Temperature name
|
||||||
const word TName_;
|
const word TName_;
|
||||||
|
|
||||||
//- Name of radiative heat flux name, default = qr
|
//- Name of radiative heat flux (default = qr)
|
||||||
word qrName_;
|
word qrName_;
|
||||||
|
|
||||||
|
|
||||||
|
protected:
|
||||||
|
|
||||||
// Protected Member Functions
|
// Protected Member Functions
|
||||||
|
|
||||||
tmp<FieldField<Field, scalar>> q() const;
|
|
||||||
|
|
||||||
//- Set the heat transfer coefficient
|
//- Set the heat transfer coefficient
|
||||||
virtual void htc(volScalarField& htc) = 0;
|
virtual void htc
|
||||||
|
(
|
||||||
|
volScalarField& htc,
|
||||||
|
const FieldField<Field, scalar>& q
|
||||||
|
) = 0;
|
||||||
|
|
||||||
//- No copy construct
|
//- No copy construct
|
||||||
heatTransferCoeffModel(const heatTransferCoeffModel&) = delete;
|
heatTransferCoeffModel(const heatTransferCoeffModel&) = delete;
|
||||||
@ -145,10 +148,42 @@ public:
|
|||||||
|
|
||||||
// Member Functions
|
// Member Functions
|
||||||
|
|
||||||
|
//- The mesh reference
|
||||||
|
const fvMesh& mesh() const
|
||||||
|
{
|
||||||
|
return mesh_;
|
||||||
|
}
|
||||||
|
|
||||||
|
//- Wall patches to process
|
||||||
|
const labelHashSet& patchSet() const
|
||||||
|
{
|
||||||
|
return patchSet_;
|
||||||
|
}
|
||||||
|
|
||||||
|
//- Temperature name
|
||||||
|
const word& TName() const
|
||||||
|
{
|
||||||
|
return TName_;
|
||||||
|
}
|
||||||
|
|
||||||
|
//- Name of radiative heat flux
|
||||||
|
const word& qrName() const
|
||||||
|
{
|
||||||
|
return qrName_;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//- Read from dictionary
|
//- Read from dictionary
|
||||||
virtual bool read(const dictionary& dict);
|
virtual bool read(const dictionary& dict);
|
||||||
|
|
||||||
virtual bool calc(volScalarField& result);
|
virtual bool calc
|
||||||
|
(
|
||||||
|
volScalarField& result,
|
||||||
|
const FieldField<Field, scalar>& q
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Return q boundary fields
|
||||||
|
tmp<FieldField<Field, scalar>> q() const;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -74,10 +74,11 @@ bool Foam::heatTransferCoeffModels::localReferenceTemperature::read
|
|||||||
|
|
||||||
void Foam::heatTransferCoeffModels::localReferenceTemperature::htc
|
void Foam::heatTransferCoeffModels::localReferenceTemperature::htc
|
||||||
(
|
(
|
||||||
volScalarField& htc
|
volScalarField& htc,
|
||||||
|
const FieldField<Field, scalar>& q
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
const FieldField<Field, scalar> qBf(q());
|
///const FieldField<Field, scalar> qBf(q());
|
||||||
const volScalarField& T = mesh_.lookupObject<volScalarField>(TName_);
|
const volScalarField& T = mesh_.lookupObject<volScalarField>(TName_);
|
||||||
const volScalarField::Boundary& Tbf = T.boundaryField();
|
const volScalarField::Boundary& Tbf = T.boundaryField();
|
||||||
const scalar eps = ROOTVSMALL;
|
const scalar eps = ROOTVSMALL;
|
||||||
@ -87,7 +88,7 @@ void Foam::heatTransferCoeffModels::localReferenceTemperature::htc
|
|||||||
for (const label patchi : patchSet_)
|
for (const label patchi : patchSet_)
|
||||||
{
|
{
|
||||||
const scalarField Tc(Tbf[patchi].patchInternalField());
|
const scalarField Tc(Tbf[patchi].patchInternalField());
|
||||||
htcBf[patchi] = qBf[patchi]/(Tc - Tbf[patchi] + eps);
|
htcBf[patchi] = q[patchi]/(Tc - Tbf[patchi] + eps);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -81,7 +81,16 @@ class localReferenceTemperature
|
|||||||
:
|
:
|
||||||
public heatTransferCoeffModel
|
public heatTransferCoeffModel
|
||||||
{
|
{
|
||||||
// Private Member Functions
|
protected:
|
||||||
|
|
||||||
|
// Protected Member Functions
|
||||||
|
|
||||||
|
//- Set the heat transfer coefficient
|
||||||
|
virtual void htc
|
||||||
|
(
|
||||||
|
volScalarField& htc,
|
||||||
|
const FieldField<Field, scalar>& q
|
||||||
|
);
|
||||||
|
|
||||||
//- No copy construct
|
//- No copy construct
|
||||||
localReferenceTemperature(const localReferenceTemperature&) = delete;
|
localReferenceTemperature(const localReferenceTemperature&) = delete;
|
||||||
@ -90,14 +99,6 @@ class localReferenceTemperature
|
|||||||
void operator=(const localReferenceTemperature&) = delete;
|
void operator=(const localReferenceTemperature&) = delete;
|
||||||
|
|
||||||
|
|
||||||
protected:
|
|
||||||
|
|
||||||
// Protected Member Functions
|
|
||||||
|
|
||||||
//- Set the heat transfer coefficient
|
|
||||||
virtual void htc(volScalarField& htc);
|
|
||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
//- Runtime type information
|
//- Runtime type information
|
||||||
|
@ -11,5 +11,6 @@ wclean libso reactingEulerFoam/reactingMultiphaseEulerFoam/multiphaseCompressibl
|
|||||||
|
|
||||||
wclean libso reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseSystem
|
wclean libso reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseSystem
|
||||||
wclean libso reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseCompressibleTurbulenceModels
|
wclean libso reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseCompressibleTurbulenceModels
|
||||||
|
wclean libso reactingEulerFoam/functionObjects
|
||||||
|
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
|
@ -27,5 +27,6 @@ wmake $targetType reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseSystem
|
|||||||
wmake $targetType reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseCompressibleTurbulenceModels
|
wmake $targetType reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseCompressibleTurbulenceModels
|
||||||
|
|
||||||
wmake $targetType reactingEulerFoam/phaseSystems
|
wmake $targetType reactingEulerFoam/phaseSystems
|
||||||
|
wmake $targetType reactingEulerFoam/functionObjects
|
||||||
|
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
sizeDistribution/sizeDistribution.C
|
sizeDistribution/sizeDistribution.C
|
||||||
phaseForces/phaseForces.C
|
phaseForces/phaseForces.C
|
||||||
|
reactingEulerHtcModel/reactingEulerHtcModel.C
|
||||||
|
|
||||||
LIB = $(FOAM_LIBBIN)/libreactingEulerFoamFunctionObjects
|
LIB = $(FOAM_LIBBIN)/libreactingEulerFoamFunctionObjects
|
@ -0,0 +1,178 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | www.openfoam.com
|
||||||
|
\\/ M anipulation |
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
Copyright (C) 2020 OpenCFD Ltd.
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
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 "reactingEulerHtcModel.H"
|
||||||
|
#include "phaseSystem.H"
|
||||||
|
#include "addToRunTimeSelectionTable.H"
|
||||||
|
#include "dictionary.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
namespace functionObjects
|
||||||
|
{
|
||||||
|
defineTypeNameAndDebug(reactingEulerHtcModel, 0);
|
||||||
|
addToRunTimeSelectionTable
|
||||||
|
(
|
||||||
|
functionObject,
|
||||||
|
reactingEulerHtcModel,
|
||||||
|
dictionary
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::tmp<Foam::FieldField<Foam::Field, Foam::scalar>>
|
||||||
|
Foam::functionObjects::reactingEulerHtcModel::q() const
|
||||||
|
{
|
||||||
|
const fvMesh& mesh = htcModelPtr_->mesh();
|
||||||
|
|
||||||
|
const volScalarField& T =
|
||||||
|
mesh.lookupObject<volScalarField>(htcModelPtr_->TName());
|
||||||
|
|
||||||
|
const volScalarField::Boundary& Tbf = T.boundaryField();
|
||||||
|
|
||||||
|
auto tq = tmp<FieldField<Field, scalar>>::New(Tbf.size());
|
||||||
|
auto& q = tq.ref();
|
||||||
|
|
||||||
|
forAll(q, patchi)
|
||||||
|
{
|
||||||
|
q.set(patchi, new Field<scalar>(Tbf[patchi].size(), Zero));
|
||||||
|
}
|
||||||
|
|
||||||
|
const auto* fluidPtr =
|
||||||
|
mesh.cfindObject<phaseSystem>("phaseProperties");
|
||||||
|
|
||||||
|
if (!fluidPtr)
|
||||||
|
{
|
||||||
|
FatalErrorInFunction
|
||||||
|
<< "Unable to find a valid phaseSystem to evaluate q" << nl
|
||||||
|
<< exit(FatalError);
|
||||||
|
}
|
||||||
|
|
||||||
|
const phaseSystem& fluid = *fluidPtr;
|
||||||
|
|
||||||
|
for (const label patchi : htcModelPtr_->patchSet())
|
||||||
|
{
|
||||||
|
for (const phaseModel& phase : fluid.phases())
|
||||||
|
{
|
||||||
|
const fvPatchScalarField& alpha = phase.boundaryField()[patchi];
|
||||||
|
const volScalarField& he = phase.thermo().he();
|
||||||
|
const volScalarField::Boundary& hebf = he.boundaryField();
|
||||||
|
|
||||||
|
q[patchi] +=
|
||||||
|
alpha*phase.alphaEff(patchi)()*hebf[patchi].snGrad();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add radiative heat flux contribution if present
|
||||||
|
|
||||||
|
const volScalarField* qrPtr =
|
||||||
|
mesh.cfindObject<volScalarField>(htcModelPtr_->qrName());
|
||||||
|
|
||||||
|
if (qrPtr)
|
||||||
|
{
|
||||||
|
const volScalarField::Boundary& qrbf = qrPtr->boundaryField();
|
||||||
|
|
||||||
|
for (const label patchi : htcModelPtr_->patchSet())
|
||||||
|
{
|
||||||
|
q[patchi] += qrbf[patchi];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return tq;
|
||||||
|
}
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||||
|
|
||||||
|
bool Foam::functionObjects::reactingEulerHtcModel::calc()
|
||||||
|
{
|
||||||
|
auto& htc =
|
||||||
|
htcModelPtr_->mesh().lookupObjectRef<volScalarField>(resultName_);
|
||||||
|
|
||||||
|
htcModelPtr_->calc(htc, q());
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::functionObjects::reactingEulerHtcModel::reactingEulerHtcModel
|
||||||
|
(
|
||||||
|
const word& name,
|
||||||
|
const Time& runTime,
|
||||||
|
const dictionary& dict
|
||||||
|
)
|
||||||
|
:
|
||||||
|
fieldExpression(name, runTime, dict),
|
||||||
|
htcModelPtr_(nullptr)
|
||||||
|
{
|
||||||
|
read(dict);
|
||||||
|
|
||||||
|
setResultName(typeName, name + ":htc:" + htcModelPtr_->type());
|
||||||
|
|
||||||
|
volScalarField* htcPtr =
|
||||||
|
new volScalarField
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
resultName_,
|
||||||
|
mesh_.time().timeName(),
|
||||||
|
mesh_,
|
||||||
|
IOobject::NO_READ,
|
||||||
|
IOobject::NO_WRITE
|
||||||
|
),
|
||||||
|
mesh_,
|
||||||
|
dimensionedScalar(dimPower/dimArea/dimTemperature, Zero)
|
||||||
|
);
|
||||||
|
|
||||||
|
mesh_.objectRegistry::store(htcPtr);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
bool Foam::functionObjects::reactingEulerHtcModel::read(const dictionary& dict)
|
||||||
|
{
|
||||||
|
if (fieldExpression::read(dict))
|
||||||
|
{
|
||||||
|
htcModelPtr_ = heatTransferCoeffModel::New(dict, mesh_, fieldName_);
|
||||||
|
|
||||||
|
htcModelPtr_->read(dict);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
@ -0,0 +1,122 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | www.openfoam.com
|
||||||
|
\\/ M anipulation |
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
Copyright (C) 2020 OpenCFD Ltd.
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
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
|
||||||
|
Foam::reactingEulerHtcModel
|
||||||
|
|
||||||
|
Description
|
||||||
|
A heat transfer coefficient for reactingEuler solvers
|
||||||
|
|
||||||
|
SourceFiles
|
||||||
|
reactingEulerHtcModel.C
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef reactingEulerHtcModel_H
|
||||||
|
#define reactingEulerHtcModel_H
|
||||||
|
|
||||||
|
#include "HashSet.H"
|
||||||
|
#include "volFields.H"
|
||||||
|
#include "fieldExpression.H"
|
||||||
|
#include "runTimeSelectionTables.H"
|
||||||
|
#include "heatTransferCoeffModel.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
namespace functionObjects
|
||||||
|
{
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
Class reactingEulerHtcModel Declaration
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
class reactingEulerHtcModel
|
||||||
|
:
|
||||||
|
public fieldExpression
|
||||||
|
{
|
||||||
|
// Private Data
|
||||||
|
|
||||||
|
//- Heat transfer coefficient model
|
||||||
|
autoPtr<heatTransferCoeffModel> htcModelPtr_;
|
||||||
|
|
||||||
|
|
||||||
|
protected:
|
||||||
|
|
||||||
|
// Protected Member Functions
|
||||||
|
|
||||||
|
//- Calculate the heat transfer coefficient field
|
||||||
|
// \return true on success
|
||||||
|
virtual bool calc();
|
||||||
|
|
||||||
|
//- Calculate heat flux
|
||||||
|
tmp<FieldField<Field, scalar>> q() const;
|
||||||
|
|
||||||
|
//- No copy construct
|
||||||
|
reactingEulerHtcModel(const reactingEulerHtcModel&) = delete;
|
||||||
|
|
||||||
|
//- No copy assignment
|
||||||
|
void operator=(const reactingEulerHtcModel&) = delete;
|
||||||
|
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
//- Runtime type information
|
||||||
|
TypeName("reactingEulerHtcModel");
|
||||||
|
|
||||||
|
|
||||||
|
// Constructors
|
||||||
|
|
||||||
|
//- Construct from components
|
||||||
|
reactingEulerHtcModel
|
||||||
|
(
|
||||||
|
const word& name,
|
||||||
|
const Time& runTime,
|
||||||
|
const dictionary& dict
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
//- Destructor
|
||||||
|
virtual ~reactingEulerHtcModel() = default;
|
||||||
|
|
||||||
|
|
||||||
|
// Member Functions
|
||||||
|
|
||||||
|
//- Read the heatTransferCoeff data
|
||||||
|
virtual bool read(const dictionary& dict);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace functionObjects
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
@ -49,4 +49,19 @@ adjustTimeStep no;
|
|||||||
|
|
||||||
maxCo 0.5;
|
maxCo 0.5;
|
||||||
|
|
||||||
|
functions
|
||||||
|
{
|
||||||
|
htc
|
||||||
|
{
|
||||||
|
type heatTransferCoeff;
|
||||||
|
libs (fieldFunctionObjects);
|
||||||
|
field T;
|
||||||
|
writeControl outputTime;
|
||||||
|
writeInterval 1;
|
||||||
|
htcModel fixedReferenceTemperature;
|
||||||
|
patches (ceiling);
|
||||||
|
TRef 373;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
|
@ -63,8 +63,8 @@ functions
|
|||||||
{
|
{
|
||||||
htc
|
htc
|
||||||
{
|
{
|
||||||
type heatTransferCoeff;
|
type reactingEulerHtcModel;
|
||||||
libs (fieldFunctionObjects);
|
libs (reactingEulerFoamFunctionObjects);
|
||||||
region water;
|
region water;
|
||||||
field T.liquid;
|
field T.liquid;
|
||||||
writeControl outputTime;
|
writeControl outputTime;
|
||||||
@ -94,7 +94,7 @@ functions
|
|||||||
|
|
||||||
operation areaAverage;
|
operation areaAverage;
|
||||||
|
|
||||||
fields ( heatTransferCoeff(T.liquid) );
|
fields ( reactingEulerHtcModel(T.liquid) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user