18 #ifndef __CRACK_FRONT_ELEMENT_HPP__
19 #define __CRACK_FRONT_ELEMENT_HPP__
25 template <
typename E,
typename B>
class TwoType {};
34 template <
typename ELEMENT,
typename BASE_ELEMENT>
54 const bool &set_singular_coordinates,
55 const Range &crack_front_nodes,
56 const Range &crack_front_nodes_edges,
57 const Range &crack_front_elements,
58 PetscBool add_singularity)
65 CHKERRABORT(PETSC_COMM_WORLD,
ierr);
77 if (this->numeredEntFiniteElementPtr->getEntType() != MBTET)
79 "Element type not implemented");
81 this->getElementPolynomialBase() =
84 CHKERR this->createDataOnElement(MBTET);
85 CHKERR this->calculateVolumeAndJacobian();
87 CHKERR this->setIntegrationPts();
88 CHKERR this->calculateCoordinatesAtGaussPts();
89 CHKERR this->calHierarchicalBaseFunctionsOnElement();
91 CHKERR this->transformBaseFunctions();
94 CHKERR this->loopOverOperators();
107 template <
typename E,
typename B>
109 return E::getSpaceBaseAndOrderOnElement();
113 template <
typename E>
117 CHKERR E::getSpaceBaseAndOrderOnElement();
121 EntityHandle ent = this->numeredEntFiniteElementPtr->getEnt();
124 for (
int nn = 0; nn != 4; nn++) {
131 for (
int ee = 0; ee != 6; ee++) {
133 CHKERR this->mField.get_moab().side_element(ent, 1, ee, edge);
152 template <
typename E>
168 const int edge_nodes[6][2] = {{0, 1}, {1, 2}, {2, 0},
169 {0, 3}, {1, 3}, {2, 3}};
175 this->coordsAtGaussPts.size2());
178 this->coordsAtGaussPts.size2());
181 const size_t nb_gauss_pts = this->gaussPts.size2();
182 sJac.resize(nb_gauss_pts, 9,
false);
183 double *s_jac_ptr = &
sJac(0, 0);
187 s_jac_ptr, &s_jac_ptr[1], &s_jac_ptr[2], &s_jac_ptr[3],
188 &s_jac_ptr[4], &s_jac_ptr[5], &s_jac_ptr[6], &s_jac_ptr[7],
190 for (
unsigned int gg = 0; gg != nb_gauss_pts; ++gg) {
200 double diff_base_n[12];
203 diff_base_n, &diff_base_n[1], &diff_base_n[2]);
206 diff_n, &diff_n[1], &diff_n[2]);
207 for (
int nn = 0; nn != 4; nn++) {
208 t_diff_n(
i) = this->tInvJac(
j,
i) * t_diff_base_n(
j);
213 this->dataH1.dataOnEntities[MBVERTEX][0].getN(
NOBASE);
215 const double base_coords[] = {0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1};
218 for (
int ee = 0; ee != 6; ee++) {
222 const int i0 = edge_nodes[ee][0];
223 const int i1 = edge_nodes[ee][1];
227 PetscPrintf(PETSC_COMM_SELF,
"Warning singular edge on both ends\n");
252 base_coords[3 * i1 + 0] - base_coords[3 * i0 + 0],
253 base_coords[3 * i1 + 1] - base_coords[3 * i0 + 1],
254 base_coords[3 * i1 + 2] - base_coords[3 * i0 + 2]);
261 t_dir(
i) = this->tJac(
i,
j) * t_base_dir(
j);
263 s_jac_ptr, &s_jac_ptr[1], &s_jac_ptr[2], &s_jac_ptr[3],
264 &s_jac_ptr[4], &s_jac_ptr[5], &s_jac_ptr[6], &s_jac_ptr[7],
274 for (
size_t gg = 0; gg != nb_gauss_pts; gg++) {
275 double t_n = shape_n(gg, i0) * shape_n(gg, i1);
277 shape_n(gg, i0) * diff_n[3 * i1 + 0] +
278 shape_n(gg, i1) * diff_n[3 * i0 + 0],
279 shape_n(gg, i0) * diff_n[3 * i1 + 1] +
280 shape_n(gg, i1) * diff_n[3 * i0 + 1],
281 shape_n(gg, i0) * diff_n[3 * i1 + 2] +
282 shape_n(gg, i1) * diff_n[3 * i0 + 2]);
283 t_s_jac(
i,
j) += t_dir(
i) * t_diff_n(
j);
284 t_singular_displacement(
i) += t_dir(
i) * t_n;
285 t_singular_ref_displacement(
i) += t_base_dir(
i) * t_n;
286 ++t_singular_displacement;
287 ++t_singular_ref_displacement;
295 s_jac_ptr, &s_jac_ptr[1], &s_jac_ptr[2], &s_jac_ptr[3],
296 &s_jac_ptr[4], &s_jac_ptr[5], &s_jac_ptr[6], &s_jac_ptr[7],
299 invSJac.resize(nb_gauss_pts, 9,
false);
300 double *inv_s_jac_ptr = &
invSJac(0, 0);
302 inv_s_jac_ptr, &inv_s_jac_ptr[1], &inv_s_jac_ptr[2],
303 &inv_s_jac_ptr[3], &inv_s_jac_ptr[4], &inv_s_jac_ptr[5],
304 &inv_s_jac_ptr[6], &inv_s_jac_ptr[7], &inv_s_jac_ptr[8], 9);
307 detS.resize(nb_gauss_pts,
false);
308 for (
size_t gg = 0; gg != nb_gauss_pts; gg++) {
332 return E::getRule(
order);
347 template <
typename E,
typename B>
349 return E::setGaussPts(
order);
359 template <
typename ELEMENT,
typename BASE_ELEMENT>
363 ierr = PetscOptionsBegin(PETSC_COMM_WORLD,
"",
"Get singular element options",
366 refinementLevels = 3;
367 ierr = PetscOptionsInt(
"-se_number_of_refinement_levels",
368 "approximation geometry order",
"", refinementLevels,
369 &refinementLevels, PETSC_NULL);
371 refineIntegration = PETSC_TRUE;
373 PetscOptionsBool(
"-se_refined_integration",
374 "if set element is subdivided to generate quadrature",
375 "", refineIntegration, &refineIntegration, PETSC_NULL);
377 ierr = PetscOptionsEnd();
386 VolumeElementForcesAndSourcesCore>::
388 VolumeElementForcesAndSourcesCore>,
395 VolumeElementForcesAndSourcesCore>::
397 VolumeElementForcesAndSourcesCore>,
401 VolumeElementForcesAndSourcesCore>
409 boost::ptr_vector<NeumannForcesSurface::MethodForAnalyticalForce>
413 VolumeElementForcesAndSourcesCore>
422 const Range &crack_front_nodes,
const Range &crack_front_nodes_edges,
423 const Range &crack_front_elements, PetscBool add_singularity,
425 boost::ptr_vector<MethodForForceScaling> &methods_op,
426 boost::ptr_vector<NeumannForcesSurface::MethodForAnalyticalForce>
427 &analytical_force_op);
436 using VolumeElementForcesAndSourcesCoreOnSide::
437 VolumeElementForcesAndSourcesCoreOnSide;
440 using VolumeElementForcesAndSourcesCoreOnSide::
441 calHierarchicalBaseFunctionsOnElement;
449 boost::ptr_vector<NeumannForcesSurface::MethodForAnalyticalForce>
454 boost::shared_ptr<MatrixDouble>
hG;
455 boost::shared_ptr<MatrixDouble>
HG;
464 const Range &crack_front_nodes,
const Range &crack_front_nodes_edges,
465 const Range &crack_front_elements, PetscBool add_singularity,
467 boost::ptr_vector<MethodForForceScaling> &methods_op,
468 boost::ptr_vector<NeumannForcesSurface::MethodForAnalyticalForce>
469 &analytical_force_op,
470 Range *forces_only_on_entities_row = NULL);
485 const std::string
field_name, boost::shared_ptr<MatrixDouble> data_at_pts,
502 std::vector<VectorDouble> &values_at_gauss_pts,
503 std::vector<MatrixDouble> &gradient_at_gauss_pts,
bool &singular_element,
506 field_name, values_at_gauss_pts, gradient_at_gauss_pts),
521 singular_element, inv_s_jac) {}
530 boost::shared_ptr<MatrixDouble>
H;
534 std::vector<EntityHandle> &map_gauss_pts,
535 boost::shared_ptr<MatrixDouble> &
H)
554 bool apply_det =
true)
589 HookeElement::DataAtIntegrationPts &common_data,
590 boost::shared_ptr<VectorDouble> rho_at_gauss_pts,
591 boost::shared_ptr<MatrixDouble> rho_grad_at_gauss_pts,
592 Range tets_in_block,
const double rho_0,
const double bone_n,
593 Range *forces_only_on_entities_row = NULL);
626 HookeElement::DataAtIntegrationPts &common_data,
627 boost::shared_ptr<VectorDouble> rho_at_gauss_pts,
628 boost::shared_ptr<MatrixDouble> diff_rho_at_gauss_pts,
629 boost::shared_ptr<MatrixDouble> diff_diff_rho_at_gauss_pts,
631 const double bone_n,
Range *forces_only_on_entities_row = NULL);
652 HookeElement::DataAtIntegrationPts &common_data,
653 boost::shared_ptr<VectorDouble> rho_at_gauss_pts,
654 boost::shared_ptr<MatrixDouble> diff_rho_at_gauss_pts,
655 boost::shared_ptr<MatrixDouble> diff_diff_rho_at_gauss_pts,
657 const double bone_n,
Range *forces_only_on_entities_row = NULL);
679 boost::shared_ptr<HookeElement::DataAtIntegrationPts>
dataAtPts;
690 const std::string row_field,
const std::string col_field,
691 boost::shared_ptr<HookeElement::DataAtIntegrationPts> &data_at_pts,
692 boost::shared_ptr<VectorDouble> rho_at_gauss_pts,
693 boost::shared_ptr<MatrixDouble> rho_grad_at_gauss_pts,
const double rho_n,
695 boost::shared_ptr<MatrixDouble> singular_displacement);
725 boost::shared_ptr<HookeElement::DataAtIntegrationPts>
dataAtPts;
736 const std::string row_field,
const std::string col_field,
737 boost::shared_ptr<HookeElement::DataAtIntegrationPts> &data_at_pts,
738 boost::shared_ptr<VectorDouble> rho_at_gauss_pts,
739 boost::shared_ptr<MatrixDouble> rho_grad_at_gauss_pts,
const double rho_n,
741 boost::shared_ptr<MatrixDouble> singular_displacement);
770 const std::string row_field,
771 boost::shared_ptr<MatrixDouble> mat_coords_ptr,
772 boost::shared_ptr<VectorDouble> density_at_pts,
773 boost::shared_ptr<MatrixDouble> rho_grad_at_gauss_pts_ptr,
774 boost::shared_ptr<MatrixDouble> rho_grad_grad_at_gauss_pts_ptr,
775 boost::shared_ptr<CrackFrontElement> fe_singular_ptr,
777 boost::shared_ptr<MatrixDouble> mat_grad_pos_at_pts_ptr)
803 vector<EntityHandle> &map_gauss_pts,
Range &range_to_tag,
804 const string &tag_name,
int tag_value = 1)
816 #endif // __CRACK_FRONT_ELEMENT_HPP__