diff --git a/src/material_damage/material_orthotropic_damage_iterative_non_local.hh b/src/material_damage/material_orthotropic_damage_iterative_non_local.hh new file mode 100644 index 000000000..48ea9078a --- /dev/null +++ b/src/material_damage/material_orthotropic_damage_iterative_non_local.hh @@ -0,0 +1,80 @@ +/** + * @file material_orthotropic_damage_iterative_non_local.hh + * + * @author Aurelia Isabel Cuba Ramos + * + * + * @brief MaterialOrthotropicDamageIterativeNonLocal 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_orthotropic_damage_iterative.hh" +#include "material_damage_non_local.hh" +/* -------------------------------------------------------------------------- */ + +#ifndef __AKANTU_MATERIAL_ORTHOTROPIC_DAMAGE_ITERATIVE_NON_LOCAL_HH__ +#define __AKANTU_MATERIAL_ORTHOTROPIC_DAMAGE_ITERATIVE_NON_LOCAL_HH__ + +__BEGIN_AKANTU__ + +/** + * Material Damage Iterative Non local + * + * parameters in the material files : + */ +template class WeightFunction = BaseWeightFunction> +class MaterialOrthotropicDamageIterativeNonLocal : public MaterialDamageNonLocal, + WeightFunction> { + /* ------------------------------------------------------------------------ */ + /* Constructors/Destructors */ + /* ------------------------------------------------------------------------ */ +public: + typedef MaterialDamageNonLocal, + WeightFunction> MaterialOrthotropicDamageIterativeNonLocalParent; + MaterialOrthotropicDamageIterativeNonLocal(SolidMechanicsModel & model, const ID & id = ""); + + virtual ~MaterialOrthotropicDamageIterativeNonLocal() {}; + + /* ------------------------------------------------------------------------ */ + /* Methods */ + /* ------------------------------------------------------------------------ */ +public: + + void initMaterial(); + +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_orthotropic_damage_iterative_non_local_inline_impl.cc" + +__END_AKANTU__ + +#endif /* __AKANTU_MATERIAL_ORTHOTROPIC_DAMAGE_ITERATIVE_NON_LOCAL_HH__ */ diff --git a/src/material_damage/material_orthotropic_damage_iterative_non_local_inline_impl.cc b/src/material_damage/material_orthotropic_damage_iterative_non_local_inline_impl.cc new file mode 100644 index 000000000..7a293a83d --- /dev/null +++ b/src/material_damage/material_orthotropic_damage_iterative_non_local_inline_impl.cc @@ -0,0 +1,123 @@ +/** + * @file material_orthotropic_damage_iterative_non_local_inline_impl.cc + * + * @author Aurelia Isabel Cuba Ramos + * + * + * @brief MaterialOrthotropicDamageIterativeNonLocal 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 class WeigthFunction> +MaterialOrthotropicDamageIterativeNonLocal::MaterialOrthotropicDamageIterativeNonLocal(SolidMechanicsModel & model, const ID & id) : + Material(model, id), + MaterialOrthotropicDamageIterativeNonLocalParent(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); + AKANTU_DEBUG_OUT(); +} + +/* -------------------------------------------------------------------------- */ +template class WeigthFunction> +void MaterialOrthotropicDamageIterativeNonLocal::initMaterial() { + AKANTU_DEBUG_IN(); + this->registerNonLocalVariable(this->gradu, grad_u_nl, spatial_dimension*spatial_dimension); + MaterialOrthotropicDamageIterativeNonLocalParent::initMaterial(); + AKANTU_DEBUG_OUT(); +} + +/* -------------------------------------------------------------------------- */ +template class WeigthFunction> +void MaterialOrthotropicDamageIterativeNonLocal::computeStress(ElementType type, + GhostType ghost_type) { + AKANTU_DEBUG_IN(); + + AKANTU_DEBUG_OUT(); +} + +/* -------------------------------------------------------------------------- */ +template class WeigthFunction> +void MaterialOrthotropicDamageIterativeNonLocal::computeNonLocalStress(ElementType el_type, + GhostType ghost_type) { + AKANTU_DEBUG_IN(); + + MaterialOrthotropicDamage::computeStress(el_type, ghost_type); + + Array::matrix_iterator damage_iterator = this->damage(el_type, ghost_type).begin(this->spatial_dimension, this->spatial_dimension); + Array::matrix_iterator damage_dir_it = this->damage_dir_vecs(el_type, ghost_type).begin(this->spatial_dimension, this->spatial_dimension); + + /// for the computation of the Cauchy stress the matrices (1-D) and + /// (1-D)^(1/2) are needed. For the formulation see Engineering + /// Damage Mechanics by Lemaitre and Desmorat. + + Matrix one_minus_D(this->spatial_dimension, this->spatial_dimension); + Matrix sqrt_one_minus_D(this->spatial_dimension, this->spatial_dimension); + Matrix one_minus_D_rotated(this->spatial_dimension, this->spatial_dimension); + Matrix sqrt_one_minus_D_rotated(this->spatial_dimension, this->spatial_dimension); + Matrix rotation_tmp(this->spatial_dimension, this->spatial_dimension); + + /// create matrix to store the first term of the computation of the + /// Cauchy stress + Matrix first_term(this->spatial_dimension, this->spatial_dimension); + Matrix third_term(this->spatial_dimension, this->spatial_dimension); + + + MATERIAL_STRESS_QUADRATURE_POINT_LOOP_BEGIN(el_type, ghost_type); + + /// rotate the tensors from the damage principal coordinate system to the CS of the computation + if ( !(Math::are_float_equal((*damage_iterator).trace(), 0)) ) { + /// compute (1-D) and (1-D)^1/2 + this->computeOneMinusD(one_minus_D, *damage_iterator); + this->computeSqrtOneMinusD(one_minus_D, sqrt_one_minus_D); + + this->rotateIntoComputationFrame(one_minus_D, + one_minus_D_rotated, + *damage_dir_it, + rotation_tmp); + + this->rotateIntoComputationFrame(sqrt_one_minus_D, + sqrt_one_minus_D_rotated, + *damage_dir_it, + rotation_tmp); + } else { + MaterialOrthotropicDamage::computeOneMinusD(one_minus_D_rotated, *damage_iterator); + MaterialOrthotropicDamage::computeSqrtOneMinusD(one_minus_D_rotated, sqrt_one_minus_D_rotated); + } + + this->computeDamageAndStressOnQuad(sigma, + one_minus_D_rotated, + sqrt_one_minus_D_rotated, + *damage_iterator, + first_term, + third_term); + + ++damage_dir_it; + ++damage_iterator; + + MATERIAL_STRESS_QUADRATURE_POINT_LOOP_END; + + this->computeNormalizedEquivalentStress(this->grad_u_nl(el_type, ghost_type), el_type, ghost_type); + this->norm_max_equivalent_stress = 0; + this->findMaxNormalizedEquivalentStress(el_type, ghost_type); + + AKANTU_DEBUG_OUT(); +} diff --git a/src/material_damage/material_orthotropic_damage_non_local.hh b/src/material_damage/material_orthotropic_damage_non_local.hh new file mode 100644 index 000000000..93143cf63 --- /dev/null +++ b/src/material_damage/material_orthotropic_damage_non_local.hh @@ -0,0 +1,101 @@ +/** + * @file material_orthotropic_damage_non_local.hh + * @author Aurelia Isabel Cuba Ramos + * @date Sun Mar 22 21:10:27 2015 + * + * @brief interface for non local orthotropic damage material + * + * @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 "aka_common.hh" +#include "material_non_local.hh" +/* -------------------------------------------------------------------------- */ + +#ifndef __AKANTU_MATERIAL_ORTHOTROPIC_DAMAGE_NON_LOCAL_HH__ +#define __AKANTU_MATERIAL_ORTHOTROPIC_DAMAGE_NON_LOCAL_HH__ + +__BEGIN_AKANTU__ + +template class WeightFunction = BaseWeightFunction> +class MaterialOrthotropicDamageNonLocal : public MaterialOrthotropicDamageLocal, + public MaterialNonLocal { +public: + typedef MaterialNonLocal MaterialNonLocalParent; + typedef MaterialOrthotropicDamageLocal MaterialOrthotropicDamageParent; + + MaterialOrthotropicDamageNonLocal(SolidMechanicsModel & model, const ID & id) : + Material(model, id), + MaterialOrthotropicDamageParent(model, id), MaterialNonLocalParent(model, id) { }; + + /* ------------------------------------------------------------------------ */ + virtual void initMaterial() { + MaterialOrthotropicDamageParent::initMaterial(); + MaterialNonLocalParent::initMaterial(); + } + +protected: + /* -------------------------------------------------------------------------- */ + virtual void computeNonLocalStress(ElementType type, GhostType ghost_type = _not_ghost) = 0; + + /* ------------------------------------------------------------------------ */ + void computeNonLocalStresses(GhostType ghost_type) { + AKANTU_DEBUG_IN(); + + 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) { + computeNonLocalStress(*it, ghost_type); + } + + AKANTU_DEBUG_OUT(); + } + +public: + /* ------------------------------------------------------------------------ */ + virtual inline UInt getNbDataForElements(const Array & elements, + SynchronizationTag tag) const { + return MaterialNonLocalParent::getNbDataForElements(elements, tag) + + MaterialOrthotropicDamageParent::getNbDataForElements(elements, tag); + } + virtual inline void packElementData(CommunicationBuffer & buffer, + const Array & elements, + SynchronizationTag tag) const { + MaterialNonLocalParent::packElementData(buffer, elements, tag); + MaterialOrthotropicDamageParent::packElementData(buffer, elements, tag); + } + + virtual inline void unpackElementData(CommunicationBuffer & buffer, + const Array & elements, + SynchronizationTag tag) { + MaterialNonLocalParent::unpackElementData(buffer, elements, tag); + MaterialOrthotropicDamageParent::unpackElementData(buffer, elements, tag); + } + +}; + +__END_AKANTU__ + +#endif /* __AKANTU_MATERIAL_ORTHOTROPIC_DAMAGE_NON_LOCAL_HH__ */