18 :
libMesh::ParallelObject(other), _mortar_initd(false)
24 const std::pair<BoundaryID, BoundaryID> & boundary_key,
25 const std::pair<SubdomainID, SubdomainID> & subdomain_key,
30 const bool correct_edge_dropping,
31 const Real minimum_projection_angle)
46 auto periodic_map_iterator = periodic_map.find(boundary_key);
47 if (periodic_map_iterator != periodic_map.end() && periodic_map_iterator->second != periodic)
48 mooseError(
"We do not currently support enforcing both periodic and non-periodic constraints " 49 "on the same boundary primary-secondary pair");
51 periodic_map.insert(periodic_map_iterator, std::make_pair(boundary_key, periodic));
54 auto debug_flag_map_iterator = debug_flag_map.find(boundary_key);
55 if (debug_flag_map_iterator != debug_flag_map.end() && debug_flag_map_iterator->second != debug)
57 "We do not currently support generating and not generating debug output " 58 "on the same boundary primary-secondary surface pair. Please set debug_mesh = true for " 59 "all constraints sharing the same primary-secondary surface pairs");
61 debug_flag_map.insert(debug_flag_map_iterator, std::make_pair(boundary_key, debug));
64 if (mortar_interfaces.find(boundary_key) == mortar_interfaces.end())
66 auto [it, inserted] = mortar_interfaces.emplace(
68 std::make_unique<AutomaticMortarGeneration>(subproblem.
getMooseApp(),
75 correct_edge_dropping,
76 minimum_projection_angle));
78 it->second->initOutput();
93 std::vector<std::pair<SubdomainID, std::set<SubdomainID> *>> subdomains_to_probe;
96 subdomains_to_probe.push_back(std::make_pair(key1, &it1.first->second));
98 subdomains_to_probe.push_back(std::make_pair(key2, &it2.first->second));
100 for (
auto & pr : subdomains_to_probe)
102 for (
const Elem * lower_d_elem :
as_range(
mesh.active_local_subdomain_elements_begin(pr.first),
103 mesh.active_local_subdomain_elements_end(pr.first)))
105 const Elem * ip = lower_d_elem->interior_parent();
108 "Lower dimensional elements should always have an interior parent set when using mortar");
109 pr.second->insert(ip->subdomain_id());
119 const std::pair<BoundaryID, BoundaryID> & boundary_key,
120 const std::pair<SubdomainID, SubdomainID> & ,
121 bool on_displaced)
const 124 auto it = mortar_interfaces.find(boundary_key);
125 if (it == mortar_interfaces.end())
127 "The requested mortar interface AutomaticMortarGeneration object does not yet exist!");
133 const std::pair<BoundaryID, BoundaryID> & boundary_key,
134 const std::pair<SubdomainID, SubdomainID> & subdomain_key,
139 boundary_key, subdomain_key, on_displaced));
146 update(*mortar_pair.second);
148 update(*mortar_pair.second);
166 const auto dim = amg.
dim();
181 mooseError(
"Invalid mesh dimension for mortar constraint");
187 const std::set<SubdomainID> &
193 lower_d_subdomain_id,
194 " has not been added to MortarInterfaceWarehouse yet");
virtual MooseMesh & mesh()=0
void dontNotifyWhenMortarSetup(MortarExecutorInterface *mei)
Removes mei from the container of objects that will have their mortarSetup method called as soon as t...
void createMortarInterface(const std::pair< BoundaryID, BoundaryID > &boundary_key, const std::pair< SubdomainID, SubdomainID > &subdomain_key, SubProblem &subproblem, bool on_displaced, bool periodic, const bool debug, const bool correct_edge_dropping, const Real minimum_projection_angle)
Create mortar generation object.
void computeInactiveLMNodes()
Get list of secondary nodes that don't contribute to interaction with any primary element...
std::unordered_map< MortarKey, std::unique_ptr< AutomaticMortarGeneration > > _displaced_mortar_interfaces
Map from primary-secondary (in that order) boundary ID pair to the corresponding displaced AutomaticM...
void clear()
Clears the mortar segment mesh and accompanying data structures.
std::unordered_map< MortarKey, bool > _debug_flag_map
Map from undisplaced AMG key to whether the undisplaced AMG object is to output mortar segment mesh...
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Interface for notifications that the mortar mesh has been setup.
std::set< MortarExecutorInterface * > _mei_objs
A container of objects for whom the mortarSetup method will be called after the mortar mesh has been ...
void buildMortarSegmentMesh()
Builds the mortar segment mesh once the secondary and primary node projections have been completed...
static constexpr std::size_t dim
This is the dimension of all vector and tensor datastructures used in MOOSE.
std::unordered_map< MortarKey, bool > _displaced_periodic_map
Map from displaced AMG key to whether the displaced AMG object is enforcing periodic constraints...
std::unordered_map< MortarKey, bool > _periodic_map
Map from undisplaced AMG key to whether the undisplaced AMG object is enforcing periodic constraints...
const Parallel::Communicator & _communicator
The following methods are specializations for using the libMesh::Parallel::packed_range_* routines fo...
bool _mortar_initd
Whether we have performed any mortar mesh construction.
MooseApp & getMooseApp() const
Get the MooseApp this class is associated with.
void projectSecondaryNodes()
Project secondary nodes (find xi^(2) values) to the closest points on the primary surface...
This class is a container/interface for the objects involved in automatic generation of mortar spaces...
void notifyWhenMortarSetup(MortarExecutorInterface *mei)
Adds mei to the container of objects that will have their mortarSetup method called as soon as the mo...
void projectPrimaryNodes()
(Inverse) project primary nodes to the points on the secondary surface where they would have come fro...
MeshBase & getMesh()
Accessor for the underlying libMesh Mesh object.
const std::set< SubdomainID > & getHigherDimSubdomainIDs(SubdomainID lower_d_subdomain_id) const
Returns the higher dimensional subdomain ids of the interior parents of the given lower-d subdomain i...
void buildNodeToElemMaps()
Once the secondary_requested_boundary_ids and primary_requested_boundary_ids containers have been fil...
std::unordered_map< SubdomainID, std::set< SubdomainID > > _lower_d_sub_to_higher_d_subs
Map from lower dimensional subdomain ids to corresponding higher simensional subdomain ids (e...
SimpleRange< IndexType > as_range(const std::pair< IndexType, IndexType > &p)
void computeNodalGeometry()
Computes and stores the nodal normal/tangent vectors in a local data structure instead of using the E...
void buildMortarSegmentMesh3d()
Builds the mortar segment mesh once the secondary and primary node projections have been completed...
std::unordered_map< MortarKey, std::unique_ptr< AutomaticMortarGeneration > > _mortar_interfaces
Map from primary-secondary (in that order) boundary ID pair to the corresponding undisplaced Automati...
void update()
Builds mortar segment meshes for each mortar interface.
std::unordered_map< MortarKey, bool > _displaced_debug_flag_map
Map from displaced AMG key to whether the displaced AMG object is to output mortar segment mesh...
Generic class for solving transient nonlinear problems.
std::set< SubdomainID > _mortar_subdomain_coverage
A set containing the subdomain ids covered by all the mortar interfaces in this MortarInterfaceWareho...
const AutomaticMortarGeneration & getMortarInterface(const std::pair< BoundaryID, BoundaryID > &boundary_key, const std::pair< SubdomainID, SubdomainID > &, bool on_displaced) const
Getter to retrieve the AutomaticMortarGeneration object corresponding to the boundary and subdomain k...
std::set< BoundaryID > _mortar_boundary_coverage
A set containing the boundary ids covered by all the mortar interfaces in this MortarInterfaceWarehou...
MortarInterfaceWarehouse(const libMesh::ParallelObject &other)
void computeInactiveLMElems()
Get list of secondary elems without any corresponding primary elements.
void set_union(T &data, const unsigned int root_id) const