FreeFOAM The Cross-Platform CFD Toolkit
phaseModel.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 
26 #include "phaseModel.H"
29 
30 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
31 
33 (
34  const fvMesh& mesh,
35  const dictionary& transportProperties,
36  const word& phaseName
37 )
38 :
39  dict_
40  (
41  transportProperties.subDict("phase" + phaseName)
42  ),
43  name_(phaseName),
44  d_
45  (
46  dict_.lookup("d")
47  ),
48  nu_
49  (
50  dict_.lookup("nu")
51  ),
52  rho_
53  (
54  dict_.lookup("rho")
55  ),
56  U_
57  (
58  IOobject
59  (
60  "U" + phaseName,
61  mesh.time().timeName(),
62  mesh,
63  IOobject::MUST_READ,
64  IOobject::AUTO_WRITE
65  ),
66  mesh
67  )
68 {
69  const word phiName = "phi" + phaseName;
70 
71  IOobject phiHeader
72  (
73  phiName,
74  mesh.time().timeName(),
75  mesh,
76  IOobject::NO_READ
77  );
78 
79  if (phiHeader.headerOk())
80  {
81  Info<< "Reading face flux field " << phiName << endl;
82 
83  phiPtr_.reset
84  (
86  (
87  IOobject
88  (
89  phiName,
90  mesh.time().timeName(),
91  mesh,
92  IOobject::MUST_READ,
93  IOobject::AUTO_WRITE
94  ),
95  mesh
96  )
97  );
98  }
99  else
100  {
101  Info<< "Calculating face flux field " << phiName << endl;
102 
103  wordList phiTypes
104  (
105  U_.boundaryField().size(),
106  calculatedFvPatchScalarField::typeName
107  );
108 
109  for (label i=0; i<U_.boundaryField().size(); i++)
110  {
111  if (isA<fixedValueFvPatchVectorField>(U_.boundaryField()[i]))
112  {
113  phiTypes[i] = fixedValueFvPatchScalarField::typeName;
114  }
115  }
116 
117  phiPtr_.reset
118  (
120  (
121  IOobject
122  (
123  phiName,
124  mesh.time().timeName(),
125  mesh,
126  IOobject::NO_READ,
127  IOobject::AUTO_WRITE
128  ),
129  fvc::interpolate(U_) & mesh.Sf(),
130  phiTypes
131  )
132  );
133  }
134 }
135 
136 
138 (
139  const fvMesh& mesh,
140  const dictionary& transportProperties,
141  const word& phaseName
142 )
143 {
144  return autoPtr<phaseModel>
145  (
146  new phaseModel(mesh, transportProperties, phaseName)
147  );
148 }
149 
150 
151 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
152 
154 {}
155 
156 
157 // ************************ vim: set sw=4 sts=4 et: ************************ //