1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
7 -------------------------------------------------------------------------------
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 the
13 Free Software Foundation; either version 2 of the License, or (at your
14 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
21 You should have received a copy of the GNU General Public License
22 along with OpenFOAM; if not, write to the Free Software Foundation,
23 Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
26 Calculate distance to wall.
28 \*---------------------------------------------------------------------------*/
30 #include <finiteVolume/fvCFD.H>
31 #include <finiteVolume/wallDistData.H>
32 #include <meshTools/wallPointData.H>
34 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
37 int main(int argc, char *argv[])
39 # include <OpenFOAM/setRootCase.H>
40 # include <OpenFOAM/createTime.H>
41 # include <OpenFOAM/createMesh.H>
43 Info<< "Mesh read in = "
44 << runTime.cpuTimeIncrement()
45 << " s\n" << endl << endl;
48 Info<< "Time now = " << runTime.timeName() << endl;
50 // wall distance and reflection vectors
57 mesh.time().timeName(),
61 dimensionedVector("n", dimLength, wallPoint::greatPoint)
64 // Fill wall patches with unit normal
65 forAll(mesh.boundary(), patchI)
67 const fvPatch& patch = mesh.boundary()[patchI];
69 if (typeid(patch) == typeid(wallFvPatch))
71 fvPatchVectorField& wallData = n.boundaryField()[patchI];
73 forAll(patch.Cf(), patchFaceI)
75 wallData[patchFaceI] = patch.Cf()[patchFaceI];
76 wallData[patchFaceI] /= Foam::mag(wallData[patchFaceI]);
82 // Do distance calculation, transporting values of n.
83 wallDistData<wallPointData<vector> > y(mesh, n, true);
87 WarningIn(args.executable())
88 << "There are " << y.nUnset()
89 << " remaining unset cells and/or boundary values" << endl;
98 Info<< "Time now = " << runTime.timeName() << endl;
103 boundBox meshBb(mesh.points());
105 pointField newPoints(mesh.points());
107 const point half(0.5*(meshBb.min() + meshBb.max()));
109 forAll(newPoints, pointI)
111 point& pt = newPoints[pointI];
113 // expand around half
114 pt.y() += pt.y() - half.y();
117 mesh.movePoints(newPoints);
127 Info<< "End\n" << endl;
136 // ************************ vim: set sw=4 sts=4 et: ************************ //