Test-fieldDependency.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) 2011 OpenFOAM Foundation
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 Description
25  Test field dependencies.
26 
27 \*---------------------------------------------------------------------------*/
28 
29 #include "argList.H"
30 #include "Time.H"
31 #include "volFields.H"
32 
33 using namespace Foam;
34 
35 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
36 
37 // Main program:
38 
39 int main(int argc, char *argv[])
40 {
41  #include "setRootCase.H"
42  #include "createTime.H"
43  #include "createMesh.H"
44 
45  Info<< "Creating field T\n" << endl;
47  (
48  IOobject
49  (
50  "T",
51  runTime.timeName(),
52  mesh,
55  ),
56  mesh,
57  dimensionedScalar("zero", dimless, 0)
58  );
59 
60  Info<< "Creating field p\n" << endl;
62  (
63  IOobject
64  (
65  "p",
66  runTime.timeName(),
67  mesh,
70  ),
71  mesh,
72  dimensionedScalar("zero", dimless, 0)
73  );
74 
75 
76  Info<< "p.eventNo:" << p.eventNo() << endl;
77  Info<< "p.uptodate:" << p.upToDate(T)<< endl;
78 
79  // Change T and mark as uptodate.
80  Info<< "Changing T" << endl;
81  T = 0.0;
82  T.setUpToDate();
83  Info<< "T.eventNo:" << T.eventNo() << endl;
84 
85  // Check p dependency:
86  Info<< "p.uptodate:" << p.upToDate(T)<< endl;
87 
88  // Change p and mark as uptodate.
89  Info<< "Changing p." << endl;
90  p.setUpToDate();
91  Info<< "p.uptodate:" << p.upToDate(T)<< endl;
92  Info<< "p.eventNo:" << p.eventNo() << endl;
93 
94 
95  Info<< "End\n" << endl;
96 
97  return 0;
98 }
99 
100 
101 // ************************************************************************* //
volFields.H
Foam::IOobject
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
Definition: IOobject.H:91
Foam::dimless
const dimensionSet dimless(0, 0, 0, 0, 0, 0, 0)
Definition: dimensionSets.H:47
p
p
Definition: pEqn.H:62
Foam::IOobject::AUTO_WRITE
@ AUTO_WRITE
Definition: IOobject.H:117
Foam::endl
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:251
Foam::IOobject::NO_READ
@ NO_READ
Definition: IOobject.H:111
Foam::Info
messageStream Info
argList.H
Foam::T
void T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)
Definition: FieldFieldFunctions.C:55
main
int main(int argc, char *argv[])
Definition: Test-fieldDependency.C:39
mesh
dynamicFvMesh & mesh
Definition: createDynamicFvMesh.H:18
Foam::dimensioned
Generic dimensioned Type class.
Definition: dimensionedScalarFwd.H:41
Foam
Namespace for OpenFOAM.
Definition: combustionModel.C:30
setRootCase.H
createMesh.H
createTime.H
Foam::GeometricField
Generic GeometricField class.
Definition: surfaceFieldsFwd.H:52