Initial commit for version 2.0.x patch release
[OpenFOAM-2.0.x.git] / applications / test / graphXi / Test-graphXi.C
blob1e825372016a956215241990c1ff84fed7110aca
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
4    \\    /   O peration     |
5     \\  /    A nd           | Copyright (C) 2004-2010 OpenCFD Ltd.
6      \\/     M anipulation  |
7 -------------------------------------------------------------------------------
8 License
9     This file is part of OpenFOAM.
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.
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.
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/>.
24 Application
25     graphTest
27 Description
28     Test program for making graphs
30 \*---------------------------------------------------------------------------*/
32 #include "graph.H"
33 #include "OFstream.H"
34 #include "mathematicalConstants.H"
36 using namespace Foam;
38 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
40 int main()
42     scalarField x(100);
43     scalarField r(x.size());
45     forAll(x, i)
46     {
47         x[i] = -3 + 0.06*i;
48     }
50     scalarField b(0.5*(1.0 + erf(x)));
51     scalarField c(1.0 - b);
52     scalarField gradb((1/::sqrt(constant::mathematical::pi))*exp(-sqr(x)));
53     scalarField lapb(-2*x*gradb);
55     r = lapb*b*c/(gradb*gradb);
58     graph("r", "x", "r", x, r).write("r", "xmgr");
60     Info<< "end" << endl;
62     return 0;
66 // ************************************************************************* //