www.mooseframework.org
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
PointValueAtXFEMInterface Class Reference

#include <PointValueAtXFEMInterface.h>

Inheritance diagram for PointValueAtXFEMInterface:
[legend]

Public Member Functions

 PointValueAtXFEMInterface (const InputParameters &parameters)
 
virtual ~PointValueAtXFEMInterface ()
 
virtual void initialize () override
 
virtual void execute () override
 
virtual void finalize () override
 
std::map< unsigned int, Real > getValueAtPositiveLevelSet () const
 get the map that stores the point index and its values at the positive level set side More...
 
std::map< unsigned int, Real > getValueAtNegativeLevelSet () const
 get the map that stores the point index and its values at the negative level set side More...
 
std::map< unsigned int, RealVectorValue > getGradientAtPositiveLevelSet () const
 get the map that stores the point index and its gradient at the positive level set side More...
 
std::map< unsigned int, RealVectorValue > getGradientAtNegativeLevelSet () const
 get the map that stores the point index and its graident at the negative level set side More...
 
unsigned int numberPoints () const
 

Protected Member Functions

const Elem * getElemContainingPoint (const Point &p, bool positive_level_set)
 Find the element in the element pairs that contains the point in its physical domain. More...
 

Protected Attributes

MooseMesh & _mesh
 The Mesh we're using. More...
 
std::vector< Point > _points
 The points to evaluate at. More...
 
std::unique_ptr< PointLocatorBase > _pl
 Pointer to PointLocatorBase object. More...
 
std::shared_ptr< XFEM_xfem
 Pointer to the XFEM controller object. More...
 
const ElementPairLocator::ElementPairList * _elem_pairs
 Pointer to ElementPairList object. More...
 
const LineSegmentCutSetUserObject_geo_cut
 Pointer to LineSegmentCutSetUserObject object. More...
 
MooseVariableFEBase * _var
 Pointer to MooseVariableFEBase object. More...
 
const unsigned int _level_set_var_number
 The variable number of the level set variable we are operating on. More...
 
const System & _system
 System reference. More...
 
const NumericVector< Number > * _solution
 The subproblem solution vector. More...
 
std::map< unsigned int, Real > _values_positive_level_set_side
 Mapping from point index and its values at the positive level set side. More...
 
std::map< unsigned int, Real > _values_negative_level_set_side
 Mapping from point index and its values at the negative level set side. More...
 
std::map< unsigned int, RealVectorValue > _grad_values_positive_level_set_side
 Mapping from point index and its gradient at the positive level set side. More...
 
std::map< unsigned int, RealVectorValue > _grad_values_negative_level_set_side
 Mapping from point index and its gradient at the negative level set side. More...
 

Detailed Description

Definition at line 27 of file PointValueAtXFEMInterface.h.

Constructor & Destructor Documentation

◆ PointValueAtXFEMInterface()

PointValueAtXFEMInterface::PointValueAtXFEMInterface ( const InputParameters &  parameters)

Definition at line 38 of file PointValueAtXFEMInterface.C.

39  : GeneralUserObject(parameters),
40  _mesh(_subproblem.mesh()),
41  _var(&_subproblem.getVariable(_tid, parameters.get<VariableName>("variable"))),
43  _subproblem.getVariable(_tid, parameters.get<VariableName>("level_set_var")).number()),
44  _system(_subproblem.getSystem(getParam<VariableName>("level_set_var"))),
45  _solution(_system.current_local_solution.get())
46 {
47 }
const NumericVector< Number > * _solution
The subproblem solution vector.
const System & _system
System reference.
MooseVariableFEBase * _var
Pointer to MooseVariableFEBase object.
const unsigned int _level_set_var_number
The variable number of the level set variable we are operating on.
MooseMesh & _mesh
The Mesh we&#39;re using.

◆ ~PointValueAtXFEMInterface()

virtual PointValueAtXFEMInterface::~PointValueAtXFEMInterface ( )
inlinevirtual

Definition at line 32 of file PointValueAtXFEMInterface.h.

32 {}

Member Function Documentation

◆ execute()

void PointValueAtXFEMInterface::execute ( )
overridevirtual

Definition at line 70 of file PointValueAtXFEMInterface.C.

