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 "displacementSBRStressFvMotionSolver.H"
28 #include "motionDiffusivity.H"
29 #include "fvmLaplacian.H"
30 #include "addToRunTimeSelectionTable.H"
33 #include "surfaceInterpolate.H"
34 #include "fvcLaplacian.H"
35 #include "mapPolyMesh.H"
36 #include "volPointInterpolation.H"
38 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
42 defineTypeNameAndDebug(displacementSBRStressFvMotionSolver, 0);
44 addToRunTimeSelectionTable
47 displacementSBRStressFvMotionSolver,
53 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
55 Foam::displacementSBRStressFvMotionSolver::displacementSBRStressFvMotionSolver
61 displacementFvMotionSolver(mesh, is),
67 fvMesh_.time().timeName(),
72 pointMesh::New(fvMesh_)
79 mesh.time().timeName(),
81 IOobject::READ_IF_PRESENT,
88 pointDisplacement_.dimensions(),
91 cellMotionBoundaryTypes<vector>(pointDisplacement_.boundaryField())
95 motionDiffusivity::New(*this, lookup("diffusivity"))
100 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
102 Foam::displacementSBRStressFvMotionSolver::
103 ~displacementSBRStressFvMotionSolver()
107 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
109 Foam::tmp<Foam::pointField>
110 Foam::displacementSBRStressFvMotionSolver::curPoints() const
112 volPointInterpolation::New(fvMesh_).interpolate
118 tmp<pointField> tcurPoints
120 points0() + pointDisplacement_.internalField()
123 twoDCorrectPoints(tcurPoints());
129 void Foam::displacementSBRStressFvMotionSolver::solve()
131 // The points have moved so before interpolation update
132 // the fvMotionSolver accordingly
133 movePoints(fvMesh_.points());
135 diffusivityPtr_->correct();
136 pointDisplacement_.boundaryField().updateCoeffs();
138 surfaceScalarField Df = diffusivityPtr_->operator()();
140 volTensorField gradCd = fvc::grad(cellDisplacement_);
148 "laplacian(diffusivity,cellDisplacement)"
156 cellDisplacement_.mesh().Sf()
157 & fvc::interpolate(gradCd.T() - gradCd)
160 // Solid-body rotation "lambda" term
161 - cellDisplacement_.mesh().Sf()*fvc::interpolate(tr(gradCd))
170 "laplacian(diffusivity,cellDisplacement)"
178 cellDisplacement_.mesh().Sf()
179 & fvc::interpolate(gradCd + gradCd.T())
182 // Solid-body rotation "lambda" term
183 - cellDisplacement_.mesh().Sf()*fvc::interpolate(tr(gradCd))
191 void Foam::displacementSBRStressFvMotionSolver::updateMesh
193 const mapPolyMesh& mpm
196 displacementFvMotionSolver::updateMesh(mpm);
198 // Update diffusivity. Note two stage to make sure old one is de-registered
199 // before creating/registering new one.
200 diffusivityPtr_.reset(NULL);
201 diffusivityPtr_ = motionDiffusivity::New(*this, lookup("diffusivity"));
205 // ************************************************************************* //