FEMTIC
MeshDataNonConformingHexaElement.h
Go to the documentation of this file.
1 //-------------------------------------------------------------------------------------------------------
2 // The MIT License (MIT)
3 //
4 // Copyright (c) 2021 Yoshiya Usui
5 //
6 // Permission is hereby granted, free of charge, to any person obtaining a copy
7 // of this software and associated documentation files (the "Software"), to deal
8 // in the Software without restriction, including without limitation the rights
9 // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 // copies of the Software, and to permit persons to whom the Software is
11 // furnished to do so, subject to the following conditions:
12 //
13 // The above copyright notice and this permission notice shall be included in all
14 // copies or substantial portions of the Software.
15 //
16 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 // SOFTWARE.
23 //-------------------------------------------------------------------------------------------------------
24 #ifndef DBLDEF_MESHDATA_NONCONFORMING_HEXA_ELEMENT
25 #define DBLDEF_MESHDATA_NONCONFORMING_HEXA_ELEMENT
26 
27 #include <vector>
28 #include "MeshData.h"
29 
30 // Class of FEM mesh for brick element
32 
33 public:
34 
35  // Constructer
37 
38  // Destructer
40 
41  // Input mesh data from "mesh.dat"
42  virtual void inputMeshData();
43 
44  // Find element including a point
45  int findElementIncludingPoint( const double locX, const double locY, const double locZ, double& xi, double& eta, double& zeta ) const;
46 
47  // Find elements including point on the surface of the earth
48  int findElementIncludingPointOnSurface( const double locX, const double locY, int& faceID, double& xi, double& eta, double& zeta,
49  const bool useUpperElem, const bool modLoc, double& locXMod, double& locYMod ) const;
50 
51  // Find element including a point on the Y-Z plane and return element ID of 2D mesh
52  void findElementsIncludingDipoleOnSurface( const double locXStart, const double locYStart, const double locXEnd, const double locYEnd,
53  std::vector<int>& elements, std::vector<double>& localCoordXStartPoint, std::vector<double>& localCoordYStartPoint, std::vector<double>& localCoordXEndPoint, std::vector<double>& localCoordYEndPoint ) const;
54 
55  // Find element including a point on the Y-Z plane and return element ID of 2D mesh
56  int findElementIncludingPointOnYZPlaneAndReturnElemID2D( const int iPlane, const double locY, const double locZ, double& xi, double& eta ) const;
57 
58  // Find element including a point on the Z-X plane and return element ID of 2D mesh
59  int findElementIncludingPointOnZXPlaneAndReturnElemID2D( const int iPlane, const double locX, const double locZ, double& xi, double& eta ) const;
60 
61  // Get mesh type
62  int getMeshType() const;
63 
64  // Get ID of a neighbor element
65  int getIDOfNeighborElement( const int iElem, const int iFace, const int num ) const;
66 
67  // Get number of neighbor elements for an element-face
68  int getNumNeighborElement( const int iElem, const int iFace ) const;
69 
70  // Get flag specifing whether an element face has slave faces
71  bool faceSlaveElements( const int iElem, const int iFace ) const;
72 
73  // Get flag specifing whether an element face is outer boundary
74  bool isOuterBoundary( const int iElem, const int iFace ) const;
75 
76  // Get local face ID of elements belonging to the boundary planes
77  int getFaceIDLocalFromElementBoundaryPlanes( const int iPlane, const int iElem ) const;
78 
79  // Get global node ID of specified element and edge
80  int getNodeIDGlobalFromElementAndEdge( const int iElem, const int iEdge, const int num ) const;
81 
82  // Get global node ID of specified element and face
83  int getNodeIDGlobalFromElementAndFace( const int iElem, const int iFace, const int num ) const;
84 
85  // Get global node ID of specified element belonging to the boundary planes
86  int getNodeIDGlobalFromElementBoundaryPlanes( const int iPlane, const int iElem, const int num ) const;
87 
88  // Get global node ID from ID of element belonging to the boundary planes and its edge index
89  int getNodeIDGlobalFromElementAndEdgeBoundaryPlanes( const int iPlane, const int iElem, const int iEdge, const int num ) const;
90 
91  // Get X coordinate of node of specified element belonging to the boundary planes
92  double getCoordXFromElementBoundaryPlanes( const int iPlane, const int iElem, const int num ) const;
93 
94  // Get Y coordinate of node of specified element belonging to the boundary planes
95  double getCoordYFromElementBoundaryPlanes( const int iPlane, const int iElem, const int num ) const;
96 
97  // Get Z coordinate of node of specified element belonging to the boundary planes
98  double getCoordZFromElementBoundaryPlanes( const int iPlane, const int iElem, const int num ) const;
99 
100  // Get local edge ID from local face ID
101  int getEdgeIDLocalFromFaceIDLocal( const int iFace, const int num ) const;
102 
103  // Decide whether specified elements share same edges
104  virtual bool shareSameEdges( const int elemID1, const int elemID2 ) const;
105 
106  // Calculate volume of a specified element
107  virtual double calcVolume( const int elemID ) const;
108 
109  // Output mesh data to VTK file
110  virtual void outputMeshDataToVTK() const;
111 
112  // Output mesh data to binary file
113  virtual void outputMeshDataToBinary() const;
114 
115  // Get ID of the nodes of elements belonging to the boundary planes
116  virtual int getNodesOfElementsBoundaryPlanes( const int iPlane, const int iElem, const int iNode ) const;
117 
118  // Calculate horizontal coordinate differences of edges of the elements on boundary planes
119  double calcHorizontalCoordDifferenceBoundaryPlanes( const int iPlane, const int iElem, const int iEdge ) const;
120 
121  // Interpolate x coordinate on top or bottom face from local coordinate of horizontal plane
122  double calcXCoordOfPointOnFace( const int iElem, const int iFace, const double xi, const double eta ) const;
123 
124  // Interpolate y coordinate on top or bottom face from local coordinate of horizontal plane
125  double calcYCoordOfPointOnFace( const int iElem, const int iFace, const double xi, const double eta ) const;
126 
127  // Interpolate z coordinate on top or bottom face from local coordinate of horizontal plane
128  double calcZCoordOfPointOnFace( const int iElem, const int iFace, const double xi, const double eta ) const;
129 
130  // Calculate length of edges of elements
131  double calcEdgeLengthFromElementAndEdge( const int iElem, const int iEdge ) const;
132 
133  // Calculate length of edges of elements on boundary planes
134  double calcEdgeLengthFromElementAndEdgeBoundaryPlanes( const int iPlane, const int iElem, const int iEdge ) const;
135 
136  // Get face index of neighbor element
137  double getEdgeLengthX( const int iElem ) const;
138 
139  // Get length of the edges parallel to Y coordinate
140  double getEdgeLengthY( const int iElem ) const;
141 
142  // Get face index of neighbor element
143  int getFaceIndexOfNeighborElement( const int iFace ) const;
144 
145  // Calculate area of face
146  double calcAreaOfFace( const int iElem, const int iFace ) const;
147 
148  // Calculate area of face at bottom of mesh
149  double calcAreaOfFaceAtBottomOfMesh( const int iElem ) const;
150 
151 private:
152 
153  // Copy constructer
155 
156  // Copy assignment operator
158 
159  // Array of IDs of neighbor Elements
161 
162  // Array of faces of elements belonging to the boundary planes
163  // m_facesOfElementsBoundaryPlanes[0] : Y-Z Plane ( Minus Side )
164  // m_facesOfElementsBoundaryPlanes[1] : Y-Z Plane ( Plus Side )
165  // m_facesOfElementsBoundaryPlanes[2] : Z-X Plane ( Minus Side )
166  // m_facesOfElementsBoundaryPlanes[3] : Z-X Plane ( Plus Side )
167  // m_facesOfElementsBoundaryPlanes[4] : X-Y Plane ( Minus Side )
168  // m_facesOfElementsBoundaryPlanes[5] : X-Y Plane ( Plus Side )
170 
171  // Number of elements belonging to the land surface
173 
174  // Array of elements belonging to the land surface
176 
177  // Array of faces belonging to the land surface
179 
180  // Array converting from face ID to node ID
181  int m_faceID2NodeID[6][4];
182 
183  // Array converting from face ID to edge ID
184  int m_faceID2EdgeID[6][4];
185 
186  // Array converting from edge ID to node ID
187  int m_edgeID2NodeID[12][2];
188 
189  const static int m_numGauss = 2;
190 
192 
194 
196 
198 
200 
201  // Array of reference coord xi values for each node
202  double m_xiAtNode[8];
203 
204  // Array of reference coord eta values for each node
205  double m_etaAtNode[8];
206 
207  // Array of reference coord zeta values for each node
208  double m_zetaAtNode[8];
209 
210  // Check whether side element-faces are parallel to Z-X or Y-Z plane
212 
213  // Check whether the specified point is located in the specified element
214  bool isLocatedInTheElement( const double x, const double y, const double z, const int iElem ) const;
215 
216  // Calculate local coordinates
217  void calcLocalCoordinates( const int iElem, const double x, const double y, const double z, double& xi, double& eta, double& zeta ) const;
218 
219  // Calculate horizontal local coordinates
220  void calcHorizontalLocalCoordinates( const int iElem, const double x, const double y, double& xi, double& eta ) const;
221 
222  // Calculate determinant of jacobian matrix of the elements
223  double calcDeterminantOfJacobianMatrix( const int iElem, const double xi, const double eta, const double zeta ) const;
224 
225 };
226 
227 #endif
Definition: MeshDataNonConformingHexaElement.h:31
bool isOuterBoundary(const int iElem, const int iFace) const
Definition: MeshDataNonConformingHexaElement.cpp:911
virtual ~MeshDataNonConformingHexaElement()
Definition: MeshDataNonConformingHexaElement.cpp:204
int getNodeIDGlobalFromElementAndEdgeBoundaryPlanes(const int iPlane, const int iElem, const int iEdge, const int num) const
Definition: MeshDataNonConformingHexaElement.cpp:983
double m_zetaAtNode[8]
Definition: MeshDataNonConformingHexaElement.h:208
int getIDOfNeighborElement(const int iElem, const int iFace, const int num) const
Definition: MeshDataNonConformingHexaElement.cpp:894
int m_faceID2NodeID[6][4]
Definition: MeshDataNonConformingHexaElement.h:181
int getNodeIDGlobalFromElementBoundaryPlanes(const int iPlane, const int iElem, const int num) const
Definition: MeshDataNonConformingHexaElement.cpp:969
virtual void inputMeshData()
Definition: MeshDataNonConformingHexaElement.cpp:255
double m_integralPointZeta[m_numIntegralPoints]
Definition: MeshDataNonConformingHexaElement.h:197
double calcHorizontalCoordDifferenceBoundaryPlanes(const int iPlane, const int iElem, const int iEdge) const
Definition: MeshDataNonConformingHexaElement.cpp:1213
void checkWhetherSideFaceIsParallelToZXOrYZPlane() const
Definition: MeshDataNonConformingHexaElement.cpp:1429
int findElementIncludingPointOnSurface(const double locX, const double locY, int &faceID, double &xi, double &eta, double &zeta, const bool useUpperElem, const bool modLoc, double &locXMod, double &locYMod) const
Definition: MeshDataNonConformingHexaElement.cpp:431
bool faceSlaveElements(const int iElem, const int iFace) const
Definition: MeshDataNonConformingHexaElement.cpp:904
virtual void outputMeshDataToBinary() const
Definition: MeshDataNonConformingHexaElement.cpp:1092
int getFaceIDLocalFromElementBoundaryPlanes(const int iPlane, const int iElem) const
Definition: MeshDataNonConformingHexaElement.cpp:930
int getNodeIDGlobalFromElementAndEdge(const int iElem, const int iEdge, const int num) const
Definition: MeshDataNonConformingHexaElement.cpp:942
virtual double calcVolume(const int elemID) const
Definition: MeshDataNonConformingHexaElement.cpp:1039
double calcEdgeLengthFromElementAndEdge(const int iElem, const int iEdge) const
Definition: MeshDataNonConformingHexaElement.cpp:1294
double calcDeterminantOfJacobianMatrix(const int iElem, const double xi, const double eta, const double zeta) const
Definition: MeshDataNonConformingHexaElement.cpp:1534
double m_integralPointEta[m_numIntegralPoints]
Definition: MeshDataNonConformingHexaElement.h:195
double getCoordZFromElementBoundaryPlanes(const int iPlane, const int iElem, const int num) const
Definition: MeshDataNonConformingHexaElement.cpp:1012
int * m_facesOfElementsBoundaryPlanes[6]
Definition: MeshDataNonConformingHexaElement.h:169
virtual int getNodesOfElementsBoundaryPlanes(const int iPlane, const int iElem, const int iNode) const
Definition: MeshDataNonConformingHexaElement.cpp:1195
int m_numElemOnLandSurface
Definition: MeshDataNonConformingHexaElement.h:172
double getCoordYFromElementBoundaryPlanes(const int iPlane, const int iElem, const int num) const
Definition: MeshDataNonConformingHexaElement.cpp:1005
bool isLocatedInTheElement(const double x, const double y, const double z, const int iElem) const
Definition: MeshDataNonConformingHexaElement.cpp:1469
virtual bool shareSameEdges(const int elemID1, const int elemID2) const
Definition: MeshDataNonConformingHexaElement.cpp:1031
static const int m_numGauss
Definition: MeshDataNonConformingHexaElement.h:189
double m_etaAtNode[8]
Definition: MeshDataNonConformingHexaElement.h:205
int findElementIncludingPointOnZXPlaneAndReturnElemID2D(const int iPlane, const double locX, const double locZ, double &xi, double &eta) const
Definition: MeshDataNonConformingHexaElement.cpp:839
double calcZCoordOfPointOnFace(const int iElem, const int iFace, const double xi, const double eta) const
Definition: MeshDataNonConformingHexaElement.cpp:1273
static const int m_numIntegralPoints
Definition: MeshDataNonConformingHexaElement.h:191
void findElementsIncludingDipoleOnSurface(const double locXStart, const double locYStart, const double locXEnd, const double locYEnd, std::vector< int > &elements, std::vector< double > &localCoordXStartPoint, std::vector< double > &localCoordYStartPoint, std::vector< double > &localCoordXEndPoint, std::vector< double > &localCoordYEndPoint) const
Definition: MeshDataNonConformingHexaElement.cpp:518
std::vector< int > * m_neighborElementsForNonConformingHexa
Definition: MeshDataNonConformingHexaElement.h:160
virtual void outputMeshDataToVTK() const
Definition: MeshDataNonConformingHexaElement.cpp:1054
int m_edgeID2NodeID[12][2]
Definition: MeshDataNonConformingHexaElement.h:187
double calcXCoordOfPointOnFace(const int iElem, const int iFace, const double xi, const double eta) const
Definition: MeshDataNonConformingHexaElement.cpp:1231
void calcLocalCoordinates(const int iElem, const double x, const double y, const double z, double &xi, double &eta, double &zeta) const
Definition: MeshDataNonConformingHexaElement.cpp:1503
int * m_faceLandSurface
Definition: MeshDataNonConformingHexaElement.h:178
double calcAreaOfFace(const int iElem, const int iFace) const
Definition: MeshDataNonConformingHexaElement.cpp:1378
double getCoordXFromElementBoundaryPlanes(const int iPlane, const int iElem, const int num) const
Definition: MeshDataNonConformingHexaElement.cpp:998
double calcAreaOfFaceAtBottomOfMesh(const int iElem) const
Definition: MeshDataNonConformingHexaElement.cpp:1422
int getEdgeIDLocalFromFaceIDLocal(const int iFace, const int num) const
Definition: MeshDataNonConformingHexaElement.cpp:1019
double calcYCoordOfPointOnFace(const int iElem, const int iFace, const double xi, const double eta) const
Definition: MeshDataNonConformingHexaElement.cpp:1252
double m_xiAtNode[8]
Definition: MeshDataNonConformingHexaElement.h:202
int findElementIncludingPointOnYZPlaneAndReturnElemID2D(const int iPlane, const double locY, const double locZ, double &xi, double &eta) const
Definition: MeshDataNonConformingHexaElement.cpp:791
int m_faceID2EdgeID[6][4]
Definition: MeshDataNonConformingHexaElement.h:184
int * m_elemOnLandSurface
Definition: MeshDataNonConformingHexaElement.h:175
double m_weights[m_numIntegralPoints]
Definition: MeshDataNonConformingHexaElement.h:199
int getMeshType() const
Definition: MeshDataNonConformingHexaElement.cpp:887
int getNodeIDGlobalFromElementAndFace(const int iElem, const int iFace, const int num) const
Definition: MeshDataNonConformingHexaElement.cpp:955
double getEdgeLengthX(const int iElem) const
Definition: MeshDataNonConformingHexaElement.cpp:1327
MeshDataNonConformingHexaElement & operator=(const MeshDataNonConformingHexaElement &rhs)
Definition: MeshDataNonConformingHexaElement.cpp:249
int findElementIncludingPoint(const double locX, const double locY, const double locZ, double &xi, double &eta, double &zeta) const
Definition: MeshDataNonConformingHexaElement.cpp:414
double m_integralPointXi[m_numIntegralPoints]
Definition: MeshDataNonConformingHexaElement.h:193
double getEdgeLengthY(const int iElem) const
Definition: MeshDataNonConformingHexaElement.cpp:1337
double calcEdgeLengthFromElementAndEdgeBoundaryPlanes(const int iPlane, const int iElem, const int iEdge) const
Definition: MeshDataNonConformingHexaElement.cpp:1301
MeshDataNonConformingHexaElement()
Definition: MeshDataNonConformingHexaElement.cpp:43
int getFaceIndexOfNeighborElement(const int iFace) const
Definition: MeshDataNonConformingHexaElement.cpp:1347
void calcHorizontalLocalCoordinates(const int iElem, const double x, const double y, double &xi, double &eta) const
Definition: MeshDataNonConformingHexaElement.cpp:1516
Definition: MeshData.h:31
int getNumNeighborElement() const
Definition: MeshData.cpp:232