velocityLaplacianFvMotionSolver.C
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2011-2024 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 "motionDiffusivity.H"
28 #include "fvmLaplacian.H"
30 #include "volPointInterpolation.H"
31 
32 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
33 
34 namespace Foam
35 {
37 
39  (
43  );
44 }
45 
46 
47 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
48 
50 (
51  const word& name,
52  const polyMesh& mesh,
53  const dictionary& dict
54 )
55 :
56  velocityMotionSolver(name, mesh, dict, typeName),
58  cellMotionU_
59  (
60  IOobject
61  (
62  "cellMotionU",
63  mesh.time().name(),
64  mesh,
65  IOobject::READ_IF_PRESENT,
66  IOobject::AUTO_WRITE
67  ),
68  fvMesh_,
70  (
71  "cellMotionU",
72  pointMotionU_.dimensions(),
73  Zero
74  ),
75  cellMotionBoundaryTypes<vector>(pointMotionU_.boundaryField())
76  ),
77  diffusivityType_(dict.lookup("diffusivity")),
78  diffusivityPtr_
79  (
80  motionDiffusivity::New(fvMesh_, diffusivityType_)
81  )
82 {}
83 
84 
85 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
86 
88 {}
89 
90 
91 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
92 
95 {
97  (
98  cellMotionU_,
99  pointMotionU_
100  );
101 
102  tmp<pointField> tcurPoints
103  (
104  fvMesh_.points()
105  + fvMesh_.time().deltaTValue()*pointMotionU_.primitiveField()
106  );
107 
108  twoDCorrectPoints(tcurPoints.ref());
109 
110  return tcurPoints;
111 }
112 
113 
115 {
116  // The points have moved so before interpolation update
117  // the fvMotionSolver accordingly
118  movePoints(fvMesh_.points());
119 
120  diffusivityPtr_->correct();
121  pointMotionU_.boundaryFieldRef().updateCoeffs();
122 
124  (
126  (
127  diffusivityPtr_->operator()(),
128  cellMotionU_,
129  "laplacian(diffusivity,cellMotionU)"
130  )
131  );
132 }
133 
134 
135 //void Foam::velocityLaplacianFvMotionSolver::movePoints(const pointField& p)
136 //{
137 // // Movement of pointMesh and volPointInterpolation already
138 // // done by polyMesh,fvMesh
139 //}
140 
141 
143 (
144  const polyTopoChangeMap& map
145 )
146 {
148 
149  // Update diffusivity. Note two stage to make sure old one is de-registered
150  // before creating/registering new one.
151  diffusivityPtr_.reset(nullptr);
152  diffusivityType_.rewind();
153  diffusivityPtr_ = motionDiffusivity::New
154  (
155  fvMesh_,
156  diffusivityType_
157  );
158 }
159 
160 
162 (
163  const polyMeshMap& map
164 )
165 {
167 
168  // Update diffusivity. Note two stage to make sure old one is de-registered
169  // before creating/registering new one.
170  diffusivityPtr_.reset(nullptr);
171  diffusivityType_.rewind();
172  diffusivityPtr_ = motionDiffusivity::New
173  (
174  fvMesh_,
175  diffusivityType_
176  );
177 }
178 
179 
180 // ************************************************************************* //
Macros for easy insertion into run-time selection tables.
static volPointInterpolation & New(const word &name, const fvMesh &mesh)
Construct and return the named DemandDrivenMeshObject.
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
Definition: IOobject.H:99
A list of keywords followed by any number of values (e.g. words and numbers) or sub-dictionaries.
Definition: dictionary.H:162
Base class for fvMesh based motionSolvers.
Abstract base class for cell-centre mesh motion diffusivity.
static autoPtr< motionDiffusivity > New(const fvMesh &mesh, Istream &mdData)
Select null constructed.
Virtual base class for mesh motion solver.
Definition: motionSolver.H:57
Class containing mesh-to-mesh mapping information.
Definition: polyMeshMap.H:51
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:80
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
A class for managing temporary objects.
Definition: tmp.H:55
T & ref() const
Return non-const reference or generate a fatal error.
Definition: tmpI.H:197
Mesh motion solver for an fvMesh. Based on solving the cell-centre Laplacian for the motion velocity.
velocityLaplacianFvMotionSolver(const word &name, const polyMesh &, const dictionary &)
Construct from polyMesh and dictionary.
virtual tmp< pointField > curPoints() const
Return point location obtained from the current motion field.
virtual void topoChange(const polyTopoChangeMap &)
Update corresponding to the given map.
virtual void mapMesh(const polyMeshMap &)
Update from another mesh using the given map.
Virtual base class for velocity motion solver.
virtual void topoChange(const polyTopoChangeMap &)
Update corresponding to the given map.
virtual void mapMesh(const polyMeshMap &)
Update from another mesh using the given map.
tmp< PointField< Type > > interpolate(const VolField< Type > &) const
Interpolate volField using inverse distance weighting.
A class for handling words, derived from string.
Definition: word.H:62
Foam::fvMesh mesh(Foam::IOobject(regionName, runTime.name(), runTime, Foam::IOobject::MUST_READ), false)
Calculate the matrix for the laplacian of the field.
autoPtr< CompressibleMomentumTransportModel > New(const volScalarField &rho, const volVectorField &U, const surfaceScalarField &phi, const viscosity &viscosity)
tmp< fvMatrix< Type > > laplacian(const VolField< Type > &vf, const word &name)
Definition: fvmLaplacian.C:47
Namespace for OpenFOAM.
static const zero Zero
Definition: zero.H:97
addToRunTimeSelectionTable(polyPatch, mergedCyclicPolyPatch, word)
const HashTable< dimensionSet > & dimensions()
Get the table of dimension sets.
Definition: dimensionSets.C:96
defineTypeNameAndDebug(combustionModel, 0)
word name(const LagrangianState state)
Return a string representation of a Lagrangian state enumeration.
SolverPerformance< Type > solve(fvMatrix< Type > &, const word &)
Solve returning the solution statistics given convergence tolerance.
dictionary dict