71 {
76  _points.clear();
77 
78  std::vector<Real> cut_data = _geo_cut->getCutData();
79 
80  const int line_cut_data_len = 6;
81  for (unsigned int i = 0; i < cut_data.size() / line_cut_data_len; ++i)
82  {
83  _points.push_back(
84  Point(cut_data[i * line_cut_data_len + 0], cut_data[i * line_cut_data_len + 1]));
85  if (i == cut_data.size() / line_cut_data_len - 1)
86  _points.push_back(
87  Point(cut_data[i * line_cut_data_len + 2], cut_data[i * line_cut_data_len + 3]));
88  }
89 
90  BoundingBox bbox = _mesh.getInflatedProcessorBoundingBox();
91 
92  std::vector<Point> point_vec(1);
93 
94  for (auto i = beginIndex(_points); i < _points.size(); ++i)
95  {
96  Point p = _points[i];
97 
98  if (bbox.contains_point(p))
99  {
100  const Elem * elem = getElemContainingPoint(p, true);
101 
102  if (elem != nullptr)
103  {
104  point_vec[0] = p;
105 
106  _subproblem.setCurrentSubdomainID(elem, 0);
107  _subproblem.reinitElemPhys(elem, point_vec, 0);
108 
109  _values_positive_level_set_side[i] = (dynamic_cast<MooseVariable *>(_var))->sln()[0];
111  ((dynamic_cast<MooseVariable *>(_var))->gradSln())[0];
112  }
113 
114  const Elem * elem2 = getElemContainingPoint(p, false);
115  if (elem2 != nullptr)
116  {
117  point_vec[0] = p;
118 
119  _subproblem.setCurrentSubdomainID(elem2, 0);
120  _subproblem.reinitElemPhys(elem2, point_vec, 0);
121 
122  _values_negative_level_set_side[i] = (dynamic_cast<MooseVariable *>(_var))->sln()[0];
124  ((dynamic_cast<MooseVariable *>(_var))->gradSln())[0];
125  }
126  }
127  }
128 }
std::map< unsigned int, RealVectorValue > _grad_values_positive_level_set_side
Mapping from point index and its gradient at the positive level set side.
std::map< unsigned int, Real > _values_negative_level_set_side
Mapping from point index and its values at the negative level set side.
std::vector< Point > _points
The points to evaluate at.
const Elem * getElemContainingPoint(const Point &p, bool positive_level_set)
Find the element in the element pairs that contains the point in its physical domain.
MooseVariableFEBase * _var
Pointer to MooseVariableFEBase object.
virtual std::vector< Real > getCutData() const
Get the cut location information.
const LineSegmentCutSetUserObject * _geo_cut
Pointer to LineSegmentCutSetUserObject object.
MooseMesh & _mesh
The Mesh we&#39;re using.
std::map< unsigned int, RealVectorValue > _grad_values_negative_level_set_side
Mapping from point index and its gradient at the negative level set side.
std::map< unsigned int, Real > _values_positive_level_set_side
Mapping from point index and its values at the positive level set side.

◆ finalize()

void PointValueAtXFEMInterface::finalize ( )
overridevirtual

Definition at line 131 of file PointValueAtXFEMInterface.C.

132 {
133  _communicator.set_union(_values_positive_level_set_side);
134  _communicator.set_union(_grad_values_positive_level_set_side);
135  _communicator.set_union(_values_negative_level_set_side);
136  _communicator.set_union(_grad_values_negative_level_set_side);
137 }
std::map< unsigned int, RealVectorValue > _grad_values_positive_level_set_side
Mapping from point index and its gradient at the positive level set side.
std::map< unsigned int, Real > _values_negative_level_set_side
Mapping from point index and its values at the negative level set side.
std::map< unsigned int, RealVectorValue > _grad_values_negative_level_set_side
Mapping from point index and its gradient at the negative level set side.
std::map< unsigned int, Real > _values_positive_level_set_side
Mapping from point index and its values at the positive level set side.

◆ getElemContainingPoint()

const Elem * PointValueAtXFEMInterface::getElemContainingPoint ( const Point &  p,
bool  positive_level_set 
)
protected

Find the element in the element pairs that contains the point in its physical domain.

Parameters
pThe point in physical space
positive_level_setTrue if the physical domain is in positive level set region
Returns
The Elem containing the point or NULL if this processor doesn't contain an element that contains this point.

Definition at line 140 of file PointValueAtXFEMInterface.C.

Referenced by execute().

