Line data Source code
1 : //* This file is part of the MOOSE framework 2 : //* https://mooseframework.inl.gov 3 : //* 4 : //* All rights reserved, see COPYRIGHT for full restrictions 5 : //* https://github.com/idaholab/moose/blob/master/COPYRIGHT 6 : //* 7 : //* Licensed under LGPL 2.1, please see LICENSE for details 8 : //* https://www.gnu.org/licenses/lgpl-2.1.html 9 : 10 : #pragma once 11 : 12 : // App includes 13 : #include "AutomaticMortarGeneration.h" 14 : #include "RelationshipManager.h" 15 : 16 : // libMesh includes 17 : #include "libmesh/mesh_base.h" 18 : 19 : using libMesh::boundary_id_type; 20 : using libMesh::CouplingMatrix; 21 : using libMesh::Elem; 22 : using libMesh::GhostingFunctor; 23 : using libMesh::MeshBase; 24 : using libMesh::processor_id_type; 25 : 26 : class AugmentSparsityOnInterface : public RelationshipManager 27 : { 28 : public: 29 : AugmentSparsityOnInterface(const InputParameters &); 30 : 31 : AugmentSparsityOnInterface(const AugmentSparsityOnInterface & others); 32 : 33 : static InputParameters validParams(); 34 : 35 : /** 36 : * This function must be overriden by application codes to add 37 : * required elements from (range_begin, range_end) to the 38 : * coupled_elements map. 39 : */ 40 : virtual void operator()(const MeshBase::const_element_iterator & range_begin, 41 : const MeshBase::const_element_iterator & range_end, 42 : processor_id_type p, 43 : map_type & coupled_elements) override; 44 : 45 : /** 46 : * A clone() is needed because GhostingFunctor can not be shared between 47 : * different meshes. The operations in GhostingFunctor are mesh dependent. 48 : */ 49 : virtual std::unique_ptr<GhostingFunctor> clone() const override; 50 : 51 : /** 52 : * Update the cached _lower_to_upper map whenever our Mesh has been 53 : * redistributed. We'll be lazy and just recalculate from scratch. 54 : */ 55 16 : virtual void redistribute() override { this->mesh_reinit(); } 56 : 57 : std::string getInfo() const override; 58 : 59 : virtual bool operator>=(const RelationshipManager & other) const override; 60 : 61 : protected: 62 : virtual void internalInitWithMesh(const MeshBase &) override; 63 : 64 : /** 65 : * Ghost the mortar interface couplings of the provided element 66 : */ 67 : void ghostMortarInterfaceCouplings(const processor_id_type p, 68 : const Elem * const elem, 69 : map_type & coupled_elements, 70 : const AutomaticMortarGeneration & amg) const; 71 : 72 : /** 73 : * Query the mortar interface couplings of the query element. If a lower dimensional secondary 74 : * element is found, then we search for its point neighbors, which we ghost, as well as all of the 75 : * mortar interface couplings of the point neighbors. This kind of ghosting is required for mortar 76 : * nodal auxiliary kernels 77 : */ 78 : void ghostLowerDSecondaryElemPointNeighbors(const processor_id_type p, 79 : const Elem * const query_elem, 80 : map_type & coupled_elements, 81 : BoundaryID secondary_boundary_id, 82 : SubdomainID secondary_subdomain_id, 83 : const AutomaticMortarGeneration & amg) const; 84 : 85 : void ghostHigherDNeighbors(const processor_id_type p, 86 : const Elem * const query_elem, 87 : map_type & coupled_elements, 88 : BoundaryID secondary_boundary_id, 89 : SubdomainID secondary_subdomain_id, 90 : const AutomaticMortarGeneration & amg) const; 91 : 92 : const BoundaryName _primary_boundary_name; 93 : const BoundaryName _secondary_boundary_name; 94 : const SubdomainName _primary_subdomain_name; 95 : const SubdomainName _secondary_subdomain_name; 96 : 97 : /// Whether this relationship manager is called when coupling functors are called when building 98 : /// the matrix sparsity pattern 99 : const bool _is_coupling_functor; 100 : 101 : /// Whether to ghost point neighbors of secondary lower subdomain elements and their 102 : /// cross mortar interface counterparts for applications such as mortar nodal auxiliary kernels 103 : const bool _ghost_point_neighbors; 104 : 105 : /// Whether we should ghost higher-dimensional neighbors. This is necessary when we are doing 106 : /// second order mortar with finite volume primal variables, because in order for the method to be 107 : /// second order we must use cell gradients, which couples in the neighbor cells 108 : const bool _ghost_higher_d_neighbors; 109 : 110 : /// null matrix for generating full variable coupling 111 : const CouplingMatrix * const _null_mat = nullptr; 112 : };