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),
ODESystem(),
UName_(dict.lookup("U")),
UName_(dict.lookupOrDefault<word>("U", "U")),
radiationFieldName_(dict.lookup("radiationField")),
thermo_
(
mesh_.lookupObject<fluidThermo>(basicThermo::dictName)
),
odeSolver_(ODESolver::New(*this, dict)),
Ttc_(this->size(), 0.0)
thermo_(mesh_.lookupObject<fluidThermo>(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);
}

View File

@ -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

View File

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