• Main Page
  • Related Pages
  • Namespaces
  • Classes
  • Files
  • File List
  • File Members

AAdapt_StressFracture.cpp

Go to the documentation of this file.
00001 //*****************************************************************//
00002 //    Albany 2.0:  Copyright 2012 Sandia Corporation               //
00003 //    This Software is released under the BSD license detailed     //
00004 //    in the file "license.txt" in the top-level Albany directory  //
00005 //*****************************************************************//
00006 
00007 #include "AAdapt_StressFracture.hpp"
00008 
00009 #include <cassert>
00010 #include "Teuchos_ScalarTraits.hpp"
00011 
00012 namespace AAdapt {
00013 
00014 //----------------------------------------------------------------------------
00015 //
00016 // Default constructor for stress fracture criteria
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 // Stress fracture criterion function.
00031 //
00032 bool
00033 StressFracture::computeFractureCriterion(stk::mesh::Entity& entity, double p) {
00034   // Fracture only defined on the boundary of the elements
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   // Need an element on each side of the edge
00042   if(neighbor_elems.size() != 2)
00043     return false;
00044 
00045   // Note that these are element GIDs
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   // Have two elements, one on each size of the edge (or
00055   // face). Check and see if the stresses are such that we want to
00056   // split the mesh here.
00057   //
00058   // Initial hack - GAH: if the average stress between two elements
00059   // is above the input value "Fracture Stress", split them at the
00060   // edge
00061 
00062   bool is_open = false;
00063 
00064   // Check criterion
00065   // If average between cells is above crit, split
00066   //  if (0.5 * (avg_stresses[elemGIDws[elem_0_Id].ws][elemGIDws[elem_0_Id].LID] +
00067   //    avg_stresses[elemGIDws[elem_1_Id].ws][elemGIDws[elem_1_Id].LID]) >= crit_stress){
00068   // If stress difference across face it above crit, split
00069   //  if (fabs(avg_stresses[elemGIDws[elem_0_Id].ws][elemGIDws[elem_0_Id].LID] -
00070   //    avg_stresses[elemGIDws[elem_1_Id].ws][elemGIDws[elem_1_Id].LID]) >= crit_stress){
00071   // Just split the doggone elements already!!!
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       //std::cout << avg_stresses[elemGIDws[elem_0_Id].ws][elemGIDws[elem_0_Id].LID] << " " <<
00080       //    avg_stresses[elemGIDws[elem_1_Id].ws][elemGIDws[elem_1_Id].LID] << std::endl;
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 } // namespace LCM
00109 

Generated on Wed Mar 26 2014 18:36:35 for Albany: a Trilinos-based PDE code by  doxygen 1.7.1