https://mooseframework.inl.gov
Loading...
Searching...
No Matches
MortarUserObjectThread.C
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
11#include "FEProblemBase.h"
12#include "SubProblem.h"
13#include "Assembly.h"
15#include "MooseMesh.h"
16#include "Assembly.h"
17#include "MortarUtils.h"
18#include "MaterialBase.h"
19#include "MortarUserObject.h"
20
21#include "libmesh/fe_base.h"
22#include "libmesh/quadrature.h"
23#include "libmesh/elem.h"
24#include "libmesh/point.h"
25#include "libmesh/mesh_base.h"
26
28 std::vector<MortarUserObject *> & mortar_user_objects,
29 const AutomaticMortarGeneration & amg,
30 SubProblem & subproblem,
31 FEProblemBase & fe_problem,
32 bool displaced,
33 Assembly & assembly)
34 : MortarExecutorInterface(fe_problem),
35 _mortar_user_objects(mortar_user_objects),
36 _amg(amg),
37 _subproblem(subproblem),
38 _fe_problem(fe_problem),
39 _displaced(displaced),
40 _assembly(assembly)
41{
43}
44
49
50void
61
62void
64{
65 const auto & secondary_elems_to_mortar_segments = _amg.secondariesToMortarSegments();
66 typedef decltype(secondary_elems_to_mortar_segments.begin()) it_type;
67
68 std::vector<it_type> iterators;
69 for (auto it = secondary_elems_to_mortar_segments.begin();
70 it != secondary_elems_to_mortar_segments.end();
71 ++it)
72 {
73 auto * const secondary_elem = _subproblem.mesh().getMesh().query_elem_ptr(it->first);
74
75 if (secondary_elem && secondary_elem->processor_id() == _subproblem.processor_id() &&
76 !it->second.empty())
77 {
78 // This is local and the mortar segment set isn't empty, so include
79 iterators.push_back(it);
80 mooseAssert(secondary_elem->active(),
81 "We loop over active elements when building the mortar segment mesh, so we golly "
82 "well hope this is active.");
83 }
84 }
85
86 auto act_functor = [this]()
87 {
88 for (auto * const mc : _mortar_user_objects)
89 {
90 mc->setNormals();
91 mc->execute();
92 }
93 };
94
99 _amg,
102 0,
106 act_functor,
107 /*reinit_mortar_user_objects=*/false);
108}
Keeps track of stuff related to assembling.
Definition Assembly.h:101
This class is a container/interface for the objects involved in automatic generation of mortar spaces...
std::vector< MortarFilterIter > secondariesToMortarSegments(const Node &node) const
Specialization of SubProblem for solving nonlinear equations plus auxiliary equations.
MeshBase & getMesh()
Accessor for the underlying libMesh Mesh object.
Definition MooseMesh.C:3512
Interface for objects that need to be notified when the mortar segment mesh for an interface they con...
MortarInterfaceWarehouse & _mortar_warehouse
The warehouse this object is registered with for mortar setup notifications.
std::map< SubdomainID, std::deque< MaterialBase * > > _primary_ip_sub_to_mats
A map from primary interior parent subdomain IDs to the block materials that will need to reinit'd on...
std::deque< MaterialBase * > _secondary_boundary_mats
A container that holds the boundary materials that will need to be reinit'd on the secondary face.
std::map< SubdomainID, std::deque< MaterialBase * > > _secondary_ip_sub_to_mats
void dontNotifyWhenMortarSetup(MortarExecutorInterface *mei)
Removes mei from the container of objects that will have their mortarSetup method called whenever a m...
const AutomaticMortarGeneration & _amg
Automatic mortar generation (amg) object providing the mortar mesh to loop over.
~MortarUserObjectThread() override
Unlike MortarExecutorInterface's other implementers, this object is stack-constructed fresh for a sin...
SubProblem & _subproblem
A reference to the SubProblem object for reiniting lower-dimensional element quantities.
Assembly & _assembly
A reference to the assembly object.
MortarUserObjectThread(std::vector< MortarUserObject * > &mortar_user_objects, const AutomaticMortarGeneration &amg, SubProblem &subproblem, FEProblemBase &fe_problem, bool displaced, Assembly &assembly)
FEProblemBase & _fe_problem
A reference to the FEProblemBase object for reiniting higher-dimensional element and neighbor element...
std::vector< MortarUserObject * > & _mortar_user_objects
The mortar user objects to loop over when on each mortar segment element.
const bool _displaced
Whether the mortar user objects are operating on the displaced mesh.
void operator()()
Loops over the mortar segment mesh and executes the user objects.
void mortarSetup(const AutomaticMortarGeneration &amg) override
Called by the MortarInterfaceWarehouse whenever amg's mortar segment mesh coverage has changed,...
Generic class for solving transient nonlinear problems.
Definition SubProblem.h:79
virtual MooseMesh & mesh()=0
processor_id_type processor_id() const
void loopOverMortarSegments(const Iterators &secondary_elems_to_mortar_segments, Assembly &assembly, SubProblem &subproblem, FEProblemBase &fe_problem, const AutomaticMortarGeneration &amg, const bool displaced, const Consumers &consumers, const THREAD_ID tid, const std::map< SubdomainID, std::deque< MaterialBase * > > &secondary_ip_sub_to_mats, const std::map< SubdomainID, std::deque< MaterialBase * > > &primary_ip_sub_to_mats, const std::deque< MaterialBase * > &secondary_boundary_mats, const ActionFunctor act, const bool reinit_mortar_user_objects)
This method will loop over pairs of secondary elements and their corresponding mortar segments,...
Definition MortarUtils.h:91
void setupMortarMaterials(const Consumers &consumers, FEProblemBase &fe_problem, const AutomaticMortarGeneration &amg, const THREAD_ID tid, std::map< SubdomainID, std::deque< MaterialBase * > > &secondary_ip_sub_to_mats, std::map< SubdomainID, std::deque< MaterialBase * > > &primary_ip_sub_to_mats, std::deque< MaterialBase * > &secondary_boundary_mats)
This function creates containers of materials necessary to execute the mortar method for a supplied s...