fvMeshStitchersMoving.H
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) 2021-2023 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 Class
25  Foam::fvMeshStitchers::moving
26 
27 Description
28  Mesh stitcher for moving meshes
29 
30 SourceFiles
31  fvMeshStitchersMoving.C
32 
33 \*---------------------------------------------------------------------------*/
34 
35 #ifndef fvMeshStitchersMoving_H
36 #define fvMeshStitchersMoving_H
37 
38 #include "fvMeshStitcher.H"
39 
40 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
41 
42 namespace Foam
43 {
44 namespace fvMeshStitchers
45 {
46 
47 /*---------------------------------------------------------------------------*\
48  Class fvMeshStitchers::moving Declaration
49 \*---------------------------------------------------------------------------*/
50 
51 class moving
52 :
53  public fvMeshStitcher
54 {
55  // Private Member Functions
56 
57  //- Return whether or not this stitcher supports a changing mesh
58  virtual bool changing() const
59  {
60  return true;
61  }
62 
63  //- Correct the mesh fluxes following a conform operation
64  virtual void conformCorrectMeshPhi(surfaceScalarField& phi);
65 
66  //- Initialise correction of the mesh fluxes. Create two error faces
67  // for every original face. These are initialised to have small
68  // opposing areas for stabilisation purposes. They will later be
69  // enlarged and given mesh fluxes by unconformErrorFaceCorrectMeshPhi.
70  virtual void createNonConformalCorrectMeshPhiGeometry
71  (
72  SurfaceFieldBoundary<label>& polyFacesBf,
73  surfaceVectorField& SfSf,
74  surfaceVectorField& CfSf
75  );
76 
77  //- Get a set of all the cells that are edge-connected to the
78  // owner-orig patches. This is the sub-set in which mesh phi gets
79  // corrected.
80  labelHashSet ownerCoupledCellSet();
81 
82  //- Correct the mismatch in mesh flux across non-conformal couplings by
83  // synchronising as much as possible without affecting the total
84  // volume change. Synchronise asymmetrically, so that the owner patch
85  // takes the neighbour value. Doing this creates a volume conservation
86  // error in the owner-adjacent cells. Remove this by solving for a
87  // potential to correct the mesh fluxes across the faces that are
88  // edge-connected to the owner patches.
89  //
90  // This process creates a very smooth and well behaved result. It
91  // cannot fully correct the mesh flux mismatch if the error does not
92  // globally conserve volume. In that case,
93  // unconformErrorFaceCorrectMeshPhi is also needed. Doing this
94  // correction first, however, vastly reduces the noise introduced by
95  // unconformErrorFaceCorrectMeshPhi.
96  //
97  void unconformInternalFaceCorrectMeshPhi(surfaceScalarField& phi);
98 
99  //- Correct the mismatch in the mesh flux by synchronising
100  // symmetrically across across non-conformal couplings. Compensate for
101  // any error that this creates by enlarging and adding mesh flux to
102  // the error faces.
103  //
104  // This correction procedure can result in significant noise being
105  // introduced to the system. This is compensated by doing
106  // unconformInternalFaceCorrectMeshPhi first, which acts to smooth and
107  // reduce (and sometimes remove entirely) changes to the error faces.
108  //
109  void unconformErrorFaceCorrectMeshPhi
110  (
111  const SurfaceFieldBoundary<label>& polyFacesBf,
112  surfaceVectorField& SfSf,
113  surfaceVectorField& CfSf,
114  surfaceScalarField& phi
115  );
116 
117  //- Correct the mesh fluxes following an unconform operation
118  virtual void unconformCorrectMeshPhi
119  (
120  const SurfaceFieldBoundary<label>& polyFacesBf,
121  surfaceVectorField& SfSf,
122  surfaceVectorField& CfSf,
123  surfaceScalarField& phi
124  );
125 
126 
127 public:
128 
129  //- Runtime type information
130  TypeName("moving");
131 
132 
133  // Constructors
134 
135  //- Construct from fvMesh
136  explicit moving(fvMesh&);
137 
138 
139  //- Destructor
140  virtual ~moving();
141 };
142 
143 
144 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
145 
146 } // End namespace fvMeshStitchers
147 } // End namespace Foam
148 
149 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
150 
151 #endif
152 
153 // ************************************************************************* //
Generic GeometricBoundaryField class.
Generic GeometricField class.
Mesh manipulator that uses the intersection provided by the cyclic non-conformal poly patches to crea...
Mesh stitcher for moving meshes.
TypeName("moving")
Runtime type information.
moving(fvMesh &)
Construct from fvMesh.
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:101
Namespace for OpenFOAM.