Test-graphXi.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 #include "OFstream.H"
34 #include "mathematicalConstants.H"
35 
36 using namespace Foam;
37 
38 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
39 
40 int main()
41 {
42  scalarField x(100);
43  scalarField r(x.size());
44 
45  forAll(x, i)
46  {
47  x[i] = -3 + 0.06*i;
48  }
49 
50  scalarField b(0.5*(1.0 + erf(x)));
51  scalarField c(1.0 - b);
53  scalarField lapb(-2*x*gradb);
54 
55  r = lapb*b*c/(gradb*gradb);
56 
57 
58  graph("r", "x", "r", x, r).write("r", "xmgr");
59 
60  Info<< "end" << endl;
61 
62  return 0;
63 }
64 
65 
66 // ************************************************************************* //
mathematicalConstants.H
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
Foam::endl
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:251
Foam::exp
dimensionedScalar exp(const dimensionedScalar &ds)
Definition: dimensionedScalar.C:252
Foam::erf
dimensionedScalar erf(const dimensionedScalar &ds)
Definition: dimensionedScalar.C:267
OFstream.H
Foam::constant::physicoChemical::b
const dimensionedScalar b
Wien displacement law constant: default SI units: [m.K].
Definition: createFields.H:28
Foam::Field
Pre-declare SubField and related Field type.
Definition: Field.H:57
Foam::Info
messageStream Info
Foam::graph::write
void write(Ostream &, const word &format) const
Write graph to stream in given format.
Definition: graph.C:221
Foam
Namespace for OpenFOAM.
Definition: combustionModel.C:30
Foam::sqr
dimensionedSymmTensor sqr(const dimensionedVector &dv)
Definition: dimensionedSymmTensor.C:49
Foam::sqrt
dimensionedScalar sqrt(const dimensionedScalar &ds)
Definition: dimensionedScalar.C:142
x
x
Definition: LISASMDCalcMethod2.H:52
graph.H
Foam::constant::mathematical::pi
const scalar pi(M_PI)
Foam::constant::universal::c
const dimensionedScalar c
Speed of light in a vacuum.
main
int main()
Definition: Test-graphXi.C:37