FreeFOAM The Cross-Platform CFD Toolkit
Hosted by SourceForge:
Get FreeFOAM at SourceForge.net.
            Fast, secure and Free Open Source software downloads

basicMultiComponentMixture.C

Go to the documentation of this file.
00001 /*---------------------------------------------------------------------------*\
00002   =========                 |
00003   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
00004    \\    /   O peration     |
00005     \\  /    A nd           | Copyright (C) 1991-2010 OpenCFD Ltd.
00006      \\/     M anipulation  |
00007 -------------------------------------------------------------------------------
00008 License
00009     This file is part of OpenFOAM.
00010 
00011     OpenFOAM is free software: you can redistribute it and/or modify it
00012     under the terms of the GNU General Public License as published by
00013     the Free Software Foundation, either version 3 of the License, or
00014     (at your option) any later version.
00015 
00016     OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
00017     ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00018     FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
00019     for more details.
00020 
00021     You should have received a copy of the GNU General Public License
00022     along with OpenFOAM.  If not, see <http://www.gnu.org/licenses/>.
00023 
00024 \*---------------------------------------------------------------------------*/
00025 
00026 #include "basicMultiComponentMixture.H"
00027 
00028 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
00029 
00030 Foam::basicMultiComponentMixture::basicMultiComponentMixture
00031 (
00032     const dictionary& thermoDict,
00033     const wordList& specieNames,
00034     const fvMesh& mesh
00035 )
00036 :
00037     species_(specieNames),
00038     Y_(species_.size())
00039 {
00040     forAll(species_, i)
00041     {
00042         IOobject header
00043         (
00044             species_[i],
00045             mesh.time().timeName(),
00046             mesh,
00047             IOobject::NO_READ
00048         );
00049 
00050         // check if field exists and can be read
00051         if (header.headerOk())
00052         {
00053             Y_.set
00054             (
00055                 i,
00056                 new volScalarField
00057                 (
00058                     IOobject
00059                     (
00060                         species_[i],
00061                         mesh.time().timeName(),
00062                         mesh,
00063                         IOobject::MUST_READ,
00064                         IOobject::AUTO_WRITE
00065                     ),
00066                     mesh
00067                 )
00068             );
00069         }
00070         else
00071         {
00072             volScalarField Ydefault
00073             (
00074                 IOobject
00075                 (
00076                     "Ydefault",
00077                     mesh.time().timeName(),
00078                     mesh,
00079                     IOobject::MUST_READ,
00080                     IOobject::NO_WRITE
00081                 ),
00082                 mesh
00083             );
00084 
00085             Y_.set
00086             (
00087                 i,
00088                 new volScalarField
00089                 (
00090                     IOobject
00091                     (
00092                         species_[i],
00093                         mesh.time().timeName(),
00094                         mesh,
00095                         IOobject::NO_READ,
00096                         IOobject::AUTO_WRITE
00097                     ),
00098                     Ydefault
00099                 )
00100             );
00101         }
00102     }
00103 
00104     // Do not enforce constraint of sum of mass fractions to equal 1 here
00105     // - not applicable to all models
00106 }
00107 
00108 
00109 // ************************ vim: set sw=4 sts=4 et: ************************ //
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines