@@ -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+
162191void
163192ElementSubdomainModifier ::updateBoundaryInfo (MooseMesh & mesh ,
164193 const std ::vector < const Elem * > & moved_elems )
0 commit comments