initial commit for version 1.5.x patch release
[OpenFOAM-1.5.x.git] / src / fvMotionSolver / fvMotionSolvers / velocity / laplacian / velocityLaplacianFvMotionSolver.C
blobf259a097ca270f6960f8cf29f20bd18178c5b945
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
4    \\    /   O peration     |
5     \\  /    A nd           | Copyright (C) 1991-2008 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 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
19     for more details.
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
25 \*---------------------------------------------------------------------------*/
27 #include "velocityLaplacianFvMotionSolver.H"
28 #include "motionDiffusivity.H"
29 #include "fvmLaplacian.H"
30 #include "addToRunTimeSelectionTable.H"
32 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
34 namespace Foam
36     defineTypeNameAndDebug(velocityLaplacianFvMotionSolver, 0);
38     addToRunTimeSelectionTable
39     (
40         fvMotionSolver,
41         velocityLaplacianFvMotionSolver,
42         dictionary
43     );
47 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
49 Foam::velocityLaplacianFvMotionSolver::velocityLaplacianFvMotionSolver
51     const polyMesh& mesh,
52     Istream& msData
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_
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_,
79         dimensionedVector
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     )
94 // * * * * * * * * * * * * * * * * Destructor  * * * * * * * * * * * * * * * //
96 Foam::velocityLaplacianFvMotionSolver::~velocityLaplacianFvMotionSolver()
100 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
102 Foam::tmp<Foam::pointField>
103 Foam::velocityLaplacianFvMotionSolver::curPoints() const
105     vpi_.interpolate(cellMotionU_, pointMotionU_);
107     tmp<pointField> tcurPoints
108     (
109         fvMesh_.points()
110       + fvMesh_.time().deltaT().value()*pointMotionU_.internalField()
111     );
113     twoDCorrectPoints(tcurPoints());
115     return tcurPoints;
119 void Foam::velocityLaplacianFvMotionSolver::solve()
121     // The points have moved so before interpolation update
122     // the fvMotionSolver accordingly
123     movePoints(fvMesh_.points());
125     diffusivityPtr_->correct();
126     pointMotionU_.boundaryField().updateCoeffs();
128     Foam::solve
129     (
130         fvm::laplacian
131         (
132             diffusivityPtr_->operator()(),
133             cellMotionU_,
134             "laplacian(diffusivity,cellMotionU)"
135         )
136     );
140 void Foam::velocityLaplacianFvMotionSolver::updateMesh
142     const mapPolyMesh& mpm
145     fvMotionSolver::updateMesh(mpm);
147     // Update diffusivity. Note two stage to make sure old one is de-registered
148     // before creating/registering new one.
149     diffusivityPtr_.reset(NULL);
150     diffusivityPtr_ = motionDiffusivity::New(*this, lookup("diffusivity"));
154 // ************************************************************************* //