141 {
142  const Elem * elem1 = (*_pl)(p);
143 
144  if (elem1->processor_id() != processor_id())
145  return nullptr;
146 
147  const Node * node = elem1->node_ptr(0);
148 
149  dof_id_type ls_dof_id = node->dof_number(_system.number(), _level_set_var_number, 0);
150 
151  Number ls_node_value = (*_solution)(ls_dof_id);
152 
153  bool positive = false;
154 
155  if (_xfem->isPointInsidePhysicalDomain(elem1, *node))
156  {
157  if (ls_node_value > 0.0)
158  positive = true;
159  }
160  else
161  {
162  if (ls_node_value < 0.0)
163  positive = true;
164  }
165 
166  const Elem * elem2 = nullptr;
167  bool found = false;
168  for (auto & pair : *_elem_pairs)
169  {
170  if (pair.first == elem1)
171  {
172  elem2 = pair.second;
173  found = true;
174  }
175  else if (pair.second == elem1)
176  {
177  elem2 = pair.first;
178  found = true;
179  }
180  }
181 
182  if (!found)
183  mooseError(
184  "PointValueAtXFEMInterface: The interface points are not found by element pair locator.");
185 
186  if ((positive && positive_level_set) || (!positive && !positive_level_set))
187  return elem1;
188  else if ((!positive && positive_level_set) || (positive && !positive_level_set))
189  return elem2;
190  else
191  return nullptr;
192 }
const ElementPairLocator::ElementPairList * _elem_pairs
Pointer to ElementPairList object.
const System & _system
System reference.
std::shared_ptr< XFEM > _xfem
Pointer to the XFEM controller object.
const unsigned int _level_set_var_number
The variable number of the level set variable we are operating on.

◆ getGradientAtNegativeLevelSet()

std::map<unsigned int, RealVectorValue> PointValueAtXFEMInterface::getGradientAtNegativeLevelSet ( ) const
inline

get the map that stores the point index and its graident at the negative level set side

Definition at line 65 of file PointValueAtXFEMInterface.h.

Referenced by XFEMPhaseTransitionMovingInterfaceVelocity::computeMovingInterfaceVelocity().

66  {
68  };
std::map< unsigned int, RealVectorValue > _grad_values_negative_level_set_side
Mapping from point index and its gradient at the negative level set side.

◆ getGradientAtPositiveLevelSet()

std::map<unsigned int, RealVectorValue> PointValueAtXFEMInterface::getGradientAtPositiveLevelSet ( ) const
inline

get the map that stores the point index and its gradient at the positive level set side

Definition at line 57 of file PointValueAtXFEMInterface.h.

Referenced by XFEMPhaseTransitionMovingInterfaceVelocity::computeMovingInterfaceVelocity().

58  {
60  };
std::map< unsigned int, RealVectorValue > _grad_values_positive_level_set_side
Mapping from point index and its gradient at the positive level set side.

◆ getValueAtNegativeLevelSet()

std::map<unsigned int, Real> PointValueAtXFEMInterface::getValueAtNegativeLevelSet ( ) const
inline

get the map that stores the point index and its values at the negative level set side

Definition at line 49 of file PointValueAtXFEMInterface.h.

Referenced by XFEMPhaseTransitionMovingInterfaceVelocity::computeMovingInterfaceVelocity().

50  {
52  };
std::map< unsigned int, Real > _values_negative_level_set_side
Mapping from point index and its values at the negative level set side.

◆ getValueAtPositiveLevelSet()

std::map<unsigned int, Real> PointValueAtXFEMInterface::getValueAtPositiveLevelSet ( ) const
inline

get the map that stores the point index and its values at the positive level set side

Definition at line 41 of file PointValueAtXFEMInterface.h.

Referenced by XFEMPhaseTransitionMovingInterfaceVelocity::computeMovingInterfaceVelocity().

42  {
44  };
std::map< unsigned int, Real > _values_positive_level_set_side
Mapping from point index and its values at the positive level set side.

◆ initialize()

void PointValueAtXFEMInterface::initialize ( )
overridevirtual

Definition at line 50 of file PointValueAtXFEMInterface.C.

51 {
52  _pl = _mesh.getPointLocator();
53 
54  const UserObject * uo =
55  &(_fe_problem.getUserObjectBase(getParam<UserObjectName>("geometric_cut_userobject")));
56 
57  if (dynamic_cast<const LineSegmentCutSetUserObject *>(uo) == nullptr)
58  mooseError("UserObject casting to GeometricCutUserObject in XFEMSingleVariableConstraint");
59 
60  _geo_cut = dynamic_cast<const LineSegmentCutSetUserObject *>(uo);
61 
62  _xfem = MooseSharedNamespace::dynamic_pointer_cast<XFEM>(_fe_problem.getXFEM());
63  if (_xfem == nullptr)
64  mooseError("Problem casting to XFEM in PointValueAtXFEMInterface");
65 
66  _elem_pairs = _xfem->getXFEMCutElemPairs(_xfem->getGeometricCutID(_geo_cut));
67 }
This is the XFEM class.
Definition: XFEM.h:62
const ElementPairLocator::ElementPairList * _elem_pairs
Pointer to ElementPairList object.
std::unique_ptr< PointLocatorBase > _pl
Pointer to PointLocatorBase object.
std::shared_ptr< XFEM > _xfem
Pointer to the XFEM controller object.
const LineSegmentCutSetUserObject * _geo_cut
Pointer to LineSegmentCutSetUserObject object.
MooseMesh & _mesh
The Mesh we&#39;re using.

