diff --git a/src/model/solid_mechanics/materials/material_damage/material_phasefield.cc b/src/model/solid_mechanics/materials/material_damage/material_phasefield.cc index e7f93ba36..011de19ef 100644 --- a/src/model/solid_mechanics/materials/material_damage/material_phasefield.cc +++ b/src/model/solid_mechanics/materials/material_damage/material_phasefield.cc @@ -1,107 +1,107 @@ /** * @file material_phasefield.cc * * @author Mohit Pundir * * @date creation: Tue Oct 02 2018 * @date last modification: Tue Oct 02 2018 * * @brief Specialization of the material class for the phasefield material * * @section LICENSE * * Copyright (©) 2010-2018 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_phasefield.hh" #include "solid_mechanics_model.hh" namespace akantu { /* -------------------------------------------------------------------------- */ template MaterialPhaseField::MaterialPhaseField(SolidMechanicsModel & model, const ID & id) : Parent(model, id) { AKANTU_DEBUG_IN(); - + this->registerParam("eta", eta, Real(0.), _pat_parsable, "eta"); this->damage.initialize(0); AKANTU_DEBUG_OUT(); } /* -------------------------------------------------------------------------- */ template void MaterialPhaseField::computeStress(ElementType el_type, GhostType ghost_type) { AKANTU_DEBUG_IN(); auto dam = this->damage(el_type, ghost_type).begin(); MATERIAL_STRESS_QUADRATURE_POINT_LOOP_BEGIN(el_type, ghost_type); computeStressOnQuad(grad_u, sigma, *dam); ++dam; MATERIAL_STRESS_QUADRATURE_POINT_LOOP_END; AKANTU_DEBUG_OUT(); } /* -------------------------------------------------------------------------- */ template void MaterialPhaseField::computeTangentModuli( ElementType el_type, Array & tangent_matrix, GhostType ghost_type) { AKANTU_DEBUG_IN(); Parent::computeTangentModuli(el_type, tangent_matrix, ghost_type); Real * dam = this->damage(el_type, ghost_type).storage(); MATERIAL_TANGENT_QUADRATURE_POINT_LOOP_BEGIN(tangent_matrix); computeTangentModuliOnQuad(tangent, *dam); ++dam; MATERIAL_TANGENT_QUADRATURE_POINT_LOOP_END; AKANTU_DEBUG_OUT(); } /* -------------------------------------------------------------------------- */ template void MaterialPhaseField::computeTangentModuliOnQuad( Matrix & tangent, Real & dam) { - tangent *= (1 - dam)*(1 - dam); + tangent *= (1 - dam)*(1 - dam) + eta; } INSTANTIATE_MATERIAL(phasefield, MaterialPhaseField); } // akantu diff --git a/src/model/solid_mechanics/materials/material_damage/material_phasefield.hh b/src/model/solid_mechanics/materials/material_damage/material_phasefield.hh index 69be3fc7d..adb654699 100644 --- a/src/model/solid_mechanics/materials/material_damage/material_phasefield.hh +++ b/src/model/solid_mechanics/materials/material_damage/material_phasefield.hh @@ -1,94 +1,96 @@ /** * @file material_phasefield.hh * * @author Mohit Pundir * * @date creation: Tue Oct 2 2018 * @date last modification: Tue Oct 02 2018 * * @brief Phasefield damage law * * @section LICENSE * * Copyright (©) 2010-2018 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 "aka_common.hh" #include "material.hh" #include "material_damage.hh" /* -------------------------------------------------------------------------- */ #ifndef __AKANTU_MATERIAL_PHASEFIELD_HH__ #define __AKANTU_MATERIAL_PHASEFIELD_HH__ namespace akantu { template class MaterialPhaseField : public MaterialDamage { using Parent = MaterialDamage; /* ------------------------------------------------------------------------ */ /* Constructors/Destructors */ /* ------------------------------------------------------------------------ */ public: MaterialPhaseField(SolidMechanicsModel & model, const ID & id = ""); ~MaterialPhaseField() override = default; /* ------------------------------------------------------------------------ */ /* Methods */ /* ------------------------------------------------------------------------ */ public: /// constitutive law for all element of a type void computeStress(ElementType el_type, GhostType ghost_type = _not_ghost) override; /// compute the tangent stiffness matrix for an element type void computeTangentModuli(ElementType el_type, Array & tangent_matrix, GhostType ghost_type = _not_ghost) override; protected: /// constitutive law for a given quadrature point inline void computeStressOnQuad(Matrix & grad_u, Matrix & sigma, Real & dam); /// compute the tangent stiffness matrix for a given quadrature point inline void computeTangentModuliOnQuad(Matrix & tangent, Real & dam); /* ------------------------------------------------------------------------ */ /* Accessors */ /* ------------------------------------------------------------------------ */ public: /* ------------------------------------------------------------------------ */ /* Class Members */ /* ------------------------------------------------------------------------ */ protected: + Real eta; + }; /* -------------------------------------------------------------------------- */ /* inline functions */ /* -------------------------------------------------------------------------- */ #include "material_phasefield_inline_impl.cc" } // akantu #endif /* __AKANTU_MATERIAL_PHASEFIELD_HH__ */ diff --git a/src/model/solid_mechanics/materials/material_damage/material_phasefield_inline_impl.cc b/src/model/solid_mechanics/materials/material_damage/material_phasefield_inline_impl.cc index 284b12efe..90acfeb4a 100644 --- a/src/model/solid_mechanics/materials/material_damage/material_phasefield_inline_impl.cc +++ b/src/model/solid_mechanics/materials/material_damage/material_phasefield_inline_impl.cc @@ -1,86 +1,85 @@ /** * @file material_phasefield_inline_impl.cc * * @author Mohit Pundir * * @date creation: Wed Oct 02 2018 * @date last modification: Wed Oct 02 2018 * * @brief Implementation of the inline functions of the material phasefield * * @section LICENSE * * Copyright (©) 2010-2018 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 . * */ /* -------------------------------------------------------------------------- */ template inline void MaterialPhaseField::computeStressOnQuad( Matrix & grad_u, Matrix & sigma, Real & dam) { MaterialElastic::computeStressOnQuad(grad_u, sigma); Matrix strain( spatial_dimension, spatial_dimension); Matrix strain_plus( spatial_dimension, spatial_dimension); Matrix strain_minus( spatial_dimension, spatial_dimension); Matrix strain_dir( spatial_dimension, spatial_dimension); Matrix strain_diag_plus( spatial_dimension, spatial_dimension); Matrix strain_diag_minus(spatial_dimension, spatial_dimension); Vector strain_values(spatial_dimension); Real trace_plus, trace_minus; this->template gradUToEpsilon(grad_u, strain); strain.eig(strain_values, strain_dir); for (UInt i=0; i < spatial_dimension; i++) { strain_diag_plus(i, i) = std::max(Real(0.), strain_values(i)); strain_diag_minus(i, i) = std::min(Real(0.), strain_values(i)); } Matrix mat_tmp( spatial_dimension, spatial_dimension); Matrix sigma_plus( spatial_dimension, spatial_dimension); Matrix sigma_minus(spatial_dimension, spatial_dimension); mat_tmp.mul(strain_diag_plus, strain_dir); strain_plus.mul(strain_dir, mat_tmp); mat_tmp.mul(strain_diag_minus, strain_dir); strain_minus.mul(strain_dir, mat_tmp); trace_plus = std::max(Real(0.), strain.trace()); trace_minus = std::min(Real(0.), strain.trace()); Real lambda = MaterialElastic::getLambda(); Real mu = MaterialElastic::getMu(); for (UInt i=0; i < spatial_dimension; i++) { for (UInt j=0; j < spatial_dimension; j++) { sigma_plus(i, j) = (i==j) * lambda * trace_plus + 2 * mu * strain_plus(i, j); sigma_minus(i, j) = (i==j) * lambda * trace_minus + 2 * mu * strain_minus(i, j); } } - //sigma = (1 - dam) * sigma_plus + sigma_minus; - sigma *= (1- dam)*(1-dam); + sigma *= (1- dam)*(1-dam) + eta; }