FreeFOAM The Cross-Platform CFD Toolkit
velocityLaplacianFvMotionSolver.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 
31 
32 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
33 
34 namespace Foam
35 {
36  defineTypeNameAndDebug(velocityLaplacianFvMotionSolver, 0);
37 
39  (
40  fvMotionSolver,
41  velocityLaplacianFvMotionSolver,
42  dictionary
43  );
44 }
45 
46 
47 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
48 
49 Foam::velocityLaplacianFvMotionSolver::velocityLaplacianFvMotionSolver
50 (
51  const polyMesh& mesh,
52  Istream&
53 )
54 :
55  fvMotionSolver(mesh),
56  pointMotionU_
57  (
58  IOobject
59  (
60  "pointMotionU",
61  fvMesh_.time().timeName(),
62  fvMesh_,
63  IOobject::MUST_READ,
64  IOobject::AUTO_WRITE
65  ),
66  pointMesh::New(fvMesh_)
67  ),
68  cellMotionU_
69  (
70  IOobject
71  (
72  "cellMotionU",
73  mesh.time().timeName(),
74  mesh,
75  IOobject::READ_IF_PRESENT,
76  IOobject::AUTO_WRITE
77  ),
78  fvMesh_,
80  (
81  "cellMotionU",
82  pointMotionU_.dimensions(),
83  vector::zero
84  ),
85  cellMotionBoundaryTypes<vector>(pointMotionU_.boundaryField())
86  ),
87  diffusivityPtr_
88  (
89  motionDiffusivity::New(*this, lookup("diffusivity"))
90  )
91 {}
92 
93 
94 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
95 
97 {}
98 
99 
100 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
101 
104 {
106  (
107  cellMotionU_,
108  pointMotionU_
109  );
110 
111  tmp<pointField> tcurPoints
112  (
113  fvMesh_.points()
114  + fvMesh_.time().deltaT().value()*pointMotionU_.internalField()
115  );
116 
117  twoDCorrectPoints(tcurPoints());
118 
119  return tcurPoints;
120 }
121 
122 
124 {
125  // The points have moved so before interpolation update
126  // the fvMotionSolver accordingly
127  movePoints(fvMesh_.points());
128 
129  diffusivityPtr_->correct();
130  pointMotionU_.boundaryField().updateCoeffs();
131 
133  (
135  (
136  diffusivityPtr_->operator()(),
137  cellMotionU_,
138  "laplacian(diffusivity,cellMotionU)"
139  )
140  );
141 }
142 
143 
145 (
146  const mapPolyMesh& mpm
147 )
148 {
150 
151  // Update diffusivity. Note two stage to make sure old one is de-registered
152  // before creating/registering new one.
153  diffusivityPtr_.reset(NULL);
154  diffusivityPtr_ = motionDiffusivity::New(*this, lookup("diffusivity"));
155 }
156 
157 
158 // ************************ vim: set sw=4 sts=4 et: ************************ //