1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
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
13 the Free Software Foundation, either version 3 of the License, or
14 (at your 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, see <http://www.gnu.org/licenses/>.
24 \*---------------------------------------------------------------------------*/
26 #include "displacementSBRStressFvMotionSolver.H"
27 #include "motionDiffusivity.H"
28 #include "fvmLaplacian.H"
29 #include "addToRunTimeSelectionTable.H"
32 #include "surfaceInterpolate.H"
33 #include "fvcLaplacian.H"
34 #include "mapPolyMesh.H"
35 #include "volPointInterpolation.H"
37 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
41 defineTypeNameAndDebug(displacementSBRStressFvMotionSolver, 0);
43 addToRunTimeSelectionTable
46 displacementSBRStressFvMotionSolver,
52 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
54 Foam::displacementSBRStressFvMotionSolver::displacementSBRStressFvMotionSolver
60 displacementFvMotionSolver(mesh, is),
66 fvMesh_.time().timeName(),
71 pointMesh::New(fvMesh_)
78 mesh.time().timeName(),
80 IOobject::READ_IF_PRESENT,
87 pointDisplacement_.dimensions(),
90 cellMotionBoundaryTypes<vector>(pointDisplacement_.boundaryField())
94 motionDiffusivity::New(*this, lookup("diffusivity"))
99 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
101 Foam::displacementSBRStressFvMotionSolver::
102 ~displacementSBRStressFvMotionSolver()
106 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
108 Foam::tmp<Foam::pointField>
109 Foam::displacementSBRStressFvMotionSolver::curPoints() const
111 volPointInterpolation::New(fvMesh_).interpolate
117 tmp<pointField> tcurPoints
119 points0() + pointDisplacement_.internalField()
122 twoDCorrectPoints(tcurPoints());
128 void Foam::displacementSBRStressFvMotionSolver::solve()
130 // The points have moved so before interpolation update
131 // the fvMotionSolver accordingly
132 movePoints(fvMesh_.points());
134 diffusivityPtr_->correct();
135 pointDisplacement_.boundaryField().updateCoeffs();
137 surfaceScalarField Df(diffusivityPtr_->operator()());
139 volTensorField gradCd(fvc::grad(cellDisplacement_));
147 "laplacian(diffusivity,cellDisplacement)"
155 cellDisplacement_.mesh().Sf()
156 & fvc::interpolate(gradCd.T() - gradCd)
159 // Solid-body rotation "lambda" term
160 - cellDisplacement_.mesh().Sf()*fvc::interpolate(tr(gradCd))
169 "laplacian(diffusivity,cellDisplacement)"
177 cellDisplacement_.mesh().Sf()
178 & fvc::interpolate(gradCd + gradCd.T())
181 // Solid-body rotation "lambda" term
182 - cellDisplacement_.mesh().Sf()*fvc::interpolate(tr(gradCd))
190 void Foam::displacementSBRStressFvMotionSolver::updateMesh
192 const mapPolyMesh& mpm
195 displacementFvMotionSolver::updateMesh(mpm);
197 // Update diffusivity. Note two stage to make sure old one is de-registered
198 // before creating/registering new one.
199 diffusivityPtr_.reset(NULL);
200 diffusivityPtr_ = motionDiffusivity::New(*this, lookup("diffusivity"));
204 // ************************************************************************* //