MapFvSurfaceField.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 | www.openfoam.com
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8  Copyright (C) 2011-2015 OpenFOAM Foundation
9 -------------------------------------------------------------------------------
10 License
11  This file is part of OpenFOAM.
12 
13  OpenFOAM is free software: you can redistribute it and/or modify it
14  under the terms of the GNU General Public License as published by
15  the Free Software Foundation, either version 3 of the License, or
16  (at your option) any later version.
17 
18  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21  for more details.
22 
23  You should have received a copy of the GNU General Public License
24  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25 
26 Description
27  Map Surface internal field on topology change. This is a partial
28  template specialisation, see MapGeometricFields.
29 
30 \*---------------------------------------------------------------------------*/
31 
32 #ifndef MapFvSurfaceField_H
33 #define MapFvSurfaceField_H
34 
35 #include "Field.H"
36 #include "surfaceMesh.H"
37 
38 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
39 
40 namespace Foam
41 {
42 
43 template<class Type, class MeshMapper>
44 class MapInternalField<Type, MeshMapper, surfaceMesh>
45 {
46 public:
47 
49  {}
50 
51  void operator()
52  (
54  const MeshMapper& mapper
55  ) const;
56 };
57 
58 
59 template<class Type, class MeshMapper>
61 (
63  const MeshMapper& mapper
64 ) const
65 {
66  if (field.size() != mapper.surfaceMap().sizeBeforeMapping())
67  {
69  << "Incompatible size before mapping. Field size: " << field.size()
70  << " map size: " << mapper.surfaceMap().sizeBeforeMapping()
71  << abort(FatalError);
72  }
73 
74  // Passing in oriented flag so that oriented fields (e.g. phi) are negated
75  // if flipped. Un-oriented fields, e.g U interpolated to faces (Uf) are not
76  // touched
77  field.autoMap(mapper.surfaceMap(), field.is_oriented());
78 
79  if (field.is_oriented())
80  {
81  // Flip the flux
82  const labelList flipFaces = mapper.surfaceMap().flipFaceFlux().toc();
83 
84  forAll(flipFaces, i)
85  {
86  if (flipFaces[i] < field.size())
87  {
88  field[flipFaces[i]] *= -1.0;
89  }
90  }
91  }
92 }
93 
94 
95 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
96 
97 } // End namespace Foam
98 
99 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
100 
101 #endif
102 
103 // ************************************************************************* //
rDeltaTY field()
Mesh data needed to do the Finite Volume discretisation.
Definition: surfaceMesh.H:43
error FatalError
Error stream (stdout output on all processes), with additional &#39;FOAM FATAL ERROR&#39; header text and sta...
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Definition: error.H:598
#define forAll(list, i)
Loop across all elements in list.
Definition: stdFoam.H:421
errorManip< error > abort(error &err)
Definition: errorManip.H:139
Generic internal field mapper. For "real" mapping, add template specialisations for mapping of intern...
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
Definition: areaFieldsFwd.H:42
List< label > labelList
A List of labels.
Definition: List.H:62
Namespace for OpenFOAM.