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>
62 
63 
64  // Private Data
65 
66  //- Reference to the source mesh
67  const fvMesh& srcMesh_;
68 
69  //- Reference to the target mesh
70  const fvMesh& tgtMesh_;
71 
72 
73  // Private Member Functions
74 
75  //- Evaluate constraint types for the given vol field
76  template<class Type>
77  static void evaluateConstraintTypes(VolField<Type>& fld);
78 
79 
80 public:
81 
82  //- Run-time type information
83  TypeName("fvMeshToFvMesh");
84 
85 
86  // Constructors
87 
88  //- Construct from source and target meshes. If a patchMap is supplied,
89  // then interpolate between the specified patches. If not, then assume
90  // a consistent mesh with consistently named patches and interpolate
91  // 1-to-1 between patches with the same name.
93  (
94  const fvMesh& srcMesh,
95  const fvMesh& tgtMesh,
96  const word& engineType,
97  const HashTable<word>& patchMap = NullObjectRef<HashTable<word>>()
98  );
99 
100 
101  //- Destructor
102  virtual ~fvMeshToFvMesh();
103 
104 
105  // Member Functions
106 
107  // Interpolation
108 
109  //- Interpolate a source vol field to the target with no left
110  // over values specified. If the interpolation weight sum is less
111  // than one for a face then they will be normalised. If the
112  // interpolation weight sum is zero for a face then that face's
113  // value will be NaN.
114  template<class Type>
116  (
117  const VolField<Type>& srcFld
118  ) const;
119 
120  //- Interpolate a source vol field to the target with left over
121  // values specified. If the interpolation weight sum is less than
122  // one for a face then the average will include the left over
123  // value multiplied by one minus the weight sum.
124  template<class Type>
126  (
127  const VolField<Type>& srcFld,
128  const VolField<Type>& leftOverTgtFld,
129  const UList<wordRe>& tgtCuttingPatches
130  ) const;
131 
132  //- Interpolate a source vol internal field to the target with no
133  // left over values specified. As the corresponding srcToTgt.
134  template<class Type>
136  (
137  const VolInternalField<Type>& srcFld
138  ) const;
139 
140  //- Interpolate a source vol internal field to the target with left
141  // over values specified. As the corresponding srcToTgt.
142  template<class Type>
144  (
145  const VolInternalField<Type>& srcFld,
146  const VolInternalField<Type>& leftOverTgtFld
147  ) const;
148 
149  //- ...
150  template<class Type>
152  (
153  const SurfaceFieldBoundary<Type>& srcFld
154  ) const;
155 };
156 
157 
158 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
159 
160 } // End namespace Foam
161 
162 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
163 
164 #ifdef NoRepository
165  #include "fvMeshToFvMeshTemplates.C"
166 #endif
167 
168 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
169 
170 #endif
171 
172 // ************************************************************************* //
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:96
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(lagrangian::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(), lagrangian::cloud::prefix, mesh, IOobject::MUST_READ, IOobject::NO_WRITE))
Namespace for OpenFOAM.
typename VolField< Type >::Internal VolInternalField
Definition: volFieldsFwd.H:59
const T & NullObjectRef()
Return const reference to the nullObject of type T.
Definition: nullObjectI.H:27
Foam::surfaceFields.