Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Panzer/umr test fix #13735

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open

Conversation

bricar
Copy link
Contributor

@bricar bricar commented Jan 20, 2025

@trilinos/panzer

Motivation

UMR unit test was not snapping to geometry. Update mesh to have geometry association stored on the mesh. New mesh ends with ".a.g" instead of just ".g". Command to do this was: /projects/cubit/extra -a -g 2block_cylinders_30deg.stp 2block_cylinders_30deg.g.

Test still does not check that coordinates were snapped to geometry. This could be done with more work.

I did not verify the build and test myself. This was done by Ryan Viertel.

Related Issues

Stakeholder Feedback

Testing

* change input mesh to one with extra geometry association data
* the cmd used to make this mesh:

    /projects/cubit/extra -a -g 2block_cylinders_30deg.stp 2block_cylinders_30deg.g
@bricar bricar requested a review from a team as a code owner January 20, 2025 16:32
@cgcgcg cgcgcg changed the base branch from master to develop January 20, 2025 16:35
@cgcgcg
Copy link
Contributor

cgcgcg commented Jan 20, 2025

@bricar Your commit needs to be signed. See e.g. https://github.com/orgs/trilinos/discussions/13497

@trilinos-autotester
Copy link
Contributor

Status Flag 'Pre-Test Inspection' - - This Pull Request Requires Inspection... The code must be inspected by a member of the Team before Testing/Merging
NO INSPECTION HAS BEEN PERFORMED ON THIS PULL REQUEST! - This PR must be inspected by setting label 'AT: PRE-TEST INSPECTED'.

@rppawlo rppawlo self-assigned this Jan 20, 2025
@rppawlo rppawlo added pkg: Panzer client: EMPIRE All issues that most directly target the ATDM EMPIRE code PA: Discretizations Issues that fall under the Trilinos Discretizations Product Area labels Jan 20, 2025
@danielsjensen1
Copy link

@bricar I have some suggestions for this merge request and attached a patch since I can't push to your branch. The first change just updates the CMake command to copy the new *.a.g mesh file instead of the old *.g one. The second change adds a test to check for snapping. Finally, I'm guessing we don't need the pl->set("Geometry File Name","meshes/2block_cylinders_30deg.stp"); line anymore but removing it breaks something so I didn't include it in the patch below.

diff --git a/packages/panzer/adapters-stk/test/stk_interface_test/CMakeLists.txt b/packages/panzer/adapters-stk/test/stk_interface_test/CMakeLists.txt
index 897aad0c239..66520e76049 100644
--- a/packages/panzer/adapters-stk/test/stk_interface_test/CMakeLists.txt
+++ b/packages/panzer/adapters-stk/test/stk_interface_test/CMakeLists.txt
@@ -178,7 +178,7 @@ ENDIF()
 # This test appears to have fallen into disrepair.  #3719
 
 TRIBITS_COPY_FILES_TO_BINARY_DIR(stk_interface_copy
-  SOURCE_FILES basic.gen basic.gen.2.0 basic.gen.2.1 basic3d.gen basic3d.gen.2.0 basic3d.gen.2.1 twoblock_cube.gen twoblock_cube.gen.2.0 twoblock_cube.gen.2.1 quad8.jou quad8.gen 2block_cylinders_30deg.g 2block_cylinders_30deg.stp
+  SOURCE_FILES basic.gen basic.gen.2.0 basic.gen.2.1 basic3d.gen basic3d.gen.2.0 basic3d.gen.2.1 twoblock_cube.gen twoblock_cube.gen.2.0 twoblock_cube.gen.2.1 quad8.jou quad8.gen 2block_cylinders_30deg.a.g 2block_cylinders_30deg.stp
   SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/meshes"
   DEST_DIR "${CMAKE_CURRENT_BINARY_DIR}/meshes"
   EXEDEPS tExodusReaderFactory
diff --git a/packages/panzer/adapters-stk/test/stk_interface_test/tExodusReaderFactory.cpp b/packages/panzer/adapters-stk/test/stk_interface_test/tExodusReaderFactory.cpp
index 4b00834d175..769d1933acd 100644
--- a/packages/panzer/adapters-stk/test/stk_interface_test/tExodusReaderFactory.cpp
+++ b/packages/panzer/adapters-stk/test/stk_interface_test/tExodusReaderFactory.cpp
@@ -728,6 +728,21 @@ TEUCHOS_UNIT_TEST(tExodusReaderFactory, umr_refine_once_with_geometry)
 
     TEST_EQUALITY((int) globalCounts[mesh->getFaceRank()],x.second*4);
   }
+  if (x.first == "inner") {
+      // The inner surface has an xy magnitude of 1 while the outer surface has a magnitude of 2
+      constexpr double inner_radius = 1.0, tol = 1e-10;
+      stk::mesh::Selector ss_selector = *ss_part;
+      const bool sort_by_gid = true;
+      std::vector<stk::mesh::Entity> nodes;
+      stk::mesh::get_selected_entities(ss_selector, mesh->getBulkData()->buckets(mesh->getNodeRank()), nodes, sort_by_gid);
+      for (auto&& node : nodes) {
+        const double* coords = mesh->getNodeCoordinates(node);
+        const double x = coords[0], y = coords[1];
+        const double xymag = std::sqrt(x * x + y * y);
+        TEST_FLOATING_EQUALITY(inner_radius, xymag, tol);
+      }
+    }
+  }
   mesh->writeToExodus("meshes/2block_cylinders_30deg.r1.g");
 }
 #endif

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
client: EMPIRE All issues that most directly target the ATDM EMPIRE code PA: Discretizations Issues that fall under the Trilinos Discretizations Product Area pkg: Panzer
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants