FreeFOAM The Cross-Platform CFD Toolkit
basicMultiComponentMixture.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) 1991-2010 OpenCFD Ltd.
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 
27 
28 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
29 
31 (
32  const dictionary& thermoDict,
33  const wordList& specieNames,
34  const fvMesh& mesh
35 )
36 :
37  species_(specieNames),
38  Y_(species_.size())
39 {
40  forAll(species_, i)
41  {
42  IOobject header
43  (
44  species_[i],
45  mesh.time().timeName(),
46  mesh,
47  IOobject::NO_READ
48  );
49 
50  // check if field exists and can be read
51  if (header.headerOk())
52  {
53  Y_.set
54  (
55  i,
56  new volScalarField
57  (
58  IOobject
59  (
60  species_[i],
61  mesh.time().timeName(),
62  mesh,
63  IOobject::MUST_READ,
64  IOobject::AUTO_WRITE
65  ),
66  mesh
67  )
68  );
69  }
70  else
71  {
72  volScalarField Ydefault
73  (
74  IOobject
75  (
76  "Ydefault",
77  mesh.time().timeName(),
78  mesh,
79  IOobject::MUST_READ,
80  IOobject::NO_WRITE
81  ),
82  mesh
83  );
84 
85  Y_.set
86  (
87  i,
88  new volScalarField
89  (
90  IOobject
91  (
92  species_[i],
93  mesh.time().timeName(),
94  mesh,
95  IOobject::NO_READ,
96  IOobject::AUTO_WRITE
97  ),
98  Ydefault
99  )
100  );
101  }
102  }
103 
104  // Do not enforce constraint of sum of mass fractions to equal 1 here
105  // - not applicable to all models
106 }
107 
108 
109 // ************************ vim: set sw=4 sts=4 et: ************************ //