1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
7 -------------------------------------------------------------------------------
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
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 * * * * * * * * * * * * * //
36 defineTypeNameAndDebug(velocityLaplacianFvMotionSolver, 0);
38 addToRunTimeSelectionTable
41 velocityLaplacianFvMotionSolver,
47 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
49 Foam::velocityLaplacianFvMotionSolver::velocityLaplacianFvMotionSolver
61 fvMesh_.time().timeName(),
66 pointMesh::New(fvMesh_)
73 mesh.time().timeName(),
75 IOobject::READ_IF_PRESENT,
82 pointMotionU_.dimensions(),
85 cellMotionBoundaryTypes<vector>(pointMotionU_.boundaryField())
89 motionDiffusivity::New(*this, lookup("diffusivity"))
94 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
96 Foam::velocityLaplacianFvMotionSolver::~velocityLaplacianFvMotionSolver()
100 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
102 Foam::tmp<Foam::pointField>
103 Foam::velocityLaplacianFvMotionSolver::curPoints() const
105 volPointInterpolation::New(fvMesh_).interpolate
111 tmp<pointField> tcurPoints
114 + fvMesh_.time().deltaTValue()*pointMotionU_.internalField()
117 twoDCorrectPoints(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();
136 diffusivityPtr_->operator()(),
138 "laplacian(diffusivity,cellMotionU)"
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 // ************************************************************************* //