Go to the documentation of this file.
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(),
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].internalField() =
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++)
259 scalar kf =
R.kf(
p,
T,
c1);
261 const label Nl =
R.lhs().size();
266 const scalar
exp =
R.lhs()[si].exponent;
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++)
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);
381 label sj =
R.lhs()[j].index;
385 label si =
R.lhs()[i].index;
386 scalar
exp =
R.lhs()[i].exponent;
407 Info<<
"Solid reactions have only elements on slhs"
415 label si =
R.lhs()[i].index;
420 label si =
R.rhs()[i].index;
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>
629 "Hs_" + pyrolisisGases_[index],
630 this->mesh_.time().timeName(),
638 zeroGradientFvPatchScalarField::typeName
644 const GasThermo&
mixture = gasThermo_[index];
648 gasHs[cellI] =
mixture.Hs(
p[cellI],
T[cellI]);
655 template<
class CompType,
class Sol
idThermo,
class GasThermo>
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
volScalarField w(IOobject("w", runTime.timeName(), mesh, IOobject::READ_IF_PRESENT, IOobject::NO_WRITE), mesh, dimensionedScalar("w", dimensionSet(0, 0, 0, 0, 0, 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
A class for handling words, derived from string.
#define forAll(list, i)
Loop across all elements in list.
A class for managing temporary objects.
const dimensionSet dimEnergy
virtual const volScalarField & T() const
Temperature [K].
const dimensionedVector & g
Ostream & endl(Ostream &os)
Add newline and flush stream.
dimensionedScalar exp(const dimensionedScalar &ds)
virtual void jacobian(const scalar t, const scalarField &c, scalarField &dcdt, scalarSquareMatrix &dfdc) const
Calculate the Jacobian of the system.
dimensioned< scalar > mag(const dimensioned< Type > &)
bool headerOk()
Read and check header info.
virtual label nEqns() const
Number of ODE's to solve.
const word dictName("particleTrackDict")
Fundamental solid thermodynamic properties.
#define NotImplemented
Issue a FatalErrorIn for a function not currently implemented.
const dimensionSet dimTime(0, 0, 1, 0, 0, 0, 0)
#define R(A, B, C, D, E, F, K, M)
const dimensionedScalar c1
First radiation constant: default SI units: [W/m2].
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Pre-declare SubField and related Field type.
virtual scalar solve(const scalar deltaT)
Solve the reaction system for the given time step.
Extends base solid chemistry model by adding a thermo package, and ODE functions. Introduces chemistr...
virtual void derivatives(const scalar t, const scalarField &c, scalarField &dcdt) const
Calculate the derivatives in dydx.
pyrolysisChemistryModel(const fvMesh &mesh, const word &phaseName)
Construct from mesh and phase name.
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].
A list of keyword definitions, which are a keyword followed by any number of values (e....
Generic dimensioned Type class.
virtual tmp< volScalarField > rho() const
Density [kg/m^3].
Mesh data needed to do the Finite Volume discretisation.
const dimensionSet dimMass(1, 0, 0, 0, 0, 0, 0)
const dimensionedScalar c2
Second radiation constant: default SI units: [m.K].
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.
Ostream & indent(Ostream &os)
Indent stream.
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))
dimensioned< Type > max(const dimensioned< Type > &, const dimensioned< Type > &)
virtual void calculate()
Calculates the reaction rates.
virtual ~pyrolysisChemistryModel()
Destructor.
const dimensionedScalar c
Speed of light in a vacuum.
virtual volScalarField & p()
Pressure [Pa].
const dimensionSet dimVolume(pow3(dimLength))
Generic GeometricField class.
Simple extension of ReactionThermo to handle reaction kinetics in addition to the equilibrium thermod...
dimensioned< Type > min(const dimensioned< Type > &, const dimensioned< Type > &)
word name(const complex &)
Return a string representation of a complex.
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...