Skip to content

Commit 6eb40b1

Browse files
committed
Clear up old moving boundary
1 parent 72a1a76 commit 6eb40b1

File tree

2 files changed

+32
-0
lines changed

2 files changed

+32
-0
lines changed

framework/include/userobject/ElementSubdomainModifier.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,9 @@ class ElementSubdomainModifier : public ElementUserObject
9090
// Change the subdomain ID of all ancestor elements
9191
void setAncestorsSubdomainIDs(const SubdomainID & subdomain_id, const dof_id_type & elem_id);
9292

93+
// Clear old moving boundaries
94+
void clearOldMovingBoundary(MooseMesh & mesh);
95+
9396
// Elements on the undisplaced mesh whose subdomain IDs have changed
9497
std::vector<const Elem *> _moved_elems;
9598

framework/src/userobject/ElementSubdomainModifier.C

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,11 @@ ElementSubdomainModifier::finalize()
136136
updateBoundaryInfo(_displaced_problem->mesh(), _moved_displaced_elems);
137137
}
138138

139+
clearOldMovingBoundary(_mesh);
140+
141+
if (_displaced_problem)
142+
clearOldMovingBoundary(_displaced_problem->mesh());
143+
139144
// Reinit equation systems
140145
_fe_problem.meshChanged();
141146

@@ -159,6 +164,30 @@ ElementSubdomainModifier::finalize()
159164
_fe_problem.initElementStatefulProps(movedElemsRange());
160165
}
161166

167+
void
168+
ElementSubdomainModifier::clearOldMovingBoundary(MooseMesh & mesh)
169+
{
170+
std::vector<std::pair<Elem *, unsigned int>> to_be_cleared;
171+
//auto & elem_side_bnd_ids = _mesh.getMesh().get_sideset_map();
172+
BoundaryInfo & bnd_info = mesh.getMesh().get_boundary_info();
173+
auto & elem_side_bnd_ids = bnd_info.get_sideset_map();
174+
for (const auto & pr : elem_side_bnd_ids)
175+
{
176+
if (pr.second.second == _moving_boundary_id)
177+
{
178+
Elem * elem = _mesh.elemPtr(pr.first->id());
179+
const Elem * neighbor = elem->neighbor_ptr(pr.second.first);
180+
if (elem->subdomain_id() == neighbor->subdomain_id())
181+
to_be_cleared.emplace_back(elem, pr.second.first);
182+
}
183+
}
184+
185+
for (auto & elem_side: to_be_cleared)
186+
{
187+
bnd_info.remove_side(elem_side.first, elem_side.second);
188+
}
189+
}
190+
162191
void
163192
ElementSubdomainModifier::updateBoundaryInfo(MooseMesh & mesh,
164193
const std::vector<const Elem *> & moved_elems)

0 commit comments

Comments
 (0)