https://mooseframework.inl.gov
Loading...
Searching...
No Matches
MortarConsumerInterface.h
Go to the documentation of this file.
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#include "MooseTypes.h"
13
14#include <set>
15
16class InputParameters;
17class MooseObject;
18class MooseMesh;
22class SubProblem;
23class Assembly;
24
25namespace libMesh
26{
27class QBase;
28}
29
37{
38public:
39 MortarConsumerInterface(const MooseObject * moose_object);
40
42
50
55
60
64 bool onInterface(BoundaryID primary_boundary_id, BoundaryID secondary_boundary_id) const;
65
66protected:
67 const std::set<SubdomainID> & getHigherDimSubdomainIDs() const
68 {
70 }
71 const std::set<BoundaryID> & getBoundaryIDs() const { return _boundary_ids; }
72
76 const AutomaticMortarGeneration & amg() const;
77
84
93 void checkPetrovGalerkinQuadraticFaces(const MooseObject & moose_object,
94 const MooseVariableFieldBase & lm_var) const;
95
99 static void trimDerivative(dof_id_type remove_derivative_index, ADReal & dual_number);
100
104 template <typename Variables, typename DualNumbers>
105 static void
106 trimInteriorNodeDerivatives(const std::map<unsigned int, unsigned int> & primary_ip_lowerd_map,
107 const Variables & moose_var,
108 DualNumbers & ad_vars,
109 const bool is_secondary);
110
114
117
119
123
126
129
132
135
137 std::set<BoundaryID> _secondary_set;
138
140 std::set<BoundaryID> _boundary_ids;
141
143 std::set<SubdomainID> _higher_dim_subdomain_ids;
144
147
150
153
155 const libMesh::QBase * const & _qrule_msm;
156
159
166 Elem const * const & _lower_secondary_elem;
167
174 Elem const * const & _lower_primary_elem;
175
177 const std::vector<Real> & _JxW_msm;
178
180 const Elem * const & _msm_elem;
181
183 std::vector<Point> _normals;
184
185private:
189 void setNormals();
190
191 // Pointer to automatic mortar generation object to give constraints access to mortar geometry
193
195 friend class FEProblemBase;
196
197 template <typename>
200
206};
207
208inline const AutomaticMortarGeneration &
210{
211 mooseAssert(_amg, "this should have been set in the constructor");
212 return *_amg;
213}
214
215template <typename Variables, typename DualNumbers>
216void
218 const std::map<unsigned int, unsigned int> & domain_ip_lowerd_map,
219 const Variables & moose_vars,
220 DualNumbers & dual_numbers,
221 const bool is_secondary)
222{
223 //
224 // Remove interior node variable's derivatives from AD objects.
225 //
226
227 mooseAssert(moose_vars.size(), "Should have passed at least one variable");
228 const auto num_indices = is_secondary ? moose_vars[0]->dofIndices().size()
229 : moose_vars[0]->dofIndicesNeighbor().size();
230#ifdef DEBUG
231 for (const auto i : make_range(std::size_t(1), moose_vars.size()))
232 if (auto * moose_var = moose_vars[i])
233 mooseAssert(is_secondary ? moose_var->dofIndices().size()
234 : moose_var->dofIndicesNeighbor().size() == num_indices,
235 "These must be the same for all passed in variables");
236#endif
237
238 for (const auto dof_index : make_range(num_indices))
239 if (!domain_ip_lowerd_map.count(dof_index))
240 {
241 for (const auto * const moose_var : moose_vars)
242 {
243 // It's valid for a user to pass a container that represents a LIBMESH_DIM vector of
244 // component variables for which one or two of the variables may be null depending on the
245 // mesh dimension in the simulation
246 if (!moose_var)
247 continue;
248
249 mooseAssert(moose_var->isNodal(),
250 "Trimming of interior node's derivatives is only supported for Lagrange "
251 "elements in mortar objects");
252
253 const auto remove_derivative_index = is_secondary
254 ? moose_var->dofIndices()[dof_index]
255 : moose_var->dofIndicesNeighbor()[dof_index];
256 for (auto & dual_number : dual_numbers)
257 trimDerivative(remove_derivative_index, dual_number);
258 }
259 }
260}
261
262inline bool
264 const BoundaryID secondary_boundary_id) const
265{
266 return (primary_boundary_id == _primary_id) && (secondary_boundary_id == _secondary_id);
267}
DualNumber< Real, DNDerivativeType, true > ADReal
boundary_id_type BoundaryID
subdomain_id_type SubdomainID
unsigned int THREAD_ID
Definition MooseTypes.h:237
Keeps track of stuff related to assembling.
Definition Assembly.h:102
This class is a container/interface for the objects involved in automatic generation of mortar spaces...
Specialization of SubProblem for solving nonlinear equations plus auxiliary equations.
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system.
forward declarations
Definition MooseArray.h:18
MooseMesh wraps a libMesh::Mesh object and enhances its capabilities by caching additional data and s...
Definition MooseMesh.h:95
Every object that can be built by the factory should be derived from this class.
Definition MooseObject.h:31
This class provides an interface for common operations on field variables of both FE and FV types wit...
An interface for accessing mortar mesh data.
SubdomainID primarySubdomain() const
static InputParameters validParams()
const AutomaticMortarGeneration * _amg
std::set< BoundaryID > _boundary_ids
the union of the secondary and primary boundary ids
static InputParameters triangulationParams()
Elem const *const & _lower_secondary_elem
The secondary face lower dimensional element (not the mortar element!).
const bool _interpolate_normals
Whether to interpolate the nodal normals.
const libMesh::QBase *const & _qrule_msm
The quadrature rule on the mortar segment element.
const libMesh::QBase *const & _qrule_face
The arbitrary quadrature rule on the lower dimensional secondary face.
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.
const AutomaticMortarGeneration & amg() const
Retrieve the automatic mortar generation object associated with this constraint.
std::set< BoundaryID > _secondary_set
the secondaryid set
const std::set< SubdomainID > & getHigherDimSubdomainIDs() const
const BoundaryID _primary_id
Boundary ID for the primary surface.
void checkPetrovGalerkinQuadraticFaces(const MooseObject &moose_object, const MooseVariableFieldBase &lm_var) const
Report an error if Petrov-Galerkin weights the gap of a SECOND order dual Lagrange multiplier with th...
const MortarInterfaceWarehouse & _mortar_data
A reference to the mortar data object that holds all the mortar mesh information.
friend void reinitMortarUserObjects(BoundaryID, BoundaryID, bool)
Calls the reinitialization of mortar user objects.
Elem const *const & _lower_primary_elem
The primary face lower dimensional element (not the mortar element!).
bool onInterface(BoundaryID primary_boundary_id, BoundaryID secondary_boundary_id) const
const MooseArray< Point > & _phys_points_secondary
The locations of the quadrature points on the interior secondary elements.
std::set< SubdomainID > _higher_dim_subdomain_ids
the higher dimensional subdomain ids corresponding to the interior parents
const Elem *const & _msm_elem
The current mortar segment element.
SubdomainID secondarySubdomain() const
const SubdomainID _secondary_subdomain_id
Subdomain ID for the secondary surface.
MooseMesh & _mci_mesh
Mesh to query for boundary and subdomain ID information.
const MooseArray< Point > & _phys_points_primary
The locations of the quadrature points on the interior primary elements.
std::vector< Point > _normals
the normals
static void trimInteriorNodeDerivatives(const std::map< unsigned int, unsigned int > &primary_ip_lowerd_map, const Variables &moose_var, DualNumbers &ad_vars, const bool is_secondary)
Get rid of interior node variable's derivatives.
const BoundaryID _secondary_id
Boundary ID for the secondary surface.
bool interpolateNormals() const
Whether to interpolate the nodal normals (e.g.
const std::vector< Real > & _JxW_msm
The element Jacobian times weights.
const SubdomainID _primary_subdomain_id
Subdomain ID for the primary surface.
const std::set< BoundaryID > & getBoundaryIDs() const
Base class for creating new nodally-based mortar auxiliary kernels.
Generic class for solving transient nonlinear problems.
Definition SubProblem.h:79
The following methods are specializations for using the libMesh::Parallel::packed_range_* routines fo...