#include <XFEMCutElem2D.h>
|
| XFEMCutElem2D (Elem *elem, const EFAElement2D *const CEMelem, unsigned int n_qpoints, unsigned int n_sides) |
| Constructor initializes XFEMCutElem2D object. More...
|
|
| ~XFEMCutElem2D () |
|
virtual void | computePhysicalVolumeFraction () |
| Computes the volume fraction of the element fragment. More...
|
|
virtual void | computePhysicalFaceAreaFraction (unsigned int side) |
| Computes the surface area fraction of the element side. More...
|
|
virtual void | computeMomentFittingWeights () |
|
virtual Point | getCutPlaneOrigin (unsigned int plane_id, MeshBase *displaced_mesh=NULL) const |
|
virtual Point | getCutPlaneNormal (unsigned int plane_id, MeshBase *displaced_mesh=NULL) const |
|
virtual void | getCrackTipOriginAndDirection (unsigned tip_id, Point &origin, Point &direction) const |
|
virtual void | getFragmentFaces (std::vector< std::vector< Point >> &frag_faces, MeshBase *displaced_mesh=NULL) const |
|
virtual const EFAElement * | getEFAElement () const |
|
virtual unsigned int | numCutPlanes () const |
|
virtual void | getIntersectionInfo (unsigned int plane_id, Point &normal, std::vector< Point > &intersectionPoints, MeshBase *displaced_mesh=NULL) const |
|
void | setQuadraturePointsAndWeights (const std::vector< Point > &qp_points, const std::vector< Real > &qp_weights) |
|
Real | getPhysicalVolumeFraction () const |
| Returns the volume fraction of the element fragment. More...
|
|
Real | getPhysicalFaceAreaFraction (unsigned int side) const |
| Returns the surface area fraction of the element side. More...
|
|
Real | getMomentFittingWeight (unsigned int i_qp) const |
|
void | getWeightMultipliers (MooseArray< Real > &weights, QBase *qrule, Xfem::XFEM_QRULE xfem_qrule, const MooseArray< Point > &q_points) |
|
void | getFaceWeightMultipliers (MooseArray< Real > &face_weights, QBase *qrule, Xfem::XFEM_QRULE xfem_qrule, const MooseArray< Point > &q_points, unsigned int side) |
|
void | computeXFEMWeights (QBase *qrule, Xfem::XFEM_QRULE xfem_qrule, const MooseArray< Point > &q_points) |
| Computes integration weights for the cut element. More...
|
|
void | computeXFEMFaceWeights (QBase *qrule, Xfem::XFEM_QRULE xfem_qrule, const MooseArray< Point > &q_points, unsigned int side) |
| Computes face integration weights for the cut element side. More...
|
|
bool | isPointPhysical (const Point &p) const |
|
Definition at line 24 of file XFEMCutElem2D.h.
◆ XFEMCutElem2D()
XFEMCutElem2D::XFEMCutElem2D |
( |
Elem * |
elem, |
|
|
const EFAElement2D *const |
CEMelem, |
|
|
unsigned int |
n_qpoints, |
|
|
unsigned int |
n_sides |
|
) |
| |
◆ ~XFEMCutElem2D()
XFEMCutElem2D::~XFEMCutElem2D |
( |
| ) |
|
◆ computeMomentFittingWeights()
void XFEMCutElem2D::computeMomentFittingWeights |
( |
| ) |
|
|
virtual |
Implements XFEMCutElem.
Definition at line 105 of file XFEMCutElem2D.C.
108 std::vector<Point> elem_nodes(
_n_nodes, Point(0.0, 0.0, 0.0));
109 std::vector<std::vector<Real>> wsg;
111 for (
unsigned int i = 0; i <
_n_nodes; ++i)
112 elem_nodes[i] = (*
_nodes[i]);
116 std::vector<std::vector<Real>> tsg;
121 for (
unsigned int i = 0; i < wsg.size(); ++i)
◆ computePhysicalFaceAreaFraction()
void XFEMCutElem2D::computePhysicalFaceAreaFraction |
( |
unsigned int |
side | ) |
|
|
virtual |
Computes the surface area fraction of the element side.
- Parameters
-
side | The side of the element |
find a fragment edge which is covered by element side
Implements XFEMCutElem.
Definition at line 80 of file XFEMCutElem2D.C.
96 frag_surf = (edge_p1 - edge_p2).norm();
◆ computePhysicalVolumeFraction()
void XFEMCutElem2D::computePhysicalVolumeFraction |
( |
| ) |
|
|
virtual |
Computes the volume fraction of the element fragment.
Implements XFEMCutElem.
Definition at line 63 of file XFEMCutElem2D.C.
74 frag_vol += 0.5 * (edge_p1(0) - edge_p2(0)) * (edge_p1(1) + edge_p2(1));
Referenced by XFEMCutElem2D().
◆ computeXFEMFaceWeights()
void XFEMCutElem::computeXFEMFaceWeights |
( |
QBase * |
qrule, |
|
|
Xfem::XFEM_QRULE |
xfem_qrule, |
|
|
const MooseArray< Point > & |
q_points, |
|
|
unsigned int |
side |
|
) |
| |
|
inherited |
Computes face integration weights for the cut element side.
- Parameters
-
qrule | The standard MOOSE face quadrature rule |
xfem_qrule | The integration scheme for the cut element (We use surface area fraction only) |
q_points | The quadrature points for the element side |
side | The side of the element |
Definition at line 90 of file XFEMCutElem.C.
100 for (
unsigned qp = 0; qp < qrule->n_points(); ++qp)
Referenced by XFEMCutElem::getFaceWeightMultipliers().
◆ computeXFEMWeights()
void XFEMCutElem::computeXFEMWeights |
( |
QBase * |
qrule, |
|
|
Xfem::XFEM_QRULE |
xfem_qrule, |
|
|
const MooseArray< Point > & |
q_points |
|
) |
| |
|
inherited |
Computes integration weights for the cut element.
- Parameters
-
qrule | The standard MOOSE quadrature rule |
xfem_qrule | The integration scheme for the cut element |
q_points | The quadrature points for the element |
Definition at line 107 of file XFEMCutElem.C.
121 for (
unsigned qp = 0; qp < qrule->n_points(); ++qp)
143 if (denominator > 0.0)
162 bool nonzero =
false;
163 for (
unsigned qp = 0; qp < qrule->n_points(); ++qp)
179 for (
unsigned qp = 0; qp < qrule->n_points(); ++qp)
185 mooseError(
"Undefined option for XFEM_QRULE");
Referenced by XFEMCutElem::getWeightMultipliers().
◆ getCrackTipOriginAndDirection()
void XFEMCutElem2D::getCrackTipOriginAndDirection |
( |
unsigned |
tip_id, |
|
|
Point & |
origin, |
|
|
Point & |
direction |
|
) |
| const |
|
virtual |
Implements XFEMCutElem.
Definition at line 180 of file XFEMCutElem2D.C.
185 std::vector<EFANode *> cut_line_nodes;
190 std::vector<EFANode *> node_line(2, NULL);
193 if (node_line[1]->
id() == tip_id)
195 cut_line_nodes.push_back(node_line[0]);
196 cut_line_nodes.push_back(node_line[1]);
198 else if (node_line[0]->
id() == tip_id)
200 node_line[1] = node_line[0];
202 cut_line_nodes.push_back(node_line[0]);
203 cut_line_nodes.push_back(node_line[1]);
207 if (cut_line_nodes.size() == 0)
208 mooseError(
"no cut line found in this element");
212 Point cut_line = cut_line_p2 - cut_line_p1;
213 Real len = std::sqrt(cut_line.norm_sq());
215 origin = cut_line_p2;
216 direction = Point(cut_line(0), cut_line(1), 0.0);
◆ getCutPlaneNormal()
Point XFEMCutElem2D::getCutPlaneNormal |
( |
unsigned int |
plane_id, |
|
|
MeshBase * |
displaced_mesh = NULL |
|
) |
| const |
|
virtual |
Implements XFEMCutElem.
Definition at line 151 of file XFEMCutElem2D.C.
153 Point normal(0.0, 0.0, 0.0);
154 std::vector<std::vector<EFANode *>> cut_line_nodes;
159 std::vector<EFANode *> node_line(2, NULL);
162 cut_line_nodes.push_back(node_line);
165 if (cut_line_nodes.size() == 0)
166 mooseError(
"no cut line found in this element");
167 if (plane_id < cut_line_nodes.size())
171 Point cut_line = cut_line_p2 - cut_line_p1;
172 Real len = std::sqrt(cut_line.norm_sq());
174 normal = Point(cut_line(1), -cut_line(0), 0.0);
Referenced by getIntersectionInfo().
◆ getCutPlaneOrigin()
Point XFEMCutElem2D::getCutPlaneOrigin |
( |
unsigned int |
plane_id, |
|
|
MeshBase * |
displaced_mesh = NULL |
|
) |
| const |
|
virtual |
Implements XFEMCutElem.
Definition at line 129 of file XFEMCutElem2D.C.
131 Point orig(0.0, 0.0, 0.0);
132 std::vector<std::vector<EFANode *>> cut_line_nodes;
137 std::vector<EFANode *> node_line(2, NULL);
140 cut_line_nodes.push_back(node_line);
143 if (cut_line_nodes.size() == 0)
144 mooseError(
"no cut line found in this element");
145 if (plane_id < cut_line_nodes.size())
◆ getEFAElement()
const EFAElement * XFEMCutElem2D::getEFAElement |
( |
| ) |
const |
|
virtual |
◆ getFaceWeightMultipliers()
void XFEMCutElem::getFaceWeightMultipliers |
( |
MooseArray< Real > & |
face_weights, |
|
|
QBase * |
qrule, |
|
|
Xfem::XFEM_QRULE |
xfem_qrule, |
|
|
const MooseArray< Point > & |
q_points, |
|
|
unsigned int |
side |
|
) |
| |
|
inherited |
◆ getFragmentFaces()
void XFEMCutElem2D::getFragmentFaces |
( |
std::vector< std::vector< Point >> & |
frag_faces, |
|
|
MeshBase * |
displaced_mesh = NULL |
|
) |
| const |
|
virtual |
Implements XFEMCutElem.
Definition at line 220 of file XFEMCutElem2D.C.
226 std::vector<Point> edge_points(2, Point(0.0, 0.0, 0.0));
231 frag_faces.push_back(edge_points);
◆ getIntersectionInfo()
void XFEMCutElem2D::getIntersectionInfo |
( |
unsigned int |
plane_id, |
|
|
Point & |
normal, |
|
|
std::vector< Point > & |
intersectionPoints, |
|
|
MeshBase * |
displaced_mesh = NULL |
|
) |
| const |
|
virtual |
Implements XFEMCutElem.
Definition at line 441 of file XFEMCutElem2D.C.
446 intersectionPoints.resize(2);
449 std::vector<std::vector<EFANode *>> cut_line_nodes;
454 std::vector<EFANode *> node_line(2, NULL);
457 cut_line_nodes.push_back(node_line);
460 if (cut_line_nodes.size() == 0)
461 mooseError(
"No cut line found in this element");
463 if (plane_id < cut_line_nodes.size())
465 intersectionPoints[0] =
getNodeCoordinates(cut_line_nodes[plane_id][0], displaced_mesh);
466 intersectionPoints[1] =
getNodeCoordinates(cut_line_nodes[plane_id][1], displaced_mesh);
◆ getMomentFittingWeight()
Real XFEMCutElem::getMomentFittingWeight |
( |
unsigned int |
i_qp | ) |
const |
|
inherited |
◆ getNodeCoordinates()
Point XFEMCutElem2D::getNodeCoordinates |
( |
EFANode * |
node, |
|
|
MeshBase * |
displaced_mesh = NULL |
|
) |
| const |
|
privatevirtual |
Implements XFEMCutElem.
Definition at line 36 of file XFEMCutElem2D.C.
38 Point node_coor(0.0, 0.0, 0.0);
39 std::vector<EFANode *> master_nodes;
40 std::vector<Point> master_points;
41 std::vector<double> master_weights;
44 for (
unsigned int i = 0; i < master_nodes.size(); ++i)
48 Node * node =
_nodes[master_nodes[i]->id()];
50 node = displaced_mesh->node_ptr(node->id());
51 Point node_p((*node)(0), (*node)(1), 0.0);
52 master_points.push_back(node_p);
55 mooseError(
"master nodes must be local");
57 for (
unsigned int i = 0; i < master_nodes.size(); ++i)
58 node_coor += master_weights[i] * master_points[i];
Referenced by computePhysicalFaceAreaFraction(), computePhysicalVolumeFraction(), getCrackTipOriginAndDirection(), getCutPlaneNormal(), getCutPlaneOrigin(), getFragmentFaces(), getIntersectionInfo(), and getPhysicalQuadraturePoints().
◆ getPhysicalFaceAreaFraction()
Real XFEMCutElem::getPhysicalFaceAreaFraction |
( |
unsigned int |
side | ) |
const |
|
inherited |
◆ getPhysicalQuadraturePoints()
void XFEMCutElem2D::getPhysicalQuadraturePoints |
( |
std::vector< std::vector< Real >> & |
tsg | ) |
|
|
private |
Definition at line 252 of file XFEMCutElem2D.C.
256 unsigned int nnd_pe = frag->
numEdges();
257 std::vector<Point> frag_points(nnd_pe, Point(0.0, 0.0, 0.0));
260 for (
unsigned int j = 0; j < nnd_pe; ++j)
264 Point xcrd(0.0, 0.0, 0.0);
265 for (
unsigned int j = 0; j < nnd_pe; ++j)
266 xcrd += frag_points[j];
267 xcrd *= (1.0 / nnd_pe);
270 if ((nnd_pe == 3) || (nnd_pe == 4))
272 std::vector<std::vector<Real>> sg2;
273 std::vector<std::vector<Real>> shape(nnd_pe, std::vector<Real>(3, 0.0));
275 for (
unsigned int l = 0; l < sg2.size(); ++l)
278 std::vector<Real> tsg_line(3, 0.0);
279 for (
unsigned int k = 0; k < nnd_pe; ++k)
281 tsg_line[0] += shape[k][2] * frag_points[k](0);
282 tsg_line[1] += shape[k][2] * frag_points[k](1);
285 tsg_line[2] = sg2[l][3] * jac;
287 tsg_line[2] = sg2[l][2] * jac;
288 tsg.push_back(tsg_line);
291 else if (nnd_pe >= 5)
293 for (
unsigned int j = 0; j < nnd_pe; ++j)
295 std::vector<std::vector<Real>> shape(3, std::vector<Real>(3, 0.0));
296 std::vector<Point> subtri_points(3, Point(0.0, 0.0, 0.0));
298 int jplus1 = j < nnd_pe - 1 ? j + 1 : 0;
299 subtri_points[0] = xcrd;
300 subtri_points[1] = frag_points[j];
301 subtri_points[2] = frag_points[jplus1];
303 std::vector<std::vector<Real>> sg2;
305 for (
unsigned int l = 0; l < sg2.size(); ++l)
308 std::vector<Real> tsg_line(3, 0.0);
309 for (
unsigned int k = 0; k < 3; ++k)
311 tsg_line[0] += shape[k][2] * subtri_points[k](0);
312 tsg_line[1] += shape[k][2] * subtri_points[k](1);
314 tsg_line[2] = sg2[l][3] * jac;
315 tsg.push_back(tsg_line);
320 mooseError(
"Invalid partial element!");
Referenced by computeMomentFittingWeights().
◆ getPhysicalVolumeFraction()
Real XFEMCutElem::getPhysicalVolumeFraction |
( |
| ) |
const |
|
inherited |
◆ getWeightMultipliers()
void XFEMCutElem::getWeightMultipliers |
( |
MooseArray< Real > & |
weights, |
|
|
QBase * |
qrule, |
|
|
Xfem::XFEM_QRULE |
xfem_qrule, |
|
|
const MooseArray< Point > & |
q_points |
|
) |
| |
|
inherited |
◆ isPointPhysical()
bool XFEMCutElem::isPointPhysical |
( |
const Point & |
p | ) |
const |
|
inherited |
◆ numCutPlanes()
unsigned int XFEMCutElem2D::numCutPlanes |
( |
| ) |
const |
|
virtual |
◆ setQuadraturePointsAndWeights()
void XFEMCutElem::setQuadraturePointsAndWeights |
( |
const std::vector< Point > & |
qp_points, |
|
|
const std::vector< Real > & |
qp_weights |
|
) |
| |
|
inherited |
◆ solveMomentFitting()
void XFEMCutElem2D::solveMomentFitting |
( |
unsigned int |
nen, |
|
|
unsigned int |
nqp, |
|
|
std::vector< Point > & |
elem_nodes, |
|
|
std::vector< std::vector< Real >> & |
tsg, |
|
|
std::vector< std::vector< Real >> & |
wsg |
|
) |
| |
|
private |
Definition at line 324 of file XFEMCutElem2D.C.
331 std::vector<std::vector<Real>> shape(nen, std::vector<Real>(3, 0.0));
332 std::vector<std::vector<Real>> wss;
337 for (
unsigned int i = 0; i <
_qp_points.size(); i++)
348 for (
unsigned int i = 0; i <
_qp_points.size(); i++)
358 mooseError(
"Invalid element");
360 wsg.resize(wss.size());
361 for (
unsigned int i = 0; i < wsg.size(); ++i)
362 wsg[i].resize(3, 0.0);
364 std::vector<Real> old_weights(wss.size(), 0.0);
366 for (
unsigned int l = 0; l < wsg.size(); ++l)
370 old_weights[l] = wss[l][2] * jac;
372 old_weights[l] = wss[l][3] * jac;
374 mooseError(
"Invalid element!");
375 for (
unsigned int k = 0; k < nen; ++k)
377 wsg[l][0] += shape[k][2] * elem_nodes[k](0);
378 wsg[l][1] += shape[k][2] * elem_nodes[k](1);
384 A =
new Real[wsg.size() * wsg.size()];
386 for (
unsigned int i = 0; i < wsg.size(); ++i)
390 A[1 + ind] = wsg[i][0];
392 A[2 + ind] = wsg[i][1];
394 A[3 + ind] = wsg[i][0] * wsg[i][1];
396 A[4 + ind] = wsg[i][0] * wsg[i][0];
398 A[5 + ind] = wsg[i][1] * wsg[i][1];
400 mooseError(
"Q-points of more than 6 are not allowed now!");
405 b =
new Real[wsg.size()];
406 for (
unsigned int i = 0; i < wsg.size(); ++i)
408 for (
unsigned int i = 0; i < tsg.size(); ++i)
412 b[1] += tsg[i][2] * tsg[i][0];
414 b[2] += tsg[i][2] * tsg[i][1];
416 b[3] += tsg[i][2] * tsg[i][0] * tsg[i][1];
418 b[4] += tsg[i][2] * tsg[i][0] * tsg[i][0];
420 b[5] += tsg[i][2] * tsg[i][1] * tsg[i][1];
422 mooseError(
"Q-points of more than 6 are not allowed now!");
428 std::vector<int> ipiv(n);
430 LAPACKgesv_(&n, &nrhs, A, &n, &ipiv[0], b, &n, &info);
432 for (
unsigned int i = 0; i < wsg.size(); ++i)
433 wsg[i][2] = b[i] / old_weights[i];
Referenced by computeMomentFittingWeights().
◆ _efa_elem2d
Definition at line 41 of file XFEMCutElem2D.h.
Referenced by computeMomentFittingWeights(), computePhysicalFaceAreaFraction(), computePhysicalVolumeFraction(), getCrackTipOriginAndDirection(), getCutPlaneNormal(), getCutPlaneOrigin(), getEFAElement(), getFragmentFaces(), getIntersectionInfo(), getNodeCoordinates(), getPhysicalQuadraturePoints(), and numCutPlanes().
◆ _elem_side_area
std::vector<Real> XFEMCutElem::_elem_side_area |
|
protectedinherited |
◆ _elem_volume
Real XFEMCutElem::_elem_volume |
|
protectedinherited |
◆ _have_face_weights
std::vector<bool> XFEMCutElem::_have_face_weights |
|
protectedinherited |
◆ _have_weights
bool XFEMCutElem::_have_weights |
|
protectedinherited |
◆ _n_nodes
unsigned int XFEMCutElem::_n_nodes |
|
protectedinherited |
◆ _n_qpoints
unsigned int XFEMCutElem::_n_qpoints |
|
protectedinherited |
◆ _n_sides
unsigned int XFEMCutElem::_n_sides |
|
protectedinherited |
◆ _new_face_weights
std::vector<std::vector<Real> > XFEMCutElem::_new_face_weights |
|
protectedinherited |
◆ _new_weights
std::vector<Real> XFEMCutElem::_new_weights |
|
protectedinherited |
◆ _nodes
std::vector<Node *> XFEMCutElem::_nodes |
|
protectedinherited |
◆ _physical_areafrac
std::vector<Real> XFEMCutElem::_physical_areafrac |
|
protectedinherited |
◆ _physical_volfrac
Real XFEMCutElem::_physical_volfrac |
|
protectedinherited |
◆ _qp_points
std::vector<Point> XFEMCutElem::_qp_points |
|
protectedinherited |
◆ _qp_weights
std::vector<Real> XFEMCutElem::_qp_weights |
|
protectedinherited |
The documentation for this class was generated from the following files:
std::vector< Point > _qp_points
EFAEdge * getEdge(unsigned int edge_id) const
void getPhysicalQuadraturePoints(std::vector< std::vector< Real >> &tsg)
void shapeFunc2D(unsigned int nen, std::vector< Real > &ss, std::vector< Point > &xl, std::vector< std::vector< Real >> &shp, Real &xsj, bool natl_flg)
virtual void getMasterInfo(EFANode *node, std::vector< EFANode * > &master_nodes, std::vector< double > &master_weights) const
Real getPhysicalVolumeFraction() const
Returns the volume fraction of the element fragment.
std::vector< Real > _elem_side_area
virtual bool isPartial() const
EFAEdge * getEdge(unsigned int edge_id) const
EFAEdge * getFragmentEdge(unsigned int frag_id, unsigned int edge_id) const
bool containsNode(const EFANode *node) const
void solveMomentFitting(unsigned int nen, unsigned int nqp, std::vector< Point > &elem_nodes, std::vector< std::vector< Real >> &tsg, std::vector< std::vector< Real >> &wsg)
virtual unsigned int numCutPlanes() const =0
void computeXFEMFaceWeights(QBase *qrule, Xfem::XFEM_QRULE xfem_qrule, const MooseArray< Point > &q_points, unsigned int side)
Computes face integration weights for the cut element side.
Real getPhysicalFaceAreaFraction(unsigned int side) const
Returns the surface area fraction of the element side.
EFANode * getNode(unsigned int index) const
EFAFragment2D * getFragment(unsigned int frag_id) const
virtual void computePhysicalFaceAreaFraction(unsigned int side)=0
Computes the surface area fraction of the element side.
std::vector< Real > _qp_weights
std::vector< Real > _new_weights
quadrature weights from volume fraction and moment fitting
std::vector< Node * > _nodes
std::vector< Real > _physical_areafrac
virtual void computePhysicalVolumeFraction()=0
Computes the volume fraction of the element fragment.
XFEMCutElem(Elem *elem, unsigned int n_qpoints, unsigned int n_sides)
Constructor initializes XFEMCutElem object.
void computeXFEMWeights(QBase *qrule, Xfem::XFEM_QRULE xfem_qrule, const MooseArray< Point > &q_points)
Computes integration weights for the cut element.
virtual Point getNodeCoordinates(EFANode *node, MeshBase *displaced_mesh=NULL) const
virtual void computePhysicalVolumeFraction()
Computes the volume fraction of the element fragment.
bool isPointPhysical(const Point &p) const
void stdQuadr2D(unsigned int nen, unsigned int iord, std::vector< std::vector< Real >> &sg2)
virtual Point getCutPlaneNormal(unsigned int plane_id, MeshBase *displaced_mesh=NULL) const
virtual Point getCutPlaneOrigin(unsigned int plane_id, MeshBase *displaced_mesh=NULL) const =0
virtual Point getCutPlaneNormal(unsigned int plane_id, MeshBase *displaced_mesh=NULL) const =0
virtual void computeMomentFittingWeights()=0
unsigned int numEdges() const
bool isEdgeInterior(unsigned int edge_id) const
std::vector< bool > _have_face_weights
std::vector< std::vector< Real > > _new_face_weights
face quadrature weights from surface area fraction