From 16b20bff41e9b6c0b81122b9f4955d0e0a61b828 Mon Sep 17 00:00:00 2001 From: itopcuoglu <114435459+itopcuoglu@users.noreply.github.com> Date: Wed, 14 Feb 2024 12:44:25 -0700 Subject: [PATCH 1/2] Fixed the iblank inconsistency at shared nodes. The iblank field is returned to Tioga after the stk::mesh::copy_owned_to_shared operation, prior to field interpolation (#1238) --- include/overset/TiogaBlock.h | 8 ++++++- src/overset/TiogaBlock.C | 44 +++++++++++++++++++++++++++++++++--- src/overset/TiogaSTKIface.C | 13 +++++++++-- 3 files changed, 59 insertions(+), 6 deletions(-) diff --git a/include/overset/TiogaBlock.h b/include/overset/TiogaBlock.h index b3467858c..352aaa50c 100644 --- a/include/overset/TiogaBlock.h +++ b/include/overset/TiogaBlock.h @@ -182,8 +182,14 @@ class TiogaBlock /** Update iblanks after connectivity updates */ - void update_iblanks( + void update_iblanks(); + /** Update fringe and hole node vectors + */ + void update_fringe_and_hole_nodes( std::vector&, std::vector&); + /** Update the Tioga view of iblanks prior to donor-to-receptor interpolation + */ + void update_tioga_iblanks(); /** Update element iblanks after connectivity updates */ diff --git a/src/overset/TiogaBlock.C b/src/overset/TiogaBlock.C index f05364e8f..f932f7fd8 100644 --- a/src/overset/TiogaBlock.C +++ b/src/overset/TiogaBlock.C @@ -224,9 +224,7 @@ TiogaBlock::update_connectivity() } void -TiogaBlock::update_iblanks( - std::vector& holeNodes, - std::vector& fringeNodes) +TiogaBlock::update_iblanks() { ScalarIntFieldType* ibf = meta_.get_field(stk::topology::NODE_RANK, "iblank"); @@ -241,7 +239,27 @@ TiogaBlock::update_iblanks( int* ib = stk::mesh::field_data(*ibf, *b); for (size_t in = 0; in < b->size(); in++) { ib[in] = ibnode(ip++); + } + } +} + +void +TiogaBlock::update_fringe_and_hole_nodes( + std::vector& holeNodes, + std::vector& fringeNodes) +{ + ScalarIntFieldType* ibf = + meta_.get_field(stk::topology::NODE_RANK, "iblank"); + + stk::mesh::Selector mesh_selector = get_node_selector(blkParts_); + const stk::mesh::BucketVector& mbkts = + bulk_.get_buckets(stk::topology::NODE_RANK, mesh_selector); + auto& ibnode = bdata_.iblank_.h_view; + int ip = 0; + for (auto b : mbkts) { + int* ib = stk::mesh::field_data(*ibf, *b); + for (size_t in = 0; in < b->size(); in++) { if (ib[in] == 0) { holeNodes.push_back((*b)[in]); } else if (ib[in] == -1) { @@ -251,6 +269,26 @@ TiogaBlock::update_iblanks( } } +void +TiogaBlock::update_tioga_iblanks() +{ + ScalarIntFieldType* ibf = + meta_.get_field(stk::topology::NODE_RANK, "iblank"); + + stk::mesh::Selector mesh_selector = get_node_selector(blkParts_); + const stk::mesh::BucketVector& mbkts = + bulk_.get_buckets(stk::topology::NODE_RANK, mesh_selector); + + auto& ibnode = bdata_.iblank_.h_view; + int ip = 0; + for (auto b : mbkts) { + int* ib = stk::mesh::field_data(*ibf, *b); + for (size_t in = 0; in < b->size(); in++) { + ibnode(ip++) = ib[in]; + } + } +} + void TiogaBlock::update_iblank_cell() { diff --git a/src/overset/TiogaSTKIface.C b/src/overset/TiogaSTKIface.C index 318fb9bd6..44a04e3ff 100644 --- a/src/overset/TiogaSTKIface.C +++ b/src/overset/TiogaSTKIface.C @@ -164,8 +164,7 @@ TiogaSTKIface::post_connectivity_work(const bool isDecoupled) { for (auto& tb : blocks_) { // Update IBLANK information at nodes and elements - tb->update_iblanks( - oversetManager_.holeNodes_, oversetManager_.fringeNodes_); + tb->update_iblanks(); tb->update_iblank_cell(); // For each block determine donor elements that needs to be ghosted to other @@ -180,6 +179,16 @@ TiogaSTKIface::post_connectivity_work(const bool isDecoupled) std::vector pvec{ibf}; stk::mesh::copy_owned_to_shared(bulk_, pvec); + for (auto& tb : blocks_) { + // Call update_iblanks again to assign holeNodes and fringeNodes vectors + // after iblanks on shared nodes are corrected + tb->update_fringe_and_hole_nodes( + oversetManager_.holeNodes_, oversetManager_.fringeNodes_); + // Return the corrected iblank field to Tioga prior to donor-to-receptor + // interpolation + tb->update_tioga_iblanks(); + } + post_connectivity_sync(); if (!isDecoupled) { From 3f6fe1d8aefb004c855f84f8824855f909fcf3b4 Mon Sep 17 00:00:00 2001 From: itopcuoglu <114435459+itopcuoglu@users.noreply.github.com> Date: Thu, 15 Feb 2024 15:30:18 -0700 Subject: [PATCH 2/2] Replaced stk::mesh::copy_owned_to_shared with stk::mesh::parallel_min in TiogaSTKIface::post_connectivity_work for iblank=-1 values to take priority at shared nodes (#1240) --- src/overset/TiogaSTKIface.C | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/overset/TiogaSTKIface.C b/src/overset/TiogaSTKIface.C index 44a04e3ff..df9b82c1f 100644 --- a/src/overset/TiogaSTKIface.C +++ b/src/overset/TiogaSTKIface.C @@ -177,7 +177,7 @@ TiogaSTKIface::post_connectivity_work(const bool isDecoupled) ScalarIntFieldType* ibf = meta_.get_field(stk::topology::NODE_RANK, "iblank"); std::vector pvec{ibf}; - stk::mesh::copy_owned_to_shared(bulk_, pvec); + stk::mesh::parallel_min(bulk_, {ibf}); for (auto& tb : blocks_) { // Call update_iblanks again to assign holeNodes and fringeNodes vectors