BUG: thermoCoupleProbes - can only create the solver after setting the number of samples

This commit is contained in:
Andrew Heather
2016-10-25 14:25:40 +01:00
parent 2f2fa53b09
commit 85e2b7e94b
3 changed files with 20 additions and 20 deletions

View File

@ -55,14 +55,11 @@ Foam::functionObjects::thermoCoupleProbes::thermoCoupleProbes
: :
probes(name, runTime, dict, loadFromFiles, false), probes(name, runTime, dict, loadFromFiles, false),
ODESystem(), ODESystem(),
UName_(dict.lookup("U")), UName_(dict.lookupOrDefault<word>("U", "U")),
radiationFieldName_(dict.lookup("radiationField")), radiationFieldName_(dict.lookup("radiationField")),
thermo_ thermo_(mesh_.lookupObject<fluidThermo>(basicThermo::dictName)),
( odeSolver_(nullptr),
mesh_.lookupObject<fluidThermo>(basicThermo::dictName) Ttc_()
),
odeSolver_(ODESolver::New(*this, dict)),
Ttc_(this->size(), 0.0)
{ {
if (readFields) if (readFields)
{ {
@ -75,6 +72,10 @@ Foam::functionObjects::thermoCoupleProbes::thermoCoupleProbes
{ {
Ttc_ = probes::sample(thermo_.T()); 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_); scalar volume = (4/3)*constant::mathematical::pi*pow3(0.5*d_);
dydx = 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); / (rho_*Cp_*volume);
} }

View File

@ -77,8 +77,8 @@ SourceFiles
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#ifndef functionObjects_hermoCoupleProbes_H #ifndef functionObjects_thermoCoupleProbes_H
#define functionObjects_hermoCoupleProbes_H #define functionObjects_thermoCoupleProbes_H
#include "probes.H" #include "probes.H"
#include "ODESystem.H" #include "ODESystem.H"
@ -184,20 +184,21 @@ public:
virtual void derivatives virtual void derivatives
( (
const scalar t, const scalar x,
const scalarField& c, const scalarField& y,
scalarField& dcdt scalarField& dydx
) const; ) const;
virtual void jacobian virtual void jacobian
( (
const scalar t, const scalar t,
const scalarField& c, const scalarField& y,
scalarField& dcdt, scalarField& dfdt,
scalarSquareMatrix& dfdc scalarSquareMatrix& dfdy
) const; ) const;
//- Public members
// Public Member Functions
//- Sample and write //- Sample and write
virtual bool write(); virtual bool write();
@ -209,6 +210,7 @@ public:
virtual bool read(const dictionary&); virtual bool read(const dictionary&);
}; };
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace functionObjects } // End namespace functionObjects

View File

@ -23,9 +23,6 @@ License
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "thermoCoupleProbes.H"
#include "volFields.H"
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
template<class Type> template<class Type>