Skip to content

Commit 8ec0b9f

Browse files
committed
Fix bugs in the nodal numbering generation for 1D meshes
1 parent fa3a27a commit 8ec0b9f

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

src/mesh/meshGenerationScript.js

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,13 @@ export class meshGeneration {
131131
}
132132
}
133133
// Generate nodal numbering (NOP) array
134-
const nodalNumbering = this.generateNodalNumbering(this.numElementsX, totalNodesX, this.elementOrder);
134+
const nodalNumbering = this.generateNodalNumbering(
135+
this.numElementsX,
136+
null, // numElementsY (not used in 1D)
137+
totalNodesX,
138+
null, // totalNodesY (not used in 1D)
139+
this.elementOrder
140+
);
135141
// Find boundary elements
136142
const boundaryElements = this.findBoundaryElements();
137143

@@ -295,7 +301,7 @@ export class meshGeneration {
295301
for (let elementIndex = 0; elementIndex < numElementsX; elementIndex++) {
296302
nop[elementIndex] = [];
297303
for (let nodeIndex = 1; nodeIndex <= 2; nodeIndex++) {
298-
nop[elementIndex][nodeIndex - 1] = i + (nodeIndex - 1);
304+
nop[elementIndex][nodeIndex - 1] = elementIndex + nodeIndex;
299305
}
300306
}
301307
} else if (elementOrder === "quadratic") {
@@ -305,11 +311,11 @@ export class meshGeneration {
305311
* 1__2__3
306312
*
307313
*/
308-
let columnCounter = 2;
314+
let columnCounter = 0;
309315
for (let elementIndex = 0; elementIndex < numElementsX; elementIndex++) {
310316
nop[elementIndex] = [];
311317
for (let nodeIndex = 1; nodeIndex <= 3; nodeIndex++) {
312-
nop[elementIndex][nodeIndex - 1] = elementIndex + (nodeIndex - 1) + columnCounter;
318+
nop[elementIndex][nodeIndex - 1] = elementIndex + nodeIndex + columnCounter;
313319
}
314320
columnCounter += 1;
315321
}

0 commit comments

Comments
 (0)