32 template<
class CompType,
class Sol
idThermo,
class GasThermo>
41 pyrolisisGases_(this->reactions_[0].gasSpecies()),
42 gasThermo_(pyrolisisGases_.size()),
43 nGases_(pyrolisisGases_.size()),
44 nSpecie_(this->Ys_.size() + nGases_),
54 this->Ys_[fieldi].
name() +
"0",
55 mesh.time().timeName(),
61 if (header.headerOk())
70 this->Ys_[fieldi].
name() +
"0",
71 mesh.time().timeName(),
87 mesh.time().timeName(),
102 this->Ys_[fieldi].
name() +
"0",
103 mesh.time().timeName(),
113 Ys0_[fieldi].primitiveFieldRef() =
115 *
max(this->Ys_[fieldi], scalar(0.001))*mesh.V();
128 "RRg." + pyrolisisGases_[fieldi],
129 mesh.time().timeName(),
146 ).subDict(pyrolisisGases_[gasI]);
151 new GasThermo(thermoDict)
155 Info<<
"pyrolysisChemistryModel: " <<
nl;
156 Info<<
indent <<
"Number of solids = " << this->nSolids_ <<
nl;
158 forAll(this->reactions_, i)
160 Info<< dynamic_cast<const solidReaction<SolidThermo>& >
170 template<
class CompType,
class Sol
idThermo,
class GasThermo>
178 template<
class CompType,
class Sol
idThermo,
class GasThermo>
188 scalar pf, cf, pr, cr;
191 const label celli = cellCounter_;
195 forAll(this->reactions_, i)
199 scalar omegai = omega
201 R, c, T, p, pf, cf, lRef, pr, cr, rRef
208 rhoL = this->solidThermo_[si].rho(p, T);
214 scalar rhoR = this->solidThermo_[si].rho(p, T);
220 Ys0_[si][celli] += sr*omegai;
226 om[gi + this->nSolids_] += (1.0 - sr)*omegai;
234 template<
class CompType,
class Sol
idThermo,
class GasThermo>
252 label celli = cellCounter_;
254 for (
label i=0; i<nSpecie_; i++)
256 c1[i] =
max(0.0, c[i]);
259 scalar kf = R.
kf(p, T, c1);
266 const scalar
exp = R.
lhs()[si].exponent;
269 pow(c1[si]/Ys0_[si][celli], exp)
277 template<
class CompType,
class Sol
idThermo,
class GasThermo>
295 scalar w = omega(R, c, T, p, pf, cf, lRef, pr, cr, rRef);
300 template<
class CompType,
class Sol
idThermo,
class GasThermo>
309 const scalar T = c[nSpecie_];
310 const scalar p = c[nSpecie_ + 1];
314 dcdt = omega(c, T, p);
318 for (
label i=0; i<this->nSolids_; i++)
325 for (
label i=0; i<this->nSolids_; i++)
327 scalar dYidt = dcdt[i]/cTot;
328 scalar Yi = c[i]/cTot;
329 newCp += Yi*this->solidThermo_[i].Cp(p, T);
330 newhi -= dYidt*this->solidThermo_[i].Hc();
333 scalar dTdt = newhi/newCp;
334 scalar dtMag =
min(500.0,
mag(dTdt));
335 dcdt[nSpecie_] = dTdt*dtMag/(
mag(dTdt) + 1.0e-10);
338 dcdt[nSpecie_ + 1] = 0.0;
342 template<
class CompType,
class Sol
idThermo,
class GasThermo>
352 const scalar T = c[nSpecie_];
353 const scalar p = c[nSpecie_ + 1];
357 for (
label i=0; i<this->nSolids_; i++)
359 c2[i] =
max(c[i], 0.0);
362 for (
label i=0; i<nEqns(); i++)
364 for (
label j=0; j<nEqns(); j++)
371 dcdt = omega(c2, T, p);
373 for (
label ri=0; ri<this->reactions_.size(); ri++)
377 scalar kf0 = R.
kf(p, T, c2);
386 scalar
exp = R.
lhs()[i].exponent;
393 kf *= exp*
pow(c2[si] + VSMALL, exp - 1.0);
402 kf *= exp*
pow(c2[si], exp - 1.0);
407 Info<<
"Solid reactions have only elements on slhs" 427 scalar
delta = 1.0e-8;
431 for (
label i=0; i<nEqns(); i++)
433 dfdc[i][nSpecie_] = 0.5*(dcdT1[i] - dcdT0[i])/delta;
439 template<
class CompType,
class Sol
idThermo,
class GasThermo>
444 return (nSpecie_ + 2);
448 template<
class CompType,
class Sol
idThermo,
class GasThermo>
452 if (!this->chemistry_)
473 this->RRs_[i].field() = 0.0;
478 RRg_[i].field() = 0.0;
483 cellCounter_ = celli;
485 const scalar
delta = this->
mesh().V()[celli];
487 if (this->reactingCells_[celli])
489 scalar rhoi = rho[celli];
494 for (
label i=0; i<this->nSolids_; i++)
496 c[i] = rhoi*this->Ys_[i][celli]*
delta;
503 this->RRs_[i][celli] = dcdt[i]/
delta;
508 RRg_[i][celli] = dcdt[this->nSolids_ + i]/
delta;
515 template<
class CompType,
class Sol
idThermo,
class GasThermo>
522 scalar deltaTMin = GREAT;
524 if (!this->chemistry_)
545 this->RRs_[i].field() = 0.0;
549 RRg_[i].field() = 0.0;
562 if (this->reactingCells_[celli])
564 cellCounter_ = celli;
566 scalar rhoi = rho[celli];
567 scalar
pi = p[celli];
568 scalar Ti = T[celli];
570 for (
label i=0; i<this->nSolids_; i++)
572 c[i] = rhoi*this->Ys_[i][celli]*delta[celli];
578 scalar timeLeft = deltaT;
581 while (timeLeft > SMALL)
583 scalar dt = timeLeft;
584 this->
solve(c, Ti, pi, dt, this->deltaTChem_[celli]);
588 deltaTMin =
min(this->deltaTChem_[celli], deltaTMin);
593 this->RRs_[i][celli] = dc[i]/(deltaT*delta[celli]);
598 RRg_[i][celli] = dc[this->nSolids_ + i]/(deltaT*delta[celli]);
602 dc = omega(c0, Ti, pi,
true);
607 deltaTMin =
min(deltaTMin, 2*deltaT);
613 template<
class CompType,
class Sol
idThermo,
class GasThermo>
628 "Hs_" + pyrolisisGases_[index],
629 this->mesh_.time().timeName(),
642 const GasThermo&
mixture = gasThermo_[index];
646 gasHs[celli] = mixture.Hs(p[celli], T[celli]);
653 template<
class CompType,
class Sol
idThermo,
class GasThermo>
const List< specieCoeffs > & lhs() const
virtual ~pyrolysisChemistryModel()
Destructor.
#define forAll(list, i)
Loop across all elements in list.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Ostream & indent(Ostream &os)
Indent stream.
virtual scalar omegaI(label iReaction, const scalarField &c, const scalar T, const scalar p, scalar &pf, scalar &cf, label &lRef, scalar &pr, scalar &cr, label &rRef) const
Return the reaction rate for iReaction.
virtual const List< specieCoeffs > & grhs() const
A list of keyword definitions, which are a keyword followed by any number of values (e...
dimensioned< Type > max(const dimensioned< Type > &, const dimensioned< Type > &)
virtual label nEqns() const
Number of ODE's to solve.
const dimensionedScalar c2
Second radiation constant: default SI units: [m.K].
Ostream & endl(Ostream &os)
Add newline and flush stream.
const List< specieCoeffs > & rhs() const
pyrolysisChemistryModel(const fvMesh &mesh, const word &phaseName)
Construct from mesh and phase name.
virtual void jacobian(const scalar t, const scalarField &c, scalarField &dcdt, scalarSquareMatrix &dfdc) const
Calculate the Jacobian of the system.
Extends base solid chemistry model by adding a thermo package, and ODE functions. Introduces chemistr...
Simple extension of ReactionThermo to handle reaction kinetics in addition to the equilibrium thermod...
virtual volScalarField & p()
Pressure [Pa].
virtual scalar kf(const scalar p, const scalar T, const scalarField &c) const
Forward rate constant.
virtual tmp< volScalarField > rho() const
Density [kg/m^3].
const dimensionSet dimVolume(pow3(dimLength))
gmvFile<< "tracers "<< particles.size()<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){gmvFile<< iter().position().x()<< " ";}gmvFile<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){gmvFile<< iter().position().y()<< " ";}gmvFile<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){gmvFile<< iter().position().z()<< " ";}gmvFile<< nl;forAll(lagrangianScalarNames, i){word name=lagrangianScalarNames[i];IOField< scalar > s(IOobject(name, runTime.timeName(), cloud::prefix, mesh, IOobject::MUST_READ, IOobject::NO_WRITE))
dimensionedScalar exp(const dimensionedScalar &ds)
A class for handling words, derived from string.
virtual void derivatives(const scalar t, const scalarField &c, scalarField &dcdt) const
Calculate the derivatives in dydx.
virtual scalar solve(const scalar deltaT)
Solve the reaction system for the given time step.
virtual const volScalarField & T() const
Temperature [K].
const dimensionedVector & g
Fundamental solid thermodynamic properties.
dimensioned< Type > min(const dimensioned< Type > &, const dimensioned< Type > &)
word name(const complex &)
Return a string representation of a complex.
const dimensionSet dimEnergy
dimensionedScalar pow(const dimensionedScalar &ds, const dimensionedScalar &expt)
virtual tmp< volScalarField > gasHs(const volScalarField &p, const volScalarField &T, const label i) const
Return sensible enthalpy for gas i [J/Kg].
word dictName("noiseDict")
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
Mesh data needed to do the Finite Volume discretisation.
const dimensionedScalar c
Speed of light in a vacuum.
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
const dimensionSet dimTime(0, 0, 1, 0, 0, 0, 0)
virtual scalarField omega(const scalarField &c, const scalar T, const scalar p, const bool updateC0=false) const
dc/dt = omega, rate of change in concentration, for each species
const dimensionedScalar c1
First radiation constant: default SI units: [W/m2].
dimensioned< scalar > mag(const dimensioned< Type > &)
const dimensionSet dimMass(1, 0, 0, 0, 0, 0, 0)
A class for managing temporary objects.
T & ref() const
Return non-const reference or generate a fatal error.
#define NotImplemented
Issue a FatalErrorIn for a function not currently implemented.
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
virtual void calculate()
Calculates the reaction rates.