diff --git a/src/material_damage/material_damage_iterative.cc b/src/material_damage/material_damage_iterative.cc index 8ec60345d..e2507700b 100644 --- a/src/material_damage/material_damage_iterative.cc +++ b/src/material_damage/material_damage_iterative.cc @@ -1,224 +1,224 @@ /** * @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_RVE.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("prescribed_dam", prescribed_dam, 0.1, _pat_parsable | _pat_modifiable, "prescribed damage" ); 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 const SolidMechanicsModelRVE * rve_model = dynamic_cast(this->model); if (rve_model == NULL) { /// is no RVE model 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; } } } } const SolidMechanicsModelRVE * rve_model = dynamic_cast(this->model); if (rve_model == NULL) { 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.hh b/src/material_damage/material_damage_iterative.hh index 6aae124bd..ea99a82e6 100644 --- a/src/material_damage/material_damage_iterative.hh +++ b/src/material_damage/material_damage_iterative.hh @@ -1,130 +1,126 @@ /** * @file material_damage_iterative.hh * * @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 "aka_common.hh" #include "material_damage.hh" #include "material.hh" /* -------------------------------------------------------------------------- */ #ifndef __AKANTU_MATERIAL_DAMAGE_ITERATIVE_HH__ #define __AKANTU_MATERIAL_DAMAGE_ITERATIVE_HH__ __BEGIN_AKANTU__ /** * Material damage iterative * * parameters in the material files : * - Sc */ template class MaterialDamageIterative : public MaterialDamage { /* ------------------------------------------------------------------------ */ /* Constructors/Destructors */ /* ------------------------------------------------------------------------ */ public: MaterialDamageIterative(SolidMechanicsModel & model, const ID & id = ""); virtual ~MaterialDamageIterative() {}; /* ------------------------------------------------------------------------ */ /* Methods */ /* ------------------------------------------------------------------------ */ public: /// virtual void updateInternalParameters(); virtual void computeAllStresses(GhostType ghost_type = _not_ghost); /// update internal field damage virtual UInt updateDamage(); UInt updateDamage(UInt quad_index, const Real eq_stress, const ElementType & el_type, const GhostType & ghost_type); /// update energies after damage has been updated virtual void updateEnergiesAfterDamage(ElementType el_type, GhostType ghost_typ); virtual void onBeginningSolveStep(const AnalysisMethod & method) { }; virtual void onEndSolveStep(const AnalysisMethod & method) { }; protected: /// constitutive law for all element of a type virtual void computeStress(ElementType el_type, GhostType ghost_type = _not_ghost); ///compute the equivalent stress on each Gauss point (i.e. the max prinicpal stress) and normalize it by the tensile strength virtual void computeNormalizedEquivalentStress(const Array & grad_u, ElementType el_type, GhostType ghost_type = _not_ghost); /// find max normalized equivalent stress void findMaxNormalizedEquivalentStress(ElementType el_type, GhostType ghost_type = _not_ghost); inline void computeDamageAndStressOnQuad(Matrix & sigma, Real & dam); /* ------------------------------------------------------------------------ */ /* DataAccessor inherited members */ /* ------------------------------------------------------------------------ */ /* ------------------------------------------------------------------------ */ /* Accessors */ /* ------------------------------------------------------------------------ */ public: /// get max normalized equivalent stress AKANTU_GET_MACRO(NormMaxEquivalentStress, norm_max_equivalent_stress, Real); - AKANTU_GET_MACRO(PrescribedDamage, prescribed_dam, Real); - AKANTU_GET_MACRO(DamageThreshold, dam_threshold, Real); - AKANTU_GET_MACRO(DamageTolerance, dam_tolerance, Real); - AKANTU_GET_MACRO(MaximumDamage, max_damage, Real); /* ------------------------------------------------------------------------ */ /* Class Members */ /* ------------------------------------------------------------------------ */ protected: /// resistance to damage RandomInternalField Sc; /// internal field to store equivalent stress on each Gauss point InternalField equivalent_stress; /// damage increment Real prescribed_dam; /// maximum equivalent stress Real norm_max_equivalent_stress; /// deviation from max stress at which Gauss point will still get damaged Real dam_tolerance; /// define damage threshold at which damage will be set to 1 Real dam_threshold; /// maximum damage value Real max_damage; }; /* -------------------------------------------------------------------------- */ /* inline functions */ /* -------------------------------------------------------------------------- */ #include "material_damage_iterative_inline_impl.cc" __END_AKANTU__ #endif /* __AKANTU_MATERIAL_DAMAGE_ITERATIVE_HH__ */ diff --git a/src/material_damage/material_iterative_stiffness_reduction.cc b/src/material_damage/material_iterative_stiffness_reduction.cc index 0540c0faf..7a947e4ec 100644 --- a/src/material_damage/material_iterative_stiffness_reduction.cc +++ b/src/material_damage/material_iterative_stiffness_reduction.cc @@ -1,207 +1,207 @@ /** * @file material_iterative_stiffness_reduction.cc * @author Aurelia Isabel Cuba Ramos * @date Thu Feb 18 16:03:56 2016 * * @brief Implementation of material iterative stiffness reduction * * @section LICENSE * * Copyright (©) 2010-2011 EPFL (Ecole Polytechnique Fédérale de Lausanne) * Laboratory (LSMS - Laboratoire de Simulation en Mécanique des Solides) * * Akantu is free software: you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License as published by the Free * Software Foundation, either version 3 of the License, or (at your option) any * later version. * * Akantu is distributed in the hope that it will be useful, but WITHOUT ANY * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR * A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more * details. * * You should have received a copy of the GNU Lesser General Public License * along with Akantu. If not, see . * */ /* -------------------------------------------------------------------------- */ #include "material_iterative_stiffness_reduction.hh" #include "solid_mechanics_model_RVE.hh" #include __BEGIN_AKANTU__ template /* -------------------------------------------------------------------------- */ MaterialIterativeStiffnessReduction::MaterialIterativeStiffnessReduction(SolidMechanicsModel & model, const ID & id) : Material(model, id), MaterialDamageIterative(model, id), eps_u("ultimate_strain", *this), reduction_step("damage_step", *this), D("tangent", *this), Gf(0.), crack_band_width(0.), max_reductions(0), reduction_constant(0.) { AKANTU_DEBUG_IN(); - this->registerParam("Gf", Gf, _pat_parsable, "fracture energy"); - this->registerParam("crack_band_width", crack_band_width, _pat_parsable, "crack band width"); + this->registerParam("Gf", Gf, _pat_parsable | _pat_modifiable, "fracture energy"); + this->registerParam("crack_band_width", crack_band_width, _pat_parsable | _pat_modifiable, "crack_band_width"); this->registerParam("max_reductions", max_reductions, UInt(10), _pat_parsable | _pat_modifiable, "max reductions"); this->registerParam("reduction_constant", reduction_constant, 2., _pat_parsable | _pat_modifiable, "reduction constant"); this->eps_u.initialize(1); this->D.initialize(1); this->reduction_step.initialize(1); AKANTU_DEBUG_OUT(); } /* -------------------------------------------------------------------------- */ template void MaterialIterativeStiffnessReduction::initMaterial() { AKANTU_DEBUG_IN(); MaterialDamageIterative::initMaterial(); for (ghost_type_t::iterator g = ghost_type_t::begin(); g != ghost_type_t::end(); ++g) { GhostType ghost_type = *g; /// loop over all types in the material typedef ElementTypeMapArray:: type_iterator iterator; iterator it = this->element_filter.firstType(spatial_dimension, ghost_type, _ek_regular); iterator last_type = this->element_filter.lastType(spatial_dimension, ghost_type, _ek_regular); /// loop over all types in the filter for(; it != last_type; ++it) { ElementType el_type = *it; /// get the stiffness on each quad point Array::const_iterator Sc_it = this->Sc(el_type, ghost_type).begin(); /// get the tangent of the tensile softening on each quad point Array::iterator D_it = this->D(el_type, ghost_type).begin(); Array::iterator D_end = this->D(el_type, ghost_type).end(); /// get the ultimate strain on each quad Array::iterator eps_u_it = this->eps_u(el_type, ghost_type).begin(); // compute the tangent and the ultimate strain for each quad for (; D_it != D_end; ++Sc_it, ++D_it, ++eps_u_it) { *eps_u_it = ( (2. * this->Gf) / (*Sc_it * this->crack_band_width) ); *D_it = *(Sc_it) / ((*eps_u_it) - ( (*Sc_it) / this->E ) ); } } } AKANTU_DEBUG_OUT(); } /* -------------------------------------------------------------------------- */ template void MaterialIterativeStiffnessReduction::computeNormalizedEquivalentStress(const Array & grad_u, ElementType el_type, GhostType ghost_type) { AKANTU_DEBUG_IN(); /// storage for the current stress Matrix sigma(spatial_dimension, spatial_dimension); /// Vector to store eigenvalues of current stress tensor Vector eigenvalues(spatial_dimension); /// iterators on the needed internal fields Array::const_scalar_iterator Sc_it = this->Sc(el_type, ghost_type).begin(); Array::scalar_iterator dam_it = this->damage(el_type, ghost_type).begin(); Array::scalar_iterator equivalent_stress_it = this->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); /// loop over all the quadrature points and compute the equivalent stress for(;grad_u_it != grad_u_end; ++ grad_u_it) { /// compute the stress sigma.clear(); MaterialElastic::computeStressOnQuad(*grad_u_it, sigma, 0.); MaterialDamageIterative::computeDamageAndStressOnQuad(sigma, *dam_it); /// 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_it; } AKANTU_DEBUG_OUT(); } /* -------------------------------------------------------------------------- */ template UInt MaterialIterativeStiffnessReduction::updateDamage() { UInt nb_damaged_elements = 0; if (this->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); /// loop over all the elements for(; it != last_type; ++it) { ElementType el_type = *it; /// get iterators on the needed internal fields Array::const_scalar_iterator equivalent_stress_it = this->equivalent_stress(el_type, ghost_type).begin(); Array::const_scalar_iterator equivalent_stress_end = this->equivalent_stress(el_type, ghost_type).end(); Array::scalar_iterator dam_it = this->damage(el_type, ghost_type).begin(); Array::scalar_iterator reduction_it = this->reduction_step(el_type, ghost_type).begin(); Array::const_scalar_iterator eps_u_it = this->eps_u(el_type, ghost_type).begin(); Array::scalar_iterator Sc_it = this->Sc(el_type, ghost_type).begin(); Array::const_scalar_iterator D_it = this->D(el_type, ghost_type).begin(); /// loop over all the quads of the given element type for (; equivalent_stress_it != equivalent_stress_end; ++equivalent_stress_it, ++dam_it, ++reduction_it, ++eps_u_it, ++Sc_it, ++D_it) { /// check if damage occurs if (*equivalent_stress_it >= (1 - this->dam_tolerance) * this->norm_max_equivalent_stress) { /// check if this element can still be damaged if (*reduction_it == this->max_reductions) continue; /// increment the counter of stiffness reduction steps *reduction_it += 1; if (*reduction_it == this->max_reductions) *dam_it = this->max_damage; else { /// update the damage on this quad *dam_it = 1. - (1./std::pow(this->reduction_constant, *reduction_it)); /// update the stiffness on this quad *Sc_it = (*eps_u_it) * (1. - (*dam_it) ) * this->E * (*D_it)/ ((1. - (*dam_it) ) * this->E + (*D_it)); } nb_damaged_elements += 1; } } } } const SolidMechanicsModelRVE * rve_model = dynamic_cast(this->model); if (rve_model == NULL) { StaticCommunicator & comm = akantu::StaticCommunicator::getStaticCommunicator(); comm.allReduce(&nb_damaged_elements, 1, _so_sum); } AKANTU_DEBUG_OUT(); return nb_damaged_elements; } /* -------------------------------------------------------------------------- */ INSTANTIATE_MATERIAL(MaterialIterativeStiffnessReduction); __END_AKANTU__ diff --git a/src/material_damage/material_iterative_stiffness_reduction.hh b/src/material_damage/material_iterative_stiffness_reduction.hh index ff2d5f310..68759179a 100644 --- a/src/material_damage/material_iterative_stiffness_reduction.hh +++ b/src/material_damage/material_iterative_stiffness_reduction.hh @@ -1,116 +1,111 @@ /** * @file material_iterative_stiffness_reduction.hh * @author Aurelia Isabel Cuba Ramos * @date Thu Feb 18 15:25:05 2016 * * @brief Damage material with constant stiffness reduction * * @section LICENSE * * Copyright (©) 2010-2011 EPFL (Ecole Polytechnique Fédérale de Lausanne) * Laboratory (LSMS - Laboratoire de Simulation en Mécanique des Solides) * * Akantu is free software: you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License as published by the Free * Software Foundation, either version 3 of the License, or (at your option) any * later version. * * Akantu is distributed in the hope that it will be useful, but WITHOUT ANY * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR * A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more * details. * * You should have received a copy of the GNU Lesser General Public License * along with Akantu. If not, see . * */ /* -------------------------------------------------------------------------- */ #include "material_damage_iterative.hh" /* -------------------------------------------------------------------------- */ #ifndef __AKANTU_MATERIAL_ITERATIVE_STIFFNESS_REDUCTION_HH__ #define __AKANTU_MATERIAL_ITERATIVE_STIFFNESS_REDUCTION_HH__ __BEGIN_AKANTU__ /** * Material damage iterative * * parameters in the material files : * - Gfx * - h * - Sc */ /// Proposed by Rots and Invernizzi, 2004: Regularized sequentially linear // saw-tooth softening model (section 4.2) template class MaterialIterativeStiffnessReduction : public MaterialDamageIterative { /* ------------------------------------------------------------------------ */ /* Constructors/Destructors */ /* ------------------------------------------------------------------------ */ public: MaterialIterativeStiffnessReduction(SolidMechanicsModel & model, const ID & id = ""); virtual ~MaterialIterativeStiffnessReduction() {}; /* ------------------------------------------------------------------------ */ /* Methods */ /* ------------------------------------------------------------------------ */ public: /// init the material virtual void initMaterial(); ///compute the equivalent stress on each Gauss point (i.e. the max prinicpal stress) and normalize it by the tensile stiffness virtual void computeNormalizedEquivalentStress(const Array & grad_u, ElementType el_type, GhostType ghost_type = _not_ghost); /// update internal field damage virtual UInt updateDamage(); /* ------------------------------------------------------------------------ */ /* DataAccessor inherited members */ /* ------------------------------------------------------------------------ */ /* ------------------------------------------------------------------------ */ /* Accessors */ /* ------------------------------------------------------------------------ */ public: - AKANTU_GET_MACRO(CrackBandWidth, crack_band_width, Real); - AKANTU_GET_MACRO(MaxReductions, max_reductions, UInt); - AKANTU_GET_MACRO(ReductionConstant, reduction_constant, Real); - AKANTU_GET_MACRO(FractureEnergy, Gf, Real); - /* ------------------------------------------------------------------------ */ /* Class Members */ /* ------------------------------------------------------------------------ */ protected: /// the ultimate strain InternalField eps_u; /// the reduction InternalField reduction_step; /// the tangent of the tensile stress-strain softening InternalField D; /// fracture energy Real Gf; /// crack_band_width for normalization of fracture energy Real crack_band_width; /// the number of total reductions steps until complete failure UInt max_reductions; /// the reduction constant (denoated by a in the paper of rots) Real reduction_constant; }; __END_AKANTU__ #endif /* __AKANTU_MATERIAL_ITERATIVE_STIFFNESS_REDUCTION_HH__ */ diff --git a/test/test_material_damage/test_material_iterative_stiffness_reduction.cc b/test/test_material_damage/test_material_iterative_stiffness_reduction.cc index 400bac57f..d4caf07f2 100644 --- a/test/test_material_damage/test_material_iterative_stiffness_reduction.cc +++ b/test/test_material_damage/test_material_iterative_stiffness_reduction.cc @@ -1,126 +1,125 @@ /** * @file test_material_iterative_strength_reduction.cc * @author Aurelia Isabel Cuba Ramos * @date Thu Nov 26 12:20:15 2015 * * @brief test the material iterative stiffness reduction * * @section LICENSE * * Copyright (©) 2010-2011 EPFL (Ecole Polytechnique Fédérale de Lausanne) * Laboratory (LSMS - Laboratoire de Simulation en Mécanique des Solides) * * Akantu is free software: you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License as published by the Free * Software Foundation, either version 3 of the License, or (at your option) any * later version. * * Akantu is distributed in the hope that it will be useful, but WITHOUT ANY * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR * A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more * details. * * You should have received a copy of the GNU Lesser General Public License * along with Akantu. If not, see . * */ /* -------------------------------------------------------------------------- */ #include "material_damage_iterative.hh" #include "solid_mechanics_model.hh" /* -------------------------------------------------------------------------- */ using namespace akantu; /* -------------------------------------------------------------------------- */ /* Main */ /* -------------------------------------------------------------------------- */ int main(int argc, char *argv[]) { Math::setTolerance(1e-13); debug::setDebugLevel(dblWarning); initialize("material_stiffness_reduction.dat" ,argc, argv); const UInt spatial_dimension = 2; ElementType element_type = _triangle_3; StaticCommunicator & comm = akantu::StaticCommunicator::getStaticCommunicator(); Int psize = comm.getNbProc(); Int prank = comm.whoAmI(); /// read the mesh and partion it Mesh mesh(spatial_dimension); akantu::MeshPartition * partition = NULL; if(prank == 0) { mesh.read("two_elements.msh"); /// partition the mesh partition = new MeshPartitionScotch(mesh, spatial_dimension); partition->partitionate(psize); } /// model creation SolidMechanicsModel model(mesh); model.initParallel(partition); delete partition; /// initialization of the model model.initFull(SolidMechanicsModelOptions(_static)); /// boundary conditions /// Dirichlet BC mesh.createGroupsFromMeshData("physical_names"); // creates groups from mesh names model.applyBC(BC::Dirichlet::FixedValue(0, _x), "left"); model.applyBC(BC::Dirichlet::FixedValue(0, _y), "bottom"); model.applyBC(BC::Dirichlet::FixedValue(2., _y), "top"); /// add fields that should be dumped model.setBaseName("material_iterative_stiffness_reduction_test"); model.addDumpField("material_index"); model.addDumpFieldVector("displacement");; model.addDumpField("stress"); model.addDumpField("blocked_dofs"); model.addDumpField("residual"); model.addDumpField("grad_u"); model.addDumpField("damage"); model.addDumpField("partitions"); model.addDumpField("Sc"); model.addDumpField("force"); model.addDumpField("equivalent_stress"); model.addDumpField("ultimate_strain"); model.dump(); MaterialDamageIterative & material = dynamic_cast & >(model.getMaterial(0)); Real error; bool converged = false; UInt nb_damaged_elements = 0; - Real max_eq_stress = 0; - Real E = material.getYoungsModulus(); + Real E = material.getParam("E"); std::cout << std::setprecision(12); const Array & damage = material.getInternal("damage")(element_type, _not_ghost); const Array & Sc = material.getInternal("Sc")(element_type, _not_ghost); /// solve the system do { converged = model.solveStep<_scm_newton_raphson_tangent_modified, _scc_increment>(1e-12, error, 2); if (converged == false) { std::cout << "The error is: " << error << std::endl; AKANTU_DEBUG_ASSERT(converged, "Did not converge"); } nb_damaged_elements = material.updateDamage(); for (UInt e = 0; e < mesh.getNbElement(element_type, _not_ghost); ++e) { std::cout << "the new modulus is " << (1-damage(0)) * E << std::endl; std::cout << "the new strength is " << Sc(0) << std::endl; } model.dump(); } while (nb_damaged_elements); finalize(); return EXIT_SUCCESS; }