1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | foam-extend: Open Source CFD
4 \\ / O peration | Version: 3.2
5 \\ / A nd | Web: http://www.foam-extend.org
6 \\/ M anipulation | For copyright notice see file Copyright
7 -------------------------------------------------------------------------------
9 This file is part of foam-extend.
11 foam-extend is free software: you can redistribute it and/or modify it
12 under the terms of the GNU General Public License as published by the
13 Free Software Foundation, either version 3 of the License, or (at your
14 option) any later version.
16 foam-extend is distributed in the hope that it will be useful, but
17 WITHOUT ANY WARRANTY; without even the implied warranty of
18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 General Public License for more details.
21 You should have received a copy of the GNU General Public License
22 along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
25 Foam::fineMgFieldLevel
28 Fine multigrid field level. Allow for access to fvField at the fine level.
33 \*---------------------------------------------------------------------------*/
35 #ifndef fineMgFieldLevel_H
36 #define fineMgFieldLevel_H
38 #include "mgFieldLevel.H"
39 #include "mgMeshLevel.H"
40 #include "volFields.H"
41 #include "surfaceFields.H"
43 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
48 /*---------------------------------------------------------------------------*\
49 Class fineMgFieldLevel Declaration
50 \*---------------------------------------------------------------------------*/
52 class fineMgFieldLevel
58 // reference to fine mesh level
59 const mgMeshLevel& meshLevel_;
61 // reference to fine mesh
67 //- Number of internal face
68 label nInternalFaces_;
71 // Primitive variables
74 const volScalarField& p_;
77 const volVectorField& U_;
80 const volScalarField& T_;
83 volScalarField const Cv_;
86 volScalarField const R_;
92 const volScalarField& rhoRes_;
95 const volVectorField& rhoURes_;
98 const volScalarField& rhoERes_;
104 surfaceScalarField& rhoFlux_;
107 surfaceVectorField& rhoUFlux_;
110 surfaceScalarField& rhoEFlux_;
113 // Conservative variables
116 volScalarField& rho_;
119 volVectorField& rhoU_;
122 volScalarField& rhoE_;
130 // Private Member Functions
132 //- Disallow default bitwise copy construct
133 fineMgFieldLevel(const fineMgFieldLevel&);
135 //- Disallow default bitwise assignment
136 void operator=(const fineMgFieldLevel&);
141 //- Runtime type information
142 TypeName("fineMgFieldLevel");
147 //- Construct from mesh
150 const mgMeshLevel& fineMeshLevel,
151 const volScalarField& p,
152 const volVectorField& U,
153 const volScalarField& T,
154 const volScalarField& Cv,
155 const volScalarField& R,
156 const volScalarField& rhoRes,
157 const volVectorField& rhoURes,
158 const volScalarField& rhoERes,
159 surfaceScalarField& rhoFlux,
160 surfaceVectorField& rhoUFlux,
161 surfaceScalarField& rhoEFlux,
163 volVectorField& rhoU,
167 meshLevel_(fineMeshLevel),
168 mesh_(fineMeshLevel.mesh()),
169 nCells_(fineMeshLevel.nCells()),
170 nInternalFaces_(fineMeshLevel.nInternalFaces()),
191 virtual ~fineMgFieldLevel()
197 //- Is this the finest level?
198 virtual bool finest() const
200 return meshLevel_.finest();
205 //- Return number of cells
206 virtual label nCells() const
208 return mesh_.nCells();
211 //- Return number of internal faces
212 virtual label nInternalFaces() const
214 return mesh_.nInternalFaces();
217 //- Return number of patches
218 virtual label nPatches() const
220 return mesh_.boundary().size();
223 //- Access to child array
224 virtual const labelList& child() const
226 return meshLevel_.child();
229 //- Access to fine level
230 virtual const mgFieldLevel& fineLevel() const
240 virtual const scalarField& pVar() const
242 return p_.internalField();
245 virtual const volScalarField& p() const
250 //- Return p value for patches
251 virtual const scalarField& patchP
256 return p_.boundaryField()[patchNo];
260 virtual const vectorField& UVar() const
262 return U_.internalField();
265 virtual const volVectorField& U() const
270 //- Return U value for patches
271 virtual const vectorField& patchU
276 return U_.boundaryField()[patchNo];
280 virtual const scalarField& TVar() const
282 return T_.internalField();
285 virtual const volScalarField& T() const
290 //- Return T value for patches
291 virtual const scalarField& patchT
296 return T_.boundaryField()[patchNo];
300 virtual const scalarField& CvVar() const
302 return Cv_.internalField();
305 virtual const volScalarField& Cv() const
310 //- Return p value for patches
311 virtual const scalarField& patchCv
316 return Cv_.boundaryField()[patchNo];
320 virtual const scalarField& RVar() const
322 return R_.internalField();
325 virtual const volScalarField& R() const
330 //- Return p value for patches
331 virtual const scalarField& patchR
336 return R_.boundaryField()[patchNo];
342 //- Access to rhoFlux field
343 virtual surfaceScalarField& rhoFlux() const
348 //- Access to rhoUFlux field
349 virtual surfaceVectorField& rhoUFlux() const
354 //- Access to rhoEFlux field
355 virtual surfaceScalarField& rhoEFlux() const
363 //- Access to rhoRes field
364 virtual const volScalarField& rhoRes() const
369 virtual const scalarField& rhoResVar() const
371 return rhoRes_.internalField();
374 virtual const scalarField& patchRhoRes
379 return rhoRes_.boundaryField()[patchNo];
382 //- Access to rhoURes field
383 virtual const volVectorField& rhoURes() const
388 virtual const vectorField& rhoUResVar() const
390 return rhoURes_.internalField();
393 virtual const vectorField& patchRhoURes
398 return rhoURes_.boundaryField()[patchNo];
401 //- Access to rhoERes field
402 virtual const volScalarField& rhoERes() const
407 virtual const scalarField& rhoEResVar() const
409 return rhoERes_.internalField();
412 virtual const scalarField& patchRhoERes
417 return rhoERes_.boundaryField()[patchNo];
421 // Conservative variables
423 //- Access to rho field
424 virtual const volScalarField& rho() const
429 virtual const scalarField& rhoVar() const
431 return rho_.internalField();
434 virtual const scalarField& patchRho
439 return rho_.boundaryField()[patchNo];
442 //- Access to rhoU field
443 virtual const volVectorField& rhoU() const
448 virtual const vectorField& rhoUVar() const
450 return rhoU_.internalField();
453 virtual const vectorField& patchRhoU
458 return rhoU_.boundaryField()[patchNo];
461 //- Access to rhoE field
462 virtual const volScalarField& rhoE() const
467 virtual const scalarField& rhoEVar() const
469 return rhoE_.internalField();
472 virtual const scalarField& patchRhoE
477 return rhoE_.boundaryField()[patchNo];
480 //- Access to helper data
481 virtual label const& level() const
489 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
491 } // End namespace Foam
493 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
497 // ************************************************************************* //