https://mooseframework.inl.gov
Loading...
Searching...
No Matches
MortarContactPressureProvider.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 "MortarUserObject.h"
12
13#include "libmesh/elem.h"
14
16 const MortarUserObject & provider_object)
17 : _provider_object(provider_object)
18{
19}
20
22MortarContactPressureProvider::qpContactPressure(const Elem & lower_secondary_elem,
23 const unsigned int qp) const
24{
25 const auto & basis = tractionBasis();
26 ADReal pressure = 0;
27 for (const auto j : index_range(basis))
28 pressure += basis[j][qp] * nodalContactPressure(lower_secondary_elem.node_ref(j));
29 return pressure;
30}
31
32void
34 const std::string & param,
35 const SubdomainID primary_subdomain,
36 const SubdomainID secondary_subdomain,
37 const bool use_displaced_mesh) const
38{
39 if (primary_subdomain != _provider_object.primarySubdomain() ||
40 secondary_subdomain != _provider_object.secondarySubdomain())
41 consumer.paramError(param,
42 "The contact pressure provider '",
44 "' must be defined on the same primary/secondary subdomain pair as '",
45 consumer.name(),
46 "'.");
47
48 if (use_displaced_mesh != _provider_object.getParam<bool>("use_displaced_mesh"))
49 consumer.paramError(param,
50 "The contact pressure provider '",
52 "' must use the same 'use_displaced_mesh' setting as '",
53 consumer.name(),
54 "'.");
55}
DualNumber< Real, DNDerivativeType, true > ADReal
subdomain_id_type SubdomainID
const std::string & name() const
Get the name of the class.
Definition MooseBase.h:103
void paramError(const std::string &param, Args... args) const
Emits an error prefixed with the file and line number of the given param (from the input file) along ...
Definition MooseBase.h:466
const T & getParam(const std::string &name) const
Retrieve a parameter for the object.
Definition MooseBase.h:415
Every object that can be built by the factory should be derived from this class.
Definition MooseObject.h:31
SubdomainID primarySubdomain() const
SubdomainID secondarySubdomain() const
const MortarUserObject & _provider_object
The mortar user object that implements this interface.
void checkConsumer(const MooseObject &consumer, const std::string &param, SubdomainID primary_subdomain, SubdomainID secondary_subdomain, bool use_displaced_mesh) const
Report an error unless a consumer lies on the same mortar interface and mesh as this provider.
virtual const VariableTestValue & tractionBasis() const =0
ADReal qpContactPressure(const libMesh::Elem &lower_secondary_elem, unsigned int qp) const
MortarContactPressureProvider(const MortarUserObject &provider_object)
virtual ADReal nodalContactPressure(const libMesh::Node &node) const =0
Base class for creating new nodally-based mortar user objects.