velocityComponentLaplacian_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"
29 #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::velocityComponent(mesh, dict, typeName),
67  cellMotionU_
68  (
69  IOobject
70  (
71  "cellMotionU" + cmptName_,
72  mesh.time().name(),
73  mesh,
74  IOobject::READ_IF_PRESENT,
75  IOobject::AUTO_WRITE
76  ),
78  dimensionedScalar(pointMotionU_.dimensions(), 0),
79  cellMotionBoundaryTypes<scalar>(pointMotionU_.boundaryField())
80  ),
81  diffusivityType_(dict.lookup("diffusivity")),
82  diffusivityPtr_
83  (
84  motionDiffusivity::New(fvMotionSolver::mesh(), diffusivityType_)
85  )
86 {}
87 
88 
90 (
91  fvMesh& mesh,
92  const dictionary& dict
93 )
94 :
96 {}
97 
98 
99 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
100 
102 {}
103 
104 
105 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
106 
109 {
110  // The points have moved so before interpolation update
111  // the fvMotionSolver accordingly
112  movePoints(mesh().points());
113 
114  diffusivityPtr_->correct();
115  pointMotionU_.boundaryFieldRef().updateCoeffs();
116 
118  (
120  (
121  diffusivityPtr_->operator()(),
122  cellMotionU_,
123  "laplacian(diffusivity,cellMotionU)"
124  )
125  );
126 
128  (
129  cellMotionU_,
130  pointMotionU_
131  );
132 
133  tmp<pointField> tcurPoints(new pointField(mesh().points()));
134 
135  tcurPoints.ref().replace
136  (
137  cmpt_,
138  tcurPoints().component(cmpt_)
139  + mesh().time().deltaTValue()
140  *pointMotionU_.primitiveField()
141  );
142 
143  twoDCorrectPoints(tcurPoints.ref());
144 
145  return tcurPoints;
146 }
147 
148 
150 (
151  const polyTopoChangeMap& map
152 )
153 {
155 
156  // Update diffusivity. Note two stage to make sure old one is de-registered
157  // before creating/registering new one.
158  diffusivityPtr_.reset(nullptr);
159  diffusivityType_.rewind();
160  diffusivityPtr_ = motionDiffusivity::New
161  (
162  mesh(),
163  diffusivityType_
164  );
165 }
166 
167 
169 (
170  const polyMeshMap& map
171 )
172 {
174 
175  // Update diffusivity. Note two stage to make sure old one is de-registered
176  // before creating/registering new one.
177  diffusivityPtr_.reset(nullptr);
178  diffusivityType_.rewind();
179  diffusivityPtr_ = motionDiffusivity::New
180  (
181  mesh(),
182  diffusivityType_
183  );
184 }
185 
186 
187 // ************************************************************************* //
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 given component ...
velocityComponentLaplacian(fvMesh &, const dictionary &)
Construct from fvMesh and dictionary.
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.
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 local data for topology changes.
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 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.
vectorField pointField
pointField is a vectorField.
Definition: pointFieldFwd.H:42
void component(GeometricField< typename GeometricField< Type, GeoMesh, PrimitiveField1 >::cmptType, GeoMesh, PrimitiveField1 > &gcf, const GeometricField< Type, GeoMesh, PrimitiveField2 > &gf, const direction d)
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