diff --git a/package.cmake b/package.cmake index 901bfe025..1c022ad44 100644 --- a/package.cmake +++ b/package.cmake @@ -1,89 +1,90 @@ #=============================================================================== # @file package.cmake # # @author Nicolas Richart # # # @brief package description for extra materials list # # @section LICENSE # # Copyright (©) 2010-2012, 2014 EPFL (Ecole Polytechnique Fédérale de Lausanne) # Laboratory (LSMS - Laboratoire de Simulation en Mécanique des Solides) # #=============================================================================== package_declare(extra_materials DESCRIPTION "Add the extra list of materials in Akantu" DEPENDS lapack) package_declare_sources(extra_materials material_extra_includes.hh material_damage/material_brittle.cc material_damage/material_brittle.hh material_damage/material_brittle_inline_impl.cc material_damage/material_damage_iterative.cc material_damage/material_damage_iterative.hh material_damage/material_damage_iterative_inline_impl.cc material_damage/material_damage_linear.cc material_damage/material_damage_linear.hh material_damage/material_damage_linear_inline_impl.cc material_damage/material_vreepeerlings.hh material_damage/material_vreepeerlings_inline_impl.cc material_damage/material_vreepeerlings_tmpl.hh material_plastic/material_viscoplastic.cc material_plastic/material_viscoplastic.hh material_plastic/material_viscoplastic_inline_impl.cc material_viscoelastic/material_stiffness_proportional.cc material_viscoelastic/material_stiffness_proportional.hh material_damage/material_orthotropic_damage.hh material_damage/material_orthotropic_damage_tmpl.hh material_damage/material_orthotropic_damage_iterative.cc material_damage/material_orthotropic_damage_iterative.hh material_damage/material_orthotropic_damage_iterative_inline_impl.cc material_damage/material_orthotropic_damage_non_local.hh material_damage/material_vreepeerlings_non_local.cc material_damage/material_vreepeerlings_non_local.hh material_damage/material_brittle_non_local.hh material_damage/material_damage_iterative_non_local.hh + material_damage/material_damage_iterative_non_local.cc material_damage/material_orthotropic_damage_iterative_non_local.hh material_damage/material_vreepeerlings_non_local_inline_impl.cc material_damage/material_brittle_non_local_inline_impl.cc material_damage/material_damage_iterative_non_local_inline_impl.cc material_damage/material_orthotropic_damage_iterative_non_local_inline_impl.cc material_non_local_extra_includes.hh ) package_declare_material_infos(extra_materials LIST AKANTU_EXTRA_MATERIAL_LIST AKANTU_DAMAGE_NON_LOCAL_MATERIAL_EXTRA_LIST INCLUDE material_extra_includes.hh ) package_declare_documentation_files(extra_materials manual-extra_materials.tex manual-appendix-materials-extra-materials.tex figures/stress_strain_visco.pdf ) package_declare_documentation(extra_materials "This package activates additional constitutive laws:" "\\begin{itemize}" " \\item Linear anisotropy" " \\item Linear orthotropy" " \\item Visco-plastic" "\\end{itemize}" ) diff --git a/src/material_damage/material_damage_iterative.cc b/src/material_damage/material_damage_iterative.cc index eefd8b931..188784ba8 100644 --- a/src/material_damage/material_damage_iterative.cc +++ b/src/material_damage/material_damage_iterative.cc @@ -1,214 +1,217 @@ /** * @file material_damage_iterative.cc * * @author Aurelia Isabel Cuba Ramos * * * @brief Specialization of the class material damage to damage only one gauss * point at a time and propagate damage in a linear way. Max principal stress * criterion is used as a failure criterion. * * @section LICENSE * * Copyright (©) 2010-2012, 2014 EPFL (Ecole Polytechnique Fédérale de Lausanne) * Laboratory (LSMS - Laboratoire de Simulation en Mécanique des Solides) * */ /* -------------------------------------------------------------------------- */ #include "material_damage_iterative.hh" #include "solid_mechanics_model.hh" __BEGIN_AKANTU__ /* -------------------------------------------------------------------------- */ template MaterialDamageIterative::MaterialDamageIterative(SolidMechanicsModel & model, const ID & id) : Material(model, id), MaterialDamage(model, id), Sc("Sc", *this), equivalent_stress("equivalent_stress", *this), norm_max_equivalent_stress(0) { AKANTU_DEBUG_IN(); this->registerParam("Sc", Sc, _pat_parsable, "critical stress threshold"); this->registerParam("prescribed_dam", prescribed_dam, 0.1, _pat_parsable | _pat_modifiable, "increase of damage in every step" ); this->registerParam("dam_threshold", dam_threshold, 0.8, _pat_parsable | _pat_modifiable, "damage threshold at which damage damage will be set to 1" ); this->registerParam("dam_tolerance", dam_tolerance, 0.01, _pat_parsable | _pat_modifiable, "damage tolerance to decide if quadrature point will be damageed" ); this->registerParam("max_damage", max_damage, 0.99999, _pat_parsable | _pat_modifiable, "maximum damage value" ); this->use_previous_stress = true; this->use_previous_gradu = true; this->Sc.initialize(1); this->equivalent_stress.initialize(1); AKANTU_DEBUG_OUT(); } /* -------------------------------------------------------------------------- */ template void MaterialDamageIterative::computeNormalizedEquivalentStress(const Array & grad_u, ElementType el_type, GhostType ghost_type) { AKANTU_DEBUG_IN(); /// Vector to store eigenvalues of current stress tensor Vector eigenvalues(spatial_dimension); Array::const_iterator Sc_it = Sc(el_type, ghost_type).begin(); Array::iterator equivalent_stress_it = equivalent_stress(el_type, ghost_type).begin(); Array::const_matrix_iterator grad_u_it = grad_u.begin(spatial_dimension, spatial_dimension); Array::const_matrix_iterator grad_u_end = grad_u.end(spatial_dimension, spatial_dimension); Real * dam = this->damage(el_type, ghost_type).storage(); Matrix sigma(spatial_dimension, spatial_dimension); for(;grad_u_it != grad_u_end; ++ grad_u_it) { sigma.clear(); MaterialElastic::computeStressOnQuad(*grad_u_it, sigma, 0.); computeDamageAndStressOnQuad(sigma,*dam); /// compute eigenvalues sigma.eig(eigenvalues); /// find max eigenvalue and normalize by tensile strength *equivalent_stress_it = *(std::max_element(eigenvalues.storage(), eigenvalues.storage() + spatial_dimension)) / *(Sc_it); ++Sc_it; ++equivalent_stress_it; ++dam; } AKANTU_DEBUG_OUT(); } /* -------------------------------------------------------------------------- */ template void MaterialDamageIterative::computeAllStresses(GhostType ghost_type) { AKANTU_DEBUG_IN(); /// reset normalized maximum equivalent stress if(ghost_type==_not_ghost) norm_max_equivalent_stress = 0; MaterialDamage::computeAllStresses(ghost_type); /// find global Gauss point with highest stress StaticCommunicator & comm = akantu::StaticCommunicator::getStaticCommunicator(); comm.allReduce(&norm_max_equivalent_stress, 1, _so_max); AKANTU_DEBUG_OUT(); } + /* -------------------------------------------------------------------------- */ template void MaterialDamageIterative::findMaxNormalizedEquivalentStress(ElementType el_type, GhostType ghost_type) { AKANTU_DEBUG_IN(); if(ghost_type==_not_ghost) { // const Array & e_stress = equivalent_stress(el_type); // if (e_stress.begin() != e_stress.end() ) { // Array::const_iterator equivalent_stress_it_max = std::max_element(e_stress.begin(),e_stress.end()); // /// check if max equivalent stress for this element type is greater than the current norm_max_eq_stress // if (*equivalent_stress_it_max > norm_max_equivalent_stress) // norm_max_equivalent_stress = *equivalent_stress_it_max; // } const Array & e_stress = equivalent_stress(el_type); Array::const_iterator equivalent_stress_it = e_stress.begin(); Array::const_iterator equivalent_stress_end = e_stress.end(); Array & dam = this->damage(el_type); Array::iterator dam_it = dam.begin(); for (; equivalent_stress_it != equivalent_stress_end; ++equivalent_stress_it, ++dam_it ) { /// check if max equivalent stress for this element type is greater than the current norm_max_eq_stress and if the element is not already fully damaged if (*equivalent_stress_it > norm_max_equivalent_stress && *dam_it < max_damage) { norm_max_equivalent_stress = *equivalent_stress_it; } } } AKANTU_DEBUG_OUT(); } /* -------------------------------------------------------------------------- */ template void MaterialDamageIterative::computeStress(ElementType el_type, GhostType ghost_type) { AKANTU_DEBUG_IN(); MaterialDamage::computeStress(el_type, ghost_type); Real * dam = this->damage(el_type, ghost_type).storage(); MATERIAL_STRESS_QUADRATURE_POINT_LOOP_BEGIN(el_type, ghost_type); computeDamageAndStressOnQuad(sigma,*dam); ++dam; MATERIAL_STRESS_QUADRATURE_POINT_LOOP_END; computeNormalizedEquivalentStress(this->gradu(el_type, ghost_type), el_type, ghost_type); norm_max_equivalent_stress = 0; findMaxNormalizedEquivalentStress(el_type, ghost_type); AKANTU_DEBUG_OUT(); } /* -------------------------------------------------------------------------- */ template UInt MaterialDamageIterative::updateDamage() { UInt nb_damaged_elements = 0; AKANTU_DEBUG_ASSERT(prescribed_dam > 0., "Your prescribed damage must be greater than zero"); if (norm_max_equivalent_stress >= 1.) { AKANTU_DEBUG_IN(); + + /// update the damage only on non-ghosts elements! Doesn't make sense to update on ghost. GhostType ghost_type = _not_ghost;; Mesh::type_iterator it = this->model->getFEEngine().getMesh().firstType(spatial_dimension, ghost_type); Mesh::type_iterator last_type = this->model->getFEEngine().getMesh().lastType(spatial_dimension, ghost_type); for(; it != last_type; ++it) { ElementType el_type = *it; const Array & e_stress = equivalent_stress(el_type); Array::const_iterator equivalent_stress_it = e_stress.begin(); Array::const_iterator equivalent_stress_end = e_stress.end(); Array & dam = this->damage(el_type); Array::iterator dam_it = dam.begin(); for (; equivalent_stress_it != equivalent_stress_end; ++equivalent_stress_it, ++dam_it ) { /// check if damage occurs if (*equivalent_stress_it >= (1-dam_tolerance)*norm_max_equivalent_stress) { if (*dam_it < dam_threshold) *dam_it +=prescribed_dam; else *dam_it = max_damage; nb_damaged_elements += 1; } } } } StaticCommunicator & comm = akantu::StaticCommunicator::getStaticCommunicator(); comm.allReduce(&nb_damaged_elements, 1, _so_sum); AKANTU_DEBUG_OUT(); return nb_damaged_elements; } /* -------------------------------------------------------------------------- */ template void MaterialDamageIterative::updateEnergiesAfterDamage(ElementType el_type, GhostType ghost_type) { MaterialDamage::updateEnergies(el_type, ghost_type); } /* -------------------------------------------------------------------------- */ INSTANTIATE_MATERIAL(MaterialDamageIterative); __END_AKANTU__ diff --git a/src/material_damage/material_damage_iterative_non_local.cc b/src/material_damage/material_damage_iterative_non_local.cc new file mode 100644 index 000000000..063462e9f --- /dev/null +++ b/src/material_damage/material_damage_iterative_non_local.cc @@ -0,0 +1,40 @@ +/** + * @file material_damage_iterative.cc + * + * @author Aurelia Isabel Cuba Ramos + * + * + * @brief Implementation of MaterialDamageIterativeNonLocal + * + * @section LICENSE + * + * Copyright (©) 2010-2012, 2014 EPFL (Ecole Polytechnique Fédérale de Lausanne) + * Laboratory (LSMS - Laboratoire de Simulation en Mécanique des Solides) + * + */ + +/* -------------------------------------------------------------------------- */ +#include "material_damage_iterative_non_local.hh" + +__BEGIN_AKANTU__ + +/* -------------------------------------------------------------------------- */ +template +void MaterialDamageIterativeNonLocal::computeNonLocalStresses(GhostType ghost_type) { + AKANTU_DEBUG_IN(); + /// reset normalized maximum equivalent stress + if(ghost_type==_not_ghost) + this->norm_max_equivalent_stress = 0; + + MaterialDamageIterativeNonLocalParent::computeNonLocalStresses(ghost_type); + + /// find global Gauss point with highest stress + StaticCommunicator & comm = akantu::StaticCommunicator::getStaticCommunicator(); + comm.allReduce(&(this->norm_max_equivalent_stress), 1, _so_max); + + AKANTU_DEBUG_OUT(); +} +/* -------------------------------------------------------------------------- */ +INSTANTIATE_MATERIAL(MaterialDamageIterativeNonLocal); + +__END_AKANTU__ diff --git a/src/material_damage/material_damage_iterative_non_local.hh b/src/material_damage/material_damage_iterative_non_local.hh index c633f7d3c..e7dbf8a34 100644 --- a/src/material_damage/material_damage_iterative_non_local.hh +++ b/src/material_damage/material_damage_iterative_non_local.hh @@ -1,79 +1,80 @@ /** * @file material_damage_iterative_non_local.hh * * @author Aurelia Isabel Cuba Ramos * * * @brief MaterialDamageIterativeNonLocal header for non-local damage * * @section LICENSE * * Copyright (©) 2010-2012, 2014 EPFL (Ecole Polytechnique Fédérale de Lausanne) * Laboratory (LSMS - Laboratoire de Simulation en Mécanique des Solides) * */ /* -------------------------------------------------------------------------- */ #include "aka_common.hh" #include "material_damage_iterative.hh" #include "material_damage_non_local.hh" /* -------------------------------------------------------------------------- */ #ifndef __AKANTU_MATERIAL_DAMAGE_ITERATIVE_NON_LOCAL_HH__ #define __AKANTU_MATERIAL_DAMAGE_ITERATIVE_NON_LOCAL_HH__ __BEGIN_AKANTU__ /** * Material Damage Iterative Non local * * parameters in the material files : */ template class MaterialDamageIterativeNonLocal : public MaterialDamageNonLocal > { /* ------------------------------------------------------------------------ */ /* Constructors/Destructors */ /* ------------------------------------------------------------------------ */ public: typedef MaterialDamageNonLocal > MaterialDamageIterativeNonLocalParent; MaterialDamageIterativeNonLocal(SolidMechanicsModel & model, const ID & id = ""); virtual ~MaterialDamageIterativeNonLocal() {}; /* ------------------------------------------------------------------------ */ /* Methods */ /* ------------------------------------------------------------------------ */ public: void initMaterial(); + virtual void computeNonLocalStresses(GhostType ghost_type); protected: void computeStress(ElementType type, GhostType ghost_type); void computeNonLocalStress(ElementType type, GhostType ghost_type = _not_ghost); private: /* ------------------------------------------------------------------------ */ /* Accessors */ /* ------------------------------------------------------------------------ */ public: /* ------------------------------------------------------------------------ */ /* Class Members */ /* ------------------------------------------------------------------------ */ private: InternalField grad_u_nl; }; /* -------------------------------------------------------------------------- */ /* inline functions */ /* -------------------------------------------------------------------------- */ #include "material_damage_iterative_non_local_inline_impl.cc" __END_AKANTU__ #endif /* __AKANTU_MATERIAL_DAMAGE_ITERATIVE_NON_LOCAL_HH__ */ diff --git a/src/material_damage/material_damage_iterative_non_local_inline_impl.cc b/src/material_damage/material_damage_iterative_non_local_inline_impl.cc index 251abdf2d..c264999b4 100644 --- a/src/material_damage/material_damage_iterative_non_local_inline_impl.cc +++ b/src/material_damage/material_damage_iterative_non_local_inline_impl.cc @@ -1,83 +1,87 @@ /** * @file material_damage_iterative_non_local_inline_impl.cc * * @author Aurelia Isabel Cuba Ramos * * * @brief MaterialDamageIterativeNonLocal inline function implementation * * @section LICENSE * * Copyright (©) 2010-2012, 2014 EPFL (Ecole Polytechnique Fédérale de Lausanne) * Laboratory (LSMS - Laboratoire de Simulation en Mécanique des Solides) * */ /* -------------------------------------------------------------------------- */ __END_AKANTU__ #if defined(AKANTU_DEBUG_TOOLS) #include "aka_debug_tools.hh" #include #endif __BEGIN_AKANTU__ /* -------------------------------------------------------------------------- */ template MaterialDamageIterativeNonLocal::MaterialDamageIterativeNonLocal(SolidMechanicsModel & model, const ID & id) : Material(model, id), MaterialDamageIterativeNonLocalParent(model, id), grad_u_nl("grad_u non local", *this) { AKANTU_DEBUG_IN(); this->is_non_local = true; this->grad_u_nl.initialize(spatial_dimension*spatial_dimension); this->model->getNonLocalManager().registerNonLocalVariable(this->gradu.getName(), grad_u_nl.getName(), spatial_dimension*spatial_dimension); AKANTU_DEBUG_OUT(); } /* -------------------------------------------------------------------------- */ template void MaterialDamageIterativeNonLocal::initMaterial() { AKANTU_DEBUG_IN(); MaterialDamageIterativeNonLocalParent::initMaterial(); this->model->getNonLocalManager().nonLocalVariableToNeighborhood(grad_u_nl.getName(), this->name); AKANTU_DEBUG_OUT(); } /* -------------------------------------------------------------------------- */ template void MaterialDamageIterativeNonLocal::computeStress(ElementType type, - GhostType ghost_type) { + GhostType ghost_type) { AKANTU_DEBUG_IN(); AKANTU_DEBUG_OUT(); } /* -------------------------------------------------------------------------- */ template void MaterialDamageIterativeNonLocal::computeNonLocalStress(ElementType el_type, - GhostType ghost_type) { + GhostType ghost_type) { AKANTU_DEBUG_IN(); + /// compute the stress (based on the elastic law) MaterialDamage::computeStress(el_type, ghost_type); + /// multiply the stress by (1-d) to get the effective stress Real * dam = this->damage(el_type, ghost_type).storage(); MATERIAL_STRESS_QUADRATURE_POINT_LOOP_BEGIN(el_type, ghost_type); this->computeDamageAndStressOnQuad(sigma,*dam); ++dam; MATERIAL_STRESS_QUADRATURE_POINT_LOOP_END; + /// compute the normalized equivalent stress this->computeNormalizedEquivalentStress(this->grad_u_nl(el_type, ghost_type), el_type, ghost_type); + /// find the maximum this->norm_max_equivalent_stress = 0; this->findMaxNormalizedEquivalentStress(el_type, ghost_type); AKANTU_DEBUG_OUT(); }