FreeFOAM The Cross-Platform CFD Toolkit
Hosted by SourceForge:
Get FreeFOAM at SourceForge.net.
            Fast, secure and Free Open Source software downloads

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-2010 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
00013     the Free Software Foundation, either version 3 of the License, or
00014     (at your 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, see <http://www.gnu.org/licenses/>.
00023 
00024 \*---------------------------------------------------------------------------*/
00025 
00026 #include "velocityLaplacianFvMotionSolver.H"
00027 #include <fvMotionSolvers/motionDiffusivity.H>
00028 #include <finiteVolume/fvmLaplacian.H>
00029 #include <OpenFOAM/addToRunTimeSelectionTable.H>
00030 #include <finiteVolume/volPointInterpolation.H>
00031 
00032 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
00033 
00034 namespace Foam
00035 {
00036     defineTypeNameAndDebug(velocityLaplacianFvMotionSolver, 0);
00037 
00038     addToRunTimeSelectionTable
00039     (
00040         fvMotionSolver,
00041         velocityLaplacianFvMotionSolver,
00042         dictionary
00043     );
00044 }
00045 
00046 
00047 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
00048 
00049 Foam::velocityLaplacianFvMotionSolver::velocityLaplacianFvMotionSolver
00050 (
00051     const polyMesh& mesh,
00052     Istream&
00053 )
00054 :
00055     fvMotionSolver(mesh),
00056     pointMotionU_
00057     (
00058         IOobject
00059         (
00060             "pointMotionU",
00061             fvMesh_.time().timeName(),
00062             fvMesh_,
00063             IOobject::MUST_READ,
00064             IOobject::AUTO_WRITE
00065         ),
00066         pointMesh::New(fvMesh_)
00067     ),
00068     cellMotionU_
00069     (
00070         IOobject
00071         (
00072             "cellMotionU",
00073             mesh.time().timeName(),
00074             mesh,
00075             IOobject::READ_IF_PRESENT,
00076             IOobject::AUTO_WRITE
00077         ),
00078         fvMesh_,
00079         dimensionedVector
00080         (
00081             "cellMotionU",
00082             pointMotionU_.dimensions(),
00083             vector::zero
00084         ),
00085         cellMotionBoundaryTypes<vector>(pointMotionU_.boundaryField())
00086     ),
00087     diffusivityPtr_
00088     (
00089         motionDiffusivity::New(*this, lookup("diffusivity"))
00090     )
00091 {}
00092 
00093 
00094 // * * * * * * * * * * * * * * * * Destructor  * * * * * * * * * * * * * * * //
00095 
00096 Foam::velocityLaplacianFvMotionSolver::~velocityLaplacianFvMotionSolver()
00097 {}
00098 
00099 
00100 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
00101 
00102 Foam::tmp<Foam::pointField>
00103 Foam::velocityLaplacianFvMotionSolver::curPoints() const
00104 {
00105     volPointInterpolation::New(fvMesh_).interpolate
00106     (
00107         cellMotionU_,
00108         pointMotionU_
00109     );
00110 
00111     tmp<pointField> tcurPoints
00112     (
00113         fvMesh_.points()
00114       + fvMesh_.time().deltaT().value()*pointMotionU_.internalField()
00115     );
00116 
00117     twoDCorrectPoints(tcurPoints());
00118 
00119     return tcurPoints;
00120 }
00121 
00122 
00123 void Foam::velocityLaplacianFvMotionSolver::solve()
00124 {
00125     // The points have moved so before interpolation update
00126     // the fvMotionSolver accordingly
00127     movePoints(fvMesh_.points());
00128 
00129     diffusivityPtr_->correct();
00130     pointMotionU_.boundaryField().updateCoeffs();
00131 
00132     Foam::solve
00133     (
00134         fvm::laplacian
00135         (
00136             diffusivityPtr_->operator()(),
00137             cellMotionU_,
00138             "laplacian(diffusivity,cellMotionU)"
00139         )
00140     );
00141 }
00142 
00143 
00144 void Foam::velocityLaplacianFvMotionSolver::updateMesh
00145 (
00146     const mapPolyMesh& mpm
00147 )
00148 {
00149     fvMotionSolver::updateMesh(mpm);
00150 
00151     // Update diffusivity. Note two stage to make sure old one is de-registered
00152     // before creating/registering new one.
00153     diffusivityPtr_.reset(NULL);
00154     diffusivityPtr_ = motionDiffusivity::New(*this, lookup("diffusivity"));
00155 }
00156 
00157 
00158 // ************************ vim: set sw=4 sts=4 et: ************************ //
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines