18 #include "libmesh/quadrature.h" 29 "AugmentSparsityOnInterface",
33 rm_params.
set<
bool>(
"use_displaced_mesh") = obj_params.
get<
bool>(
"use_displaced_mesh");
34 rm_params.
set<BoundaryName>(
"secondary_boundary") =
35 obj_params.
get<BoundaryName>(
"secondary_boundary");
36 rm_params.
set<BoundaryName>(
"primary_boundary") =
37 obj_params.
get<BoundaryName>(
"primary_boundary");
38 rm_params.
set<SubdomainName>(
"secondary_subdomain") =
39 obj_params.
get<SubdomainName>(
"secondary_subdomain");
40 rm_params.
set<SubdomainName>(
"primary_subdomain") =
41 obj_params.
get<SubdomainName>(
"primary_subdomain");
42 rm_params.
set<
bool>(
"ghost_point_neighbors") =
43 obj_params.
get<
bool>(
"ghost_point_neighbors");
44 rm_params.
set<
bool>(
"ghost_higher_d_neighbors") =
45 obj_params.
get<
bool>(
"ghost_higher_d_neighbors");
49 "The name of the primary boundary sideset.");
51 "The name of the secondary boundary sideset.");
52 params.
addRequiredParam<SubdomainName>(
"primary_subdomain",
"The name of the primary subdomain.");
54 "The name of the secondary subdomain.");
58 "Whether this constraint is going to be used to enforce a periodic condition. This has the " 59 "effect of changing the normals vector for projection from outward to inward facing");
64 "Whether this constraint is going to enable mortar segment mesh debug information. An exodus" 65 "file will be generated if the user sets this flag to true");
68 "correct_edge_dropping",
70 "Whether to enable correct edge dropping treatment for mortar constraints. When disabled " 71 "any Lagrange Multiplier degree of freedom on a secondary element without full primary " 72 "contributions will be set (strongly) to 0.");
75 "interpolate_normals",
77 "Whether to interpolate the nodal normals (e.g. classic idea of evaluating field at " 78 "quadrature points). If this is set to false, then non-interpolated nodal normals will be " 79 "used, and then the _normals member should be indexed with _i instead of _qp");
81 params.
addParam<
bool>(
"ghost_point_neighbors",
83 "Whether we should ghost point neighbors of secondary face elements, and " 84 "consequently also their mortar interface couples.");
86 "minimum_projection_angle",
88 "Parameter to control which angle (in degrees) is admissible for the creation of mortar " 89 "segments. If set to a value close to zero, very oblique projections are allowed, which " 90 "can result in mortar segments solving physics not meaningfully, and overprojection of " 91 "primary nodes onto the mortar segment mesh in extreme cases. This parameter is mostly " 92 "intended for mortar mesh debugging purposes in two dimensions.");
95 "ghost_higher_d_neighbors",
97 "Whether we should ghost higher-dimensional neighbors. This is necessary when we are doing " 98 "second order mortar with finite volume primal variables, because in order for the method to " 99 "be second order we must use cell gradients, which couples in the neighbor cells.");
106 : _mci_fe_problem(*moose_object->getCheckedPointerParam<
FEProblemBase *>(
"_fe_problem_base")),
107 _mci_subproblem(*moose_object->getCheckedPointerParam<
SubProblem *>(
"_subproblem")),
108 _mci_tid(moose_object->getParam<
THREAD_ID>(
"_tid")),
109 _mci_mesh(_mci_subproblem.
mesh()),
111 _mci_assembly(_mci_subproblem.assembly(_mci_tid, 0)),
112 _mortar_data(_mci_fe_problem.mortarData()),
114 _mci_mesh.
getBoundaryID(moose_object->getParam<BoundaryName>(
"secondary_boundary"))),
115 _primary_id(_mci_mesh.
getBoundaryID(moose_object->getParam<BoundaryName>(
"primary_boundary"))),
116 _secondary_subdomain_id(
117 _mci_mesh.
getSubdomainID(moose_object->getParam<SubdomainName>(
"secondary_subdomain"))),
118 _primary_subdomain_id(
119 _mci_mesh.
getSubdomainID(moose_object->getParam<SubdomainName>(
"primary_subdomain"))),
121 _interpolate_normals(moose_object->getParam<
bool>(
"interpolate_normals")),
122 _phys_points_secondary(_mci_assembly.qPointsFace()),
123 _phys_points_primary(_mci_assembly.qPointsFaceNeighbor()),
124 _qrule_msm(_mci_assembly.qRuleMortar()),
125 _qrule_face(_mci_assembly.qRuleFace()),
126 _lower_secondary_elem(_mci_assembly.lowerDElem()),
127 _lower_primary_elem(_mci_assembly.neighborLowerDElem()),
128 _JxW_msm(_mci_assembly.jxWMortar()),
129 _msm_elem(_mci_assembly.msmElem())
131 const bool displaced = moose_object->isParamValid(
"use_displaced_mesh")
132 ? moose_object->getParam<
bool>(
"use_displaced_mesh")
136 _mci_fe_problem.createMortarInterface(
137 std::make_pair(_primary_id, _secondary_id),
138 std::make_pair(_primary_subdomain_id, _secondary_subdomain_id),
140 moose_object->getParam<
bool>(
"periodic"),
141 moose_object->getParam<
bool>(
"debug_mesh"),
142 moose_object->getParam<
bool>(
"correct_edge_dropping"),
143 moose_object->getParam<Real>(
"minimum_projection_angle"));
145 _amg = &_mci_fe_problem.getMortarInterface(
146 std::make_pair(_primary_id, _secondary_id),
147 std::make_pair(_primary_subdomain_id, _secondary_subdomain_id),
150 const auto & secondary_set = _mortar_data.getHigherDimSubdomainIDs(_secondary_subdomain_id);
151 const auto & primary_set = _mortar_data.getHigherDimSubdomainIDs(_primary_subdomain_id);
153 std::set_union(secondary_set.begin(),
157 std::inserter(_higher_dim_subdomain_ids, _higher_dim_subdomain_ids.begin()));
158 _boundary_ids = {_secondary_id, _primary_id};
174 auto md_it = dual_number.derivatives().nude_data().begin();
175 auto mi_it = dual_number.derivatives().nude_indices().begin();
177 auto d_it = dual_number.derivatives().nude_data().begin();
179 for (
auto i_it = dual_number.derivatives().nude_indices().begin();
180 i_it != dual_number.derivatives().nude_indices().end();
182 if (*i_it != remove_derivative_index)
190 std::size_t n_indices = md_it - dual_number.derivatives().nude_data().begin();
191 dual_number.derivatives().nude_indices().resize(n_indices);
192 dual_number.derivatives().nude_data().resize(n_indices);
const BoundaryID _secondary_id
Boundary ID for the secondary surface.
MortarConsumerInterface(const MooseObject *moose_object)
const libMesh::QBase *const & _qrule_face
The arbitrary quadrature rule on the lower dimensional secondary face.
std::vector< Point > getNodalNormals(const Elem &secondary_elem) const
DualNumber< Real, DNDerivativeType, true > ADReal
Specialization of SubProblem for solving nonlinear equations plus auxiliary equations.
SubdomainID getSubdomainID(const SubdomainName &subdomain_name, const MeshBase &mesh)
Gets the subdomain ID associated with the given SubdomainName.
BoundaryID getBoundaryID(const BoundaryName &boundary_name, const MeshBase &mesh)
Gets the boundary ID associated with the given BoundaryName.
Elem const *const & _lower_secondary_elem
The secondary face lower dimensional element (not the mortar element!).
const AutomaticMortarGeneration & amg() const
Retrieve the automatic mortar generation object associated with this constraint.
Every object that can be built by the factory should be derived from this class.
std::vector< Point > _normals
the normals
bool interpolateNormals() const
Whether to interpolate the nodal normals (e.g.
static void trimDerivative(dof_id_type remove_derivative_index, ADReal &dual_number)
Get rid of AD derivative entries by dof index.
void setNormals()
Set the normals vector.
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
Generic class for solving transient nonlinear problems.
const std::vector< Point > & get_points() const
static InputParameters validParams()
std::vector< Point > getNormals(const Elem &secondary_elem, const std::vector< Point > &xi1_pts) const
Compute the normals at given reference points on a secondary element.