Loading...
Searching...
No Matches
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 | www.openfoam.com
6 \\/ M anipulation |
7-------------------------------------------------------------------------------
8 Copyright (C) 2011-2017 OpenFOAM Foundation
9-------------------------------------------------------------------------------
10License
11 This file is part of OpenFOAM.
12
13 OpenFOAM is free software: you can redistribute it and/or modify it
14 under the terms of the GNU General Public License as published by
15 the Free Software Foundation, either version 3 of the License, or
16 (at your option) any later version.
17
18 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21 for more details.
22
23 You should have received a copy of the GNU General Public License
24 along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25
26\*---------------------------------------------------------------------------*/
29
30// * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * //
31
32namespace Foam
33{
35}
36
37// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
38
40(
42 const wordList& specieNames,
43 const fvMesh& mesh,
44 const word& phaseName
45)
46:
47 basicMixture(thermoDict, mesh, phaseName),
48 species_(specieNames),
49 active_(species_.size(), true),
50 Y_(species_.size())
51{
52 tmp<volScalarField> tYdefault;
53
55 {
56 IOobject header
57 (
58 IOobject::groupName(species_[i], phaseName),
59 mesh.time().timeName(),
60 mesh,
62 );
63
64 // Check if field exists and can be read
65 if (header.typeHeaderOk<volScalarField>(true))
66 {
68 << "basicMultiComponentMixture: reading " << species_[i]
69 << endl;
70
71 Y_.set
72 (
73 i,
75 (
77 (
78 IOobject::groupName(species_[i], phaseName),
79 mesh.time().timeName(),
80 mesh,
83 ),
84 mesh
85 )
86 );
87 }
88 else
89 {
90 // Read Ydefault if not already read
91 if (!tYdefault.valid())
92 {
93 word YdefaultName(IOobject::groupName("Ydefault", phaseName));
94
95 IOobject timeIO
96 (
97 YdefaultName,
98 mesh.time().timeName(),
99 mesh,
103 );
104
105 IOobject constantIO
106 (
107 YdefaultName,
108 mesh.time().constant(),
109 mesh,
112 );
113
114 IOobject time0IO
115 (
116 YdefaultName,
118 mesh,
121 );
122
123 if (timeIO.typeHeaderOk<volScalarField>(true))
124 {
125 tYdefault = new volScalarField(timeIO, mesh);
126 }
127 else if (constantIO.typeHeaderOk<volScalarField>(true))
128 {
129 tYdefault = new volScalarField(constantIO, mesh);
130 }
131 else
132 {
133 tYdefault = new volScalarField(time0IO, mesh);
134 }
135 }
136
137 Y_.set
138 (
139 i,
141 (
142 IOobject
143 (
144 IOobject::groupName(species_[i], phaseName),
145 mesh.time().timeName(),
146 mesh,
149 ),
150 tYdefault()
151 )
152 );
153 }
154 }
155
156 // Do not enforce constraint of sum of mass fractions to equal 1 here
157 // - not applicable to all models
158}
159
160
161// ************************************************************************* //
@ NO_REGISTER
Do not request registration (bool: false).
@ NO_READ
Nothing to be read.
@ MUST_READ
Reading required.
@ NO_WRITE
Ignore writing from objectRegistry::writeObject().
@ AUTO_WRITE
Automatically write from objectRegistry::writeObject().
Defines the attributes of an object for which implicit objectRegistry management is supported,...
Definition IOobject.H:191
bool typeHeaderOk(const bool checkType=true, const bool search=true, const bool verbose=true)
Read header (respects is_globalIOobject trait) and check its info. A void type suppresses trait and t...
static word groupName(StringType base, const word &group)
Create dot-delimited name.group string.
static word timeName(const scalar t, const int precision=precision_)
Return a time name for the given scalar time value formatted with the given precision.
Definition Time.C:714
const word & timeName() const noexcept
The current time name.
Definition TimeStateI.H:30
Foam::basicMixture.
basicMixture(const dictionary &, const fvMesh &, const word &)
Construct from dictionary, mesh and phase name.
List< bool > active_
List of specie active flags.
basicMultiComponentMixture(const dictionary &thermoDict, const wordList &specieNames, const fvMesh &mesh, const word &phaseName)
Construct from dictionary, species names, mesh and phase name.
speciesTable species_
Table of specie names.
PtrList< volScalarField > Y_
Species mass fractions.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition dictionary.H:133
Mesh data needed to do the Finite Volume discretisation.
Definition fvMesh.H:85
A class for managing temporary objects.
Definition tmp.H:75
bool valid() const noexcept
Identical to good(), or bool operator.
Definition tmp.H:481
A class for handling words, derived from Foam::string.
Definition word.H:66
#define defineTypeNameAndDebug(Type, DebugSwitch)
Define the typeName and debug information.
Definition className.H:142
const dictionary & thermoDict
Definition EEqn.H:16
dynamicFvMesh & mesh
#define DebugInfo
Report an information message using Foam::Info.
Namespace for OpenFOAM.
List< word > wordList
List of word.
Definition fileName.H:60
GeometricField< scalar, fvPatchField, volMesh > volScalarField
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition Ostream.H:519
#define forAll(list, i)
Loop across all elements in list.
Definition stdFoam.H:299