readInitialConditions.H
Go to the documentation of this file.
1 
2  const label nSpecie = Y.size();
3  const scalarList W(::W(thermo));
4 
7 
8  dictionary fractions(initialConditions.subDict("fractions"));
9  if (fractionBasis == "mole")
10  {
11  forAll(Y, i)
12  {
13  const word& name = Y[i].name();
14  if (fractions.found(name))
15  {
16  X0[i] = fractions.lookup<scalar>(name);
17  }
18  }
19 
20  scalar mw = 0.0;
21  const scalar mTot = sum(X0);
22  forAll(Y, i)
23  {
24  X0[i] /= mTot;
25  mw += W[i]*X0[i];
26  }
27 
28  forAll(Y, i)
29  {
30  Y0[i] = X0[i]*W[i]/mw;
31  }
32  }
33  else // mass fraction
34  {
35  forAll(Y, i)
36  {
37  const word& name = Y[i].name();
38  if (fractions.found(name))
39  {
40  Y0[i] = fractions.lookup<scalar>(name);
41  }
42  }
43 
44  scalar invW = 0.0;
45  const scalar mTot = sum(Y0);
46  forAll(Y, i)
47  {
48  Y0[i] /= mTot;
49  invW += Y0[i]/W[i];
50  }
51  const scalar mw = 1.0/invW;
52 
53  forAll(Y, i)
54  {
55  X0[i] = Y0[i]*mw/W[i];
56  }
57  }
58 
59  // const scalar h0 = ::h0(thermo, Y0, p[0], T0);
60 
61  // forAll(Y, i)
62  // {
63  // Y[i] = Y0[i];
64  // }
65 
66  // thermo.he() = dimensionedScalar(dimEnergy/dimMass, h0);
67  // thermo.correct();
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Definition: label.H:59
List< scalar > scalarList
A List of scalars.
Definition: scalarList.H:50
dimensioned< Type > sum(const DimensionedField< Type, GeoMesh, PrimitiveField > &df)
word name(const LagrangianState state)
Return a string representation of a Lagrangian state enumeration.
forAll(Y, i)
dictionary fractions(initialConditions.subDict("fractions"))
const scalar mTot
const scalarList W(::W(thermo))
const scalar mw
const label nSpecie
scalarList X0(nSpecie, 0.0)
scalarList Y0(nSpecie, 0.0)
PtrList< volScalarField > & Y
fluidMulticomponentThermo & thermo
Definition: createFields.H:15