Line data Source code
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 : 10 : #pragma once 11 : 12 : #include "GeneralUserObject.h" 13 : #include "ElementPairLocator.h" 14 : #include "MooseVariableFE.h" 15 : 16 : class XFEM; 17 : class InterfaceMeshCutUserObjectBase; 18 : 19 : class NodeValueAtXFEMInterface : public GeneralUserObject 20 : { 21 : public: 22 : static InputParameters validParams(); 23 : 24 : NodeValueAtXFEMInterface(const InputParameters & parameters); 25 : 26 36 : virtual ~NodeValueAtXFEMInterface() {} 27 : 28 : virtual void initialize() override; 29 : virtual void execute() override; 30 : virtual void finalize() override; 31 : 32 : /** 33 : * get the map that stores the point index and its values at the positive level set side 34 : */ 35 : std::map<unsigned int, Real> getValueAtPositiveLevelSet() const 36 : { 37 : return _values_positive_level_set_side; 38 : }; 39 : 40 : /** 41 : * get the map that stores the point index and its values at the negative level set side 42 : */ 43 : std::map<unsigned int, Real> getValueAtNegativeLevelSet() const 44 : { 45 3312 : return _values_negative_level_set_side; 46 : }; 47 : 48 : /** 49 : * get the map that stores the point index and its gradient at the positive level set side 50 : */ 51 : std::map<unsigned int, RealVectorValue> getGradientAtPositiveLevelSet() const 52 : { 53 3312 : return _grad_values_positive_level_set_side; 54 : }; 55 : 56 : /** 57 : * get the map that stores the point index and its graident at the negative level set side 58 : */ 59 : std::map<unsigned int, RealVectorValue> getGradientAtNegativeLevelSet() const 60 : { 61 3312 : return _grad_values_negative_level_set_side; 62 : }; 63 : 64 : unsigned int numberNodes() const { return _nodes.size(); }; 65 : 66 : protected: 67 : /** 68 : * Find the element in the element pairs that contains the point in its physical domain. 69 : * @param p The point in physical space 70 : * @param positive_level_set True if the physical domain is in positive level set region 71 : * @return The Elem containing the point or NULL if this processor doesn't contain an element that 72 : * contains this point. 73 : */ 74 : const Elem * getElemContainingPoint(const Node & p, bool positive_level_set); 75 : 76 : /// The computation mesh 77 : MooseMesh & _mesh; 78 : 79 : /// The nodes to evaluate at 80 : std::vector<Point> _nodes; 81 : 82 : /// Pointer to PointLocatorBase object 83 : std::unique_ptr<libMesh::PointLocatorBase> _pl; 84 : 85 : /// Pointer to the XFEM controller object 86 : std::shared_ptr<XFEM> _xfem; 87 : 88 : /// Pointer to ElementPairList object 89 : const ElementPairLocator::ElementPairList * _elem_pairs; 90 : 91 : /// Pointer to LineSegmentCutSetUserObject object 92 : const InterfaceMeshCutUserObjectBase * _mesh_cut; 93 : 94 : /// Pointer to MooseVariableFEBase object 95 : MooseVariableFEBase * _var; 96 : 97 : /// The variable number of the level set variable we are operating on 98 : const unsigned int _level_set_var_number; 99 : 100 : /// System reference 101 : const libMesh::System & _system; 102 : 103 : /// The subproblem solution vector 104 : const NumericVector<Number> & _solution; 105 : 106 : /// Mapping from point index and its values at the positive level set side 107 : std::map<unsigned int, Real> _values_positive_level_set_side; 108 : 109 : /// Mapping from point index and its values at the negative level set side 110 : std::map<unsigned int, Real> _values_negative_level_set_side; 111 : 112 : /// Mapping from point index and its gradient at the positive level set side 113 : std::map<unsigned int, RealVectorValue> _grad_values_positive_level_set_side; 114 : 115 : /// Mapping from point index and its gradient at the negative level set side 116 : std::map<unsigned int, RealVectorValue> _grad_values_negative_level_set_side; 117 : };