OpenFOAM logo
The Open Source CFD Toolbox
  Source Guide OpenCFD Solutions Contact OpenFOAM

velocityLaplacianFvMotionSolver.C

Go to the documentation of this file.
00001 /*---------------------------------------------------------------------------*\
00002   =========                 |
00003   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
00004    \\    /   O peration     |
00005     \\  /    A nd           | Copyright (C) 1991-2009 OpenCFD Ltd.
00006      \\/     M anipulation  |
00007 -------------------------------------------------------------------------------
00008 License
00009     This file is part of OpenFOAM.
00010 
00011     OpenFOAM is free software; you can redistribute it and/or modify it
00012     under the terms of the GNU General Public License as published by the
00013     Free Software Foundation; either version 2 of the License, or (at your
00014     option) any later version.
00015 
00016     OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
00017     ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00018     FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
00019     for more details.
00020 
00021     You should have received a copy of the GNU General Public License
00022     along with OpenFOAM; if not, write to the Free Software Foundation,
00023     Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
00024 
00025 \*---------------------------------------------------------------------------*/
00026 
00027 #include "velocityLaplacianFvMotionSolver.H"
00028 #include "motionDiffusivity.H"
00029 #include "fvmLaplacian.H"
00030 #include "addToRunTimeSelectionTable.H"
00031 #include "volPointInterpolation.H"
00032 
00033 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
00034 
00035 namespace Foam
00036 {
00037     defineTypeNameAndDebug(velocityLaplacianFvMotionSolver, 0);
00038 
00039     addToRunTimeSelectionTable
00040     (
00041         fvMotionSolver,
00042         velocityLaplacianFvMotionSolver,
00043         dictionary
00044     );
00045 }
00046 
00047 
00048 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
00049 
00050 Foam::velocityLaplacianFvMotionSolver::velocityLaplacianFvMotionSolver
00051 (
00052     const polyMesh& mesh,
00053     Istream&
00054 )
00055 :
00056     fvMotionSolver(mesh),
00057     pointMotionU_
00058     (
00059         IOobject
00060         (
00061             "pointMotionU",
00062             fvMesh_.time().timeName(),
00063             fvMesh_,
00064             IOobject::MUST_READ,
00065             IOobject::AUTO_WRITE
00066         ),
00067         pointMesh::New(fvMesh_)
00068     ),
00069     cellMotionU_
00070     (
00071         IOobject
00072         (
00073             "cellMotionU",
00074             mesh.time().timeName(),
00075             mesh,
00076             IOobject::READ_IF_PRESENT,
00077             IOobject::AUTO_WRITE
00078         ),
00079         fvMesh_,
00080         dimensionedVector
00081         (
00082             "cellMotionU",
00083             pointMotionU_.dimensions(),
00084             vector::zero
00085         ),
00086         cellMotionBoundaryTypes<vector>(pointMotionU_.boundaryField())
00087     ),
00088     diffusivityPtr_
00089     (
00090         motionDiffusivity::New(*this, lookup("diffusivity"))
00091     )
00092 {}
00093 
00094 
00095 // * * * * * * * * * * * * * * * * Destructor  * * * * * * * * * * * * * * * //
00096 
00097 Foam::velocityLaplacianFvMotionSolver::~velocityLaplacianFvMotionSolver()
00098 {}
00099 
00100 
00101 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
00102 
00103 Foam::tmp<Foam::pointField>
00104 Foam::velocityLaplacianFvMotionSolver::curPoints() const
00105 {
00106     volPointInterpolation::New(fvMesh_).interpolate
00107     (
00108         cellMotionU_,
00109         pointMotionU_
00110     );
00111 
00112     tmp<pointField> tcurPoints
00113     (
00114         fvMesh_.points()
00115       + fvMesh_.time().deltaT().value()*pointMotionU_.internalField()
00116     );
00117 
00118     twoDCorrectPoints(tcurPoints());
00119 
00120     return tcurPoints;
00121 }
00122 
00123 
00124 void Foam::velocityLaplacianFvMotionSolver::solve()
00125 {
00126     // The points have moved so before interpolation update
00127     // the fvMotionSolver accordingly
00128     movePoints(fvMesh_.points());
00129 
00130     diffusivityPtr_->correct();
00131     pointMotionU_.boundaryField().updateCoeffs();
00132 
00133     Foam::solve
00134     (
00135         fvm::laplacian
00136         (
00137             diffusivityPtr_->operator()(),
00138             cellMotionU_,
00139             "laplacian(diffusivity,cellMotionU)"
00140         )
00141     );
00142 }
00143 
00144 
00145 void Foam::velocityLaplacianFvMotionSolver::updateMesh
00146 (
00147     const mapPolyMesh& mpm
00148 )
00149 {
00150     fvMotionSolver::updateMesh(mpm);
00151 
00152     // Update diffusivity. Note two stage to make sure old one is de-registered
00153     // before creating/registering new one.
00154     diffusivityPtr_.reset(NULL);
00155     diffusivityPtr_ = motionDiffusivity::New(*this, lookup("diffusivity"));
00156 }
00157 
00158 
00159 // ************************************************************************* //
Copyright © 2000-2009 OpenCFD Ltd