Programming finite elements in java

Page 357

29.3 Surface Edges and Nodes 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174

339

// Compare two element edges. // e1 - first edge connectivities. // e2 - second edge connectivities. // returns true if edges have same node numbers at ends boolean equalEdges(int[] e1, int[] e2) { int len = e1.length - 1; return (e1[0] == e2[0] && e1[len] == e2[len]) || (e1[0] == e2[len] && e1[len] == e2[0]); } // Fill out array of surface nodes sNodes (0/1). void createNodes() { for (int i = 0; i < sNodes.length; i++) sNodes[i] = 0; ListIterator e = listEdges.listIterator(); for (int iEdge = 0; iEdge < nEdges; iEdge++) { int edgeNodes[] = (int[]) e.next(); int nEdgeNodes = edgeNodes.length; for (int i = 0; i < nEdgeNodes; i++) sNodes[edgeNodes[i] - 1] = 1; } nsNodes = 0; for (int sNode : sNodes) if (sNode > 0) nsNodes++; }

The loop over surface element faces starts in line 121. Face node numbers and the number of face nodes are obtained from list listFaces in lines 123–124. We are going to compare edges using numbers of their end nodes. Since we take into account linear and quadratic elements, an edge can contain two or three nodes. Variable step (line 125) equals 2 for edges with three nodes, otherwise 1. The loop over element edges starts with statement 127. Node numbers for current element edge edgeNodes are selected in lines 129–131. Comparison of the current edge with edges stored in list listEdges is performed in the loop of lines 135–141. If an equal edge is found in the list (method equalEdges) then variable edgeFound becomes true and the loop is broken. After the loop end, we check if an equal edge was found. If not, the current face edge is added to the list listEdges. Method equalEdges compares two edges e1 and e2. If the end node numbers of edges are equal to each other then the edges are considered equal and the method returns a true value. Method createNodes registers surface nodes in array sNodes, which has a length equal to the total number of nodes in the finite element model. The presence of a surface node with number i is marked by placement of one at position i − 1 in the array. All other entries of arraysNodes are zeros. Statement 161 initializes the array sNodes with zeros. The loop over surface element edges in list listEdges


Issuu converts static files into: digital portfolios, online yearbooks, online catalogs, digital photo albums and more. Sign up and create your flipbook.