Test-graph.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 Application
25  graphTest
26 
27 Description
28  Test program for making graphs
29 
30 \*---------------------------------------------------------------------------*/
31 
32 #include "graph.H"
33 
34 using namespace Foam;
35 
36 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
37 
38 int main()
39 {
40  scalarField alpha(200);
41  scalarField phie(alpha.size());
42  scalarField phic(alpha.size());
43 
44  forAll(alpha, i)
45  {
46  alpha[i] = scalar(i)/50.0;
47  }
48 
49  scalar R = 5.0;
50 
51  phie = (R - 1)/(sqrt(R/(alpha + 1.0e-6)) + 1.0) + 1.0;
52  phic = (R - 1)/(sqrt(R*alpha) + 1.0) + 1.0;
53 
54 
55  graph phi("@f! (R = 5)", "@a!", "@f!", alpha);
56  phi.insert
57  (
58  "@f!&e!", new curve("@f!&e!", curve::curveStyle::CONTINUOUS, phie)
59  );
60  phi.insert
61  (
62  "@f!&c!", new curve("@f!&c!", curve::curveStyle::CONTINUOUS, phic)
63  );
64  phi.write("phi", "xmgr");
65 
66  Info<< "end" << endl;
67 }
68 
69 
70 // ************************************************************************* //
Foam::graph
Class to create, store and output qgraph files.
Definition: graph.H:58
forAll
#define forAll(list, i)
Loop across all elements in list.
Definition: UList.H:406
phi
surfaceScalarField & phi
Definition: setRegionFluidFields.H:8
Foam::constant::atomic::alpha
const dimensionedScalar alpha
Fine-structure constant: default SI units: [].
Definition: readThermalProperties.H:216
Foam::endl
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:251
main
int main()
Definition: Test-graph.C:35
R
#define R(A, B, C, D, E, F, K, M)
Foam::Field
Pre-declare SubField and related Field type.
Definition: Field.H:57
Foam::Info
messageStream Info
Foam
Namespace for OpenFOAM.
Definition: combustionModel.C:30
Foam::e
const double e
Elementary charge.
Definition: doubleFloat.H:94
phic
phic
Definition: alphaEqnsSubCycle.H:5
Foam::curve::curveStyle::CONTINUOUS
@ CONTINUOUS
Definition: curve.H:72
Foam::sqrt
dimensionedScalar sqrt(const dimensionedScalar &ds)
Definition: dimensionedScalar.C:142
graph.H
Foam::curve
A single curve in a graph.
Definition: curve.H:56