23 params.
addCoupledVar(
"scalar_variable",
"Primary coupled scalar variable");
24 params.
addParam<
bool>(
"compute_scalar_residuals",
true,
"Whether to compute scalar residuals");
30 _use_scalar(isParamValid(
"scalar_variable") ? true : false),
31 _compute_scalar_residuals(!_use_scalar ? false : getParam<bool>(
"compute_scalar_residuals")),
32 _kappa_var_ptr(_use_scalar ? getScalarVar(
"scalar_variable", 0) : nullptr),
33 _kappa_var(_use_scalar ? _kappa_var_ptr->number() : 0),
34 _k_order(_use_scalar ? _kappa_var_ptr->order() : 0),
35 _kappa(_use_scalar ? (_is_implicit ? _kappa_var_ptr->sln() : _kappa_var_ptr->slnOld()) : _zero)
47 std::vector<Real> scalar_residuals(
_k_order);
74 for (
const auto & svariable : coupled_scalar_vars)
85 for (
const auto & svariable : coupled_scalar_vars)
97 for (
const auto & svariable : coupled_scalar_vars)
101 const unsigned int svar_num = svariable->number();
137 for (
const auto & it : ce)
142 const unsigned int ivar_num = ivariable.
number();
143 const unsigned int jvar_num = jvariable.
number();
149 std::array<size_t, 3> shape_space_sizes{{jvariable.
dofIndices().size(),
152 std::array<const VariablePhiValue *, 3> phis;
153 std::array<const VariablePhiGradient *, 3> grad_phis;
154 std::array<const VectorVariablePhiValue *, 3> vector_phis;
155 std::array<const VectorVariablePhiGradient *, 3> vector_grad_phis;
159 vector_phis = {{&temp_var.
phiFace(), &temp_var.phiFaceNeighbor(), &temp_var.phiLower()}};
161 {&temp_var.gradPhiFace(), &temp_var.gradPhiFaceNeighbor(), &temp_var.gradPhiLower()}};
166 phis = {{&temp_var.
phiFace(), &temp_var.phiFaceNeighbor(), &temp_var.phiLower()}};
168 {&temp_var.gradPhiFace(), &temp_var.gradPhiFaceNeighbor(), &temp_var.gradPhiLower()}};
172 for (MooseIndex(3) type_index = 0; type_index < 3; ++type_index)
174 const auto mortar_type = mortar_types[type_index];
175 const auto shape_space_size = shape_space_sizes[type_index];
176 std::vector<dof_id_type> dof_indices;
200 _phi = phis[type_index];
212 for (
_j = 0;
_j < shape_space_size;
_j++)
231 unsigned int test_space_size = 0;
232 std::vector<dof_id_type> dof_indices;
233 Real scaling_factor = 1;
249 mooseAssert(
_var,
"LM variable is null");
250 test_space_size =
_test.size();
258 const unsigned int s_order = svar.
order();
266 for (
_h = 0;
_h < s_order;
_h++)
267 for (
_i = 0;
_i < test_space_size;
_i++)
283 const unsigned int s_order = svar.
order();
290 for (
_l = 0;
_l < s_order;
_l++)
void computeScalarOffDiagJacobian()
Method for computing an off-diagonal jacobian component d-_kappa-residual / d-jvar.
MooseVariableField< Real > & _secondary_var
Reference to the secondary variable.
static InputParameters validParams()
const VectorVariablePhiValue * _vector_phi
The current shape functions for vector variables.
virtual void computeJacobian() override
Computes d-_var-residual / d-_var and d-_var-residual / d-jvar, as well as d-_kappa-residual / d-_var...
virtual Real computeScalarQpOffDiagJacobian(const Moose::MortarType, const unsigned int)
Method for computing an off-diagonal jacobian component at quadrature points.
const MooseVariableScalar *const _kappa_var_ptr
(Pointer to) Scalar variable this kernel operates on
const VariableTestValue & _test_secondary
The shape functions corresponding to the secondary interior primal variable.
static InputParameters validParams()
const VariablePhiValue * _phi
The current shape functions.
unsigned int number() const
Get variable number coming from libMesh.
void computeOffDiagJacobianScalar(unsigned int) override final
Computes jacobian block with respect to a scalar variable.
const VariablePhiGradient * _grad_phi
The current shape function gradients.
void addResiduals(Assembly &assembly, const Residuals &residuals, const Indices &dof_indices, Real scaling_factor)
Add the provided incoming residuals corresponding to the provided dof indices.
const std::vector< dof_id_type > & dofIndicesLower() const final
Get dof indices for the current lower dimensional element (this is meaningful when performing mortar ...
const VectorVariablePhiGradient * _vector_grad_phi
The current shape function gradients for vector variables.
virtual void computeResidual() override
Computes _var-residuals as well as _kappa-residual.
const bool _compute_primal_residuals
Whether to compute primal residuals.
const std::vector< Real > & _JxW_msm
The element Jacobian times weights.
This class provides an interface for common operations on field variables of both FE and FV types wit...
const bool _compute_scalar_residuals
Whether to compute scalar contributions for this instance.
THREAD_ID _tid
The thread ID for this kernel.
unsigned int _h
Used internally to iterate over each scalar component.
DenseMatrix< Number > _local_ke
Holds local Jacobian entries as they are accumulated by this Kernel.
void computeScalarOffDiagJacobianScalar(const unsigned int svar_num)
Method for computing an off-diagonal jacobian component d-_kappa-residual / d-scalar.
virtual void computeResidual() override
Method for computing the residual.
const libMesh::QBase *const & _qrule_msm
The quadrature rule on the mortar segment element.
const VariableTestValue & _test
The shape functions corresponding to the lagrange multiplier variable.
SystemBase & _sys
Reference to the EquationSystem object.
void addJacobian(Assembly &assembly, const Residuals &residuals, const Indices &dof_indices, Real scaling_factor)
Add the provided residual derivatives into the Jacobian for the provided dof indices.
virtual bool isVector() const =0
virtual const std::vector< dof_id_type > & dofIndicesNeighbor() const =0
Get neighbor DOF indices for currently selected element.
const std::vector< MooseVariableScalar * > & getCoupledMooseScalarVars()
Get the list of coupled scalar variables.
const bool _use_scalar
Whether a scalar variable is declared for this constraint.
virtual void initScalarQpResidual()
Put necessary evaluations depending on qp but independent of test functions here. ...
const unsigned int _kappa_var
The unknown scalar variable ID.
virtual Real computeScalarQpResidual()
Method for computing the scalar part of residual at quadrature points.
virtual Real computeQpOffDiagJacobianScalar(const Moose::MortarType, unsigned int)
For coupling scalar variables.
virtual const std::vector< dof_id_type > & dofIndices() const
Get local DoF indices.
virtual void initScalarQpOffDiagJacobian(const Moose::MortarType, const unsigned int)
Put necessary evaluations depending on qp but independent of test and shape functions here for off-di...
unsigned int n_points() const
virtual Real computeScalarQpJacobian()
Method for computing the scalar variable part of Jacobian at quadrature points.
Assembly & _assembly
Reference to this Kernel's assembly object.
virtual void initScalarQpJacobian(const unsigned int)
Put necessary evaluations depending on qp but independent of test and shape functions here...
libMesh::Order order() const
Get the order of this variable Note: Order enum can be implicitly converted to unsigned int...
virtual MooseVariableScalar & getScalarVariable(THREAD_ID tid, const std::string &var_name) const
Gets a reference to a scalar variable with specified number.
MooseVariable *const _var
Pointer to the lagrange multipler variable. nullptr if none.
const std::vector< std::pair< MooseVariableScalar *, MooseVariableFieldBase * > > & scalarFieldCouplingEntries() const
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
const unsigned int _k_order
Order of the scalar variable, used in several places.
virtual void computeJacobian() override
Method for computing the Jacobian.
void resize(const unsigned int new_m, const unsigned int new_n)
Class for scalar variables (they are different).
const FieldVariablePhiValue & phiFace() const override final
Return the variable's shape functions on an element face.
virtual const std::vector< dof_id_type > & dofIndicesLower() const =0
Get dof indices for the current lower dimensional element (this is meaningful when performing mortar ...
MortarScalarBase(const InputParameters ¶meters)
const MooseArray< Real > & _coord
Member for handling change of coordinate systems (xyz, rz, spherical)
virtual bool hasScalarVariable(const std::string &var_name) const
virtual Real computeScalarQpOffDiagJacobianScalar(const unsigned int)
Method for computing an off-diagonal jacobian component at quadrature points.
const VariableTestValue & _test_primary
The shape functions corresponding to the primary interior primal variable.
virtual void computeScalarJacobian()
Method for computing the scalar variable part of Jacobian.
void scalingFactor(const std::vector< Real > &factor)
Set the scaling factor for this variable.
const bool _compute_lm_residuals
Whether to compute lagrange multiplier residuals.
MooseVariableField< Real > & _primary_var
Reference to the primary variable.