Page MenuHomec4science

material_damage.cc
No OneTemporary

File Metadata

Created
Sun, Aug 25, 21:19

material_damage.cc

/**
* @file material_damage.cc
* @author Nicolas Richart <nicolas.richart@epfl.ch>
* @author Guillaume Anciaux <guillaume.anciaux@epfl.ch>
* @author Marion Chambart <marion.chambart@epfl.ch>
* @date Tue Jul 27 11:53:52 2010
*
* @brief Specialization of the material class for the 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 <http://www.gnu.org/licenses/>.
*
*/
/* -------------------------------------------------------------------------- */
#include "material_damage.hh"
#include "solid_mechanics_model.hh"
__BEGIN_AKANTU__
/* -------------------------------------------------------------------------- */
MaterialDamage::MaterialDamage(Model & model, const MaterialID & id) :
MaterialElastic(model, id) {
AKANTU_DEBUG_IN();
Yd = 50;
Sd = 5000;
initInternalVector(this->damage, 1, "damage");
AKANTU_DEBUG_OUT();
}
/* -------------------------------------------------------------------------- */
void MaterialDamage::initMaterial() {
AKANTU_DEBUG_IN();
MaterialElastic::initMaterial();
resizeInternalVector(this->damage);
is_init = true;
AKANTU_DEBUG_OUT();
}
/* -------------------------------------------------------------------------- */
void MaterialDamage::computeStress(ElementType el_type, GhostType ghost_type) {
AKANTU_DEBUG_IN();
Real F[3*3];
Real sigma[3*3];
Real * dam ;
dam = damage(el_type, ghost_type)->values;
MATERIAL_STRESS_QUADRATURE_POINT_LOOP_BEGIN;
memset(F, 0, 3 * 3 * sizeof(Real));
for (UInt i = 0; i < spatial_dimension; ++i)
for (UInt j = 0; j < spatial_dimension; ++j)
F[3*i + j] = strain_val[spatial_dimension * i + j];
computeStress(F, sigma, *dam);
++dam;
for (UInt i = 0; i < spatial_dimension; ++i)
for (UInt j = 0; j < spatial_dimension; ++j)
stress_val[spatial_dimension*i + j] = sigma[3 * i + j];
MATERIAL_STRESS_QUADRATURE_POINT_LOOP_END;
AKANTU_DEBUG_OUT();
}
/* -------------------------------------------------------------------------- */
void MaterialDamage::setParam(const std::string & key, const std::string & value,
const MaterialID & id) {
std::stringstream sstr(value);
if(key == "Yd") { sstr >> Yd; }
else if(key == "Sd") { sstr >> Sd; }
else { MaterialElastic::setParam(key, value, id); }
}
/* -------------------------------------------------------------------------- */
void MaterialDamage::printself(std::ostream & stream, int indent) const {
std::string space;
for(Int i = 0; i < indent; i++, space += AKANTU_INDENT);
stream << space << "Material<_damage> [" << std::endl;
stream << space << " + Yd : " << Yd << std::endl;
stream << space << " + Sd : " << Sd << std::endl;
MaterialElastic::printself(stream, indent + 1);
stream << space << "]" << std::endl;
}
/* -------------------------------------------------------------------------- */
__END_AKANTU__

Event Timeline