Test-wallDist.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-2015 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  Calculate and write the distance-to-wall field for a moving mesh.
26 
27 \*---------------------------------------------------------------------------*/
28 
29 #include "argList.H"
30 #include "Time.H"
31 #include "fvMesh.H"
32 #include "wallDist.H"
33 
34 using namespace Foam;
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<< "Mesh read in = "
46  << runTime.cpuTimeIncrement()
47  << " s\n" << endl << endl;
48 
49  Info<< "Time now = " << runTime.timeName() << endl;
50 
51  // Wall-reflection vectors
52  const volVectorField& n = wallDist::New(mesh).n();
53  n.write();
54 
55  // Wall distance
56  const volScalarField& y = wallDist::New(mesh).y();
57  y.write();
58 
59  runTime++;
60 
61  Info<< "Time now = " << runTime.timeName() << endl;
62 
63  // Move points
64 
66 
67  pointField newPoints(mesh.points());
68 
69  const point half(0.5*(meshBb.min() + meshBb.max()));
70 
71  forAll(newPoints, pointI)
72  {
73  point& pt = newPoints[pointI];
74 
75  // expand around half
76  pt.y() += pt.y() - half.y();
77  }
78 
79  mesh.movePoints(newPoints);
80  mesh.write();
81  n.write();
82  y.write();
83 
84  Info<< "End\n" << endl;
85 
86  return 0;
87 }
88 
89 
90 // ************************************************************************* //
wallDist.H
Foam::polyMesh::points
virtual const pointField & points() const
Return raw points.
Definition: polyMesh.C:979
forAll
#define forAll(list, i)
Loop across all elements in list.
Definition: UList.H:406
Foam::wallDist::y
const volScalarField & y() const
Return reference to cached distance-to-wall field.
Definition: wallDist.H:142
Foam::fvMesh::movePoints
virtual tmp< scalarField > movePoints(const pointField &)
Move points, returns volumes swept by faces in motion.
Definition: fvMesh.C:726
Foam::endl
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:251
meshBb
List< treeBoundBox > meshBb(1, treeBoundBox(boundBox(coarseMesh.points(), false)).extend(rndGen, 1e-3))
Foam::MeshObject< fvMesh, UpdateableMeshObject, wallDist >::New
static const wallDist & New(const fvMesh &mesh)
Definition: MeshObject.C:44
Foam::fvMesh::write
virtual bool write() const
Write mesh using IO settings from time.
Definition: fvMesh.C:873
main
int main(int argc, char *argv[])
Definition: Test-wallDist.C:39
n
label n
Definition: TABSMDCalcMethod2.H:31
Foam::Field
Pre-declare SubField and related Field type.
Definition: Field.H:57
Foam::Info
messageStream Info
argList.H
Foam::wallDist::n
const volVectorField & n() const
Return reference to cached normal-to-wall field.
Definition: wallDist.C:168
mesh
dynamicFvMesh & mesh
Definition: createDynamicFvMesh.H:18
fvMesh.H
Foam
Namespace for OpenFOAM.
Definition: combustionModel.C:30
setRootCase.H
Foam::Vector< scalar >
createMesh.H
createTime.H
Foam::boundBox
A bounding box defined in terms of the points at its extremities.
Definition: boundBox.H:55
Foam::Vector::y
const Cmpt & y() const
Definition: VectorI.H:71
Foam::GeometricField
Generic GeometricField class.
Definition: surfaceFieldsFwd.H:52
y
scalar y
Definition: LISASMDCalcMethod1.H:14