FreeFOAM The Cross-Platform CFD Toolkit
coupledFvPatch.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration |
5  \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
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::coupledFvPatch
26 
27 Description
28  An abstract base class for patches that couple regions of the
29  computational domain e.g. cyclic and processor-processor links.
30 
31 SourceFiles
32  coupledFvPatch.C
33 
34 \*---------------------------------------------------------------------------*/
35 
36 #ifndef coupledFvPatch_H
37 #define coupledFvPatch_H
38 
39 #include <finiteVolume/fvPatch.H>
40 #include <OpenFOAM/lduInterface.H>
42 
43 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
44 
45 namespace Foam
46 {
47 
48 /*---------------------------------------------------------------------------*\
49  Class coupledFvPatch Declaration
50 \*---------------------------------------------------------------------------*/
51 
53 :
54  public lduInterface,
55  public fvPatch
56 {
57  // Private data
58 
59  const coupledPolyPatch& coupledPolyPatch_;
60 
61 
62 protected:
63 
64  // Protected Member Functions
65 
66  //- Make patch weighting factors
67  virtual void makeWeights(scalarField&) const = 0;
68 
69  //- Make patch face - neighbour cell distances
70  virtual void makeDeltaCoeffs(scalarField&) const = 0;
71 
72 
73 public:
74 
75  friend class surfaceInterpolation;
76 
77 
78  //- Runtime type information
79  TypeName(coupledPolyPatch::typeName_());
80 
81 
82  // Constructors
83 
84  //- Construct from polyPatch
86  :
87  fvPatch(patch, bm),
88  coupledPolyPatch_(refCast<const coupledPolyPatch>(patch))
89  {}
90 
91 
92  // Destructor
93 
94  virtual ~coupledFvPatch();
95 
96 
97  // Member Functions
98 
99  // Access
100 
101  //- Return true because this patch is coupled
102  virtual bool coupled() const
103  {
104  return coupledPolyPatch_.coupled();
105  }
106 
107  //- Return face transformation tensor
108  const tensorField& forwardT() const
109  {
110  return coupledPolyPatch_.forwardT();
111  }
112 
113  //- Return neighbour-cell transformation tensor
114  const tensorField& reverseT() const
115  {
116  return coupledPolyPatch_.reverseT();
117  }
118 
119  //- Are the cyclic planes parallel
120  bool parallel() const
121  {
122  return coupledPolyPatch_.parallel();
123  }
124 
125  //- Return faceCell addressing
126  virtual const unallocLabelList& faceCells() const
127  {
128  return fvPatch::faceCells();
129  }
130 
131  //- Return delta (P to N) vectors across coupled patch
132  virtual tmp<vectorField> delta() const = 0;
133 
134 
135  // Interface transfer functions
136 
137  //- Return the values of the given internal data adjacent to
138  // the interface as a field
140  (
141  const unallocLabelList& internalData
142  ) const = 0;
143 
144  //- Initialise interface data transfer
145  virtual void initTransfer
146  (
147  const Pstream::commsTypes commsType,
148  const unallocLabelList& interfaceData
149  ) const
150  {}
151 
152  //- Transfer and return neighbour field
153  virtual tmp<labelField> transfer
154  (
155  const Pstream::commsTypes commsType,
156  const unallocLabelList& interfaceData
157  ) const = 0;
158 
159  //- Initialise neighbour field transfer
160  virtual void initInternalFieldTransfer
161  (
162  const Pstream::commsTypes commsType,
163  unallocLabelList& iF
164  ) const
165  {}
166 
167  //- Return neighbour field
169  (
170  const Pstream::commsTypes commsType,
171  const unallocLabelList& iF
172  ) const = 0;
173 };
174 
175 
176 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
177 
178 } // End namespace Foam
179 
180 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
181 
182 #endif
183 
184 // ************************ vim: set sw=4 sts=4 et: ************************ //