21 #include "libmesh/string_to_enum.h" 22 #include "libmesh/sparse_matrix.h" 31 params.
addClassDescription(
"This is a constraint enforcing overlapping portions of two blocks to " 32 "have the same variable value");
33 params.
set<
bool>(
"use_displaced_mesh") =
false;
34 MooseEnum formulation(
"kinematic penalty",
"kinematic");
36 "formulation", formulation,
"Formulation used to enforce the constraint");
39 "Penalty parameter used in constraint enforcement for kinematic and penalty formulations.");
46 _displaced_problem(parameters.
get<
FEProblemBase *>(
"_fe_problem_base")->getDisplacedProblem()),
47 _fe_problem(*parameters.
get<
FEProblem *>(
"_fe_problem")),
49 _penalty(getParam<
Real>(
"penalty")),
50 _residual_copy(_sys.residualGhosted())
61 pointLocator->enable_out_of_mesh_mode();
62 const std::set<subdomain_id_type> allowed_subdomains{
_primary};
68 std::set<dof_id_type> unique_secondary_node_ids;
70 for (
const auto & elem :
as_range(meshhelper.active_subdomain_elements_begin(
_secondary),
71 meshhelper.active_subdomain_elements_end(
_secondary)))
73 for (
auto & sn : elem->node_ref_range())
79 const Elem * me = pointLocator->operator()(sn, &allowed_subdomains);
171 Real curr_jac, secondary_jac;
234 Real curr_jac, secondary_jac;
MooseMesh & _mesh
Reference to this Kernel's mesh object.
unsigned short _secondary
secondary block id
static InputParameters validParams()
bool shouldApply() override
Whether or not this constraint should be applied.
const VariableTestValue & _test_primary
Side test function.
virtual Elem * elemPtr(const dof_id_type i)
bool _overwrite_secondary_residual
Whether or not the secondary's residual should be overwritten.
Specialization of SubProblem for solving nonlinear equations plus auxiliary equations.
unsigned int number() const
Get variable number coming from libMesh.
unsigned short _primary
primary block id
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...
T * get(const std::unique_ptr< T > &u)
The MooseUtils::get() specializations are used to support making forwards-compatible code changes fro...
Real _constraint_residual
constraint force needed to enforce the constraint
void reinitConstraint()
Prepare the residual contribution of the current constraint required to enforce it based on the speci...
NumericVector< Number > & _residual_copy
copy of the residual before the constraint is applied
const VariableValue & _u_secondary
Value of the unknown variable on the secondary node.
Formulation
Formulations, currently only supports KINEMATIC and PENALTY.
Specialization of SubProblem for solving nonlinear equations plus auxiliary equations.
SystemBase & _sys
Reference to the EquationSystem object.
static MooseEnum getNonlinearVariableOrders()
Get the possible variable orders.
registerMooseObject("MooseApp", EqualValueEmbeddedConstraint)
const Real _penalty
Penalty parameter used in constraint enforcement for kinematic and penalty formulations.
MeshBase & getMesh()
Accessor for the underlying libMesh Mesh object.
const VariableValue & _u_primary
Holds the current solution at the current quadrature point.
virtual void reinitNeighborPhys(const Elem *neighbor, unsigned int neighbor_side, const std::vector< Point > &physical_points, const THREAD_ID tid) override
std::map< dof_id_type, dof_id_type > _secondary_to_primary_map
maps secondary node ids to primary element ids
SubProblem & _subproblem
Reference to this kernel's SubProblem.
SimpleRange< IndexType > as_range(const std::pair< IndexType, IndexType > &p)
enum EqualValueEmbeddedConstraint::Formulation _formulation
const std::string & type() const
Get the type of this class.
This is a "smart" enum class intended to replace many of the shortcomings in the C++ enum type It sho...
unsigned int number() const
Gets the number of this system.
EqualValueEmbeddedConstraint(const InputParameters ¶meters)
virtual Real computeQpResidual(Moose::ConstraintType type) override
This is the virtual that derived classes should override for computing the residual.
const VariablePhiValue & _phi_primary
Side shape function.
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
const Node *const & _current_node
current node being processed
virtual void addGhostedElem(dof_id_type elem_id)=0
Will make sure that all dofs connected to elem_id are ghosted to this processor.
std::vector< dof_id_type > _connected_dof_indices
dofs connected to the secondary node
void mooseError(Args &&... args) const
Emits an error prefixed with object name and type.
virtual Real computeQpJacobian(Moose::ConstraintJacobianType type) override
This is the virtual that derived classes should override for computing the Jacobian.
A EqualValueEmbeddedConstraint forces the value of a variable to be the same on overlapping portion o...
virtual void prepareSecondaryToPrimaryMap() override
prepare the _secondary_to_primary_map
A NodeElemConstraint is used when you need to create constraints between a secondary node and a prima...
static InputParameters validParams()
VariableTestValue _test_secondary
Shape function on the secondary side. This will always only have one entry and that entry will always...
virtual std::unique_ptr< PointLocatorBase > getPointLocator() const
Proxy function to get a (sub)PointLocator from either the underlying libMesh mesh (default)...
VariablePhiValue _phi_secondary
Shape function on the secondary side.
virtual Real computeQpSecondaryValue() override
Compute the value the secondary node should have at the beginning of a timestep.
virtual void setNeighborSubdomainID(const Elem *elem, unsigned int side, const THREAD_ID tid) override