fvMeshToFvMesh.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) 2022-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 Class
25  Foam::fvMeshToFvMesh
26 
27 Description
28 
29 SourceFiles
30  fvMeshToFvMeshTemplates.C
31 
32 \*---------------------------------------------------------------------------*/
33 
34 #ifndef fvMeshToFvMesh_H
35 #define fvMeshToFvMesh_H
36 
37 #include "meshToMesh.H"
38 #include "volFields.H"
39 #include "surfaceFields.H"
40 
41 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
42 
43 namespace Foam
44 {
45 
46 /*---------------------------------------------------------------------------*\
47  Class fvMeshToFvMesh Declaration
48 \*---------------------------------------------------------------------------*/
49 
50 class fvMeshToFvMesh
51 :
52  public meshToMesh
53 {
54 private:
55 
56  // Private Typedefs
57 
58  //- Alias for surface boundary fields to reduce verbosity of method
59  // definitions below
60  template<class Type>
61  using SurfaceFieldBoundary =
63 
64 
65  // Private Data
66 
67  //- Reference to the source mesh
68  const fvMesh& srcMesh_;
69 
70  //- Reference to the target mesh
71  const fvMesh& tgtMesh_;
72 
73 
74  // Private Member Functions
75 
76  //- Evaluate constraint types for the given vol field
77  template<class Type>
78  static void evaluateConstraintTypes(VolField<Type>& fld);
79 
80 
81 public:
82 
83  //- Run-time type information
84  TypeName("fvMeshToFvMesh");
85 
86 
87  // Constructors
88 
89  //- Construct from source and target meshes. If a patchMap is supplied,
90  // then interpolate between the specified patches. If not, then assume
91  // a consistent mesh with consistently named patches and interpolate
92  // 1-to-1 between patches with the same name.
94  (
95  const fvMesh& srcMesh,
96  const fvMesh& tgtMesh,
97  const word& engineType,
98  const HashTable<word>& patchMap = NullObjectRef<HashTable<word>>()
99  );
100 
101 
102  //- Destructor
103  virtual ~fvMeshToFvMesh();
104 
105 
106  // Member Functions
107 
108  // Interpolation
109 
110  //- Interpolate a source vol field to the target with no left
111  // over values specified. If the interpolation weight sum is less
112  // than one for a face then they will be normalised. If the
113  // interpolation weight sum is zero for a face then that face's
114  // value will be NaN.
115  template<class Type>
117  (
118  const VolField<Type>& srcFld
119  ) const;
120 
121  //- Interpolate a source vol field to the target with left over
122  // values specified. If the interpolation weight sum is less than
123  // one for a face then the average will include the left over
124  // value multiplied by one minus the weight sum.
125  template<class Type>
127  (
128  const VolField<Type>& srcFld,
129  const VolField<Type>& leftOverTgtFld,
130  const UList<wordRe>& tgtCuttingPatches
131  ) const;
132 
133  //- Interpolate a source vol internal field to the target with no
134  // left over values specified. As the corresponding srcToTgt.
135  template<class Type>
137  (
138  const VolInternalField<Type>& srcFld
139  ) const;
140 
141  //- Interpolate a source vol internal field to the target with left
142  // over values specified. As the corresponding srcToTgt.
143  template<class Type>
145  (
146  const VolInternalField<Type>& srcFld,
147  const VolInternalField<Type>& leftOverTgtFld
148  ) const;
149 
150  //- ...
151  template<class Type>
153  (
154  const SurfaceFieldBoundary<Type>& srcFld
155  ) const;
156 };
157 
158 
159 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
160 
161 } // End namespace Foam
162 
163 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
164 
165 #ifdef NoRepository
166  #include "fvMeshToFvMeshTemplates.C"
167 #endif
168 
169 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
170 
171 #endif
172 
173 // ************************************************************************* //
Generic GeometricBoundaryField class.
Generic GeometricField class.
An STL-conforming hash table.
Definition: HashTable.H:127
A 1D vector of objects of type <T>, where the size of the vector is known and can be used for subscri...
Definition: UList.H:74
virtual ~fvMeshToFvMesh()
Destructor.
TypeName("fvMeshToFvMesh")
Run-time type information.
tmp< VolField< Type > > srcToTgt(const VolField< Type > &srcFld) const
Interpolate a source vol field to the target with no left.
fvMeshToFvMesh(const fvMesh &srcMesh, const fvMesh &tgtMesh, const word &engineType, const HashTable< word > &patchMap=NullObjectRef< HashTable< word >>())
Construct from source and target meshes. If a patchMap is supplied,.
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:99
Class to calculate interpolative addressing and weights between the cells and patches of two overlapp...
Definition: meshToMesh.H:54
const polyMesh & srcMesh() const
Return const access to the source mesh.
Definition: meshToMeshI.H:127
const polyMesh & tgtMesh() const
Return const access to the target mesh.
Definition: meshToMeshI.H:133
A class for managing temporary objects.
Definition: tmp.H:55
A class for handling words, derived from string.
Definition: word.H:62
gmvFile<< "tracers "<< particles.size()<< nl;{ pointField positions(particles.size());label particlei=0;forAllConstIter(Cloud< passiveParticle >, particles, iter) { positions[particlei++]=iter().position(mesh);} for(i=0;i< pTraits< point >::nComponents;i++) { forAll(positions, particlei) { gmvFile<< component(positions[particlei], i)<< ' ';} gmvFile<< nl;}}forAll(lagrangianScalarNames, i){ const word &name=lagrangianScalarNames[i];IOField< scalar > fld(IOobject(name, runTime.name(), cloud::prefix, mesh, IOobject::MUST_READ, IOobject::NO_WRITE))
Namespace for OpenFOAM.
typename VolField< Type >::Internal VolInternalField
Definition: volFieldsFwd.H:61
const T & NullObjectRef()
Return const reference to the nullObject of type T.
Definition: nullObjectI.H:27
Foam::surfaceFields.