FreeFOAM The Cross-Platform CFD Toolkit
processorFvPatchField.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::processorFvPatchField
26 
27 Description
28  Foam::processorFvPatchField
29 
30 SourceFiles
31  processorFvPatchField.C
32 
33 \*---------------------------------------------------------------------------*/
34 
35 #ifndef processorFvPatchField_H
36 #define processorFvPatchField_H
37 
41 
42 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
43 
44 namespace Foam
45 {
46 
47 /*---------------------------------------------------------------------------*\
48  Class processorFvPatch Declaration
49 \*---------------------------------------------------------------------------*/
50 
51 template<class Type>
53 :
55  public coupledFvPatchField<Type>
56 {
57  // Private data
58 
59  //- Local reference cast into the processor patch
60  const processorFvPatch& procPatch_;
61 
62 
63 public:
64 
65  //- Runtime type information
66  TypeName(processorFvPatch::typeName_());
67 
68 
69  // Constructors
70 
71  //- Construct from patch and internal field
73  (
74  const fvPatch&,
76  );
77 
78  //- Construct from patch and internal field and patch field
80  (
81  const fvPatch&,
83  const Field<Type>&
84  );
85 
86  //- Construct from patch, internal field and dictionary
88  (
89  const fvPatch&,
91  const dictionary&
92  );
93 
94  //- Construct by mapping given processorFvPatchField onto a new patch
96  (
98  const fvPatch&,
100  const fvPatchFieldMapper&
101  );
102 
103  //- Construct as copy
105 
106  //- Construct and return a clone
107  virtual tmp<fvPatchField<Type> > clone() const
108  {
109  return tmp<fvPatchField<Type> >
110  (
111  new processorFvPatchField<Type>(*this)
112  );
113  }
114 
115  //- Construct as copy setting internal field reference
117  (
120  );
121 
122  //- Construct and return a clone setting internal field reference
123  virtual tmp<fvPatchField<Type> > clone
124  (
126  ) const
127  {
128  return tmp<fvPatchField<Type> >
129  (
130  new processorFvPatchField<Type>(*this, iF)
131  );
132  }
133 
134 
135  // Destructor
136 
138 
139 
140  // Member functions
141 
142  // Access
143 
144  //- Return true if running parallel
145  virtual bool coupled() const
146  {
147  if (Pstream::parRun())
148  {
149  return true;
150  }
151  else
152  {
153  return false;
154  }
155  }
156 
157  //- Return neighbour field given internal field
159 
160 
161  // Evaluation functions
162 
163  //- Initialise the evaluation of the patch field
164  virtual void initEvaluate(const Pstream::commsTypes commsType);
165 
166  //- Evaluate the patch field
167  virtual void evaluate(const Pstream::commsTypes commsType);
168 
169  //- Return patch-normal gradient
170  virtual tmp<Field<Type> > snGrad() const;
171 
172  //- Initialise neighbour matrix update
173  virtual void initInterfaceMatrixUpdate
174  (
175  const scalarField& psiInternal,
176  scalarField& result,
177  const lduMatrix& m,
178  const scalarField& coeffs,
179  const direction cmpt,
180  const Pstream::commsTypes commsType
181  ) const;
182 
183  //- Update result field based on interface functionality
184  virtual void updateInterfaceMatrix
185  (
186  const scalarField& psiInternal,
187  scalarField& result,
188  const lduMatrix& m,
189  const scalarField& coeffs,
190  const direction cmpt,
191  const Pstream::commsTypes commsType
192  ) const;
193 
194  //- Processor coupled interface functions
195 
196  //- Return processor number
197  virtual int myProcNo() const
198  {
199  return procPatch_.myProcNo();
200  }
201 
202  //- Return neigbour processor number
203  virtual int neighbProcNo() const
204  {
205  return procPatch_.neighbProcNo();
206  }
207 
208  //- Does the patch field perform the transfromation
209  virtual bool doTransform() const
210  {
211  return !(procPatch_.parallel() || pTraits<Type>::rank == 0);
212  }
213 
214  //- Return face transformation tensor
215  virtual const tensorField& forwardT() const
216  {
217  return procPatch_.forwardT();
218  }
219 
220  //- Return rank of component for transform
221  virtual int rank() const
222  {
223  return pTraits<Type>::rank;
224  }
225 };
226 
227 
228 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
229 
230 } // End namespace Foam
231 
232 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
233 
234 #ifdef NoRepository
236 #endif
237 
238 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
239 
240 #endif
241 
242 // ************************ vim: set sw=4 sts=4 et: ************************ //