From 85e2b7e94bea3d8a57dc3a818995546f45fab674 Mon Sep 17 00:00:00 2001 From: Andrew Heather Date: Tue, 25 Oct 2016 14:25:40 +0100 Subject: [PATCH] BUG: thermoCoupleProbes - can only create the solver after setting the number of samples --- .../thermoCoupleProbes/thermoCoupleProbes.C | 17 ++++++++-------- .../thermoCoupleProbes/thermoCoupleProbes.H | 20 ++++++++++--------- .../thermoCoupleProbesTemplates.C | 3 --- 3 files changed, 20 insertions(+), 20 deletions(-) diff --git a/src/functionObjects/utilities/thermoCoupleProbes/thermoCoupleProbes.C b/src/functionObjects/utilities/thermoCoupleProbes/thermoCoupleProbes.C index afe2072171..4a976d1b58 100644 --- a/src/functionObjects/utilities/thermoCoupleProbes/thermoCoupleProbes.C +++ b/src/functionObjects/utilities/thermoCoupleProbes/thermoCoupleProbes.C @@ -55,14 +55,11 @@ Foam::functionObjects::thermoCoupleProbes::thermoCoupleProbes : probes(name, runTime, dict, loadFromFiles, false), ODESystem(), - UName_(dict.lookup("U")), + UName_(dict.lookupOrDefault("U", "U")), radiationFieldName_(dict.lookup("radiationField")), - thermo_ - ( - mesh_.lookupObject(basicThermo::dictName) - ), - odeSolver_(ODESolver::New(*this, dict)), - Ttc_(this->size(), 0.0) + thermo_(mesh_.lookupObject(basicThermo::dictName)), + odeSolver_(nullptr), + Ttc_() { if (readFields) { @@ -75,6 +72,10 @@ Foam::functionObjects::thermoCoupleProbes::thermoCoupleProbes { Ttc_ = probes::sample(thermo_.T()); } + + // Note: can only create the solver once all samples have been found + // - the number of samples is used to set the size of the ODE system + odeSolver_ = ODESolver::New(*this, dict); } @@ -131,7 +132,7 @@ void Foam::functionObjects::thermoCoupleProbes::derivatives scalar volume = (4/3)*constant::mathematical::pi*pow3(0.5*d_); dydx = - (epsilon_*(G/4 - sigma*pow(y, 4.0))*area + htc*(Tc - y)*area) + (epsilon_*(G/4 - sigma*pow4(y))*area + htc*(Tc - y)*area) / (rho_*Cp_*volume); } diff --git a/src/functionObjects/utilities/thermoCoupleProbes/thermoCoupleProbes.H b/src/functionObjects/utilities/thermoCoupleProbes/thermoCoupleProbes.H index e237014402..47047b5183 100644 --- a/src/functionObjects/utilities/thermoCoupleProbes/thermoCoupleProbes.H +++ b/src/functionObjects/utilities/thermoCoupleProbes/thermoCoupleProbes.H @@ -77,8 +77,8 @@ SourceFiles \*---------------------------------------------------------------------------*/ -#ifndef functionObjects_hermoCoupleProbes_H -#define functionObjects_hermoCoupleProbes_H +#ifndef functionObjects_thermoCoupleProbes_H +#define functionObjects_thermoCoupleProbes_H #include "probes.H" #include "ODESystem.H" @@ -184,20 +184,21 @@ public: virtual void derivatives ( - const scalar t, - const scalarField& c, - scalarField& dcdt + const scalar x, + const scalarField& y, + scalarField& dydx ) const; virtual void jacobian ( const scalar t, - const scalarField& c, - scalarField& dcdt, - scalarSquareMatrix& dfdc + const scalarField& y, + scalarField& dfdt, + scalarSquareMatrix& dfdy ) const; - //- Public members + + // Public Member Functions //- Sample and write virtual bool write(); @@ -209,6 +210,7 @@ public: virtual bool read(const dictionary&); }; + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // } // End namespace functionObjects diff --git a/src/functionObjects/utilities/thermoCoupleProbes/thermoCoupleProbesTemplates.C b/src/functionObjects/utilities/thermoCoupleProbes/thermoCoupleProbesTemplates.C index 64877bf221..c92524b29e 100644 --- a/src/functionObjects/utilities/thermoCoupleProbes/thermoCoupleProbesTemplates.C +++ b/src/functionObjects/utilities/thermoCoupleProbes/thermoCoupleProbesTemplates.C @@ -23,9 +23,6 @@ License \*---------------------------------------------------------------------------*/ -#include "thermoCoupleProbes.H" -#include "volFields.H" - // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // template