Skip to content

Commit 1463349

Browse files
authored
Merge pull request #3477 from grmnptr/grmnptr/boundary_on_child_elements
Allow children to have boundary conditions
2 parents 4ba5837 + 588d615 commit 1463349

File tree

8 files changed

+824
-93
lines changed

8 files changed

+824
-93
lines changed

include/mesh/boundary_info.h

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -480,6 +480,13 @@ class BoundaryInfo : public ParallelObject
480480
unsigned int n_boundary_ids (const Elem * const elem,
481481
const unsigned short int side) const;
482482

483+
/**
484+
* \returns The number of raw (excludes ancestors) boundary ids associated with the \p side
485+
* side of element \p elem.
486+
*/
487+
unsigned int n_raw_boundary_ids (const Elem * const elem,
488+
const unsigned short int side) const;
489+
483490
/**
484491
* \returns The list of boundary ids associated with the \p side side of
485492
* element \p elem.
@@ -550,6 +557,21 @@ class BoundaryInfo : public ParallelObject
550557
*/
551558
void build_shellface_boundary_ids(std::vector<boundary_id_type> & b_ids) const;
552559

560+
#ifdef LIBMESH_ENABLE_AMR
561+
/**
562+
* Update parent's boundary id list so that this information is consistent with
563+
* its children
564+
*
565+
* This is useful when `_children_on_boundary = true`, and is used when the
566+
* element is about to get coarsened i.e., in MeshRefinement::_coarsen_elements()
567+
*
568+
* Specifically, when we coarsen an element whose children have different boundary ids.
569+
* In such scenarios, the parent will inherit the children's boundaries if at
570+
* least 50% them own a boundary while sharing the side of the parent.
571+
*/
572+
void transfer_boundary_ids_from_children(const Elem * const parent);
573+
#endif
574+
553575
/**
554576
* \returns The number of element-side-based boundary conditions.
555577
*
@@ -877,6 +899,18 @@ class BoundaryInfo : public ParallelObject
877899
const std::multimap<const Elem *, std::pair<unsigned short int, boundary_id_type>> & get_sideset_map() const
878900
{ return _boundary_side_id; }
879901

902+
/**
903+
* \returns Whether or not there may be child elements directly assigned boundary sides
904+
*/
905+
bool is_children_on_boundary_side() const
906+
{ return _children_on_boundary; }
907+
908+
/**
909+
* Whether or not to allow directly setting boundary sides on child elements
910+
*/
911+
void allow_children_on_boundary_side(const bool children_on_boundary)
912+
{ _children_on_boundary = children_on_boundary; }
913+
880914
private:
881915

882916
/**
@@ -927,6 +961,13 @@ class BoundaryInfo : public ParallelObject
927961
std::pair<unsigned short int, boundary_id_type>>
928962
_boundary_side_id;
929963

964+
/*
965+
* Whether or not children elements are associated with any boundary
966+
* It is false by default. The flag will be turned on if `add_side`
967+
* function is called with a child element
968+
*/
969+
bool _children_on_boundary;
970+
930971
/**
931972
* A collection of user-specified boundary ids for sides, edges, nodes,
932973
* and shell faces.

include/mesh/mesh_refinement.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,10 @@ class MeshRefinement : public ParallelObject
241241
*
242242
* \note This function used to take an argument, \p maintain_level_one,
243243
* new code should use face_level_mismatch_limit() instead.
244+
*
245+
* \note When we allow boundaries to be directly associated with child elements,
246+
* i.e., `_children_on_boundary = true`. A child's boundary ID may be
247+
* lost during coarsening if it differs from its siblings on that parent side.
244248
*/
245249
bool coarsen_elements ();
246250

0 commit comments

Comments
 (0)