◆ numberPoints()

unsigned int PointValueAtXFEMInterface::numberPoints ( ) const
inline

Definition at line 70 of file PointValueAtXFEMInterface.h.

Referenced by XFEMMovingInterfaceVelocityBase::numberPoints().

70 { return _points.size(); };
std::vector< Point > _points
The points to evaluate at.

Member Data Documentation

◆ _elem_pairs

const ElementPairLocator::ElementPairList* PointValueAtXFEMInterface::_elem_pairs
protected

Pointer to ElementPairList object.

Definition at line 95 of file PointValueAtXFEMInterface.h.

Referenced by getElemContainingPoint(), and initialize().

◆ _geo_cut

const LineSegmentCutSetUserObject* PointValueAtXFEMInterface::_geo_cut
protected

Pointer to LineSegmentCutSetUserObject object.

Definition at line 98 of file PointValueAtXFEMInterface.h.

Referenced by execute(), and initialize().

◆ _grad_values_negative_level_set_side

std::map<unsigned int, RealVectorValue> PointValueAtXFEMInterface::_grad_values_negative_level_set_side
protected

Mapping from point index and its gradient at the negative level set side.

Definition at line 122 of file PointValueAtXFEMInterface.h.

Referenced by execute(), finalize(), and getGradientAtNegativeLevelSet().

◆ _grad_values_positive_level_set_side

std::map<unsigned int, RealVectorValue> PointValueAtXFEMInterface::_grad_values_positive_level_set_side
protected

Mapping from point index and its gradient at the positive level set side.

Definition at line 119 of file PointValueAtXFEMInterface.h.

Referenced by execute(), finalize(), and getGradientAtPositiveLevelSet().

◆ _level_set_var_number

const unsigned int PointValueAtXFEMInterface::_level_set_var_number
protected

The variable number of the level set variable we are operating on.

Definition at line 104 of file PointValueAtXFEMInterface.h.

Referenced by getElemContainingPoint().

◆ _mesh

MooseMesh& PointValueAtXFEMInterface::_mesh
protected

The Mesh we're using.

Definition at line 83 of file PointValueAtXFEMInterface.h.

Referenced by execute(), and initialize().

◆ _pl

std::unique_ptr<PointLocatorBase> PointValueAtXFEMInterface::_pl
protected

Pointer to PointLocatorBase object.

Definition at line 89 of file PointValueAtXFEMInterface.h.

Referenced by initialize().

◆ _points

std::vector<Point> PointValueAtXFEMInterface::_points
protected

The points to evaluate at.

Definition at line 86 of file PointValueAtXFEMInterface.h.

Referenced by execute(), and numberPoints().

◆ _solution

const NumericVector<Number>* PointValueAtXFEMInterface::_solution
protected

The subproblem solution vector.

Definition at line 110 of file PointValueAtXFEMInterface.h.

◆ _system

const System& PointValueAtXFEMInterface::_system
protected

System reference.

Definition at line 107 of file PointValueAtXFEMInterface.h.

Referenced by getElemContainingPoint().

◆ _values_negative_level_set_side

std::map<unsigned int, Real> PointValueAtXFEMInterface::_values_negative_level_set_side
protected

Mapping from point index and its values at the negative level set side.

Definition at line 116 of file PointValueAtXFEMInterface.h.

Referenced by execute(), finalize(), and getValueAtNegativeLevelSet().

◆ _values_positive_level_set_side

std::map<unsigned int, Real> PointValueAtXFEMInterface::_values_positive_level_set_side
protected

Mapping from point index and its values at the positive level set side.

Definition at line 113 of file PointValueAtXFEMInterface.h.

Referenced by execute(), finalize(), and getValueAtPositiveLevelSet().

◆ _var

MooseVariableFEBase* PointValueAtXFEMInterface::_var
protected

Pointer to MooseVariableFEBase object.

Definition at line 101 of file PointValueAtXFEMInterface.h.

Referenced by execute().

◆ _xfem

std::shared_ptr<XFEM> PointValueAtXFEMInterface::_xfem
protected

Pointer to the XFEM controller object.

Definition at line 92 of file PointValueAtXFEMInterface.h.

Referenced by getElemContainingPoint(), and initialize().


The documentation for this class was generated from the following files: