From 019a7878f3bc0aa1cd783c425324e23a7d85f087 Mon Sep 17 00:00:00 2001 From: David Kopriva Date: Tue, 11 Aug 2026 17:26:37 -0700 Subject: [PATCH] Fix Symmetry error Fix the issue where symmetry elements were destroyed by setting the distanceFromBoundary field in the node type away from zero for nodes along the symmetry boundary, since they are no longer on a boundary. This made minor changes in the smoothing since different nodes were allowed to move, so the PacMan benchmark data has been changed. --- Benchmarks/BenchmarkData/PacMan.txt | 12 ++++++------ Source/Mesh/Connections.f90 | 2 +- Source/Mesh/MeshGeneratorMethods.f90 | 16 ++++++++++++---- Source/MeshObjects/SMMeshObjects.f90 | 1 + 4 files changed, 20 insertions(+), 11 deletions(-) diff --git a/Benchmarks/BenchmarkData/PacMan.txt b/Benchmarks/BenchmarkData/PacMan.txt index 2a7f4f29..7557ad5a 100644 --- a/Benchmarks/BenchmarkData/PacMan.txt +++ b/Benchmarks/BenchmarkData/PacMan.txt @@ -1,9 +1,9 @@ 1 94 115 208 0 3.39246E-02 - 1.21406E+00 - 1.10216E+00 - 1.40356E+00 - 2.80011E-02 - 7.56617E+01 - 1.06337E+02 + 1.21083E+00 + 1.09944E+00 + 1.39822E+00 + 2.79568E-02 + 7.56404E+01 + 1.06188E+02 diff --git a/Source/Mesh/Connections.f90 b/Source/Mesh/Connections.f90 index f4e1b5a6..66f87b89 100644 --- a/Source/Mesh/Connections.f90 +++ b/Source/Mesh/Connections.f90 @@ -153,7 +153,7 @@ SUBROUTINE makeNodeToElementConnections( mesh, errorCode ) ! grid based method is set to 11. ! ----------------------------------------------------- ! - errorCode = NONE + errorCode = A_OK_ERROR_CODE CALL deallocateNodeToElementConnections numNodes = mesh % nodes % COUNT() diff --git a/Source/Mesh/MeshGeneratorMethods.f90 b/Source/Mesh/MeshGeneratorMethods.f90 index 5546569b..3a2f8c97 100644 --- a/Source/Mesh/MeshGeneratorMethods.f90 +++ b/Source/Mesh/MeshGeneratorMethods.f90 @@ -2359,6 +2359,16 @@ SUBROUTINE ReflectMesh( mesh, symmetryCurve) newElement % boundaryInfo % bCurveName(j) = NO_BC_STRING oldElement % boundaryInfo % bCurveFlag(j) = NONE newElement % boundaryInfo % bCurveFlag(j) = NONE +! +! ------------------------------------------------------------------------- +! Mark that the nodes that were on the symmetry boundary are off of it now. +! The amount doesn't matter. +! ------------------------------------------------------------------------- +! + oldElement % nodes(edgeMap(1,j)) % node % distToBoundary = 1.0 + oldElement % nodes(edgeMap(2,j)) % node % distToBoundary = 1.0 + newElement % nodes(edgeMap(1,j)) % node % distToBoundary = 1.0 + newElement % nodes(edgeMap(2,j)) % node % distToBoundary = 1.0 END IF END DO @@ -2386,8 +2396,7 @@ SUBROUTINE ReflectMesh( mesh, symmetryCurve) DO WHILE( .NOT. nodeItr % isAtEnd() ) - obj => nodeItr % object() - CALL castToSMNode(obj,oldNode) + CALL castToSMNode(nodeItr % object(),oldNode) ! IF ( oldNode % bCurveID /= bCurveID ) THEN !Skip over nodes along the symmetry axis ! @@ -2414,7 +2423,7 @@ SUBROUTINE ReflectMesh( mesh, symmetryCurve) ! DO i = 1, numElementsForNode(oldNode % id) e => elementsForNodes(i, oldNode % id) % element - DO j = 1, e % eType + DO j = 1, e % eType IF ( ASSOCIATED(e % nodes(j) % node, oldNode) ) THEN e % nodes(j) % node => newNode e % boundaryInfo % nodeIDs(j) = newNode % id @@ -2479,7 +2488,6 @@ SUBROUTINE ReflectMesh( mesh, symmetryCurve) ! Clean up ! -------- ! - CALL releaseFTLinkedListClass(newNodes) CALL releaseFTLinkedListClass(savedElements) CALL deallocateNodeToElementConnections diff --git a/Source/MeshObjects/SMMeshObjects.f90 b/Source/MeshObjects/SMMeshObjects.f90 index 7abdf805..bd495e27 100644 --- a/Source/MeshObjects/SMMeshObjects.f90 +++ b/Source/MeshObjects/SMMeshObjects.f90 @@ -515,6 +515,7 @@ FUNCTION SMElementCopy(source) RESULT(copy) IF ( ALLOCATED(source % nodes) ) THEN copy % nodes = source % nodes DO j = 1, copy % eType + copy % nodes(j) % node => source % nodes(j) % node CALL copy % nodes(j) % node % retain() END DO END IF