v0.14.0
MWLS.hpp
Go to the documentation of this file.
1 /** \file MWLS.hpp
2  */
3 
4 /* This file is part of MoFEM.
5  * MoFEM is free software: you can redistribute it and/or modify it under
6  * the terms of the GNU Lesser General Public License as published by the
7  * Free Software Foundation, either version 3 of the License, or (at your
8  * option) any later version.
9  *
10  * MoFEM is distributed in the hope that it will be useful, but WITHOUT
11  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
13  * License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public
16  * License along with MoFEM. If not, see <http://www.gnu.org/licenses/>. */
17 
18 #ifndef __MWLS_HPP__
19 #define __MWLS_HPP__
20 
21 namespace FractureMechanics {
22 
23 /**
24 
25 Moving least weighted square approximation (MWLS)
26 
27 \f[
28 u^h(x) = p_k(x)a_k(x)\\
29 J(x)=\frac{1}{2} \sum_i w(x-x_i)\left(p_j(x_i)a_j(x)-u_i\right)^2 = \\
30 J(x)=\frac{1}{2} \sum_i w(x-x_i)\left( p_j(x_i)a_j(x) p_k(x_i)a_k(x) -
31 2p_j(x_i)a_j(x)u_i + u_i^2 \right) \\ \frac{\partial J}{\partial a_j} =
32 \sum_i w(x_i-x)\left(p_j(x_i)p_k(x_i) a_k(x) -p_j(x_j)u_i\right)\\
33 A_{jk}(x) = \sum_i w(x_i-x)p_j(x_i)p_k(x_i)\\
34 B_{ji}(x) = w(x-x_i) p_j(x_i)\\
35 A_{jk}(x) a_k(x) = B_{ji}(x)u_i\\
36 a_k(x) = \left( A^{-1}_{kj}(x) B_{ji}(x) \right) u_i\\
37 u^h(x) = p_k(x) \left( A^{-1}_{kj}(x) B_{ji}(x) \right) u_i \\
38 u^h(x) = \left[ p_k(x) \left( A^{-1}_{kj}(x) B_{ji}(x) \right) \right] u_i \\
39 \phi_i = p_k(x) \left( A^{-1}_{kj}(x) B_{ji}(x) \right) \\
40 \phi_{i,l} =
41 p_{k,l}(x) \left( A^{-1}_{kj}(x) B_{ji}(x) \right)+
42 p_k(x) \left( A^{-1}_{kj,l}(x) B_{ji}(x) + A^{-1}_{kj}(x) B_{ji,l}(x) \right)\\
43 \phi_{i,l} =
44 p_{k,l}(x) \left( A^{-1}_{kj}(x) B_{ji}(x) \right)+
45 p_k(x) \left( A^{-1}_{kj,l}(x) B_{ji}(x) + A^{-1}_{kj}(x) B_{ji,l}(x) \right)\\
46 \left(\mathbf{A}\mathbf{A}^{-1}\right)_{,l} = \mathbf{0} \to
47 \mathbf{A}^{-1}_{,l} = -\mathbf{A}^{-1} \mathbf{A}_{,l} \mathbf{A}^{-1}\\
48 A_{jk,l} = \sum_i w_{,l}(x_i-x)p_j(x_i)p_k(x_i) \\
49 B_{ij,l} = w_{,l}(x_i-x)p_j(x_i)
50 \f]
51 
52 */
53 struct MWLSApprox {
54 
59 
60  boost::weak_ptr<DofEntity> arcLengthDof;
61 
62  MWLSApprox(MoFEM::Interface &m_field, Vec F_lambda = PETSC_NULL,
63  boost::shared_ptr<DofEntity> arc_length_dof = nullptr);
64  virtual ~MWLSApprox() = default;
65 
66  /**
67  * @brief Get the Use Local Base At Material Reference Configuration object
68  *
69  * If true base is calculated at initail integration point coordinates and
70  * base function evaluated at another point. Local derivatives are uses, since
71  * weight function is at initial point.
72  *
73  * @return true
74  * @return false
75  */
77  return (useGlobalBaseAtMaterialReferenceConfiguration == PETSC_TRUE);
78  }
79 
80  /**
81  * \brief get options from command line for MWLS
82  * @return error code
83  */
85 
86  /**
87  * Load mesh with data and do basic calculation
88  * @param file_name File name
89  * @return Error code
90  */
91  MoFEMErrorCode loadMWLSMesh(std::string file_name);
92 
93  /**
94  * \brief get values form elements to nodes
95  * @param th tag with approximated data
96  * @param th tag with approximated data
97  * @return error code
98  */
100 
101  /**
102  * \brief Get node in influence domain
103  * @param material_coords material position
104  * @return error code
105  */
106  MoFEMErrorCode getInfluenceNodes(double material_coords[3]);
107 
108  /**
109  * \brief Calculate approximation function coefficients
110  * @param material_coords material position
111  * @return error code
112 
113  NOTE: This function remove form influenceNodes entities which
114  are beyond influence radius.
115 
116  */
117  MoFEMErrorCode calculateApproxCoeff(bool trim_influence_nodes,
118  bool global_derivatives);
119 
120  /**
121  * \brief evaluate approximation function at material point
122  * @param material_coords material position
123  * @return error code
124 
125  */
126  MoFEMErrorCode evaluateApproxFun(double eval_point[3]);
127 
128  /**
129  * \brief evaluate 1st derivative of approximation function at material point
130  * @param global_derivatives decide whether global derivative will be
131  calculated
132  * @return error code
133 
134  */
135  MoFEMErrorCode evaluateFirstDiffApproxFun(double eval_point[3],
136  bool global_derivatives);
137 
138  /**
139  * \brief evaluate 2nd derivative of approximation function at material point
140  * @param global_derivatives decide whether global derivative will be
141  calculated
142  * @return error code
143 
144  */
145  MoFEMErrorCode evaluateSecondDiffApproxFun(double eval_point[3],
146  bool global_derivatives);
147 
148  /**
149  * Get tag data on influence nodes
150  * @param th tag
151  * @return error code
152  */
154 
155  /**
156  * @brief Get the norm of the error at nod
157  *
158  * @param th
159  * @param total_stress_at_node
160  * @param total_stress_error_at_node
161  * @param hydro_static_error_at_node
162  * @param deviatoric_error_at_node
163  * @param total_energy
164  * @param total_energy_error
165  * @param young_modulus
166  * @param poisson_ratio
167  * @return MoFEMErrorCode
168  */
170  Tag th, double &total_stress_at_node, double &total_stress_error_at_node,
171  double &hydro_static_error_at_node, double &deviatoric_error_at_node,
172  double &total_energy, double &total_energy_error,
173  const double young_modulus, const double poisson_ratio);
174 
175  typedef ublas::vector<double, ublas::bounded_array<double, 9>> VecVals;
176  typedef ublas::matrix<double, ublas::row_major,
177  ublas::bounded_array<double, 27>>
179  typedef ublas::matrix<double, ublas::row_major,
180  ublas::bounded_array<double, 81>>
182 
183  /**
184  * Get values at point
185  * @return error code
186  */
187  const VecVals &getDataApprox();
188 
189  /**
190  * Get derivatives of values at points
191  * @return error code
192  */
194 
195  /**
196  * Get second derivatives of values at points
197  * @return error code
198  */
200 
201  // Stress at gauss point on finite element
204 
205  // Density at gauss point on finite element
206  boost::shared_ptr<VectorDouble> rhoAtGaussPts;
207  boost::shared_ptr<MatrixDouble> diffRhoAtGaussPts;
208  boost::shared_ptr<MatrixDouble> diffDiffRhoAtGaussPts;
209 
218 
219  /**
220  * @brief Store Coefficient of base functions at integration points
221  *
222  */
223  std::map<EntityHandle, std::vector<MatrixDouble>> invABMap;
224 
225  /**
226  * @brief Influence nodes on elements on at integration points
227  *
228  */
229  std::map<EntityHandle, std::vector<std::vector<EntityHandle>>>
231 
232  /**
233  * @brief Store weight function radius at the nodes
234  *
235  */
236  std::map<EntityHandle, std::vector<double>> dmNodesMap;
237 
238  template <class T> struct OpMWLSBase : public T::UserDataOperator {
239  boost::shared_ptr<MatrixDouble> matPosAtPtsPtr;
240  boost::shared_ptr<MatrixDouble> matGradPosAtPtsPtr;
241  boost::weak_ptr<CrackFrontElement> feSingularPtr;
242  boost::shared_ptr<MWLSApprox> mwlsApprox;
243 
244  OpMWLSBase(boost::shared_ptr<MatrixDouble> mat_pos_at_pts_ptr,
245  boost::shared_ptr<MatrixDouble> mat_grad_pos_at_pts_ptr,
246  boost::shared_ptr<CrackFrontElement> fe_singular_ptr,
247  boost::shared_ptr<MWLSApprox> mwls_approx, bool testing = false)
248  : T::UserDataOperator("MESH_NODE_POSITIONS",
249  T::UserDataOperator::OPROW),
250  matPosAtPtsPtr(mat_pos_at_pts_ptr),
251  matGradPosAtPtsPtr(mat_grad_pos_at_pts_ptr),
252  feSingularPtr(fe_singular_ptr), mwlsApprox(mwls_approx) {}
253 
254  virtual ~OpMWLSBase() = default;
255 
256  MoFEMErrorCode doWork(int side, EntityType type,
258 
259  protected:
260  /**
261  * @brief Do specific work in operator.
262  *
263  * Is protected to prevent direct call. This can be only called by
264  * doWork method.
265  *
266  * @param side
267  * @param type
268  * @param data
269  * @return MoFEMErrorCode
270  */
271  virtual MoFEMErrorCode
272  doMWLSWork(int side, EntityType type,
274  };
275 
276  template <class T>
278 
279  const bool testing;
281  boost::shared_ptr<MatrixDouble> mat_pos_at_pts_ptr,
282  boost::shared_ptr<MatrixDouble> mat_grad_pos_at_pts_ptr,
283  boost::shared_ptr<CrackFrontElement> fe_singular_ptr,
284  boost::shared_ptr<MWLSApprox> mwls_approx, bool testing = false)
285  : OpMWLSBase<T>(mat_pos_at_pts_ptr, mat_grad_pos_at_pts_ptr,
286  fe_singular_ptr, mwls_approx, testing),
287  testing(testing) {}
288 
289  protected:
290  MoFEMErrorCode doMWLSWork(int side, EntityType type,
292  };
293 
294  typedef OpMWLSCalculateBaseCoeffcientsAtGaussPtsTmpl<
295  VolumeElementForcesAndSourcesCore>
297 
301 
303  : public OpMWLSBase<VolumeElementForcesAndSourcesCore> {
304 
305  std::string rhoTagName;
308  const bool testing;
310  boost::shared_ptr<MatrixDouble> mat_pos_at_pts_ptr,
311  boost::shared_ptr<MatrixDouble> mat_grad_pos_at_pts_ptr,
312  boost::shared_ptr<CrackFrontElement> fe_singular_ptr,
313  boost::shared_ptr<MWLSApprox> mwls_approx,
314  const std::string rho_tag_name, const bool calculate_derivative,
315  const bool calculate_2nd_derivative, bool testing = false)
316  : OpMWLSBase<VolumeElementForcesAndSourcesCore>(
317  mat_pos_at_pts_ptr, mat_grad_pos_at_pts_ptr, fe_singular_ptr,
318  mwls_approx, testing),
319  rhoTagName(rho_tag_name), calculateDerivative(calculate_derivative),
320  calculate2ndDerivative(calculate_2nd_derivative), testing(testing) {}
321 
322  protected:
323  MoFEMErrorCode doMWLSWork(int side, EntityType type,
325  };
326 
327  /**
328  * \brief Evaluate density at integration points
329  */
330  struct OpMWLSRhoAtGaussPts : OpMWLSBase<VolumeElementForcesAndSourcesCore> {
331  std::string rhoTagName;
332 
335  const bool testing;
336  OpMWLSRhoAtGaussPts(boost::shared_ptr<MatrixDouble> mat_pos_at_pts_ptr,
337  boost::shared_ptr<MatrixDouble> mat_grad_pos_at_pts_ptr,
338  boost::shared_ptr<CrackFrontElement> fe_singular_ptr,
339  boost::shared_ptr<MWLSApprox> mwls_approx,
340  const std::string rho_tag_name,
341  const bool calculate_derivative,
342  const bool calculate_2nd_derivative,
343  bool testing = false)
344  : OpMWLSBase<VolumeElementForcesAndSourcesCore>(
345  mat_pos_at_pts_ptr, mat_grad_pos_at_pts_ptr, fe_singular_ptr,
346  mwls_approx, testing),
347  rhoTagName(rho_tag_name), calculateDerivative(calculate_derivative),
348  calculate2ndDerivative(calculate_2nd_derivative), testing(testing) {}
349 
350  protected:
351  MoFEMErrorCode doMWLSWork(int side, EntityType type,
353  };
354 
357 
358  boost::shared_ptr<moab::Interface> postProcMeshPtr;
359  boost::shared_ptr<std::vector<EntityHandle>> mapGaussPtsPtr;
360  boost::shared_ptr<MWLSApprox> mwlsApproxPtr;
362 
364  boost::shared_ptr<moab::Interface> &post_proc_mesh,
365  boost::shared_ptr<std::vector<EntityHandle>> &map_gauss_pts,
366  boost::shared_ptr<MWLSApprox> mwls_approx,
368  : VolumeElementForcesAndSourcesCore::UserDataOperator(
369  "SPATIAL_POSITION", UserDataOperator::OPROW),
370  postProcMeshPtr(post_proc_mesh), mapGaussPtsPtr(map_gauss_pts),
371  mwlsApproxPtr(mwls_approx), commonData(common_data) {}
372 
373  PetscErrorCode doWork(int side, EntityType type,
375  };
376 
378  : public OpMWLSBase<VolumeElementForcesAndSourcesCore> {
379 
380  std::string stressTagName;
382  const bool testing;
383 
385  boost::shared_ptr<MatrixDouble> mat_pos_at_pts_ptr,
386  boost::shared_ptr<MatrixDouble> mat_grad_pos_at_pts_ptr,
387  boost::shared_ptr<CrackFrontElement> fe_singular_ptr,
388  boost::shared_ptr<MWLSApprox> mwls_approx,
389  const std::string stress_tag_name, bool calculate_derivative,
390  bool testing = false)
391  : OpMWLSBase<VolumeElementForcesAndSourcesCore>(
392  mat_pos_at_pts_ptr, mat_grad_pos_at_pts_ptr, fe_singular_ptr,
393  mwls_approx, testing),
394  stressTagName(stress_tag_name),
395  calculateDerivative(calculate_derivative), testing(testing) {}
396 
397  protected:
398  MoFEMErrorCode doMWLSWork(int side, EntityType type,
400  };
401  /**
402  * \brief Evaluate stress at integration points
403  */
405  : OpMWLSBase<VolumeElementForcesAndSourcesCore> {
406  std::string stressTagName;
408  const bool testing;
409  boost::shared_ptr<MatrixDouble> matGradPosAtPtsPtr;
411  boost::shared_ptr<MatrixDouble> mat_pos_at_pts_ptr,
412  boost::shared_ptr<MatrixDouble> mat_grad_pos_at_pts_ptr,
413  boost::shared_ptr<CrackFrontElement> fe_singular_ptr,
414  boost::shared_ptr<MWLSApprox> mwls_approx,
415  const std::string stress_tag_name, bool calculate_derivative,
416  bool testing = false)
417  : OpMWLSBase<VolumeElementForcesAndSourcesCore>(
418  mat_pos_at_pts_ptr, mat_grad_pos_at_pts_ptr, fe_singular_ptr,
419  mwls_approx, testing),
420  matGradPosAtPtsPtr(mat_pos_at_pts_ptr),
421  stressTagName(stress_tag_name),
422  calculateDerivative(calculate_derivative), testing(testing) {}
423 
424  virtual ~OpMWLSStressAtGaussPts() = default;
425 
426  protected:
427  MoFEMErrorCode doMWLSWork(int side, EntityType type,
429  };
430 
433 
434  boost::shared_ptr<moab::Interface> postProcMeshPtr;
435  boost::shared_ptr<std::vector<EntityHandle>> mapGaussPtsPtr;
436  boost::shared_ptr<MWLSApprox> mwlsApproxPtr;
437 
439  boost::shared_ptr<moab::Interface> post_proc_mesh,
440  boost::shared_ptr<std::vector<EntityHandle>> map_gauss_pts,
441  boost::shared_ptr<MWLSApprox> mwls_approx)
442  : VolumeElementForcesAndSourcesCore::UserDataOperator(
443  "MESH_NODE_POSITIONS", UserDataOperator::OPROW),
444  postProcMeshPtr(post_proc_mesh), mapGaussPtsPtr(map_gauss_pts),
445  mwlsApproxPtr(mwls_approx) {}
446 
447  PetscErrorCode doWork(int side, EntityType type,
449  };
450 
451  /**
452  * \brief Evaluate stress at integration points
453  */
456  std::string stressTagName;
457  boost::shared_ptr<MWLSApprox> mwlsApproxPtr;
459 
460  OpMWLSStressAndErrorsAtGaussPts(boost::shared_ptr<MWLSApprox> mwls_approx,
461  const std::string stress_tag_name,
462  MoFEM::Interface &m_field)
463  : VolumeElementForcesAndSourcesCore::UserDataOperator(
464  "SPATIAL_POSITION", UserDataOperator::OPROW),
465  mwlsApproxPtr(mwls_approx), stressTagName(stress_tag_name),
466  mField(m_field) {}
467 
468  protected:
469  MoFEMErrorCode doWork(int side, EntityType type,
471  };
472 
473  /**
474  * \brief Integrate force vector
475  */
478  boost::shared_ptr<MatrixDouble> matGradPosAtPtsPtr;
479  boost::shared_ptr<MWLSApprox> mwlsApprox;
480  const bool testing;
482  boost::shared_ptr<MatrixDouble> mat_grad_pos_at_pts_ptr,
483  boost::shared_ptr<MWLSApprox> mwls_approx, const bool testing = false)
484  : MoFEM::VolumeElementForcesAndSourcesCore::UserDataOperator(
485  "SPATIAL_POSITION", UserDataOperator::OPROW),
486  matGradPosAtPtsPtr(mat_grad_pos_at_pts_ptr), mwlsApprox(mwls_approx),
487  testing(testing) {}
489  MoFEMErrorCode doWork(int side, EntityType type,
491  };
492 
493  /**
494  * \brief Integrate force vector
495  */
498  boost::shared_ptr<MatrixDouble> spaceGradPosAtPtsPtr;
499  boost::shared_ptr<MatrixDouble> matGradPosAtPtsPtr;
500  boost::shared_ptr<MWLSApprox> mwlsApprox;
505  boost::shared_ptr<MatrixDouble> space_grad_pos_at_pts_ptr,
506  boost::shared_ptr<MatrixDouble> mat_grad_pos_at_pts_ptr,
507  boost::shared_ptr<MWLSApprox> mwls_approx,
508  Range *forces_only_on_entities_row = NULL)
509  : MoFEM::VolumeElementForcesAndSourcesCore::UserDataOperator(
510  "MESH_NODE_POSITIONS", UserDataOperator::OPROW),
511  spaceGradPosAtPtsPtr(space_grad_pos_at_pts_ptr),
512  matGradPosAtPtsPtr(mat_grad_pos_at_pts_ptr), mwlsApprox(mwls_approx),
513  F_lambda(mwls_approx->F_lambda) {
514  if (forces_only_on_entities_row)
515  forcesOnlyOnEntitiesRow = *forces_only_on_entities_row;
516  }
518  MoFEMErrorCode doWork(int side, EntityType type,
520  };
521 
524  boost::shared_ptr<MatrixDouble> matGradPosAtPtsPtr;
525  boost::shared_ptr<MWLSApprox> mwlsApprox;
528  boost::shared_ptr<MatrixDouble> mat_grad_pos_at_pts_ptr,
529  boost::shared_ptr<MWLSApprox> mwls_approx)
530  : MoFEM::VolumeElementForcesAndSourcesCore::UserDataOperator(
531  "SPATIAL_POSITION", "MESH_NODE_POSITIONS",
533  matGradPosAtPtsPtr(mat_grad_pos_at_pts_ptr), mwlsApprox(mwls_approx) {
534  sYmm = false;
535  }
537  MoFEMErrorCode doWork(int row_side, int col_side, EntityType row_type,
538  EntityType col_type,
541  };
542 
545  boost::shared_ptr<MatrixDouble> spaceGradPosAtPtsPtr;
546  boost::shared_ptr<MatrixDouble> matGradPosAtPtsPtr;
547  boost::shared_ptr<MWLSApprox> mwlsApprox;
551  boost::shared_ptr<MatrixDouble> space_grad_pos_at_pts_ptr,
552  boost::shared_ptr<MatrixDouble> mat_grad_pos_at_pts_ptr,
553  boost::shared_ptr<MWLSApprox> mwls_approx,
554  Range *forces_only_on_entities_row = nullptr)
555  : MoFEM::VolumeElementForcesAndSourcesCore::UserDataOperator(
556  "MESH_NODE_POSITIONS", "SPATIAL_POSITION",
558  spaceGradPosAtPtsPtr(space_grad_pos_at_pts_ptr),
559  matGradPosAtPtsPtr(mat_grad_pos_at_pts_ptr), mwlsApprox(mwls_approx) {
560  sYmm = false;
561  if (forces_only_on_entities_row)
562  forcesOnlyOnEntitiesRow = *forces_only_on_entities_row;
563  }
565  MoFEMErrorCode doWork(int row_side, int col_side, EntityType row_type,
566  EntityType col_type,
569  };
570 
573  boost::shared_ptr<MatrixDouble> spaceGradPosAtPtsPtr;
574  boost::shared_ptr<MatrixDouble> matGradPosAtPtsPtr;
575  boost::shared_ptr<MWLSApprox> mwlsApprox;
579  boost::shared_ptr<MatrixDouble> space_grad_pos_at_pts_ptr,
580  boost::shared_ptr<MatrixDouble> mat_grad_pos_at_pts_ptr,
581  boost::shared_ptr<MWLSApprox> mwls_approx,
582  Range *forces_only_on_entities_row = nullptr)
583  : MoFEM::VolumeElementForcesAndSourcesCore::UserDataOperator(
584  "MESH_NODE_POSITIONS", "MESH_NODE_POSITIONS",
586  spaceGradPosAtPtsPtr(space_grad_pos_at_pts_ptr),
587  matGradPosAtPtsPtr(mat_grad_pos_at_pts_ptr), mwlsApprox(mwls_approx) {
588  sYmm = false;
589  if (forces_only_on_entities_row)
590  forcesOnlyOnEntitiesRow = *forces_only_on_entities_row;
591  }
593  MoFEMErrorCode doWork(int row_side, int col_side, EntityType row_type,
594  EntityType col_type,
597  };
598 
599  /// \brief This is used to set up analytical function for testing
600  /// approximation
601  boost::function<VectorDouble(const double, const double, const double)>
603 
604  inline MatrixDouble &getInvAB() { return invAB; }
605  inline std::vector<EntityHandle> &getInfluenceNodes() {
606  return influenceNodes;
607  }
608  inline auto &getShortenDm() { return shortenDm; }
609 
610 private:
611  boost::shared_ptr<BVHTree> myTree;
612 
613  // 1 (1) x y z (4) xx yy zz xy xz yz (10)
614  int nbBasePolynomials; ///< Number of base functions (1 - linear, 4 - linear,
615  ///< 10 - quadratic)
616 
617  double dmFactor; ///< Relative value of weight function radius
618  double shortenDm; ///< Radius of weight function used to calculate base
619  ///< function.
620  int maxElemsInDMFactor; ///< Maximal number of elements in the horizon is
621  ///< calculated from max_nb_elems = maxElemsInDMFactor
622  ///< *nbBasePolynomials. Value is set by command line
623  ///< -mwls_max_elems_factor
624 
625  int maxThreeDepth; ///< Maximal three depths
626  int splitsPerDir; ///< Split per direction in the tree
627 
629  PetscBool useNodalData;
631 
633  double maxEdgeL;
634 
636  std::vector<EntityHandle> influenceNodes;
637  std::map<EntityHandle, std::array<double, 3>> elemCentreMap;
638 
640 
641  ublas::symmetric_matrix<double, ublas::lower> A;
642  ublas::symmetric_matrix<double, ublas::lower> testA;
644  ublas::triangular_matrix<double, ublas::lower> L;
650 
651  ublas::symmetric_matrix<double, ublas::lower, ublas::row_major,
653  diffA[3];
654  ublas::symmetric_matrix<double, ublas::lower, ublas::row_major,
662 
665 
667 
670 
673 
674  template <class T = FTensor::Tensor1<double, 3>>
675  MoFEMErrorCode calculateBase(const T &t_coords) {
677 
678  baseFun.resize(nbBasePolynomials, false);
679  baseFun.clear();
680 
681  baseFun[0] = 1;
682  if (nbBasePolynomials > 1) {
683  baseFun[1] = t_coords(0); // x
684  baseFun[2] = t_coords(1); // y
685  baseFun[3] = t_coords(2); // z
686  }
687 
688  if (nbBasePolynomials > 4) {
689  baseFun[4] = t_coords(0) * t_coords(0); // x^2
690  baseFun[5] = t_coords(1) * t_coords(1); // y^2
691  baseFun[6] = t_coords(2) * t_coords(2); // z^2
692  baseFun[7] = t_coords(0) * t_coords(1); // xy
693  baseFun[8] = t_coords(0) * t_coords(2); // xz
694  baseFun[9] = t_coords(1) * t_coords(2); // yz
695  }
696 
698  }
699 
700  template <class T = FTensor::Tensor1<double, 3>>
701  MoFEMErrorCode calculateDiffBase(const T &t_coords, const double dm) {
703 
704  // Local base functions
705  for (int d = 0; d != 3; ++d) {
706  diffBaseFun[d].resize(nbBasePolynomials, false);
707  diffBaseFun[d].clear();
708  }
709 
710  for (int d = 0; d != 3; d++) {
711  diffBaseFun[d][0] = 0;
712  }
713 
714  if (nbBasePolynomials > 1) {
715  // derivative dx
716  diffBaseFun[0][1] = 1. / dm;
717  // derivative dy
718  diffBaseFun[1][2] = 1. / dm;
719  // derivative dz
720  diffBaseFun[2][3] = 1. / dm;
721  }
722 
723  if (nbBasePolynomials > 4) {
724  // dx derivative
725  diffBaseFun[0][4] = 2 * t_coords(0) / dm;
726  diffBaseFun[0][5] = 0;
727  diffBaseFun[0][6] = 0;
728  diffBaseFun[0][7] = t_coords(1) / dm;
729  diffBaseFun[0][8] = t_coords(2) / dm;
730  diffBaseFun[0][9] = 0;
731  // dy derivative
732  diffBaseFun[1][4] = 0;
733  diffBaseFun[1][5] = 2 * t_coords(1) / dm;
734  diffBaseFun[1][6] = 0;
735  diffBaseFun[1][7] = t_coords(0) / dm;
736  diffBaseFun[1][8] = 0;
737  diffBaseFun[1][9] = t_coords(2) / dm;
738  // dz derivative
739  diffBaseFun[2][4] = 0;
740  diffBaseFun[2][5] = 0;
741  diffBaseFun[2][6] = 2 * t_coords(2) / dm;
742  diffBaseFun[2][7] = 0;
743  diffBaseFun[2][8] = t_coords(0) / dm;
744  diffBaseFun[2][9] = t_coords(1) / dm;
745  }
747  }
748 
749  template <class T = FTensor::Tensor1<double, 3>>
750  MoFEMErrorCode calculateDiffDiffBase(const T &t_coords, const double dm) {
752 
753  // Local base functions
754  for (int d = 0; d != 9; ++d) {
755  diffDiffBaseFun[d].resize(nbBasePolynomials, false);
756  diffDiffBaseFun[d].clear();
757  }
758 
759  // if (nbBasePolynomials > 1) {
760  // }
761 
762  if (nbBasePolynomials > 4) {
763  const double dm2 = dm * dm;
764  // set the non-zero values
765  // dxd? derivative
766  diffDiffBaseFun[0][4] = 2. / dm2; // dxdx
767  diffDiffBaseFun[1][7] = 1. / dm2; // dxdy
768  diffDiffBaseFun[2][8] = 1. / dm2; // dxdz
769  // dyd? derivative
770  diffDiffBaseFun[4][5] = 2. / dm2; // dydy
771  diffDiffBaseFun[3][7] = 1. / dm2; // dydx
772  diffDiffBaseFun[5][9] = 1. / dm2; // dydz
773  // dzd? derivative
774  diffDiffBaseFun[8][6] = 2. / dm2; // dzdz
775  diffDiffBaseFun[6][8] = 1. / dm2; // dzdx
776  diffDiffBaseFun[7][9] = 1. / dm2; // dzdy
777  }
779  }
780 
781  inline double evalWeight(const double r) {
782  const double rr = r * r;
783  const double rrr = rr * r;
784  const double r4 = rrr * r;
785  if (r < 1) {
786  return 1 - 6 * rr + 8 * rrr - 3 * r4;
787  } else {
788  return 0;
789  }
790  // if(r<=0.5) {
791  // return 2./3-4*rr+4*rrr;
792  // } else if(r<=1) {
793  // return 4./3-4*r+4*rr-(4./3)*rrr;
794  // } else return 0;
795  }
796 
797  inline double evalDiffWeight(const double r) {
798  const double rr = r * r;
799  const double rrr = rr * r;
800  if (r < 1) {
801  return -12 * r + 24 * rr - 12 * rrr;
802  } else {
803  return 0;
804  }
805  // if(r<=0.5) {
806  // return -8*r+12*rr;
807  // } else if(r<=1) {
808  // return -4+8*r-4*rr;
809  // } else return 0;
810  }
811 
812  inline double evalDiffDiffWeight(const double r) {
813  const double rr = r * r;
814  if (r < 1) {
815  return -36 * rr + 48 * r - 12;
816  } else {
817  return 0;
818  }
819  }
820 
821  std::vector<EntityHandle> treeTets;
822  std::vector<EntityHandle> leafsTetsVecLeaf;
823  std::vector<double> leafsTetsCentre;
824  std::vector<EntityHandle> leafsVec;
825  std::vector<double> leafsDist;
826  std::vector<std::pair<double, EntityHandle>> distLeafs;
827 
828 };
829 
830 } // namespace FractureMechanics
831 
832 #endif //__MWLS_HPP__
FractureMechanics::MWLSApprox::calculateApproxCoeff
MoFEMErrorCode calculateApproxCoeff(bool trim_influence_nodes, bool global_derivatives)
Calculate approximation function coefficients.
Definition: MWLS.cpp:576
MoFEMFunctionReturnHot
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:460
FractureMechanics::MWLSApprox::evalWeight
double evalWeight(const double r)
Definition: MWLS.hpp:781
FractureMechanics::MWLSApprox::evalDiffWeight
double evalDiffWeight(const double r)
Definition: MWLS.hpp:797
FractureMechanics::MWLSApprox::OpMWLSRhoAtGaussUsingPrecalulatedCoeffs::testing
const bool testing
Definition: MWLS.hpp:308
FractureMechanics::MWLSApprox::functionTestHack
boost::function< VectorDouble(const double, const double, const double)> functionTestHack
This is used to set up analytical function for testing approximation.
Definition: MWLS.hpp:602
FractureMechanics::MWLSApprox::thMidNode
Tag thMidNode
Definition: MWLS.hpp:217
FractureMechanics::MWLSApprox::OpMWLSMaterialStressRhs::mwlsApprox
boost::shared_ptr< MWLSApprox > mwlsApprox
Definition: MWLS.hpp:500
FractureMechanics::MWLSApprox::diffStressAtGaussPts
MatrixDouble diffStressAtGaussPts
Definition: MWLS.hpp:203
FractureMechanics::MWLSApprox::elemCentreMap
std::map< EntityHandle, std::array< double, 3 > > elemCentreMap
Definition: MWLS.hpp:637
FractureMechanics::MWLSApprox::trisInBlock
Range trisInBlock
Definition: MWLS.hpp:216
FractureMechanics::MWLSApprox::OpMWLSRhoAtGaussPts::testing
const bool testing
Definition: MWLS.hpp:335
FractureMechanics::MWLSApprox::levelNodes
Range levelNodes
Definition: MWLS.hpp:635
FractureMechanics::MWLSApprox::OpMWLSBase::mwlsApprox
boost::shared_ptr< MWLSApprox > mwlsApprox
Definition: MWLS.hpp:242
MoFEM::Types::VectorDouble3
VectorBoundedArray< double, 3 > VectorDouble3
Definition: Types.hpp:92
FractureMechanics::MWLSApprox::OpMWLSRhoAtGaussPts::OpMWLSRhoAtGaussPts
OpMWLSRhoAtGaussPts(boost::shared_ptr< MatrixDouble > mat_pos_at_pts_ptr, boost::shared_ptr< MatrixDouble > mat_grad_pos_at_pts_ptr, boost::shared_ptr< CrackFrontElement > fe_singular_ptr, boost::shared_ptr< MWLSApprox > mwls_approx, const std::string rho_tag_name, const bool calculate_derivative, const bool calculate_2nd_derivative, bool testing=false)
Definition: MWLS.hpp:336
FractureMechanics::MWLSApprox::OpMWLSMaterialStressLhs_Dx::spaceGradPosAtPtsPtr
boost::shared_ptr< MatrixDouble > spaceGradPosAtPtsPtr
Definition: MWLS.hpp:545
FractureMechanics::MWLSApprox::invAB
MatrixDouble invAB
Definition: MWLS.hpp:648
FractureMechanics::MWLSApprox::outDeviatoricDifference
VecVals outDeviatoricDifference
Definition: MWLS.hpp:668
EntityHandle
FractureMechanics::MWLSApprox::getDataApprox
const VecVals & getDataApprox()
Definition: MWLS.cpp:992
FractureMechanics::MWLSApprox::nbBasePolynomials
int nbBasePolynomials
Definition: MWLS.hpp:614
FractureMechanics::MWLSApprox::OpMWLSRhoAtGaussPts
Evaluate density at integration points.
Definition: MWLS.hpp:330
FractureMechanics::MWLSApprox::OpMWLSStressAtGaussPts::~OpMWLSStressAtGaussPts
virtual ~OpMWLSStressAtGaussPts()=default
FractureMechanics::MWLSApprox::OpMWLSMaterialStressRhs::doWork
MoFEMErrorCode doWork(int side, EntityType type, DataForcesAndSourcesCore::EntData &data)
Definition: MWLS.cpp:1864
FractureMechanics::MWLSApprox::OpMWLSSpatialStressLhs_DX::mwlsApprox
boost::shared_ptr< MWLSApprox > mwlsApprox
Definition: MWLS.hpp:525
young_modulus
double young_modulus
Young modulus.
Definition: plastic.cpp:121
FractureMechanics::MWLSApprox::getDiffDiffDataApprox
const MatDiffDiffVals & getDiffDiffDataApprox()
Definition: MWLS.cpp:1002
FractureMechanics::MWLSApprox::OpMWLSStressAndErrorsAtGaussPts::doWork
MoFEMErrorCode doWork(int side, EntityType type, DataForcesAndSourcesCore::EntData &data)
Definition: MWLS.cpp:1685
FractureMechanics::MWLSApprox::OpMWLSMaterialStressRhs::iNdices
VectorInt iNdices
Definition: MWLS.hpp:502
FractureMechanics::MWLSApprox::OpMWLSMaterialStressRhs::nF
VectorDouble nF
Definition: MWLS.hpp:517
FractureMechanics::MWLSApprox::OpMWLSSpatialStressLhs_DX::doWork
MoFEMErrorCode doWork(int row_side, int col_side, EntityType row_type, EntityType col_type, DataForcesAndSourcesCore::EntData &row_data, DataForcesAndSourcesCore::EntData &col_data)
Definition: MWLS.cpp:1948
FractureMechanics::MWLSApprox::diffB
MatrixDouble diffB[3]
Definition: MWLS.hpp:657
FTensor::row_major
@ row_major
Definition: Layout.hpp:13
FractureMechanics::MWLSApprox::OpMWLSStressPostProcess::OpMWLSStressPostProcess
OpMWLSStressPostProcess(boost::shared_ptr< moab::Interface > post_proc_mesh, boost::shared_ptr< std::vector< EntityHandle >> map_gauss_pts, boost::shared_ptr< MWLSApprox > mwls_approx)
Definition: MWLS.hpp:438
FractureMechanics::MWLSApprox::diffDiffApproxFun
MatrixDouble diffDiffApproxFun
Definition: MWLS.hpp:661
FractureMechanics::MWLSApprox::getMWLSOptions
MoFEMErrorCode getMWLSOptions()
get options from command line for MWLS
Definition: MWLS.cpp:71
FractureMechanics::MWLSApprox::F_lambda
Vec F_lambda
Definition: MWLS.hpp:58
FractureMechanics::MWLSApprox::getErrorAtNode
MoFEMErrorCode getErrorAtNode(Tag th, double &total_stress_at_node, double &total_stress_error_at_node, double &hydro_static_error_at_node, double &deviatoric_error_at_node, double &total_energy, double &total_energy_error, const double young_modulus, const double poisson_ratio)
Get the norm of the error at nod.
Definition: MWLS.cpp:1007
FractureMechanics::MWLSApprox::B
MatrixDouble B
Definition: MWLS.hpp:645
PostProcCommonOnRefMesh::CommonDataForVolume
Definition: PostProcOnRefMesh.hpp:37
FractureMechanics::MWLSApprox::myTree
boost::shared_ptr< BVHTree > myTree
Definition: MWLS.hpp:611
FractureMechanics::MWLSApprox::tetsInBlock
Range tetsInBlock
Definition: MWLS.hpp:215
FractureMechanics::MWLSApprox::OpMWLSRhoAtGaussPts::calculateDerivative
const bool calculateDerivative
Definition: MWLS.hpp:333
FractureMechanics::MWLSApprox::OpMWLSCalculateBaseCoeffcientsForFaceAtGaussPts
OpMWLSCalculateBaseCoeffcientsAtGaussPtsTmpl< FaceElementForcesAndSourcesCore > OpMWLSCalculateBaseCoeffcientsForFaceAtGaussPts
Definition: MWLS.hpp:300
FractureMechanics::MWLSApprox::splitsPerDir
int splitsPerDir
Split per direction in the tree.
Definition: MWLS.hpp:626
FractureMechanics::MWLSApprox::OpMWLSStressAtGaussUsingPrecalulatedCoeffs
Definition: MWLS.hpp:377
FractureMechanics::MWLSApprox::loadMWLSMesh
MoFEMErrorCode loadMWLSMesh(std::string file_name)
Definition: MWLS.cpp:139
FractureMechanics::MWLSApprox::OpMWLSBase::~OpMWLSBase
virtual ~OpMWLSBase()=default
MoFEM::Exceptions::MoFEMErrorCode
PetscErrorCode MoFEMErrorCode
MoFEM/PETSc error code.
Definition: Exceptions.hpp:56
FractureMechanics::MWLSApprox::OpMWLSRhoAtGaussUsingPrecalulatedCoeffs
Definition: MWLS.hpp:302
FractureMechanics::MWLSApprox::diffRhoAtGaussPts
boost::shared_ptr< MatrixDouble > diffRhoAtGaussPts
Definition: MWLS.hpp:207
FractureMechanics::MWLSApprox::OpMWLSStressAtGaussPts::matGradPosAtPtsPtr
boost::shared_ptr< MatrixDouble > matGradPosAtPtsPtr
Definition: MWLS.hpp:409
MoFEM::Types::MatrixDouble
UBlasMatrix< double > MatrixDouble
Definition: Types.hpp:77
FractureMechanics::MWLSApprox::OpMWLSCalculateBaseCoeffcientsAtGaussPtsTmpl::doMWLSWork
MoFEMErrorCode doMWLSWork(int side, EntityType type, DataForcesAndSourcesCore::EntData &data)
Do specific work in operator.
Definition: MWLS.cpp:1237
FractureMechanics::MWLSApprox::mwlsCore
moab::Core mwlsCore
Definition: MWLS.hpp:56
FractureMechanics::MWLSApprox::OpMWLSMaterialStressLhs_DX::forcesOnlyOnEntitiesRow
Range forcesOnlyOnEntitiesRow
Definition: MWLS.hpp:576
FractureMechanics::MWLSApprox::OpMWLSMaterialStressLhs_Dx::mwlsApprox
boost::shared_ptr< MWLSApprox > mwlsApprox
Definition: MWLS.hpp:547
MoFEM::th
Tag th
Definition: Projection10NodeCoordsOnField.cpp:122
FractureMechanics::MWLSApprox::OpMWLSBase::matGradPosAtPtsPtr
boost::shared_ptr< MatrixDouble > matGradPosAtPtsPtr
Definition: MWLS.hpp:240
FractureMechanics::MWLSApprox::evalDiffDiffWeight
double evalDiffDiffWeight(const double r)
Definition: MWLS.hpp:812
FractureMechanics::MWLSApprox::OpMWLSMaterialStressLhs_DX::OpMWLSMaterialStressLhs_DX
OpMWLSMaterialStressLhs_DX(boost::shared_ptr< MatrixDouble > space_grad_pos_at_pts_ptr, boost::shared_ptr< MatrixDouble > mat_grad_pos_at_pts_ptr, boost::shared_ptr< MWLSApprox > mwls_approx, Range *forces_only_on_entities_row=nullptr)
Definition: MWLS.hpp:578
FractureMechanics::MWLSApprox::approxBasePoint
MatrixDouble approxBasePoint
Definition: MWLS.hpp:213
FractureMechanics::MWLSApprox::OpMWLSSpatialStressLhs_DX::iNdices
VectorInt iNdices
Definition: MWLS.hpp:526
FractureMechanics::MWLSApprox::outData
VecVals outData
Definition: MWLS.hpp:664
FractureMechanics::MWLSApprox::calculateBase
MoFEMErrorCode calculateBase(const T &t_coords)
Definition: MWLS.hpp:675
FractureMechanics::MWLSApprox::OpMWLSSpatialStressLhs_DX
Definition: MWLS.hpp:522
FractureMechanics::MWLSApprox::evaluateApproxFun
MoFEMErrorCode evaluateApproxFun(double eval_point[3])
evaluate approximation function at material point
Definition: MWLS.cpp:801
FractureMechanics::MWLSApprox::diffApproxFun
MatrixDouble diffApproxFun
Definition: MWLS.hpp:660
FractureMechanics::MWLSApprox::OpMWLSStressAndErrorsAtGaussPts::stressTagName
std::string stressTagName
Definition: MWLS.hpp:456
MoFEM::ForcesAndSourcesCore::UserDataOperator::OPROWCOL
@ OPROWCOL
operator doWork is executed on FE rows &columns
Definition: ForcesAndSourcesCore.hpp:569
FractureMechanics::MWLSApprox::OpMWLSSpatialStressRhs::matGradPosAtPtsPtr
boost::shared_ptr< MatrixDouble > matGradPosAtPtsPtr
Definition: MWLS.hpp:478
FractureMechanics::MWLSApprox::leafsVec
std::vector< EntityHandle > leafsVec
Definition: MWLS.hpp:824
FractureMechanics::MWLSApprox::OpMWLSBase::OpMWLSBase
OpMWLSBase(boost::shared_ptr< MatrixDouble > mat_pos_at_pts_ptr, boost::shared_ptr< MatrixDouble > mat_grad_pos_at_pts_ptr, boost::shared_ptr< CrackFrontElement > fe_singular_ptr, boost::shared_ptr< MWLSApprox > mwls_approx, bool testing=false)
Definition: MWLS.hpp:244
sdf.r
int r
Definition: sdf.py:8
FractureMechanics::MWLSApprox::leafsTetsVecLeaf
std::vector< EntityHandle > leafsTetsVecLeaf
Definition: MWLS.hpp:822
FractureMechanics::MWLSApprox::approxPointCoords
VectorDouble3 approxPointCoords
Definition: MWLS.hpp:214
FractureMechanics::MWLSApprox::outDiffData
MatDiffVals outDiffData
Definition: MWLS.hpp:671
FractureMechanics::MWLSApprox::MatDiffVals
ublas::matrix< double, ublas::row_major, ublas::bounded_array< double, 27 > > MatDiffVals
Definition: MWLS.hpp:178
MoFEM::DeprecatedCoreInterface
Deprecated interface functions.
Definition: DeprecatedCoreInterface.hpp:16
FractureMechanics::MWLSApprox::L
ublas::triangular_matrix< double, ublas::lower > L
Definition: MWLS.hpp:644
FractureMechanics::MWLSApprox::influenceNodesData
MatrixDouble influenceNodesData
Definition: MWLS.hpp:663
FractureMechanics::MWLSApprox::OpMWLSStressAtGaussPts::doMWLSWork
MoFEMErrorCode doMWLSWork(int side, EntityType type, DataForcesAndSourcesCore::EntData &data)
Do specific work in operator.
Definition: MWLS.cpp:1582
FractureMechanics::MWLSApprox::influenceNodes
std::vector< EntityHandle > influenceNodes
Definition: MWLS.hpp:636
FractureMechanics::MWLSApprox::approxFun
VectorDouble approxFun
Definition: MWLS.hpp:647
FractureMechanics::MWLSApprox::OpMWLSBase
Definition: MWLS.hpp:238
FractureMechanics::MWLSApprox::OpMWLSStressPostProcess::mapGaussPtsPtr
boost::shared_ptr< std::vector< EntityHandle > > mapGaussPtsPtr
Definition: MWLS.hpp:435
FractureMechanics::MWLSApprox::OpMWLSSpatialStressRhs::mwlsApprox
boost::shared_ptr< MWLSApprox > mwlsApprox
Definition: MWLS.hpp:479
MoFEM::Interface
DeprecatedCoreInterface Interface
Definition: Interface.hpp:2010
FractureMechanics::MWLSApprox::OpMWLSStressAtGaussPts
Evaluate stress at integration points.
Definition: MWLS.hpp:404
FractureMechanics::MWLSApprox
Definition: MWLS.hpp:53
FractureMechanics::MWLSApprox::OpMWLSMaterialStressRhs::OpMWLSMaterialStressRhs
OpMWLSMaterialStressRhs(boost::shared_ptr< MatrixDouble > space_grad_pos_at_pts_ptr, boost::shared_ptr< MatrixDouble > mat_grad_pos_at_pts_ptr, boost::shared_ptr< MWLSApprox > mwls_approx, Range *forces_only_on_entities_row=NULL)
Definition: MWLS.hpp:504
FractureMechanics::MWLSApprox::levelEdges
Range levelEdges
Definition: MWLS.hpp:635
FractureMechanics::MWLSApprox::outHydroStaticError
double outHydroStaticError
Definition: MWLS.hpp:666
FractureMechanics::MWLSApprox::OpMWLSCalculateBaseCoeffcientsAtGaussPtsTmpl::testing
const bool testing
Definition: MWLS.hpp:279
FractureMechanics::MWLSApprox::OpMWLSSpatialStressLhs_DX::matGradPosAtPtsPtr
boost::shared_ptr< MatrixDouble > matGradPosAtPtsPtr
Definition: MWLS.hpp:524
FractureMechanics::MWLSApprox::singularCurrentDisplacement
MatrixDouble singularCurrentDisplacement
Definition: MWLS.hpp:211
FractureMechanics::MWLSApprox::stressAtGaussPts
MatrixDouble stressAtGaussPts
Definition: MWLS.hpp:202
FractureMechanics::MWLSApprox::OpMWLSRhoAtGaussPts::calculate2ndDerivative
const bool calculate2ndDerivative
Definition: MWLS.hpp:334
FractureMechanics::MWLSApprox::OpMWLSStressPostProcess::mwlsApproxPtr
boost::shared_ptr< MWLSApprox > mwlsApproxPtr
Definition: MWLS.hpp:436
FractureMechanics::MWLSApprox::OpMWLSBase::feSingularPtr
boost::weak_ptr< CrackFrontElement > feSingularPtr
Definition: MWLS.hpp:241
FractureMechanics::MWLSApprox::OpMWLSMaterialStressLhs_DX::mwlsApprox
boost::shared_ptr< MWLSApprox > mwlsApprox
Definition: MWLS.hpp:575
FractureMechanics::MWLSApprox::invABMap
std::map< EntityHandle, std::vector< MatrixDouble > > invABMap
Store Coefficient of base functions at integration points.
Definition: MWLS.hpp:223
FractureMechanics::MWLSApprox::diffInvA
ublas::symmetric_matrix< double, ublas::lower, ublas::row_major, DoubleAllocator > diffInvA[3]
Definition: MWLS.hpp:656
FractureMechanics::MWLSApprox::rhoAtGaussPts
boost::shared_ptr< VectorDouble > rhoAtGaussPts
Definition: MWLS.hpp:206
FractureMechanics::MWLSApprox::OpMWLSStressAtGaussPts::OpMWLSStressAtGaussPts
OpMWLSStressAtGaussPts(boost::shared_ptr< MatrixDouble > mat_pos_at_pts_ptr, boost::shared_ptr< MatrixDouble > mat_grad_pos_at_pts_ptr, boost::shared_ptr< CrackFrontElement > fe_singular_ptr, boost::shared_ptr< MWLSApprox > mwls_approx, const std::string stress_tag_name, bool calculate_derivative, bool testing=false)
Definition: MWLS.hpp:410
FractureMechanics::MWLSApprox::OpMWLSRhoPostProcess::mapGaussPtsPtr
boost::shared_ptr< std::vector< EntityHandle > > mapGaussPtsPtr
Definition: MWLS.hpp:359
MoFEM
implementation of Data Operators for Forces and Sources
Definition: Common.hpp:10
FractureMechanics::MWLSApprox::influenceNodesMap
std::map< EntityHandle, std::vector< std::vector< EntityHandle > > > influenceNodesMap
Influence nodes on elements on at integration points.
Definition: MWLS.hpp:230
FractureMechanics::MWLSApprox::evaluateSecondDiffApproxFun
MoFEMErrorCode evaluateSecondDiffApproxFun(double eval_point[3], bool global_derivatives)
evaluate 2nd derivative of approximation function at material point
Definition: MWLS.cpp:921
FractureMechanics::MWLSApprox::OpMWLSCalculateBaseCoeffcientsAtGaussPtsTmpl
Definition: MWLS.hpp:277
FractureMechanics::MWLSApprox::OpMWLSStressAtGaussPts::testing
const bool testing
Definition: MWLS.hpp:408
FractureMechanics::MWLSApprox::OpMWLSStressAndErrorsAtGaussPts::mwlsApproxPtr
boost::shared_ptr< MWLSApprox > mwlsApproxPtr
Definition: MWLS.hpp:457
FractureMechanics::MWLSApprox::arcLengthDof
boost::weak_ptr< DofEntity > arcLengthDof
Definition: MWLS.hpp:60
MoFEM::ForcesAndSourcesCore::UserDataOperator
Definition: ForcesAndSourcesCore.hpp:549
FractureMechanics::MWLSApprox::~MWLSApprox
virtual ~MWLSApprox()=default
FractureMechanics::MWLSApprox::OpMWLSRhoPostProcess::postProcMeshPtr
boost::shared_ptr< moab::Interface > postProcMeshPtr
Definition: MWLS.hpp:358
FractureMechanics::MWLSApprox::A
ublas::symmetric_matrix< double, ublas::lower > A
Definition: MWLS.hpp:641
FractureMechanics::MWLSApprox::OpMWLSMaterialStressLhs_Dx
Definition: MWLS.hpp:543
FractureMechanics::MWLSApprox::OpMWLSMaterialStressLhs_DX::nA
MatrixDouble nA
Definition: MWLS.hpp:592
FractureMechanics::MWLSApprox::outDeviatoricError
double outDeviatoricError
Definition: MWLS.hpp:669
double
convert.type
type
Definition: convert.py:64
FractureMechanics::MWLSApprox::mwlsMaterialPositions
MatrixDouble mwlsMaterialPositions
Definition: MWLS.hpp:212
FractureMechanics::MWLSApprox::OpMWLSStressAtGaussPts::stressTagName
std::string stressTagName
Definition: MWLS.hpp:406
FractureMechanics::MWLSApprox::OpMWLSRhoAtGaussPts::rhoTagName
std::string rhoTagName
Definition: MWLS.hpp:331
FractureMechanics::MWLSApprox::OpMWLSMaterialStressLhs_Dx::matGradPosAtPtsPtr
boost::shared_ptr< MatrixDouble > matGradPosAtPtsPtr
Definition: MWLS.hpp:546
FractureMechanics::MWLSApprox::leafsDist
std::vector< double > leafsDist
Definition: MWLS.hpp:825
FractureMechanics::MWLSApprox::OpMWLSBase::doMWLSWork
virtual MoFEMErrorCode doMWLSWork(int side, EntityType type, DataForcesAndSourcesCore::EntData &data)=0
Do specific work in operator.
FractureMechanics::MWLSApprox::OpMWLSRhoPostProcess::mwlsApproxPtr
boost::shared_ptr< MWLSApprox > mwlsApproxPtr
Definition: MWLS.hpp:360
FractureMechanics::MWLSApprox::OpMWLSStressAtGaussUsingPrecalulatedCoeffs::doMWLSWork
MoFEMErrorCode doMWLSWork(int side, EntityType type, DataForcesAndSourcesCore::EntData &data)
Do specific work in operator.
Definition: MWLS.cpp:1504
FractureMechanics::MWLSApprox::dmFactor
double dmFactor
Relative value of weight function radius.
Definition: MWLS.hpp:617
poisson_ratio
double poisson_ratio
Poisson ratio.
Definition: plastic.cpp:122
FractureMechanics::MWLSApprox::maxThreeDepth
int maxThreeDepth
Maximal three depths.
Definition: MWLS.hpp:625
FractureMechanics::MWLSApprox::treeRoot
EntityHandle treeRoot
Definition: MWLS.hpp:632
FractureMechanics::MWLSApprox::OpMWLSRhoPostProcess::doWork
PetscErrorCode doWork(int side, EntityType type, DataForcesAndSourcesCore::EntData &data)
Definition: MWLS.cpp:1458
FractureMechanics::MWLSApprox::OpMWLSSpatialStressRhs::OpMWLSSpatialStressRhs
OpMWLSSpatialStressRhs(boost::shared_ptr< MatrixDouble > mat_grad_pos_at_pts_ptr, boost::shared_ptr< MWLSApprox > mwls_approx, const bool testing=false)
Definition: MWLS.hpp:481
FractureMechanics::MWLSApprox::OpMWLSMaterialStressRhs::F_lambda
Vec & F_lambda
Definition: MWLS.hpp:503
FractureMechanics::MWLSApprox::mwlsMoab
moab::Interface & mwlsMoab
Definition: MWLS.hpp:57
FractureMechanics::MWLSApprox::VecVals
ublas::vector< double, ublas::bounded_array< double, 9 > > VecVals
Definition: MWLS.hpp:175
FractureMechanics::MWLSApprox::testA
ublas::symmetric_matrix< double, ublas::lower > testA
Definition: MWLS.hpp:642
FractureMechanics::MWLSApprox::OpMWLSMaterialStressLhs_DX
Definition: MWLS.hpp:571
FractureMechanics::MWLSApprox::OpMWLSMaterialStressRhs::spaceGradPosAtPtsPtr
boost::shared_ptr< MatrixDouble > spaceGradPosAtPtsPtr
Definition: MWLS.hpp:498
FractureMechanics::MWLSApprox::invA
MatrixDouble invA
Definition: MWLS.hpp:643
FractureMechanics::MWLSApprox::evaluateFirstDiffApproxFun
MoFEMErrorCode evaluateFirstDiffApproxFun(double eval_point[3], bool global_derivatives)
evaluate 1st derivative of approximation function at material point
Definition: MWLS.cpp:836
FractureMechanics::MWLSApprox::OpMWLSRhoPostProcess::OpMWLSRhoPostProcess
OpMWLSRhoPostProcess(boost::shared_ptr< moab::Interface > &post_proc_mesh, boost::shared_ptr< std::vector< EntityHandle >> &map_gauss_pts, boost::shared_ptr< MWLSApprox > mwls_approx, PostProcVolumeOnRefinedMesh::CommonData &common_data)
Definition: MWLS.hpp:363
FractureMechanics::MWLSApprox::OpMWLSStressPostProcess::doWork
PetscErrorCode doWork(int side, EntityType type, DataForcesAndSourcesCore::EntData &data)
Definition: MWLS.cpp:1648
FractureMechanics::MWLSApprox::OpMWLSRhoPostProcess::commonData
PostProcVolumeOnRefinedMesh::CommonData & commonData
Definition: MWLS.hpp:361
FractureMechanics::MWLSApprox::OpMWLSMaterialStressLhs_DX::doWork
MoFEMErrorCode doWork(int row_side, int col_side, EntityType row_type, EntityType col_type, DataForcesAndSourcesCore::EntData &row_data, DataForcesAndSourcesCore::EntData &col_data)
Definition: MWLS.cpp:2163
FractureMechanics::MWLSApprox::calculateDiffDiffBase
MoFEMErrorCode calculateDiffDiffBase(const T &t_coords, const double dm)
Definition: MWLS.hpp:750
FractureMechanics::MWLSApprox::OpMWLSStressAtGaussUsingPrecalulatedCoeffs::calculateDerivative
const bool calculateDerivative
Definition: MWLS.hpp:381
FractureMechanics::MWLSApprox::outDiffDiffData
MatDiffDiffVals outDiffDiffData
Definition: MWLS.hpp:672
FractureMechanics::MWLSApprox::OpMWLSMaterialStressRhs::forcesOnlyOnEntitiesRow
Range forcesOnlyOnEntitiesRow
Definition: MWLS.hpp:501
FractureMechanics::MWLSApprox::getInvAB
MatrixDouble & getInvAB()
Definition: MWLS.hpp:604
FractureMechanics::MWLSApprox::OpMWLSBase::doWork
MoFEMErrorCode doWork(int side, EntityType type, DataForcesAndSourcesCore::EntData &data)
Definition: MWLS.cpp:1111
FractureMechanics::MWLSApprox::getDiffDataApprox
const MatDiffVals & getDiffDataApprox()
Definition: MWLS.cpp:997
MoFEM::VolumeElementForcesAndSourcesCore::UserDataOperator
Definition: VolumeElementForcesAndSourcesCore.hpp:108
FractureMechanics::MWLSApprox::maxEdgeL
double maxEdgeL
Definition: MWLS.hpp:633
FaceElementForcesAndSourcesCore
FractureMechanics::MWLSApprox::baseFunInvA
VectorDouble baseFunInvA
Definition: MWLS.hpp:649
EntData
EntitiesFieldData::EntData EntData
Definition: child_and_parent.cpp:37
MoFEM::Types::DoubleAllocator
VecAllocator< double > DoubleAllocator
Definition: Types.hpp:62
FractureMechanics::MWLSApprox::getShortenDm
auto & getShortenDm()
Definition: MWLS.hpp:608
FractureMechanics::MWLSApprox::baseFun
VectorDouble baseFun
Definition: MWLS.hpp:646
FractureMechanics::MWLSApprox::OpMWLSStressAtGaussUsingPrecalulatedCoeffs::stressTagName
std::string stressTagName
Definition: MWLS.hpp:380
FractureMechanics::MWLSApprox::shortenDm
double shortenDm
Definition: MWLS.hpp:618
FractureMechanics::MWLSApprox::OpMWLSMaterialStressLhs_Dx::iNdices
VectorInt iNdices
Definition: MWLS.hpp:549
FractureMechanics::MWLSApprox::maxElemsInDMFactor
int maxElemsInDMFactor
Definition: MWLS.hpp:620
FractureMechanics::MWLSApprox::OpMWLSStressPostProcess
Definition: MWLS.hpp:431
FractureMechanics::MWLSApprox::mwlsAnalyticalInternalStressTest
PetscBool mwlsAnalyticalInternalStressTest
Definition: MWLS.hpp:630
FractureMechanics::MWLSApprox::OpMWLSStressAndErrorsAtGaussPts::OpMWLSStressAndErrorsAtGaussPts
OpMWLSStressAndErrorsAtGaussPts(boost::shared_ptr< MWLSApprox > mwls_approx, const std::string stress_tag_name, MoFEM::Interface &m_field)
Definition: MWLS.hpp:460
Range
FractureMechanics::MWLSApprox::OpMWLSBase::matPosAtPtsPtr
boost::shared_ptr< MatrixDouble > matPosAtPtsPtr
Definition: MWLS.hpp:239
FractureMechanics::MWLSApprox::OpMWLSSpatialStressLhs_DX::nA
MatrixDouble nA
Definition: MWLS.hpp:536
FractureMechanics::MWLSApprox::mField
MoFEM::Interface & mField
Definition: MWLS.hpp:55
FractureMechanics::MWLSApprox::OpMWLSRhoAtGaussUsingPrecalulatedCoeffs::OpMWLSRhoAtGaussUsingPrecalulatedCoeffs
OpMWLSRhoAtGaussUsingPrecalulatedCoeffs(boost::shared_ptr< MatrixDouble > mat_pos_at_pts_ptr, boost::shared_ptr< MatrixDouble > mat_grad_pos_at_pts_ptr, boost::shared_ptr< CrackFrontElement > fe_singular_ptr, boost::shared_ptr< MWLSApprox > mwls_approx, const std::string rho_tag_name, const bool calculate_derivative, const bool calculate_2nd_derivative, bool testing=false)
Definition: MWLS.hpp:309
FractureMechanics::MWLSApprox::OpMWLSSpatialStressRhs::doWork
MoFEMErrorCode doWork(int side, EntityType type, DataForcesAndSourcesCore::EntData &data)
Definition: MWLS.cpp:1800
MoFEM::Core
CoreTmp< 0 > Core
Definition: Core.hpp:1148
FractureMechanics::MWLSApprox::diffA
ublas::symmetric_matrix< double, ublas::lower, ublas::row_major, DoubleAllocator > diffA[3]
Definition: MWLS.hpp:653
FractureMechanics::MWLSApprox::leafsTetsCentre
std::vector< double > leafsTetsCentre
Definition: MWLS.hpp:823
FractureMechanics::MWLSApprox::diffBaseFun
VectorDouble diffBaseFun[3]
Definition: MWLS.hpp:658
FractureMechanics::MWLSApprox::OpMWLSRhoPostProcess
Definition: MWLS.hpp:355
UserDataOperator
ForcesAndSourcesCore::UserDataOperator UserDataOperator
Definition: HookeElement.hpp:75
FractureMechanics::MWLSApprox::OpMWLSRhoAtGaussUsingPrecalulatedCoeffs::doMWLSWork
MoFEMErrorCode doMWLSWork(int side, EntityType type, DataForcesAndSourcesCore::EntData &data)
Do specific work in operator.
Definition: MWLS.cpp:1293
FractureMechanics::MWLSApprox::OpMWLSMaterialStressLhs_DX::spaceGradPosAtPtsPtr
boost::shared_ptr< MatrixDouble > spaceGradPosAtPtsPtr
Definition: MWLS.hpp:573
MoFEM::Types::VectorInt
UBlasVector< int > VectorInt
Definition: Types.hpp:67
FractureMechanics::MWLSApprox::useNodalData
PetscBool useNodalData
Definition: MWLS.hpp:629
FractureMechanics::MWLSApprox::MatDiffDiffVals
ublas::matrix< double, ublas::row_major, ublas::bounded_array< double, 81 > > MatDiffDiffVals
Definition: MWLS.hpp:181
FractureMechanics::MWLSApprox::getInfluenceNodes
std::vector< EntityHandle > & getInfluenceNodes()
Definition: MWLS.hpp:605
FractureMechanics::MWLSApprox::OpMWLSSpatialStressRhs::testing
const bool testing
Definition: MWLS.hpp:480
FractureMechanics::MWLSApprox::OpMWLSCalculateBaseCoeffcientsAtGaussPtsTmpl::OpMWLSCalculateBaseCoeffcientsAtGaussPtsTmpl
OpMWLSCalculateBaseCoeffcientsAtGaussPtsTmpl(boost::shared_ptr< MatrixDouble > mat_pos_at_pts_ptr, boost::shared_ptr< MatrixDouble > mat_grad_pos_at_pts_ptr, boost::shared_ptr< CrackFrontElement > fe_singular_ptr, boost::shared_ptr< MWLSApprox > mwls_approx, bool testing=false)
Definition: MWLS.hpp:280
FractureMechanics::MWLSApprox::calculateDiffBase
MoFEMErrorCode calculateDiffBase(const T &t_coords, const double dm)
Definition: MWLS.hpp:701
EigenMatrix::Vec
const FTensor::Tensor2< T, Dim, Dim > Vec
Definition: MatrixFunction.hpp:66
FractureMechanics::MWLSApprox::MWLSApprox
MWLSApprox(MoFEM::Interface &m_field, Vec F_lambda=PETSC_NULL, boost::shared_ptr< DofEntity > arc_length_dof=nullptr)
Definition: MWLS.cpp:36
FractureMechanics::MWLSApprox::OpMWLSStressPostProcess::postProcMeshPtr
boost::shared_ptr< moab::Interface > postProcMeshPtr
Definition: MWLS.hpp:434
FractureMechanics::MWLSApprox::getTagData
MoFEMErrorCode getTagData(Tag th)
Definition: MWLS.cpp:978
sdf_hertz_2d_axisymm_plane.d
float d
Definition: sdf_hertz_2d_axisymm_plane.py:4
FractureMechanics::MWLSApprox::dmNodesMap
std::map< EntityHandle, std::vector< double > > dmNodesMap
Store weight function radius at the nodes.
Definition: MWLS.hpp:236
FractureMechanics::MWLSApprox::singularInitialDisplacement
MatrixDouble singularInitialDisplacement
Definition: MWLS.hpp:210
MoFEM::Types::VectorDouble
UBlasVector< double > VectorDouble
Definition: Types.hpp:68
FractureMechanics::MWLSApprox::OpMWLSStressAndErrorsAtGaussPts
Evaluate stress at integration points.
Definition: MWLS.hpp:454
FractureMechanics::MWLSApprox::OpMWLSStressAndErrorsAtGaussPts::mField
MoFEM::Interface & mField
Definition: MWLS.hpp:458
FractureMechanics::MWLSApprox::OpMWLSMaterialStressLhs_Dx::OpMWLSMaterialStressLhs_Dx
OpMWLSMaterialStressLhs_Dx(boost::shared_ptr< MatrixDouble > space_grad_pos_at_pts_ptr, boost::shared_ptr< MatrixDouble > mat_grad_pos_at_pts_ptr, boost::shared_ptr< MWLSApprox > mwls_approx, Range *forces_only_on_entities_row=nullptr)
Definition: MWLS.hpp:550
FractureMechanics::MWLSApprox::getUseGlobalBaseAtMaterialReferenceConfiguration
bool getUseGlobalBaseAtMaterialReferenceConfiguration() const
Get the Use Local Base At Material Reference Configuration object.
Definition: MWLS.hpp:76
MoFEMFunctionBeginHot
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:453
FractureMechanics::MWLSApprox::useGlobalBaseAtMaterialReferenceConfiguration
PetscBool useGlobalBaseAtMaterialReferenceConfiguration
Definition: MWLS.hpp:628
FractureMechanics::MWLSApprox::OpMWLSMaterialStressRhs::matGradPosAtPtsPtr
boost::shared_ptr< MatrixDouble > matGradPosAtPtsPtr
Definition: MWLS.hpp:499
FractureMechanics::MWLSApprox::OpMWLSCalculateBaseCoeffcientsAtGaussPts
OpMWLSCalculateBaseCoeffcientsAtGaussPtsTmpl< VolumeElementForcesAndSourcesCore > OpMWLSCalculateBaseCoeffcientsAtGaussPts
Definition: MWLS.hpp:296
FractureMechanics::MWLSApprox::OpMWLSRhoAtGaussUsingPrecalulatedCoeffs::calculateDerivative
const bool calculateDerivative
Definition: MWLS.hpp:306
FractureMechanics::MWLSApprox::OpMWLSSpatialStressLhs_DX::OpMWLSSpatialStressLhs_DX
OpMWLSSpatialStressLhs_DX(boost::shared_ptr< MatrixDouble > mat_grad_pos_at_pts_ptr, boost::shared_ptr< MWLSApprox > mwls_approx)
Definition: MWLS.hpp:527
FractureMechanics::MWLSApprox::OpMWLSMaterialStressLhs_DX::matGradPosAtPtsPtr
boost::shared_ptr< MatrixDouble > matGradPosAtPtsPtr
Definition: MWLS.hpp:574
FractureMechanics::MWLSApprox::OpMWLSMaterialStressRhs
Integrate force vector.
Definition: MWLS.hpp:496
FractureMechanics::MWLSApprox::OpMWLSMaterialStressLhs_Dx::forcesOnlyOnEntitiesRow
Range forcesOnlyOnEntitiesRow
Definition: MWLS.hpp:548
FractureMechanics::MWLSApprox::levelTets
Range levelTets
Definition: MWLS.hpp:635
FractureMechanics::MWLSApprox::treeTets
std::vector< EntityHandle > treeTets
Definition: MWLS.hpp:821
FractureMechanics::MWLSApprox::OpMWLSStressAtGaussUsingPrecalulatedCoeffs::testing
const bool testing
Definition: MWLS.hpp:382
FractureMechanics::MWLSApprox::OpMWLSSpatialStressRhs
Integrate force vector.
Definition: MWLS.hpp:476
FractureMechanics::MWLSApprox::OpMWLSRhoAtGaussUsingPrecalulatedCoeffs::rhoTagName
std::string rhoTagName
Definition: MWLS.hpp:305
FractureMechanics::MWLSApprox::nearestInfluenceNode
EntityHandle nearestInfluenceNode
Definition: MWLS.hpp:639
MoFEM::DataOperator::sYmm
bool sYmm
If true assume that matrix is symmetric structure.
Definition: DataOperators.hpp:82
FractureMechanics::MWLSApprox::getValuesToNodes
MoFEMErrorCode getValuesToNodes(Tag th)
get values form elements to nodes
Definition: MWLS.cpp:275
FractureMechanics::MWLSApprox::diffDiffRhoAtGaussPts
boost::shared_ptr< MatrixDouble > diffDiffRhoAtGaussPts
Definition: MWLS.hpp:208
FractureMechanics::MWLSApprox::OpMWLSRhoAtGaussPts::doMWLSWork
MoFEMErrorCode doMWLSWork(int side, EntityType type, DataForcesAndSourcesCore::EntData &data)
Do specific work in operator.
Definition: MWLS.cpp:1383
FractureMechanics::MWLSApprox::diffDiffBaseFun
VectorDouble diffDiffBaseFun[9]
Definition: MWLS.hpp:659
FractureMechanics::MWLSApprox::OpMWLSRhoAtGaussUsingPrecalulatedCoeffs::calculate2ndDerivative
const bool calculate2ndDerivative
Definition: MWLS.hpp:307
FractureMechanics::MWLSApprox::OpMWLSStressAtGaussPts::calculateDerivative
const bool calculateDerivative
Definition: MWLS.hpp:407
FractureMechanics
Definition: AnalyticalFun.hpp:15
FractureMechanics::MWLSApprox::distLeafs
std::vector< std::pair< double, EntityHandle > > distLeafs
Definition: MWLS.hpp:826
FractureMechanics::MWLSApprox::OpMWLSMaterialStressLhs_Dx::doWork
MoFEMErrorCode doWork(int row_side, int col_side, EntityType row_type, EntityType col_type, DataForcesAndSourcesCore::EntData &row_data, DataForcesAndSourcesCore::EntData &col_data)
Definition: MWLS.cpp:2065
FractureMechanics::MWLSApprox::OpMWLSStressAtGaussUsingPrecalulatedCoeffs::OpMWLSStressAtGaussUsingPrecalulatedCoeffs
OpMWLSStressAtGaussUsingPrecalulatedCoeffs(boost::shared_ptr< MatrixDouble > mat_pos_at_pts_ptr, boost::shared_ptr< MatrixDouble > mat_grad_pos_at_pts_ptr, boost::shared_ptr< CrackFrontElement > fe_singular_ptr, boost::shared_ptr< MWLSApprox > mwls_approx, const std::string stress_tag_name, bool calculate_derivative, bool testing=false)
Definition: MWLS.hpp:384
FractureMechanics::MWLSApprox::OpMWLSSpatialStressRhs::nF
VectorDouble nF
Definition: MWLS.hpp:488
FractureMechanics::MWLSApprox::OpMWLSMaterialStressLhs_DX::iNdices
VectorInt iNdices
Definition: MWLS.hpp:577
MoFEM::ForcesAndSourcesCore::UserDataOperator::OPROW
@ OPROW
operator doWork function is executed on FE rows
Definition: ForcesAndSourcesCore.hpp:567
FractureMechanics::MWLSApprox::OpMWLSMaterialStressLhs_Dx::nA
MatrixDouble nA
Definition: MWLS.hpp:564