displacementSBRStressFvMotionSolver.C
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration |
5  \\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
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.
15 
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
19  for more details.
20 
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/>.
23 
24 \*---------------------------------------------------------------------------*/
25 
27 #include "motionInterpolation.H"
28 #include "motionDiffusivity.H"
29 #include "fvmLaplacian.H"
31 #include "fvcDiv.H"
32 #include "fvcGrad.H"
33 #include "surfaceInterpolate.H"
34 #include "fvcLaplacian.H"
35 #include "mapPolyMesh.H"
36 
37 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
38 
39 namespace Foam
40 {
41  defineTypeNameAndDebug(displacementSBRStressFvMotionSolver, 0);
42 
44  (
45  motionSolver,
46  displacementSBRStressFvMotionSolver,
47  dictionary
48  );
49 
51  (
52  displacementMotionSolver,
53  displacementSBRStressFvMotionSolver,
54  displacement
55  );
56 }
57 
58 
59 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
60 
62 (
63  const polyMesh& mesh,
64  const IOdictionary& dict
65 )
66 :
67  displacementMotionSolver(mesh, dict, dict.lookup("solver")),
69  cellDisplacement_
70  (
71  IOobject
72  (
73  "cellDisplacement",
74  mesh.time().timeName(),
75  mesh,
76  IOobject::READ_IF_PRESENT,
77  IOobject::AUTO_WRITE
78  ),
79  fvMesh_,
81  (
82  "cellDisplacement",
83  pointDisplacement().dimensions(),
84  vector::zero
85  ),
86  cellMotionBoundaryTypes<vector>(pointDisplacement().boundaryField())
87  ),
88  interpolationPtr_
89  (
90  coeffDict().found("interpolation")
91  ? motionInterpolation::New(fvMesh_, coeffDict().lookup("interpolation"))
92  : motionInterpolation::New(fvMesh_)
93  ),
94  diffusivityPtr_
95  (
96  motionDiffusivity::New(fvMesh_, coeffDict().lookup("diffusivity"))
97  )
98 {}
99 
100 
103 (
104  const polyMesh& mesh,
105  const IOdictionary& dict,
106  const pointVectorField& pointDisplacement,
107  const pointIOField& points0
108 )
109 :
110  displacementMotionSolver(mesh, dict, pointDisplacement, points0, typeName),
112  cellDisplacement_
113  (
114  IOobject
115  (
116  "cellDisplacement",
117  mesh.time().timeName(),
118  mesh,
119  IOobject::READ_IF_PRESENT,
120  IOobject::AUTO_WRITE
121  ),
122  fvMesh_,
124  (
125  "cellDisplacement",
126  displacementMotionSolver::pointDisplacement().dimensions(),
127  vector::zero
128  ),
129  cellMotionBoundaryTypes<vector>
130  (
131  displacementMotionSolver::pointDisplacement().boundaryField()
132  )
133  ),
134  interpolationPtr_
135  (
136  coeffDict().found("interpolation")
137  ? motionInterpolation::New(fvMesh_, coeffDict().lookup("interpolation"))
138  : motionInterpolation::New(fvMesh_)
139  ),
140  diffusivityPtr_
141  (
142  motionDiffusivity::New(fvMesh_, coeffDict().lookup("diffusivity"))
143  )
144 {}
145 
146 
147 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
148 
151 {}
152 
153 
154 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
155 
158 {
159  interpolationPtr_->interpolate
160  (
161  cellDisplacement_,
162  pointDisplacement_
163  );
164 
165  tmp<pointField> tcurPoints
166  (
167  points0() + pointDisplacement().internalField()
168  );
169 
170  twoDCorrectPoints(tcurPoints());
171 
172  return tcurPoints;
173 }
174 
175 
177 {
178  // The points have moved so before interpolation update
179  // the mtionSolver accordingly
180  movePoints(fvMesh_.points());
181 
182  diffusivityPtr_->correct();
183  pointDisplacement_.boundaryField().updateCoeffs();
184 
185  surfaceScalarField Df(diffusivityPtr_->operator()());
186 
187  volTensorField gradCd("gradCd", fvc::grad(cellDisplacement_));
188 
190  (
192  (
193  2*Df,
194  cellDisplacement_,
195  "laplacian(diffusivity,cellDisplacement)"
196  )
197 
198  + fvc::div
199  (
200  Df
201  *(
202  (
203  cellDisplacement_.mesh().Sf()
204  & fvc::interpolate(gradCd.T() - gradCd)
205  )
206 
207  // Solid-body rotation "lambda" term
208  - cellDisplacement_.mesh().Sf()*fvc::interpolate(tr(gradCd))
209  )
210  )
211 
212  /*
213  - fvc::laplacian
214  (
215  2*Df,
216  cellDisplacement_,
217  "laplacian(diffusivity,cellDisplacement)"
218  )
219 
220  + fvc::div
221  (
222  Df
223  *(
224  (
225  cellDisplacement_.mesh().Sf()
226  & fvc::interpolate(gradCd + gradCd.T())
227  )
228 
229  // Solid-body rotation "lambda" term
230  - cellDisplacement_.mesh().Sf()*fvc::interpolate(tr(gradCd))
231  )
232  )
233  */
234  );
235 }
236 
237 
239 (
240  const mapPolyMesh& mpm
241 )
242 {
244 
245  // Update diffusivity. Note two stage to make sure old one is de-registered
246  // before creating/registering new one.
247  diffusivityPtr_.reset(NULL);
248  diffusivityPtr_ = motionDiffusivity::New
249  (
250  fvMesh_,
251  coeffDict().lookup("diffusivity")
252  );
253 }
254 
255 
256 // ************************************************************************* //
Foam::IOdictionary
IOdictionary is derived from dictionary and IOobject to give the dictionary automatic IO functionalit...
Definition: IOdictionary.H:53
Foam::IOobject
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
Definition: IOobject.H:91
Foam::fvc::grad
tmp< GeometricField< typename outerProduct< vector, Type >::type, fvPatchField, volMesh >> grad(const GeometricField< Type, fvsPatchField, surfaceMesh > &ssf)
Definition: fvcGrad.C:52
Foam::compressible::New
autoPtr< BasicCompressibleTurbulenceModel > New(const volScalarField &rho, const volVectorField &U, const surfaceScalarField &phi, const typename BasicCompressibleTurbulenceModel::transportModel &transport, const word &propertiesName)
Definition: turbulentFluidThermoModel.C:36
Foam::IOField< vector >
Foam::tmp
A class for managing temporary objects.
Definition: PtrList.H:118
Foam::addToRunTimeSelectionTable
addToRunTimeSelectionTable(ensightPart, ensightPartCells, istream)
mapPolyMesh.H
Foam::fvc::interpolate
tmp< GeometricField< Type, fvsPatchField, surfaceMesh > > interpolate(const GeometricField< Type, fvPatchField, volMesh > &vf, const surfaceScalarField &faceFlux, Istream &schemeData)
Interpolate field onto faces using scheme given by Istream.
Definition: surfaceInterpolate.C:110
Foam::displacementSBRStressFvMotionSolver::solve
virtual void solve()
Solve for motion.
Definition: displacementSBRStressFvMotionSolver.C:176
fvcDiv.H
Calculate the divergence of the given field.
Foam::displacementSBRStressFvMotionSolver::displacementSBRStressFvMotionSolver
displacementSBRStressFvMotionSolver(const displacementSBRStressFvMotionSolver &)
Disallow default bitwise copy construct.
Foam::displacementMotionSolver::updateMesh
virtual void updateMesh(const mapPolyMesh &)
Update local data for topology changes.
Definition: displacementMotionSolver.C:248
Foam::fvc::div
tmp< GeometricField< Type, fvPatchField, volMesh > > div(const GeometricField< Type, fvsPatchField, surfaceMesh > &ssf)
Definition: fvcDiv.C:47
Foam::displacementSBRStressFvMotionSolver::~displacementSBRStressFvMotionSolver
~displacementSBRStressFvMotionSolver()
Destructor.
Definition: displacementSBRStressFvMotionSolver.C:150
Foam::polyMesh
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:74
Foam::fvMotionSolverCore
Base class for fvMesh based motionSolvers.
Definition: fvMotionSolverCore.H:48
Foam::fvm::laplacian
tmp< fvMatrix< Type > > laplacian(const GeometricField< Type, fvPatchField, volMesh > &vf, const word &name)
Definition: fvmLaplacian.C:46
fvmLaplacian.H
Calculate the matrix for the laplacian of the field.
Foam::displacementSBRStressFvMotionSolver::updateMesh
virtual void updateMesh(const mapPolyMesh &)
Update topology.
Definition: displacementSBRStressFvMotionSolver.C:239
Foam::motionDiffusivity::New
static autoPtr< motionDiffusivity > New(const fvMesh &mesh, Istream &mdData)
Select null constructed.
Definition: motionDiffusivity.C:48
Foam::displacementSBRStressFvMotionSolver::curPoints
virtual tmp< pointField > curPoints() const
Return point location obtained from the current motion field.
Definition: displacementSBRStressFvMotionSolver.C:157
dict
dictionary dict
Definition: searchingEngine.H:14
Foam::displacementMotionSolver
Virtual base class for displacement motion solver.
Definition: displacementMotionSolver.H:55
mesh
dynamicFvMesh & mesh
Definition: createDynamicFvMesh.H:18
addToRunTimeSelectionTable.H
Macros for easy insertion into run-time selection tables.
boundaryField
cellIbMask *cellIbMaskExt *faceIbMask *cellIbMask boundaryField().evaluateCoupled()
Foam::dimensioned
Generic dimensioned Type class.
Definition: dimensionedScalarFwd.H:41
surfaceInterpolate.H
Surface Interpolation.
Foam
Namespace for OpenFOAM.
Definition: combustionModel.C:30
motionDiffusivity.H
displacementSBRStressFvMotionSolver.H
Foam::GeometricField::T
tmp< GeometricField< Type, PatchField, GeoMesh > > T() const
Return transpose (only if it is a tensor field)
Definition: GeometricField.C:996
internalField
conserve internalField()+
found
bool found
Definition: TABSMDCalcMethod2.H:32
Foam::solve
SolverPerformance< Type > solve(fvMatrix< Type > &, const dictionary &)
Solve returning the solution statistics given convergence tolerance.
fvcLaplacian.H
Calculate the laplacian of the given field.
fvcGrad.H
Calculate the gradient of the given field.
Foam::mapPolyMesh
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
Definition: mapPolyMesh.H:158
Foam::tr
dimensionedScalar tr(const dimensionedSphericalTensor &dt)
Definition: dimensionedSphericalTensor.C:49
Foam::GeometricField
Generic GeometricField class.
Definition: surfaceFieldsFwd.H:52
Foam::defineTypeNameAndDebug
defineTypeNameAndDebug(combustionModel, 0)
motionInterpolation.H
lookup
stressControl lookup("compactNormalStress") >> compactNormalStress