From f5f93e81d89b29783ef7a4855cbe6012e2d3714c Mon Sep 17 00:00:00 2001 From: mattijs <mattijs> Date: Mon, 6 Dec 2021 10:54:43 +0000 Subject: [PATCH] COMP: temperatureCoupledBase: make API consistent. Fixes #2287. --- .../temperatureCoupledBase.C | 21 +++++++++++------- .../temperatureCoupledBase.H | 9 ++++---- .../contactHeatFluxSource.H | 22 +++++++++++++++++++ 3 files changed, 40 insertions(+), 12 deletions(-) diff --git a/src/TurbulenceModels/compressible/turbulentFluidThermoModels/derivedFvPatchFields/temperatureCoupledBase/temperatureCoupledBase.C b/src/TurbulenceModels/compressible/turbulentFluidThermoModels/derivedFvPatchFields/temperatureCoupledBase/temperatureCoupledBase.C index f2b3bcd255c..c3651276f37 100644 --- a/src/TurbulenceModels/compressible/turbulentFluidThermoModels/derivedFvPatchFields/temperatureCoupledBase/temperatureCoupledBase.C +++ b/src/TurbulenceModels/compressible/turbulentFluidThermoModels/derivedFvPatchFields/temperatureCoupledBase/temperatureCoupledBase.C @@ -170,7 +170,7 @@ Foam::temperatureCoupledBase::temperatureCoupledBase void Foam::temperatureCoupledBase::autoMap ( - const FieldMapper& mapper + const fvPatchFieldMapper& mapper ) { if (kappaFunction1_) @@ -186,17 +186,22 @@ void Foam::temperatureCoupledBase::autoMap void Foam::temperatureCoupledBase::rmap ( - const temperatureCoupledBase& ptf, + const fvPatchField<scalar>& ptf, const labelList& addr ) { - if (kappaFunction1_) - { - kappaFunction1_().rmap(ptf.kappaFunction1_(), addr); - } - if (alphaFunction1_) + const auto* tcb = isA<temperatureCoupledBase>(ptf); + + if (tcb) { - alphaFunction1_().rmap(ptf.alphaFunction1_(), addr); + if (kappaFunction1_) + { + kappaFunction1_().rmap(tcb->kappaFunction1_(), addr); + } + if (alphaFunction1_) + { + alphaFunction1_().rmap(tcb->alphaFunction1_(), addr); + } } } diff --git a/src/TurbulenceModels/compressible/turbulentFluidThermoModels/derivedFvPatchFields/temperatureCoupledBase/temperatureCoupledBase.H b/src/TurbulenceModels/compressible/turbulentFluidThermoModels/derivedFvPatchFields/temperatureCoupledBase/temperatureCoupledBase.H index 65a759f7822..3e7eff8b762 100644 --- a/src/TurbulenceModels/compressible/turbulentFluidThermoModels/derivedFvPatchFields/temperatureCoupledBase/temperatureCoupledBase.H +++ b/src/TurbulenceModels/compressible/turbulentFluidThermoModels/derivedFvPatchFields/temperatureCoupledBase/temperatureCoupledBase.H @@ -87,6 +87,7 @@ SourceFiles #include "Enum.H" #include "fvPatch.H" #include "PatchFunction1.H" +#include "fvPatchFieldMapper.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -204,15 +205,15 @@ public: //- Map (and resize as needed) from self given a mapping object virtual void autoMap ( - const FieldMapper& - ); + const fvPatchFieldMapper& + ) = 0; //- Reverse map the given fvPatchField onto this fvPatchField virtual void rmap ( - const temperatureCoupledBase&, + const fvPatchField<scalar>&, const labelList& - ); + ) = 0; //- Given patch temperature calculate corresponding K field virtual tmp<scalarField> kappa(const scalarField& Tp) const; diff --git a/src/faOptions/sources/derived/contactHeatFluxSource/contactHeatFluxSource.H b/src/faOptions/sources/derived/contactHeatFluxSource/contactHeatFluxSource.H index b5aeb34bb39..fbc4c6c0a00 100644 --- a/src/faOptions/sources/derived/contactHeatFluxSource/contactHeatFluxSource.H +++ b/src/faOptions/sources/derived/contactHeatFluxSource/contactHeatFluxSource.H @@ -164,6 +164,28 @@ public: // Member Functions + // Mapping functions + + //- Map (and resize as needed) from self given a mapping object + virtual void autoMap + ( + const fvPatchFieldMapper& mapper + ) + { + temperatureCoupledBase::autoMap(mapper); + } + + //- Reverse map the given fvPatchField onto this fvPatchField + virtual void rmap + ( + const fvPatchField<scalar>& fld, + const labelList& map + ) + { + temperatureCoupledBase::rmap(fld, map); + } + + // Evaluation //- Add explicit contribution to compressible momentum equation -- GitLab