velocityLaplacian_fvMotionSolver.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-2026 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 {
36 namespace fvMotionSolvers
37 {
39 
41  (
44  fvMesh
45  );
46 
48  (
52  );
53 }
54 }
55 
56 
57 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
58 
60 (
61  const polyMesh& mesh,
62  const dictionary& dict
63 )
64 :
66  pointMeshMovers::velocity(mesh, dict, typeName),
67  cellMotionU_
68  (
69  IOobject
70  (
71  "cellMotionU",
72  mesh.time().name(),
73  mesh,
74  IOobject::READ_IF_PRESENT,
75  IOobject::AUTO_WRITE
76  ),
79  (
80  "cellMotionU",
81  pointMotionU_.dimensions(),
82  Zero
83  ),
84  cellMotionBoundaryTypes<vector>(pointMotionU_.boundaryField())
85  ),
86  diffusivityType_(dict.lookup("diffusivity")),
87  diffusivityPtr_
88  (
89  motionDiffusivity::New(fvMotionSolver::mesh(), diffusivityType_)
90  )
91 {}
92 
93 
95 (
96  fvMesh& mesh,
97  const dictionary& dict
98 )
99 :
100  velocityLaplacian(mesh.poly(), dict)
101 {}
102 
103 
104 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
105 
107 {}
108 
109 
110 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
111 
114 {
115  // The points have moved so before interpolation update
116  // the fvMotionSolver accordingly
117  movePoints(mesh().points());
118 
119  diffusivityPtr_->correct();
120  pointMotionU_.boundaryFieldRef().updateCoeffs();
121 
123  (
125  (
126  diffusivityPtr_->operator()(),
127  cellMotionU_,
128  "laplacian(diffusivity,cellMotionU)"
129  )
130  );
131 
133  (
134  cellMotionU_,
135  pointMotionU_
136  );
137 
138  tmp<pointField> tcurPoints
139  (
140  mesh().points()
141  + mesh().time().deltaTValue()*pointMotionU_.primitiveField()
142  );
143 
144  twoDCorrectPoints(tcurPoints.ref());
145 
146  return tcurPoints;
147 }
148 
149 
150 //void Foam::fvMotionSolvers::velocityLaplacian::movePoints(const pointField& p)
151 //{
152 // // Movement of pointMesh and volPointInterpolation already
153 // // done by polyMesh,fvMesh
154 //}
155 
156 
158 (
159  const polyTopoChangeMap& map
160 )
161 {
163 
164  // Update diffusivity. Note two stage to make sure old one is de-registered
165  // before creating/registering new one.
166  diffusivityPtr_.reset(nullptr);
167  diffusivityType_.rewind();
168  diffusivityPtr_ = motionDiffusivity::New
169  (
170  mesh(),
171  diffusivityType_
172  );
173 }
174 
175 
177 (
178  const polyMeshMap& map
179 )
180 {
182 
183  // Update diffusivity. Note two stage to make sure old one is de-registered
184  // before creating/registering new one.
185  diffusivityPtr_.reset(nullptr);
186  diffusivityType_.rewind();
187  diffusivityPtr_ = motionDiffusivity::New
188  (
189  mesh(),
190  diffusivityType_
191  );
192 }
193 
194 
195 // ************************************************************************* //
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
Abstract base class for fvMesh movers.
Definition: fvMeshMover.H:53
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:98
Base class for fvMesh motion solvers.
Mesh motion solver for an fvMesh. Based on solving the cell-centre Laplacian for the motion velocity.
virtual void topoChange(const polyTopoChangeMap &)
Update corresponding to the given map.
virtual tmp< pointField > newPoints()
Return point location obtained from the current motion field.
virtual void mapMesh(const polyMeshMap &)
Update from another mesh using the given map.
velocityLaplacian(fvMesh &, const dictionary &)
Construct from fvMesh and dictionary.
Abstract base class for cell-centre mesh motion diffusivity.
static autoPtr< motionDiffusivity > New(const fvMesh &mesh, Istream &mdData)
Select null constructed.
Abstract base class for pointMesh movers.
virtual void topoChange(const polyTopoChangeMap &)
Update corresponding to the given map.
virtual void mapMesh(const polyMeshMap &)
Update from another mesh using the given map.
Class containing mesh-to-mesh mapping information.
Definition: polyMeshMap.H:51
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:78
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
Template function which returns the un-mangled name of a given type. Useful for types which do not ha...
tmp< PointField< Type > > interpolate(const VolField< Type > &) const
Interpolate volField using inverse distance weighting.
Foam::fvMesh mesh(Foam::IOobject(regionName, runTime.name(), runTime, Foam::IOobject::MUST_READ), false)
Calculate the matrix for the laplacian of the field.
const pointField & points
const dimensionSet velocity
const dimensionSet time
defineTypeNameAndDebug(displacementLaplacian, 0)
addToRunTimeSelectionTable(fvMeshMover, displacementLaplacian, fvMesh)
tmp< fvMatrix< Type > > laplacian(const VolField< Type > &vf, const word &name)
Definition: fvmLaplacian.C:47
const unitSet & lookup(const word &unitName)
Lookup and return the named unit from the table.
Definition: units.C:346
Namespace for OpenFOAM.
static const zero Zero
Definition: zero.H:97
word name(const LagrangianState state)
Return a string representation of a Lagrangian state enumeration.
tmp< DimensionedField< TypeR, GeoMesh, Field > > New(const tmp< DimensionedField< TypeR, GeoMesh, Field >> &tdf1, const word &name, const dimensionSet &dimensions)
SolverPerformance< Type > solve(fvMatrix< Type > &, const word &)
Solve returning the solution statistics given convergence tolerance.
dictionary dict