diff --git a/packages/phase_field.cmake b/packages/phase_field.cmake index c23b2e38d..048e416e3 100644 --- a/packages/phase_field.cmake +++ b/packages/phase_field.cmake @@ -1,53 +1,54 @@ #=============================================================================== # @file phase_field.cmake # # @author Mohit Pundir # # @date creation: Fri Sep 03 2010 # @date last modification: Wed Jun 30 2021 # # @brief package description for phase field model # # # @section LICENSE # # Copyright (©) 2010-2021 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 . # #=============================================================================== package_declare(phase_field DEPENDS model_couplers DESCRIPTION "Use Phase Field package of Akantu") package_declare_sources(phase_field model/phase_field/phasefield.cc model/phase_field/phasefield.hh model/phase_field/phasefield_inline_impl.cc model/phase_field/phasefield_selector.hh model/phase_field/phasefield_selector_tmpl.hh model/phase_field/phasefields/phasefield_exponential.hh model/phase_field/phasefields/phasefield_exponential.cc + model/phase_field/phasefields/phasefield_exponential_inline_impl.hh model/phase_field/phase_field_model.cc model/phase_field/phase_field_model.hh model/phase_field/phase_field_model_inline_impl.cc model/model_couplers/coupler_solid_phasefield.hh model/model_couplers/coupler_solid_phasefield.cc ) diff --git a/packages/solid_mechanics.cmake b/packages/solid_mechanics.cmake index 113376256..c7b8776ac 100644 --- a/packages/solid_mechanics.cmake +++ b/packages/solid_mechanics.cmake @@ -1,118 +1,118 @@ #=============================================================================== # @file solid_mechanics.cmake # # @author Guillaume Anciaux # @author Nicolas Richart # # @date creation: Mon Dec 04 2017 # @date last modification: Fri Mar 26 2021 # # @brief package description for core # # # @section LICENSE # # Copyright (©) 2016-2021 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 . # #=============================================================================== package_declare(solid_mechanics DEFAULT ON DESCRIPTION "Solid mechanics model" DEPENDS core lapack ) package_declare_sources(solid_mechanics model/solid_mechanics/material.cc model/solid_mechanics/material.hh model/solid_mechanics/material_inline_impl.hh model/solid_mechanics/material_selector.hh model/solid_mechanics/material_selector_tmpl.hh model/solid_mechanics/materials/internal_field.hh model/solid_mechanics/materials/internal_field_tmpl.hh model/solid_mechanics/materials/random_internal_field.hh model/solid_mechanics/materials/random_internal_field_tmpl.hh model/solid_mechanics/solid_mechanics_model.cc model/solid_mechanics/solid_mechanics_model.hh model/solid_mechanics/solid_mechanics_model_inline_impl.hh model/solid_mechanics/solid_mechanics_model_io.cc model/solid_mechanics/solid_mechanics_model_mass.cc model/solid_mechanics/solid_mechanics_model_material.cc model/solid_mechanics/solid_mechanics_model_tmpl.hh model/solid_mechanics/solid_mechanics_model_event_handler.hh model/solid_mechanics/materials/plane_stress_toolbox.hh model/solid_mechanics/materials/plane_stress_toolbox_tmpl.hh model/solid_mechanics/materials/material_core_includes.hh model/solid_mechanics/materials/material_elastic.cc model/solid_mechanics/materials/material_elastic.hh model/solid_mechanics/materials/material_elastic_inline_impl.hh model/solid_mechanics/materials/material_thermal.cc model/solid_mechanics/materials/material_thermal.hh model/solid_mechanics/materials/material_elastic_linear_anisotropic.cc model/solid_mechanics/materials/material_elastic_linear_anisotropic.hh model/solid_mechanics/materials/material_elastic_linear_anisotropic_inline_impl.hh model/solid_mechanics/materials/material_elastic_orthotropic.cc model/solid_mechanics/materials/material_elastic_orthotropic.hh model/solid_mechanics/materials/material_damage/material_anisotropic_damage.hh model/solid_mechanics/materials/material_damage/material_anisotropic_damage.cc model/solid_mechanics/materials/material_damage/material_anisotropic_damage_tmpl.hh model/solid_mechanics/materials/material_damage/material_damage.hh model/solid_mechanics/materials/material_damage/material_damage_tmpl.hh model/solid_mechanics/materials/material_damage/material_marigo.cc model/solid_mechanics/materials/material_damage/material_marigo.hh model/solid_mechanics/materials/material_damage/material_marigo_inline_impl.hh model/solid_mechanics/materials/material_damage/material_mazars.cc model/solid_mechanics/materials/material_damage/material_mazars.hh model/solid_mechanics/materials/material_damage/material_phasefield.cc model/solid_mechanics/materials/material_damage/material_phasefield.hh - model/solid_mechanics/materials/material_damage/material_phasefield_inline_impl.cc + model/solid_mechanics/materials/material_damage/material_phasefield_inline_impl.hh model/solid_mechanics/materials/material_damage/material_mazars_inline_impl.hh model/solid_mechanics/materials/material_finite_deformation/material_neohookean.cc model/solid_mechanics/materials/material_finite_deformation/material_neohookean.hh model/solid_mechanics/materials/material_finite_deformation/material_neohookean_inline_impl.hh model/solid_mechanics/materials/material_plastic/material_plastic.cc model/solid_mechanics/materials/material_plastic/material_plastic.hh model/solid_mechanics/materials/material_plastic/material_plastic_inline_impl.hh model/solid_mechanics/materials/material_plastic/material_drucker_prager.cc model/solid_mechanics/materials/material_plastic/material_drucker_prager.hh model/solid_mechanics/materials/material_plastic/material_drucker_prager_inline_impl.hh model/solid_mechanics/materials/material_plastic/material_linear_isotropic_hardening.cc model/solid_mechanics/materials/material_plastic/material_linear_isotropic_hardening.hh model/solid_mechanics/materials/material_plastic/material_linear_isotropic_hardening_inline_impl.hh model/solid_mechanics/materials/material_damage/material_von_mises_mazars.cc model/solid_mechanics/materials/material_damage/material_von_mises_mazars.hh model/solid_mechanics/materials/material_damage/material_von_mises_mazars_inline_impl.hh model/solid_mechanics/materials/material_viscoelastic/material_standard_linear_solid_deviatoric.cc model/solid_mechanics/materials/material_viscoelastic/material_standard_linear_solid_deviatoric.hh model/solid_mechanics/materials/material_viscoelastic/material_viscoelastic_maxwell.cc model/solid_mechanics/materials/material_viscoelastic/material_viscoelastic_maxwell.hh model/solid_mechanics/materials/material_non_local.hh model/solid_mechanics/materials/material_non_local_tmpl.hh model/solid_mechanics/materials/material_non_local_includes.hh ) package_declare_material_infos(solid_mechanics LIST AKANTU_CORE_MATERIAL_LIST INCLUDE material_core_includes.hh ) package_declare_extra_files_to_package(solid_mechanics SOURCES model/solid_mechanics/material_list.hh.in ) 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 52b32859a..94359daa1 100644 --- a/src/model/solid_mechanics/materials/material_damage/material_phasefield.cc +++ b/src/model/solid_mechanics/materials/material_damage/material_phasefield.cc @@ -1,100 +1,117 @@ /** * @file material_phasefield.cc * * @author Mohit Pundir * * @date creation: Mon Dec 13 2010 * @date last modification: Fri Apr 02 2021 * * @brief Specialization of the material class for the phasefield material * * * @section LICENSE * * Copyright (©) 2010-2021 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 "aka_common.hh" #include "solid_mechanics_model.hh" namespace akantu { /* -------------------------------------------------------------------------- */ template MaterialPhaseField::MaterialPhaseField( SolidMechanicsModel & model, const ID & id) - : Parent(model, id) { + : Parent(model, id), effective_damage("effective_damage", *this) { AKANTU_DEBUG_IN(); this->registerParam("eta", eta, Real(0.), _pat_parsable, "eta"); this->damage.initialize(0); + this->effective_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(); + computeEffectiveDamage(el_type, ghost_type); + auto dam = this->effective_damage(el_type, ghost_type).begin(); MATERIAL_STRESS_QUADRATURE_POINT_LOOP_BEGIN(el_type, ghost_type); - computeStressOnQuad(grad_u, sigma, *dam); + MaterialElastic::computeStressOnQuad(grad_u, sigma); + sigma *= (1. - *dam) * (1. - *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(); + computeEffectiveDamage(el_type, ghost_type); + auto dam = this->effective_damage(el_type, ghost_type).begin(); MATERIAL_TANGENT_QUADRATURE_POINT_LOOP_BEGIN(tangent_matrix); - computeTangentModuliOnQuad(tangent, *dam); + tangent *= (1. - *dam) * (1. - *dam) + eta; ++dam; MATERIAL_TANGENT_QUADRATURE_POINT_LOOP_END; AKANTU_DEBUG_OUT(); } /* -------------------------------------------------------------------------- */ template -void MaterialPhaseField::computeTangentModuliOnQuad( - Matrix & tangent, Real & dam) { - tangent *= (1 - dam) * (1 - dam) + eta; +void MaterialPhaseField::computeEffectiveDamage( + ElementType el_type, GhostType ghost_type) { + + auto && grad_u_view = + make_view(this->gradu(el_type, ghost_type), this->spatial_dimension, + this->spatial_dimension); + + for (auto && data : zip(grad_u_view, this->damage(el_type, ghost_type), + this->effective_damage(el_type, ghost_type))) { + auto & grad_u = std::get<0>(data); + auto & dam = std::get<1>(data); + auto & eff_dam = std::get<2>(data); + + computeEffectiveDamageOnQuad(grad_u, dam, eff_dam); + } } INSTANTIATE_MATERIAL(phasefield, MaterialPhaseField); } // namespace 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 49bf05ec2..f9f5b1b35 100644 --- a/src/model/solid_mechanics/materials/material_damage/material_phasefield.hh +++ b/src/model/solid_mechanics/materials/material_damage/material_phasefield.hh @@ -1,92 +1,102 @@ /** * @file material_phasefield.hh * * @author Mohit Pundir * * @date creation: Fri Jun 18 2010 * @date last modification: Fri Apr 02 2021 * * @brief Phasefield damage law * * * @section LICENSE * * Copyright (©) 2010-2021 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); + // 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); + // inline void computeTangentModuliOnQuad(Matrix & tangent, Real & dam); + + void computeEffectiveDamage(ElementType el_type, + GhostType ghost_type = _not_ghost); + + inline void computeEffectiveDamageOnQuad(Matrix & grad_u, Real & dam, + Real & eff_dam); /* ------------------------------------------------------------------------ */ /* Accessors */ /* ------------------------------------------------------------------------ */ public: /* ------------------------------------------------------------------------ */ /* Class Members */ /* ------------------------------------------------------------------------ */ protected: Real eta; + + // effective damage to conserve stiffness in compression + InternalField effective_damage; }; + +} // namespace akantu + /* -------------------------------------------------------------------------- */ /* inline functions */ /* -------------------------------------------------------------------------- */ -#include "material_phasefield_inline_impl.cc" - -} // namespace akantu +#include "material_phasefield_inline_impl.hh" #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.hh similarity index 84% rename from src/model/solid_mechanics/materials/material_damage/material_phasefield_inline_impl.cc rename to src/model/solid_mechanics/materials/material_damage/material_phasefield_inline_impl.hh index a5f16f0e9..b98ead0b3 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.hh @@ -1,86 +1,93 @@ /** * @file material_phasefield_inline_impl.cc * * @author Mohit Pundir * * @date creation: Mon Dec 13 2010 * @date last modification: Fri Apr 02 2021 * * @brief Implementation of the inline functions of the material phasefield * * * @section LICENSE * * Copyright (©) 2010-2021 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" + +#ifndef AKANTU_MATERIAL_PHASEFIELD_INLINE_IMPL_HH_ +#define AKANTU_MATERIAL_PHASEFIELD_INLINE_IMPL_HH_ /* -------------------------------------------------------------------------- */ +namespace akantu { template -inline void MaterialPhaseField::computeStressOnQuad( - Matrix & grad_u, Matrix & sigma, Real & dam) { - - MaterialElastic::computeStressOnQuad(grad_u, sigma); +inline void MaterialPhaseField::computeEffectiveDamageOnQuad( + Matrix & grad_u, Real & dam, Real & eff_dam) { 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) = static_cast(i == j) * lambda * trace_plus + 2 * mu * strain_plus(i, j); sigma_minus(i, j) = static_cast(i == j) * lambda * trace_minus + 2 * mu * strain_minus(i, j); } } + auto strain_energy_plus = 0.5 * sigma_plus.doubleDot(strain_plus); + auto strain_energy_minus = 0.5 * sigma_minus.doubleDot(strain_minus); - // sigma = (1 - dam) * sigma_plus + sigma_minus; - sigma *= (1 - dam) * (1 - dam) + eta; + eff_dam = dam * static_cast(strain_energy_minus < strain_energy_plus); } +} // namespace akantu + +#endif