Go to the documentation of this file.
21 #include "libmesh/string_to_enum.h"
22 #include "libmesh/sparse_matrix.h"
33 params.
addClassDescription(
"This is a constraint enforcing overlapping portions of two blocks to "
34 "have the same variable value");
35 params.
set<
bool>(
"use_displaced_mesh") =
false;
36 MooseEnum formulation(
"kinematic penalty",
"kinematic");
38 "formulation", formulation,
"Formulation used to enforce the constraint");
41 "Penalty parameter used in constraint enforcement for kinematic and penalty formulations.");
48 _displaced_problem(parameters.get<
FEProblemBase *>(
"_fe_problem_base")->getDisplacedProblem()),
49 _fe_problem(*parameters.get<
FEProblem *>(
"_fe_problem")),
51 _penalty(getParam<Real>(
"penalty")),
52 _residual_copy(_sys.residualGhosted())
63 pointLocator->enable_out_of_mesh_mode();
64 const std::set<subdomain_id_type> allowed_subdomains{
_master};
70 std::set<dof_id_type> unique_slave_node_ids;
72 for (
const auto & elem : as_range(meshhelper.active_subdomain_elements_begin(
_slave),
73 meshhelper.active_subdomain_elements_end(
_slave)))
75 for (
auto & sn : elem->node_ref_range())
81 const Elem * me = pointLocator->operator()(sn, &allowed_subdomains);
120 dof_id_type dof_number = node->dof_number(sys_num,
_var.
number(), 0);
173 Real curr_jac, slave_jac;
236 Real curr_jac, slave_jac;
278 DenseMatrix<Number> & Knn =
288 DenseMatrix<Number> & Ken =
290 if (Ken.m() && Ken.n())
301 if (Knn.m() && Knn.n())
314 DenseMatrix<Number> & Knn =
322 DenseMatrix<Number> & Ken =
virtual Elem * elemPtr(const dof_id_type i)
virtual Real computeQpOffDiagJacobian(Moose::ConstraintJacobianType type, unsigned int jvar) override
This is the virtual that derived classes should override for computing the off-diag Jacobian.
MooseVariableFEBase & getVariable(THREAD_ID tid, const std::string &var_name)
Gets a reference to a variable of with specified name.
DenseMatrix< Number > _Kee
stiffness matrix holding slave-slave jacobian
const Node *const & _current_node
current node being processed
DenseMatrix< Number > & jacobianBlockNeighbor(Moose::DGJacobianType type, unsigned int ivar, unsigned int jvar, TagID tag=0)
Get local Jacobian block of a DG Jacobian type for a pair of variables and a tag.
Specialization of SubProblem for solving nonlinear equations plus auxiliary equations.
virtual void reinitNeighborPhys(const Elem *neighbor, unsigned int neighbor_side, const std::vector< Point > &physical_points, THREAD_ID tid) override
void mooseError(Args &&... args) const
const VariableValue & _u_master
Holds the current solution at the current quadrature point.
virtual void addGhostedElem(dof_id_type elem_id)=0
Will make sure that all dofs connected to elem_id are ghosted to this processor.
static InputParameters validParams()
std::vector< dof_id_type > _connected_dof_indices
dofs connected to the slave node
virtual void computeJacobian() override
Computes the jacobian for the current element.
const std::string & type() const
Get the type of this object.
bool shouldApply() override
Whether or not this constraint should be applied.
registerMooseObject("MooseApp", EqualValueEmbeddedConstraint)
This is a "smart" enum class intended to replace many of the shortcomings in the C++ enum type It sho...
const VariableTestValue & _test_master
Side test function.
A NodeElemConstraint is used when you need to create constraints between a slave node and a master el...
void reinitConstraint()
Prepare the residual contribution of the current constraint required to enforce it based on the speci...
defineLegacyParams(EqualValueEmbeddedConstraint)
Real _constraint_residual
constraint force needed to enforce the constraint
std::map< dof_id_type, dof_id_type > _slave_to_master_map
maps slave node ids to master element ids
static MooseEnum getNonlinearVariableOrders()
Get the possible variable orders.
virtual void prepareSlaveToMasterMap() override
prepare the _slave_to_master_map
virtual void computeOffDiagJacobian(unsigned int jvar) override
Computes d-residual / d-jvar...
A EqualValueEmbeddedConstraint forces the value of a variable to be the same on overlapping portion o...
bool _overwrite_slave_residual
Whether or not the slave's residual should be overwritten.
virtual void setNeighborSubdomainID(const Elem *elem, unsigned int side, THREAD_ID tid) override
unsigned short _slave
slave block id
MooseVariable & _master_var
Master side variable.
virtual void getConnectedDofIndices(unsigned int var_num)
Gets the indices for all dofs connected to the constraint.
SubProblem & _subproblem
SubProblem that contains tag info.
virtual const dof_id_type & nodalDofIndex() const =0
const VariableValue & _u_slave
Value of the unknown variable on the slave node.
MeshBase & getMesh()
Accessor for the underlying libMesh Mesh object.
static InputParameters validParams()
EqualValueEmbeddedConstraint(const InputParameters ¶meters)
virtual unsigned int number() const
Gets the number of this system.
virtual std::unique_ptr< PointLocatorBase > getPointLocator() const
Proxy function to get a (sub)PointLocator from either the underlying libMesh mesh (default),...
const Real _penalty
Penalty parameter used in constraint enforcement for kinematic and penalty formulations.
Formulation
Formulations, currently only supports KINEMATIC and PENALTY.
virtual void getConnectedDofIndices(unsigned int var_num) override
Gets the indices for all dofs connected to the constraint.
NumericVector< Number > & _residual_copy
copy of the residual before the constraint is applied
virtual Real computeQpResidual(Moose::ConstraintType type) override
This is the virtual that derived classes should override for computing the residual.
const VariablePhiValue & _phi_master
Side shape function.
virtual Real computeQpJacobian(Moose::ConstraintJacobianType type) override
This is the virtual that derived classes should override for computing the Jacobian.
virtual Real computeQpSlaveValue() override
Compute the value the slave node should have at the beginning of a timestep.
VariableTestValue _test_slave
Shape function on the slave side. This will always only have one entry and that entry will always be ...
enum EqualValueEmbeddedConstraint::Formulation _formulation
DenseMatrix< Number > _Kne
stiffness matrix holding master-slave jacobian
void resize(unsigned int size)
Change the number of elements the array can store.
unsigned short _master
master block id
unsigned int size() const
The number of elements that can currently be stored in the array.
Specialization of SubProblem for solving nonlinear equations plus auxiliary equations.
VariablePhiValue _phi_slave
Shape function on the slave side.
unsigned int number() const
Get variable number coming from libMesh.