1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 1991-2009 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 "velocityComponentLaplacianFvMotionSolver.H"
28 #include "motionDiffusivity.H"
29 #include "fvmLaplacian.H"
30 #include "addToRunTimeSelectionTable.H"
31 #include "volPointInterpolation.H"
33 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
37 defineTypeNameAndDebug(velocityComponentLaplacianFvMotionSolver, 0);
39 addToRunTimeSelectionTable
42 velocityComponentLaplacianFvMotionSolver,
48 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
50 Foam::velocityComponentLaplacianFvMotionSolver::
51 velocityComponentLaplacianFvMotionSolver
64 "pointMotionU" + cmptName_,
65 fvMesh_.time().timeName(),
70 pointMesh::New(fvMesh_)
76 "cellMotionU" + cmptName_,
77 mesh.time().timeName(),
79 IOobject::READ_IF_PRESENT,
86 pointMotionU_.dimensions(),
89 cellMotionBoundaryTypes<scalar>(pointMotionU_.boundaryField())
93 motionDiffusivity::New(*this, lookup("diffusivity"))
100 else if (cmptName_ == "y")
104 else if (cmptName_ == "z")
112 "velocityComponentLaplacianFvMotionSolver::"
113 "velocityComponentLaplacianFvMotionSolver"
114 "(const polyMesh& mesh, Istream& msData)"
115 ) << "Given component name " << cmptName_ << " should be x, y or z"
121 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
123 Foam::velocityComponentLaplacianFvMotionSolver::
124 ~velocityComponentLaplacianFvMotionSolver()
128 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
130 Foam::tmp<Foam::pointField>
131 Foam::velocityComponentLaplacianFvMotionSolver::curPoints() const
133 volPointInterpolation::New(fvMesh_).interpolate
139 tmp<pointField> tcurPoints(new pointField(fvMesh_.points()));
144 tcurPoints().component(cmpt_)
145 + fvMesh_.time().deltaT().value()*pointMotionU_.internalField()
148 twoDCorrectPoints(tcurPoints());
154 void Foam::velocityComponentLaplacianFvMotionSolver::solve()
156 // The points have moved so before interpolation update
157 // the fvMotionSolver accordingly
158 movePoints(fvMesh_.points());
160 diffusivityPtr_->correct();
161 pointMotionU_.boundaryField().updateCoeffs();
167 diffusivityPtr_->operator()(),
169 "laplacian(diffusivity,cellMotionU)"
175 void Foam::velocityComponentLaplacianFvMotionSolver::updateMesh
177 const mapPolyMesh& mpm
180 fvMotionSolver::updateMesh(mpm);
182 // Update diffusivity. Note two stage to make sure old one is de-registered
183 // before creating/registering new one.
184 diffusivityPtr_.reset(NULL);
185 diffusivityPtr_ = motionDiffusivity::New(*this, lookup("diffusivity"));
189 // ************************************************************************* //