Skip to content

Allow children to have boundary conditions #3477

New issue

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

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

Already on GitHub? Sign in to your account

Merged
merged 17 commits into from
Mar 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 41 additions & 0 deletions include/mesh/boundary_info.h
Original file line number Diff line number Diff line change
Expand Up @@ -480,6 +480,13 @@ class BoundaryInfo : public ParallelObject
unsigned int n_boundary_ids (const Elem * const elem,
const unsigned short int side) const;

/**
* \returns The number of raw (excludes ancestors) boundary ids associated with the \p side
* side of element \p elem.
*/
unsigned int n_raw_boundary_ids (const Elem * const elem,
const unsigned short int side) const;

/**
* \returns The list of boundary ids associated with the \p side side of
* element \p elem.
Expand Down Expand Up @@ -550,6 +557,21 @@ class BoundaryInfo : public ParallelObject
*/
void build_shellface_boundary_ids(std::vector<boundary_id_type> & b_ids) const;

#ifdef LIBMESH_ENABLE_AMR
/**
* Update parent's boundary id list so that this information is consistent with
* its children
*
* This is useful when `_children_on_boundary = true`, and is used when the
* element is about to get coarsened i.e., in MeshRefinement::_coarsen_elements()
*
* Specifically, when we coarsen an element whose children have different boundary ids.
* In such scenarios, the parent will inherit the children's boundaries if at
* least 50% them own a boundary while sharing the side of the parent.
*/
void transfer_boundary_ids_from_children(const Elem * const parent);
#endif

/**
* \returns The number of element-side-based boundary conditions.
*
Expand Down Expand Up @@ -877,6 +899,18 @@ class BoundaryInfo : public ParallelObject
const std::multimap<const Elem *, std::pair<unsigned short int, boundary_id_type>> & get_sideset_map() const
{ return _boundary_side_id; }

/**
* \returns Whether or not there may be child elements directly assigned boundary sides
*/
bool is_children_on_boundary_side() const
{ return _children_on_boundary; }

/**
* Whether or not to allow directly setting boundary sides on child elements
*/
void allow_children_on_boundary_side(const bool children_on_boundary)
{ _children_on_boundary = children_on_boundary; }

private:

/**
Expand Down Expand Up @@ -927,6 +961,13 @@ class BoundaryInfo : public ParallelObject
std::pair<unsigned short int, boundary_id_type>>
_boundary_side_id;

/*
* Whether or not children elements are associated with any boundary
* It is false by default. The flag will be turned on if `add_side`
* function is called with a child element
*/
bool _children_on_boundary;

/**
* A collection of user-specified boundary ids for sides, edges, nodes,
* and shell faces.
Expand Down
4 changes: 4 additions & 0 deletions include/mesh/mesh_refinement.h
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,10 @@ class MeshRefinement : public ParallelObject
*
* \note This function used to take an argument, \p maintain_level_one,
* new code should use face_level_mismatch_limit() instead.
*
* \note When we allow boundaries to be directly associated with child elements,
* i.e., `_children_on_boundary = true`. A child's boundary ID may be
* lost during coarsening if it differs from its siblings on that parent side.
*/
bool coarsen_elements ();

Expand Down
Loading