1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 1991-2008 OpenCFD Ltd.
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 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
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 * * * * * * * * * * * * * //
36 defineTypeNameAndDebug(velocityLaplacianFvMotionSolver, 0);
38 addToRunTimeSelectionTable
41 velocityLaplacianFvMotionSolver,
47 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
49 Foam::velocityLaplacianFvMotionSolver::velocityLaplacianFvMotionSolver
61 fvMesh_.time().timeName(),
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 vpi_.interpolate(cellMotionU_, pointMotionU_);
107 tmp<pointField> tcurPoints
110 + fvMesh_.time().deltaT().value()*pointMotionU_.internalField()
113 twoDCorrectPoints(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();
132 diffusivityPtr_->operator()(),
134 "laplacian(diffusivity,cellMotionU)"
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 // ************************************************************************* //