https://mooseframework.inl.gov
XFEMEqualValueAtInterface.C
Go to the documentation of this file.
1 //* This file is part of the MOOSE framework
2 //* https://mooseframework.inl.gov
3 //*
4 //* All rights reserved, see COPYRIGHT for full restrictions
5 //* https://github.com/idaholab/moose/blob/master/COPYRIGHT
6 //*
7 //* Licensed under LGPL 2.1, please see LICENSE for details
8 //* https://www.gnu.org/licenses/lgpl-2.1.html
9 
11 #include "FEProblem.h"
12 #include "GeometricCutUserObject.h"
13 #include "XFEM.h"
14 
16 
19 {
21  params.addRequiredParam<Real>("alpha", "Penalty parameter in penalty formulation.");
22  params.addRequiredParam<Real>("value", "Prescribed value at the interface.");
23  params.addParam<UserObjectName>(
24  "geometric_cut_userobject",
25  "Name of GeometricCutUserObject associated with this constraint.");
26  params.addClassDescription("Enforce that the solution have the same value on opposing sides of "
27  "an XFEM interface.");
28  return params;
29 }
30 
32  : ElemElemConstraint(parameters), _alpha(getParam<Real>("alpha")), _value(getParam<Real>("value"))
33 {
34  _xfem = std::dynamic_pointer_cast<XFEM>(_fe_problem.getXFEM());
35  if (_xfem == nullptr)
36  mooseError("Problem casting to XFEM in XFEMEqualValueAtInterface");
37 
38  const UserObject * uo =
39  &(_fe_problem.getUserObjectBase(getParam<UserObjectName>("geometric_cut_userobject")));
40 
41  if (dynamic_cast<const GeometricCutUserObject *>(uo) == nullptr)
42  mooseError("UserObject casting to GeometricCutUserObject in XFEMEqualValueAtInterface");
43 
44  _interface_id = _xfem->getGeometricCutID(dynamic_cast<const GeometricCutUserObject *>(uo));
45 }
46 
48 
49 void
51 {
53 }
54 
55 Real
57 {
58  Real r = 0;
59 
60  switch (type)
61  {
62  case Moose::Element:
63  r += _alpha * (_u[_qp] - _value) * _test[_i][_qp];
64  break;
65 
66  case Moose::Neighbor:
68  break;
69  }
70  return r;
71 }
72 
73 Real
75 {
76  Real r = 0;
77 
78  switch (type)
79  {
81  r += _alpha * _phi[_j][_qp] * _test[_i][_qp];
82  break;
83 
86  break;
87 
88  default:
89  break;
90  }
91 
92  return r;
93 }
FEProblemBase & _fe_problem
void addParam(const std::string &name, const std::initializer_list< typename T::value_type > &value, const std::string &doc_string)
unsigned int _interface_id
virtual Real computeQpResidual(Moose::DGResidualType type) override
const VariableValue & _u_neighbor
Real _value
Value at the interface.
DGResidualType
This is the XFEM class.
Definition: XFEM.h:107
ElementElement
void addRequiredParam(const std::string &name, const std::string &doc_string)
XFEMEqualValueAtInterface(const InputParameters &parameters)
const VariableTestValue & _test_neighbor
static InputParameters validParams()
virtual void reinitConstraintQuadrature(const ElementPairInfo &element_pair_info)
const VariableTestValue & _test
const std::string & type() const
const VariablePhiValue & _phi_neighbor
registerMooseObject("XFEMApp", XFEMEqualValueAtInterface)
DGJacobianType
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
const VariableValue & _u
std::shared_ptr< XFEMInterface > getXFEM()
virtual Real computeQpJacobian(Moose::DGJacobianType type) override
std::shared_ptr< XFEM > _xfem
Pointer to the XFEM controller object.
static InputParameters validParams()
void mooseError(Args &&... args) const
void addClassDescription(const std::string &doc_string)
const VariablePhiValue & _phi
const UserObject & getUserObjectBase(const std::string &name, const THREAD_ID tid=0) const
virtual void reinitConstraintQuadrature(const ElementPairInfo &element_pair_info) override
unsigned int _j
unsigned int _qp
NeighborNeighbor
unsigned int _i