FreeFOAM The Cross-Platform CFD Toolkit
solidBodyMotionFvMesh.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) 1991-2010 OpenCFD Ltd.
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 \*---------------------------------------------------------------------------*/
25 
26 #include "solidBodyMotionFvMesh.H"
28 #include <finiteVolume/volFields.H>
31 
32 using namespace Foam::mathematicalConstant;
33 
34 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
35 
36 namespace Foam
37 {
38  defineTypeNameAndDebug(solidBodyMotionFvMesh, 0);
39  addToRunTimeSelectionTable(dynamicFvMesh, solidBodyMotionFvMesh, IOobject);
40 }
41 
42 
43 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
44 
45 Foam::solidBodyMotionFvMesh::solidBodyMotionFvMesh(const IOobject& io)
46 :
47  dynamicFvMesh(io),
48  dynamicMeshCoeffs_
49  (
51  (
52  IOobject
53  (
54  "dynamicMeshDict",
55  io.time().constant(),
56  *this,
57  IOobject::MUST_READ,
58  IOobject::NO_WRITE
59  )
60  ).subDict(typeName + "Coeffs")
61  ),
62  SBMFPtr_(solidBodyMotionFunction::New(dynamicMeshCoeffs_, io.time())),
63  undisplacedPoints_
64  (
65  IOobject
66  (
67  "points",
68  io.time().constant(),
69  meshSubDir,
70  *this,
71  IOobject::MUST_READ,
72  IOobject::NO_WRITE
73  )
74  )
75 {}
76 
77 
78 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
79 
81 {}
82 
83 
84 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
85 
87 {
88  static bool hasWarned = false;
89 
91  (
92  transform(SBMFPtr_().transformation(),
93  undisplacedPoints_)
94  );
95 
96  if (foundObject<volVectorField>("U"))
97  {
98  const_cast<volVectorField&>(lookupObject<volVectorField>("U"))
100  }
101  else if (!hasWarned)
102  {
103  hasWarned = true;
104 
105  WarningIn("solidBodyMotionFvMesh::update()")
106  << "Did not find volVectorField U."
107  << " Not updating U boundary conditions." << endl;
108  }
109 
110  return true;
111 }
112 
113 
114 // ************************ vim: set sw=4 sts=4 et: ************************ //