basicSpecieMixture.C
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration |
5  \\ / A nd | Copyright (C) 2014-2016 OpenFOAM Foundation
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
11  OpenFOAM is free software: you can redistribute it and/or modify it
12  under the terms of the GNU General Public License as published by
13  the Free Software Foundation, either version 3 of the License, or
14  (at your option) any later version.
15 
16  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19  for more details.
20 
21  You should have received a copy of the GNU General Public License
22  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
23 
24 \*---------------------------------------------------------------------------*/
25 
26 #include "basicSpecieMixture.H"
27 
28 // * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * //
29 
30 namespace Foam
31 {
32  defineTypeNameAndDebug(basicSpecieMixture, 0);
33 }
34 
35 
36 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
37 
39 (
40  const dictionary& thermoDict,
41  const wordList& specieNames,
42  const fvMesh& mesh,
43  const word& phaseName
44 )
45 :
46  basicMultiComponentMixture(thermoDict, specieNames, mesh, phaseName)
47 {}
48 
49 
50 // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
51 
53 {
55 
57  (
58  new volScalarField
59  (
60  IOobject
61  (
62  IOobject::groupName("W", Y[0].group()),
63  Y[0].time().timeName(),
64  Y[0].mesh()
65  ),
66  Y[0].mesh(),
67  dimensionedScalar("zero", dimless, 0)
68  )
69  );
70 
71  volScalarField& rW = trW.ref();
72 
73  forAll(Y, i)
74  {
75  rW += Y[i]/W(i);
76  }
77 
78  rW = 1.0/rW;
79 
80  return trW;
81 }
82 
83 
84 // ************************************************************************* //
const char *const group
Group name for atomic constants.
#define forAll(list, i)
Loop across all elements in list.
Definition: UList.H:428
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:137
PtrList< volScalarField > & Y()
Return the mass-fraction fields.
dynamicFvMesh & mesh
A class for handling words, derived from string.
Definition: word.H:59
static word groupName(Name name, const word &group)
word timeName
Definition: getTimeIndex.H:3
defineTypeNameAndDebug(combustionModel, 0)
const dimensionSet dimless(0, 0, 0, 0, 0, 0, 0)
Definition: dimensionSets.H:47
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
A templated 1D list of pointers to objects of type <T>, where the size of the array is known and used...
Definition: List.H:62
PtrList< volScalarField > & Y
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:78
A class for managing temporary objects.
Definition: PtrList.H:54
T & ref() const
Return non-const reference or generate a fatal error.
Definition: tmpI.H:174
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
Definition: IOobject.H:91
basicSpecieMixture(const dictionary &, const wordList &specieNames, const fvMesh &, const word &)
Construct from dictionary, species names, mesh and phase name.
Namespace for OpenFOAM.
tmp< volScalarField > W() const
Molecular weight of the mixture [kg/kmol].