velocityComponentLaplacianFvMotionSolver.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 
32 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
33 
34 namespace Foam
35 {
36  defineTypeNameAndDebug(velocityComponentLaplacianFvMotionSolver, 0);
37 
39  (
40  motionSolver,
41  velocityComponentLaplacianFvMotionSolver,
42  dictionary
43  );
44 }
45 
46 
47 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
48 
51 (
52  const polyMesh& mesh,
53  const IOdictionary& dict
54 )
55 :
58  cellMotionU_
59  (
60  IOobject
61  (
62  "cellMotionU" + cmptName_,
63  mesh.time().timeName(),
64  mesh,
65  IOobject::READ_IF_PRESENT,
66  IOobject::AUTO_WRITE
67  ),
68  fvMesh_,
70  (
71  "cellMotionU",
72  pointMotionU_.dimensions(),
73  0
74  ),
75  cellMotionBoundaryTypes<scalar>(pointMotionU_.boundaryField())
76  ),
77  interpolationPtr_
78  (
79  coeffDict().found("interpolation")
80  ? motionInterpolation::New(fvMesh_, coeffDict().lookup("interpolation"))
81  : motionInterpolation::New(fvMesh_)
82  ),
83  diffusivityPtr_
84  (
85  motionDiffusivity::New(fvMesh_, coeffDict().lookup("diffusivity"))
86  )
87 {}
88 
89 
90 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
91 
94 {}
95 
96 
97 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
98 
101 {
102  interpolationPtr_->interpolate
103  (
104  cellMotionU_,
105  pointMotionU_
106  );
107 
108  tmp<pointField> tcurPoints(new pointField(fvMesh_.points()));
109 
110  tcurPoints().replace
111  (
112  cmpt_,
113  tcurPoints().component(cmpt_)
114  + fvMesh_.time().deltaTValue()*pointMotionU_.internalField()
115  );
116 
117  twoDCorrectPoints(tcurPoints());
118 
119  return tcurPoints;
120 }
121 
122 
124 {
125  // The points have moved so before interpolation update
126  // the fvMotionSolver accordingly
127  movePoints(fvMesh_.points());
128 
129  diffusivityPtr_->correct();
130  pointMotionU_.boundaryField().updateCoeffs();
131 
133  (
135  (
136  diffusivityPtr_->operator()(),
137  cellMotionU_,
138  "laplacian(diffusivity,cellMotionU)"
139  )
140  );
141 }
142 
143 
145 (
146  const mapPolyMesh& mpm
147 )
148 {
150 
151  // Update diffusivity. Note two stage to make sure old one is de-registered
152  // before creating/registering new one.
153  diffusivityPtr_.reset(NULL);
154  diffusivityPtr_ = motionDiffusivity::New
155  (
156  fvMesh_,
157  coeffDict().lookup("diffusivity")
158  );
159 }
160 
161 
162 // ************************************************************************* //
Foam::componentVelocityMotionSolver::updateMesh
virtual void updateMesh(const mapPolyMesh &)
Update local data for topology changes.
Definition: componentVelocityMotionSolver.C:108
Foam::pointField
vectorField pointField
pointField is a vectorField.
Definition: pointFieldFwd.H:42
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::velocityComponentLaplacianFvMotionSolver::velocityComponentLaplacianFvMotionSolver
velocityComponentLaplacianFvMotionSolver(const velocityComponentLaplacianFvMotionSolver &)
Disallow default bitwise copy construct.
Foam::component
void component(FieldField< Field, typename FieldField< Field, Type >::cmptType > &sf, const FieldField< Field, Type > &f, const direction d)
Definition: FieldFieldFunctions.C:41
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::tmp
A class for managing temporary objects.
Definition: PtrList.H:118
Foam::addToRunTimeSelectionTable
addToRunTimeSelectionTable(ensightPart, ensightPartCells, istream)
Foam::velocityComponentLaplacianFvMotionSolver::~velocityComponentLaplacianFvMotionSolver
~velocityComponentLaplacianFvMotionSolver()
Destructor.
Definition: velocityComponentLaplacianFvMotionSolver.C:93
Foam::polyMesh
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:74
velocityComponentLaplacianFvMotionSolver.H
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::motionDiffusivity::New
static autoPtr< motionDiffusivity > New(const fvMesh &mesh, Istream &mdData)
Select null constructed.
Definition: motionDiffusivity.C:48
Foam::componentVelocityMotionSolver
Virtual base class for velocity motion solver.
Definition: componentVelocityMotionSolver.H:54
dict
dictionary dict
Definition: searchingEngine.H:14
mesh
dynamicFvMesh & mesh
Definition: createDynamicFvMesh.H:18
addToRunTimeSelectionTable.H
Macros for easy insertion into run-time selection tables.
Foam::dimensioned
Generic dimensioned Type class.
Definition: dimensionedScalarFwd.H:41
Foam
Namespace for OpenFOAM.
Definition: combustionModel.C:30
motionDiffusivity.H
found
bool found
Definition: TABSMDCalcMethod2.H:32
Foam::velocityComponentLaplacianFvMotionSolver::curPoints
virtual tmp< pointField > curPoints() const
Return point location obtained from the current motion field.
Definition: velocityComponentLaplacianFvMotionSolver.C:100
Foam::solve
SolverPerformance< Type > solve(fvMatrix< Type > &, const dictionary &)
Solve returning the solution statistics given convergence tolerance.
Foam::mapPolyMesh
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
Definition: mapPolyMesh.H:158
Foam::velocityComponentLaplacianFvMotionSolver::solve
virtual void solve()
Solve for motion.
Definition: velocityComponentLaplacianFvMotionSolver.C:123
Foam::defineTypeNameAndDebug
defineTypeNameAndDebug(combustionModel, 0)
motionInterpolation.H
lookup
stressControl lookup("compactNormalStress") >> compactNormalStress
Foam::velocityComponentLaplacianFvMotionSolver::updateMesh
virtual void updateMesh(const mapPolyMesh &)
Update topology.
Definition: velocityComponentLaplacianFvMotionSolver.C:145