Transferred copyright to the OpenFOAM Foundation
[OpenFOAM-2.0.x.git] / src / thermophysicalModels / reactionThermo / mixtures / basicMultiComponentMixture / basicMultiComponentMixture.C
blob2ad347e1506916dfa60eb74cc5ca85c3568b41ee
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
4    \\    /   O peration     |
5     \\  /    A nd           | Copyright (C) 2011 OpenFOAM Foundation
6      \\/     M anipulation  |
7 -------------------------------------------------------------------------------
8 License
9     This file is part of OpenFOAM.
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.
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.
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/>.
24 \*---------------------------------------------------------------------------*/
26 #include "basicMultiComponentMixture.H"
28 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
30 Foam::basicMultiComponentMixture::basicMultiComponentMixture
32     const dictionary& thermoDict,
33     const wordList& specieNames,
34     const fvMesh& mesh
37     species_(specieNames),
38     Y_(species_.size())
40     forAll(species_, i)
41     {
42         IOobject header
43         (
44             species_[i],
45             mesh.time().timeName(),
46             mesh,
47             IOobject::NO_READ
48         );
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             );
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     }
104     // Do not enforce constraint of sum of mass fractions to equal 1 here
105     // - not applicable to all models
109 // ************************************************************************* //