interRegionModel.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) 2011-2021 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::fv::interRegionModel
26 
27 Description
28  Base class for inter-region exchange.
29 
30 \*---------------------------------------------------------------------------*/
31 
32 #ifndef interRegionModel_H
33 #define interRegionModel_H
34 
35 #include "fvModel.H"
36 #include "volFields.H"
37 #include "autoPtr.H"
38 #include "meshToMesh.H"
39 
40 
41 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
42 
43 namespace Foam
44 {
45 namespace fv
46 {
47 
48 /*---------------------------------------------------------------------------*\
49  Class interRegionModel Declaration
50 \*---------------------------------------------------------------------------*/
51 
52 class interRegionModel
53 :
54  public fvModel
55 {
56  // Private data
57 
58  //- Master or slave region
59  bool master_;
60 
61  //- Name of the neighbour region to map
62  word nbrRegionName_;
63 
64  //- Interpolation method
65  word interpolationMethod_;
66 
67  //- Mesh to mesh interpolation object
68  mutable autoPtr<meshToMesh> meshInterpPtr_;
69 
70 
71  // Private member functions
72 
73  //- Non-virtual read
74  void readCoeffs();
75 
76  //- Set the mesh to mesh interpolation object
77  void setMapper() const;
78 
79 
80 protected:
81 
82  // Protected member functions
83 
84  //- Get the neighbour interRegionModel
85  const interRegionModel& nbrModel() const;
86 
87 
88 public:
89 
90  //- Runtime type information
91  TypeName("interRegionModel");
92 
93 
94  // Constructors
95 
96  //- Construct from dictionary
98  (
99  const word& name,
100  const word& modelType,
101  const dictionary& dict,
102  const fvMesh& mesh
103  );
104 
105 
106  //- Destructor
107  virtual ~interRegionModel();
108 
109 
110  // Member Functions
111 
112  // Access
113 
114  //- Return whether the master region
115  inline bool master() const;
116 
117  //- Return const access to the neighbour region name
118  inline const word& nbrRegionName() const;
119 
120  //- Return const access to the neighbour mesh
121  inline const fvMesh& nbrMesh() const;
122 
123  //- Return const access to the mapToMap pointer
124  inline const meshToMesh& meshInterp() const;
125 
126 
127  // Interpolation
128 
129  //- Interpolate field with nbrModel specified
130  template<class Type>
132  (
133  const interRegionModel& nbrModel,
134  const Field<Type>& field
135  ) const;
136 
137  //- Interpolate field without nbrModel specified
138  template<class Type>
140  (
141  const Field<Type>& field
142  ) const;
143 
144  //- Interpolate field with nbrModel specified
145  template<class Type>
146  void interpolate
147  (
148  const interRegionModel& nbrModel,
149  const Field<Type>& field,
150  Field<Type>& result
151  ) const;
152 
153  //- Interpolate field without nbrModel specified
154  template<class Type>
155  void interpolate
156  (
157  const Field<Type>& field,
158  Field<Type>& result
159  ) const;
160 
161 
162  // IO
163 
164  //- Read dictionary
165  virtual bool read(const dictionary& dict);
166 };
167 
168 
169 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
170 
171 } // End namespace fv
172 } // End namespace Foam
173 
174 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
175 
176 #include "interRegionModelI.H"
177 
178 #ifdef NoRepository
179  #include "interRegionModelTemplates.C"
180 #endif
181 
182 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
183 
184 #endif
185 
186 // ************************************************************************* //
const word & nbrRegionName() const
Return const access to the neighbour region name.
dictionary dict
const word & name() const
Return const access to the source name.
Definition: fvModelI.H:28
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:156
Finite volume model abstract base class.
Definition: fvModel.H:57
Class to calculate the cell-addressing between two overlapping meshes.
Definition: meshToMesh.H:60
const fvMesh & mesh() const
Return const access to the mesh database.
Definition: fvModelI.H:34
const fvMesh & nbrMesh() const
Return const access to the neighbour mesh.
Base class for inter-region exchange.
Pre-declare SubField and related Field type.
Definition: Field.H:56
A class for handling words, derived from string.
Definition: word.H:59
labelList fv(nPoints)
interRegionModel(const word &name, const word &modelType, const dictionary &dict, const fvMesh &mesh)
Construct from dictionary.
bool master() const
Return whether the master region.
virtual bool read(const dictionary &dict)
Read dictionary.
tmp< Field< Type > > interpolate(const interRegionModel &nbrModel, const Field< Type > &field) const
Interpolate field with nbrModel specified.
const meshToMesh & meshInterp() const
Return const access to the mapToMap pointer.
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:95
virtual ~interRegionModel()
Destructor.
const interRegionModel & nbrModel() const
Get the neighbour interRegionModel.
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: PtrList.H:52
TypeName("interRegionModel")
Runtime type information.
rDeltaTY field()
A class for managing temporary objects.
Definition: PtrList.H:53
Namespace for OpenFOAM.