https://mooseframework.inl.gov
Loading...
Searching...
No Matches
LMWeightedGapUserObject.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
13
14#include "libmesh/fe_base.h"
15#include "libmesh/quadrature_gauss.h"
16
17#include <memory>
18#include <unordered_map>
19#include <unordered_set>
20#include <vector>
21
22template <typename>
23class MooseVariableFE;
24
30{
31public:
37
39
40 virtual const ADVariableValue & contactPressure() const override;
41 virtual void reinit() override;
42 virtual Real getNormalContactPressure(const Node * const /*node*/) const override;
43
44 virtual void initialize() override;
45 virtual void finalize() override;
46
47 virtual Real nodalScale(const DofObject * const dof) const override
48 {
49 return findValue(_dof_to_nodal_scale, dof, Real(1));
50 }
51 virtual bool usesNodalScaling() const override { return _use_nodal_scaling; }
52
53 virtual Real normalizeCDivisor(const DofObject * const dof,
54 const Real covered_normalization) const override
55 {
56 return _use_nodal_scaling ? findValue(_dof_to_full_normalization, dof, covered_normalization)
57 : covered_normalization;
58 }
59
60protected:
61 virtual const VariableTestValue & test() const override;
62 virtual bool constrainedByOwner() const override { return true; }
63 virtual void computeQpIProperties() override;
64
71
79 const std::vector<Real> & fullNodalIntegrals(const Elem * elem);
80
84 void checkInput(const MooseVariable * const var, const std::string & var_name) const;
85
89 void verifyLagrange(const MooseVariable & var, const std::string & var_name) const;
90
93
96
99
103
107
110 std::unordered_map<const DofObject *, Real> _dof_to_covered_fraction_sum;
111
113 std::unordered_map<const DofObject *, Real> _dof_to_nodal_scale;
114
117 std::unordered_map<dof_id_type, std::vector<Real>> _elem_to_full_nodal_integral;
118
125 std::unordered_map<const DofObject *, Real> _dof_to_full_normalization;
126
129 std::unordered_map<const DofObject *, std::unordered_set<dof_id_type>> _full_normalization_elems;
130
132 std::unique_ptr<libMesh::FEBase> _nodal_scaling_fe;
133 std::unique_ptr<libMesh::QGauss> _nodal_scaling_qrule;
134};
User object for computing weighted gaps and contact pressure for Lagrange multipler based mortar cons...
const std::vector< Real > & fullNodalIntegrals(const Elem *elem)
Full coordinate-weighted integral int_e N_j per local node on the secondary lower-dimensional element...
void initializeNodalScaling()
The node-based scaling steps, kept out of initialize()/finalize()/computeQpIProperties() so that a cl...
std::unordered_map< const DofObject *, std::unordered_set< dof_id_type > > _full_normalization_elems
Elements already folded into _dof_to_full_normalization for a given node, to avoid double counting wh...
std::unordered_map< const DofObject *, Real > _dof_to_full_normalization
Per-node sum, over each distinct adjacent secondary element, of the full-element integral int_e N_j (...
const bool _use_nodal_scaling
Whether to apply the Popp et al.
virtual bool usesNodalScaling() const override
virtual void reinit() override
virtual void initialize() override
virtual Real nodalScale(const DofObject *const dof) const override
Node-based Lagrange-multiplier scaling factor kappa_j of Popp et al.
virtual void finalize() override
std::unordered_map< dof_id_type, std::vector< Real > > _elem_to_full_nodal_integral
Cache of the per-node full integrals int_e N_j (see fullNodalIntegrals()), keyed by element id; clear...
static InputParameters validParams()
const MooseVariable *const _aux_lm_var
The auxiliary Lagrange multiplier variable (used together whith the Petrov-Galerkin approach)
virtual bool constrainedByOwner() const override
virtual const ADVariableValue & contactPressure() const override
std::unique_ptr< libMesh::FEBase > _nodal_scaling_fe
Finite element and quadrature rule used to evaluate fullNodalIntegrals()
const bool _use_petrov_galerkin
Whether to use Petrov-Galerkin approach.
void verifyLagrange(const MooseVariable &var, const std::string &var_name) const
Verify that the provided variables have degrees of freedom at nodes.
std::unordered_map< const DofObject *, Real > _dof_to_covered_fraction_sum
Per-node numerator of kappa_j (Popp 2013 eq.
ADVariableValue _scaled_contact_pressure
Physical contact pressure sum_j Phi_j (zhat_j / kappa_j) at the segment quadrature points when node-b...
void checkInput(const MooseVariable *const var, const std::string &var_name) const
Check user input validity for provided variable.
virtual void computeQpIProperties() override
Computes properties that are functions both of _qp and _i, for example the weighted gap.
std::unique_ptr< libMesh::QGauss > _nodal_scaling_qrule
virtual Real normalizeCDivisor(const DofObject *const dof, const Real covered_normalization) const override
virtual Real getNormalContactPressure(const Node *const) const override
virtual const VariableTestValue & test() const override
const MooseVariableFE< Real > *const _lm_var
The Lagrange multiplier variable representing the contact pressure.
std::unordered_map< const DofObject *, Real > _dof_to_nodal_scale
A map from node to its node-based scaling factor kappa_j (see nodalScale())
static InputParameters newParams()
New parameters that this sub-class introduces.
const InputParameters & parameters() const
Creates dof object to weighted gap map.
V findValue(const std::unordered_map< K, V > &map, const K &key, const V &default_value=0) const
Find a value in a map or return a default if the key doesn't exist.
VariableShapeValue< true > VariableTestValue
VariableValueTempl< true > ADVariableValue