https://mooseframework.inl.gov
Loading...
Searching...
No Matches
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"
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
49void
54
55Real
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
73Real
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}
registerMooseObject("XFEMApp", XFEMEqualValueAtInterface)
unsigned int _qp
const VariableTestValue & _test_neighbor
const VariablePhiValue & _phi_neighbor
FEProblemBase & _fe_problem
const VariablePhiValue & _phi
virtual void reinitConstraintQuadrature(const ElementPairInfo &element_pair_info)
unsigned int _j
const VariableValue & _u
unsigned int _i
const VariableValue & _u_neighbor
const VariableTestValue & _test
static InputParameters validParams()
unsigned int _interface_id
std::shared_ptr< XFEMInterface > getXFEM()
const UserObject & getUserObjectBase(const std::string &name, const THREAD_ID tid=0) const
void addRequiredParam(const std::string &name, const std::string &doc_string)
void addParam(const std::string &name, const std::initializer_list< typename T::value_type > &value, const std::string &doc_string)
void addClassDescription(const std::string &doc_string)
const std::string & type() const
void mooseError(Args &&... args) const
std::shared_ptr< XFEM > _xfem
Pointer to the XFEM controller object.
XFEMEqualValueAtInterface(const InputParameters &parameters)
virtual Real computeQpResidual(Moose::DGResidualType type) override
Real _value
Value at the interface.
virtual Real computeQpJacobian(Moose::DGJacobianType type) override
static InputParameters validParams()
virtual void reinitConstraintQuadrature(const ElementPairInfo &element_pair_info) override
DGResidualType
DGJacobianType
NeighborNeighbor
ElementElement