BUG: UListIO: byteSize overflowing on really big faceLists
[OpenFOAM-2.0.x.git] / src / fvMotionSolver / fvMotionSolvers / velocity / laplacian / velocityLaplacianFvMotionSolver.C
blobdcf367f0858b0a85794ae7205df81f1b1dfddc57
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
4    \\    /   O peration     |
5     \\  /    A nd           | Copyright (C) 2011 OpenFOAM Foundation
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
13     the Free Software Foundation, either version 3 of the License, or
14     (at your 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, see <http://www.gnu.org/licenses/>.
24 \*---------------------------------------------------------------------------*/
26 #include "velocityLaplacianFvMotionSolver.H"
27 #include "motionDiffusivity.H"
28 #include "fvmLaplacian.H"
29 #include "addToRunTimeSelectionTable.H"
30 #include "volPointInterpolation.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&
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_,
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     volPointInterpolation::New(fvMesh_).interpolate
106     (
107         cellMotionU_,
108         pointMotionU_
109     );
111     tmp<pointField> tcurPoints
112     (
113         fvMesh_.points()
114       + fvMesh_.time().deltaTValue()*pointMotionU_.internalField()
115     );
117     twoDCorrectPoints(tcurPoints());
119     return tcurPoints;
123 void Foam::velocityLaplacianFvMotionSolver::solve()
125     // The points have moved so before interpolation update
126     // the fvMotionSolver accordingly
127     movePoints(fvMesh_.points());
129     diffusivityPtr_->correct();
130     pointMotionU_.boundaryField().updateCoeffs();
132     Foam::solve
133     (
134         fvm::laplacian
135         (
136             diffusivityPtr_->operator()(),
137             cellMotionU_,
138             "laplacian(diffusivity,cellMotionU)"
139         )
140     );
144 void Foam::velocityLaplacianFvMotionSolver::updateMesh
146     const mapPolyMesh& mpm
149     fvMotionSolver::updateMesh(mpm);
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"));
158 // ************************************************************************* //