nonConformalMappedPatchBase.C
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-2023 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 \*---------------------------------------------------------------------------*/
25 
27 #include "nonConformalBoundary.H"
28 
29 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
30 
31 namespace Foam
32 {
34 }
35 
36 
37 // * * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * //
38 
40 {
41  const polyPatch& pp = patch_.patch();
42 
43  const word& regionName = pp.boundaryMesh().mesh().name();
44  const word& patchName = pp.name();
45 
46  if (regionName != nbrRegionName())
47  {
48  return regionName < nbrRegionName();
49  }
50 
51  if (patchName != nbrPatchName())
52  {
53  return patchName < nbrPatchName();
54  }
55 
57  << "Patch " << patch_.patch().name() << " of type "
58  << nonConformalMappedPatchBase::typeName << " maps to itself"
59  << exit(FatalError);
60 
61  return false;
62 }
63 
64 
65 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
66 
68 (
69  const nonConformalPolyPatch& ncPp
70 )
71 :
72  mappedPatchBaseBase(ncPp.patch()),
73  patch_(ncPp),
74  owner_(calcOwner()),
75  intersectionIsValid_(false),
76  intersection_(false)
77 {}
78 
79 
81 (
82  const nonConformalPolyPatch& ncPp,
83  const word& nbrRegionName,
84  const word& nbrPatchName,
86 )
87 :
88  mappedPatchBaseBase(ncPp.patch(), nbrRegionName, nbrPatchName, transform),
89  patch_(ncPp),
90  owner_(calcOwner()),
91  intersectionIsValid_(false),
92  intersection_(false)
93 {}
94 
95 
97 (
98  const nonConformalPolyPatch& ncPp,
99  const dictionary& dict,
100  const bool defaultTransformIsNone
101 )
102 :
103  mappedPatchBaseBase(ncPp.patch(), dict, defaultTransformIsNone),
104  patch_(ncPp),
105  owner_(calcOwner()),
106  intersectionIsValid_(false),
107  intersection_(false)
108 {}
109 
110 
112 (
113  const nonConformalPolyPatch& ncPp,
114  const nonConformalMappedPatchBase& mpb
115 )
116 :
117  mappedPatchBaseBase(ncPp.patch(), mpb),
118  patch_(ncPp),
119  owner_(calcOwner()),
120  intersectionIsValid_(false),
121  intersection_(false)
122 {}
123 
124 
125 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
126 
128 {}
129 
130 
131 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
132 
134 {
135  return owner_;
136 }
137 
138 
141 {
142  if (!owner())
143  {
145  << "The non-conformal mapped intersection is only available to "
146  << "the owner patch" << abort(FatalError);
147  }
148 
149  if (!intersectionIsValid_ || !nbrMappedPatch().intersectionIsValid_)
150  {
151  const polyMesh& mesh =
153 
155 
156  intersection_.update
157  (
158  patch_.origPatch(),
159  ncb.patchPointNormals(patch_.origPatchIndex()),
160  nbrMappedPatch().patch_.origPatch(),
161  transform_.transform()
162  );
163 
164  intersectionIsValid_ = true;
165  nbrMappedPatch().intersectionIsValid_ = true;
166  }
167 
168  return intersection_;
169 }
170 
171 
173 {
174  intersectionIsValid_ = false;
175 }
176 
177 
179 {
181 }
182 
183 
184 // ************************************************************************* //
static nonConformalBoundary & New(const word &name, const polyMesh &mesh)
Construct and return the named DemandDrivenMeshObject.
const word & name() const
Return name.
Definition: IOobject.H:310
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:57
Cyclic plane transformation.
A list of keyword definitions, which are a keyword followed by any number of values (e....
Definition: dictionary.H:162
Base class for engines and poly patches which provide mapping between two poly patches.
const polyPatch & patch_
Patch to map to.
virtual void write(Ostream &) const
Write as a dictionary.
const word & nbrPatchName() const
Name of the patch to map from.
const word & nbrRegionName() const
Name of the region to map from.
Mesh object that stores an all boundary patch and mapping to and from it and the mesh and the individ...
tmp< vectorField > patchPointNormals(const label patchi) const
Get parallel consistent point normals for the patch.
Base class for poly patches which provides non-conformal mapping between two potentially non-globally...
bool owner() const
Does this side own the patch?
virtual void write(Ostream &) const
Write as a dictionary.
const nonConformalPolyPatch & patch_
Non-conformal patch to map to.
nonConformalMappedPatchBase(const nonConformalPolyPatch &ncPp)
Construct from non-conformal patch.
const patchToPatches::intersection & intersection() const
Access the intersection engine.
bool calcOwner() const
Constructor helper for owner.
void clearOut()
Clear out data on mesh change.
Non-conformal poly patch. This patch is a placeholder and must have no faces. This patch is linked to...
const polyPatch & patch() const
Reference to the polyPatch.
const word & name() const
Return name.
Class to generate patchToPatch coupling geometry. A full geometric intersection is done between a fac...
const polyMesh & mesh() const
Return the mesh reference.
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:80
A patch is a list of labels that address the faces in the global face list.
Definition: polyPatch.H:70
const polyBoundaryMesh & boundaryMesh() const
Return boundaryMesh reference.
Definition: polyPatch.C:270
A class for handling words, derived from string.
Definition: word.H:62
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Definition: error.H:334
Namespace for OpenFOAM.
errorManipArg< error, int > exit(error &err, const int errNo=1)
Definition: errorManip.H:124
errorManip< error > abort(error &err)
Definition: errorManip.H:131
const word & regionName(const solver &region)
Definition: solver.H:209
dimensionSet transform(const dimensionSet &)
Definition: dimensionSet.C:504
defineTypeNameAndDebug(combustionModel, 0)
error FatalError
dictionary dict