www.mooseframework.org
XFEMSingleVariableConstraint.C
Go to the documentation of this file.
1 /****************************************************************/
2 /* MOOSE - Multiphysics Object Oriented Simulation Environment */
3 /* */
4 /* All contents are licensed under LGPL V2.1 */
5 /* See LICENSE for full restrictions */
6 /****************************************************************/
7 
9 
10 // MOOSE includes
11 #include "Assembly.h"
12 #include "ElementPairInfo.h"
13 #include "FEProblem.h"
14 
15 #include "libmesh/quadrature.h"
16 
17 template <>
18 InputParameters
20 {
21  InputParameters params = validParams<ElemElemConstraint>();
22  params.addParam<Real>("alpha", 100, "Stablization parameter in Nitsche's formulation.");
23  params.addParam<Real>("jump", 0, "Jump at the interface.");
24  params.addParam<Real>("jump_flux", 0, "Flux jump at the interface.");
25  return params;
26 }
27 
29  : ElemElemConstraint(parameters),
30  _alpha(getParam<Real>("alpha")),
31  _jump(getParam<Real>("jump")),
32  _jump_flux(getParam<Real>("jump_flux"))
33 {
34 }
35 
37 
38 void
39 XFEMSingleVariableConstraint::reinitConstraintQuadrature(const ElementPairInfo & element_pair_info)
40 {
41  _interface_normal = element_pair_info._elem1_normal;
42  ElemElemConstraint::reinitConstraintQuadrature(element_pair_info);
43 }
44 
45 Real
47 {
48  Real r = 0;
49 
50  switch (type)
51  {
52  case Moose::Element:
53  r -= (0.5 * _grad_u[_qp] * _interface_normal +
54  0.5 * _grad_u_neighbor[_qp] * _interface_normal) *
55  _test[_i][_qp];
56  r -= (_u[_qp] - _u_neighbor[_qp]) * 0.5 * _grad_test[_i][_qp] * _interface_normal;
57  r +=
58  0.5 * _grad_test[_i][_qp] * _interface_normal * _jump + 0.5 * _test[_i][_qp] * _jump_flux;
59  r += _alpha * (_u[_qp] - _u_neighbor[_qp] - _jump) * _test[_i][_qp];
60  break;
61 
62  case Moose::Neighbor:
63  r += (0.5 * _grad_u[_qp] * _interface_normal +
64  0.5 * _grad_u_neighbor[_qp] * _interface_normal) *
65  _test_neighbor[_i][_qp];
66  r -= (_u[_qp] - _u_neighbor[_qp]) * 0.5 * _grad_test_neighbor[_i][_qp] * _interface_normal;
67  r += 0.5 * _grad_test_neighbor[_i][_qp] * _interface_normal * _jump +
68  0.5 * _test_neighbor[_i][_qp] * _jump_flux;
69  r -= _alpha * (_u[_qp] - _u_neighbor[_qp] - _jump) * _test_neighbor[_i][_qp];
70  break;
71  }
72  return r;
73 }
74 
75 Real
77 {
78  Real r = 0;
79 
80  switch (type)
81  {
82  case Moose::ElementElement:
83  r += -0.5 * _grad_phi[_j][_qp] * _interface_normal * _test[_i][_qp] -
84  _phi[_j][_qp] * 0.5 * _grad_test[_i][_qp] * _interface_normal;
85  r += _alpha * _phi[_j][_qp] * _test[_i][_qp];
86  break;
87 
88  case Moose::ElementNeighbor:
89  r += -0.5 * _grad_phi_neighbor[_j][_qp] * _interface_normal * _test[_i][_qp] +
90  _phi_neighbor[_j][_qp] * 0.5 * _grad_test[_i][_qp] * _interface_normal;
91  r -= _alpha * _phi_neighbor[_j][_qp] * _test[_i][_qp];
92  break;
93 
94  case Moose::NeighborElement:
95  r += 0.5 * _grad_phi[_j][_qp] * _interface_normal * _test_neighbor[_i][_qp] -
96  _phi[_j][_qp] * 0.5 * _grad_test_neighbor[_i][_qp] * _interface_normal;
97  r -= _alpha * _phi[_j][_qp] * _test_neighbor[_i][_qp];
98  break;
99 
100  case Moose::NeighborNeighbor:
101  r += 0.5 * _grad_phi_neighbor[_j][_qp] * _interface_normal * _test_neighbor[_i][_qp] +
102  _phi_neighbor[_j][_qp] * 0.5 * _grad_test_neighbor[_i][_qp] * _interface_normal;
103  r += _alpha * _phi_neighbor[_j][_qp] * _test_neighbor[_i][_qp];
104  break;
105  }
106 
107  return r;
108 }
InputParameters validParams< XFEMSingleVariableConstraint >()
virtual Real computeQpResidual(Moose::DGResidualType type)
Compute the residual for one of the constraint quadrature points.
Real _alpha
Stabilization parameter in Nitsche&#39;s formulation.
XFEMSingleVariableConstraint(const InputParameters &parameters)
virtual void reinitConstraintQuadrature(const ElementPairInfo &element_pair_info)
Set information needed for constraint integration.
virtual Real computeQpJacobian(Moose::DGJacobianType type)
Compute the Jacobian for one of the constraint quadrature points.
Real _jump
Vector normal to the internal interface.
Real _jump_flux
Vector normal to the internal interface.
Point _interface_normal
Vector normal to the internal interface.