14 #include "ElementPairInfo.h"
15 #include "FEProblem.h"
20 #include "libmesh/quadrature.h"
28 InputParameters params = validParams<ElemElemConstraint>();
29 params.addParam<Real>(
"alpha",
31 "Stabilization parameter in Nitsche's formulation and penalty factor "
32 "in the Penalty Method. In Nitsche's formulation this should be as "
33 "small as possible while the method is still stable; while in the "
34 "Penalty Method you want this to be quite large (e.g. 1e6).");
35 params.addParam<FunctionName>(
"jump", 0,
"Jump at the interface. Can be a Real or FunctionName.");
36 params.addParam<FunctionName>(
37 "jump_flux", 0,
"Flux jump at the interface. Can be a Real or FunctionName.");
38 params.addParam<UserObjectName>(
39 "geometric_cut_userobject",
40 "Name of GeometricCutUserObject associated with this constraint.");
41 params.addParam<
bool>(
44 "Use the Penalty instead of Nitsche (Nitsche only works for simple diffusion problems).");
49 : ElemElemConstraint(parameters),
50 _alpha(getParam<Real>(
"alpha")),
51 _jump(getFunction(
"jump")),
52 _jump_flux(getFunction(
"jump_flux")),
53 _use_penalty(getParam<bool>(
"use_penalty"))
55 _xfem = std::dynamic_pointer_cast<XFEM>(_fe_problem.getXFEM());
57 mooseError(
"Problem casting to XFEM in XFEMSingleVariableConstraint");
59 const UserObject * uo =
60 &(_fe_problem.getUserObjectBase(getParam<UserObjectName>(
"geometric_cut_userobject")));
62 if (dynamic_cast<const GeometricCutUserObject *>(uo) ==
nullptr)
63 mooseError(
"UserObject casting to GeometricCutUserObject in XFEMSingleVariableConstraint");
65 _interface_id =
_xfem->getGeometricCutID(dynamic_cast<const GeometricCutUserObject *>(uo));
74 ElemElemConstraint::reinitConstraintQuadrature(element_pair_info);
90 r -= (_u[_qp] - _u_neighbor[_qp]) * 0.5 * _grad_test[_i][_qp] *
_interface_normal;
93 r += 0.5 * _test[_i][_qp] *
_jump_flux.value(_t, _u[_qp]);
94 r +=
_alpha * (_u[_qp] - _u_neighbor[_qp] -
_jump.value(_t, _u[_qp])) * _test[_i][_qp];
102 _test_neighbor[_i][_qp];
103 r -= (_u[_qp] - _u_neighbor[_qp]) * 0.5 * _grad_test_neighbor[_i][_qp] *
_interface_normal;
105 _jump.value(_t, _u_neighbor[_qp]);
107 r += 0.5 * _test_neighbor[_i][_qp] *
_jump_flux.value(_t, _u_neighbor[_qp]);
108 r -=
_alpha * (_u[_qp] - _u_neighbor[_qp] -
_jump.value(_t, _u_neighbor[_qp])) *
109 _test_neighbor[_i][_qp];
122 case Moose::ElementElement:
126 r +=
_alpha * _phi[_j][_qp] * _test[_i][_qp];
129 case Moose::ElementNeighbor:
133 r -=
_alpha * _phi_neighbor[_j][_qp] * _test[_i][_qp];
136 case Moose::NeighborElement:
140 r -=
_alpha * _phi[_j][_qp] * _test_neighbor[_i][_qp];
143 case Moose::NeighborNeighbor:
145 r += 0.5 * _grad_phi_neighbor[_j][_qp] *
_interface_normal * _test_neighbor[_i][_qp] +
147 r +=
_alpha * _phi_neighbor[_j][_qp] * _test_neighbor[_i][_qp];