www.mooseframework.org
XFEMPressure.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 #include "XFEMPressure.h"
8 #include "Function.h"
9 #include "GeometricSearchData.h"
10 #include "ElementPairLocator.h"
11 #include "FEProblem.h"
12 
13 template <>
14 InputParameters
16 {
17  InputParameters params = validParams<DiracKernel>();
18  params.addRequiredParam<unsigned int>("component", "The component for the pressure");
19  params.addParam<Real>("factor", 1.0, "The magnitude to use in computing the pressure");
20  params.addParam<FunctionName>("function", "The function that describes the pressure");
21  return params;
22 }
23 
24 XFEMPressure::XFEMPressure(const InputParameters & parameters)
25  : DiracKernel(parameters),
26  _component(getParam<unsigned int>("component")),
27  _factor(getParam<Real>("factor")),
28  _function(isParamValid("function") ? &getFunction("function") : NULL)
29 {
30  GeometricSearchData & geo_search_data = _subproblem.geomSearchData();
31  _element_pair_locators = &geo_search_data._element_pair_locators;
32 }
33 
34 void
36 {
37  _elem_qp_normal.clear();
38  _elem_qp_JxW.clear();
39 
40  for (std::map<unsigned int, MooseSharedPointer<ElementPairLocator>>::iterator it_epl =
41  _element_pair_locators->begin();
42  it_epl != _element_pair_locators->end();
43  ++it_epl)
44  {
45  ElementPairLocator & elem_pair_loc = *it_epl->second;
46  // go over pair elements
47  const std::list<std::pair<const Elem *, const Elem *>> & elem_pairs =
48  elem_pair_loc.getElemPairs();
49  for (std::list<std::pair<const Elem *, const Elem *>>::const_iterator it_ep =
50  elem_pairs.begin();
51  it_ep != elem_pairs.end();
52  ++it_ep)
53  {
54  const Elem * elem1 = it_ep->first;
55  const Elem * elem2 = it_ep->second;
56  const ElementPairInfo & info = elem_pair_loc.getElemPairInfo(*it_ep);
57 
58  for (unsigned int i = 0; i < info._elem1_constraint_q_point.size(); ++i)
59  {
60  _elem_qp_normal[elem1][i] = -info._elem1_normal;
61  _elem_qp_normal[elem2][i] = -info._elem2_normal;
62  _elem_qp_JxW[elem1][i] = info._elem1_constraint_JxW[i];
63  _elem_qp_JxW[elem2][i] = info._elem2_constraint_JxW[i];
64  addPoint(elem1, info._elem1_constraint_q_point[i]);
65  addPoint(elem2, info._elem2_constraint_q_point[i]);
66  }
67  }
68  }
69 }
70 
71 Real
73 {
74  Real factor = _factor;
75 
76  if (_function)
77  factor *= _function->value(_t, _current_point);
78 
79  Point normal = _elem_qp_normal[_current_elem][_qp];
80  Real JxW = _elem_qp_JxW[_current_elem][_qp];
81 
82  return -factor * JxW * (normal(_component) * _test[_i][_qp]);
83 }
std::map< const Elem *, std::map< unsigned int, Point > > _elem_qp_normal
Definition: XFEMPressure.h:29
const int _component
Definition: XFEMPressure.h:24
std::map< const Elem *, std::map< unsigned int, Real > > _elem_qp_JxW
Definition: XFEMPressure.h:30
XFEMPressure(const InputParameters &parameters)
Definition: XFEMPressure.C:24
std::map< unsigned int, MooseSharedPointer< ElementPairLocator > > * _element_pair_locators
Definition: XFEMPressure.h:28
InputParameters validParams< XFEMPressure >()
Definition: XFEMPressure.C:15
const Real _factor
Definition: XFEMPressure.h:25
virtual void addPoints()
Definition: XFEMPressure.C:35
Function *const _function
Definition: XFEMPressure.h:26
virtual Real computeQpResidual()
Definition: XFEMPressure.C:72