Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007 #include "AAdapt_StressFracture.hpp"
00008
00009 #include <cassert>
00010 #include "Teuchos_ScalarTraits.hpp"
00011
00012 namespace AAdapt {
00013
00014
00015
00016
00017
00018 StressFracture::StressFracture(int num_dim, stk::mesh::EntityRank& element_rank,
00019 const std::vector<std::vector<double> >& stresses,
00020 double crit_stress,
00021 Albany::STKDiscretization& stk) :
00022 AbstractFractureCriterion(num_dim, element_rank),
00023 avg_stresses_(stresses),
00024 critical_stress_(crit_stress),
00025 stk_(stk) {
00026 }
00027
00028
00029
00030
00031
00032 bool
00033 StressFracture::computeFractureCriterion(stk::mesh::Entity& entity, double p) {
00034
00035 stk::mesh::EntityRank rank = entity.entity_rank();
00036 assert(rank == num_dim_ - 1);
00037
00038 stk::mesh::PairIterRelation neighbor_elems =
00039 entity.relations(element_rank_);
00040
00041
00042 if(neighbor_elems.size() != 2)
00043 return false;
00044
00045
00046
00047 stk::mesh::EntityId elem_0_Id =
00048 neighbor_elems[0].entity()->identifier();
00049 stk::mesh::EntityId elem_1_Id =
00050 neighbor_elems[1].entity()->identifier();
00051
00052 Albany::WsLIDList& elemGIDws = stk_.getElemGIDws();
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062 bool is_open = false;
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072 if(p == 5) {
00073 if((elem_0_Id - 1 == 35 && elem_1_Id - 1 == 140) ||
00074 (elem_1_Id - 1 == 35 && elem_0_Id - 1 == 140)) {
00075
00076 is_open = true;
00077
00078 std::cout << "Splitting elements " << elem_0_Id - 1 << " and " << elem_1_Id - 1 << std::endl;
00079
00080
00081
00082 }
00083 }
00084
00085 else if(p == 10) {
00086 if((elem_0_Id - 1 == 42 && elem_1_Id - 1 == 147) ||
00087 (elem_1_Id - 1 == 42 && elem_0_Id - 1 == 147)) {
00088
00089 is_open = true;
00090
00091 std::cout << "Splitting elements " << elem_0_Id - 1 << " and " << elem_1_Id - 1 << std::endl;
00092 }
00093 }
00094
00095 else if(p == 15) {
00096 if((elem_0_Id - 1 == 49 && elem_1_Id - 1 == 154) ||
00097 (elem_1_Id - 1 == 49 && elem_0_Id - 1 == 154)) {
00098
00099 is_open = true;
00100
00101 std::cout << "Splitting elements " << elem_0_Id - 1 << " and " << elem_1_Id - 1 << std::endl;
00102 }
00103 }
00104
00105 return is_open;
00106 }
00107
00108 }
00109