Page MenuHomec4science

material_marigo_inline_impl.hh
No OneTemporary

File Metadata

Created
Mon, May 20, 04:09

material_marigo_inline_impl.hh

/**
* Copyright (©) 2010-2023 EPFL (Ecole Polytechnique Fédérale de Lausanne)
* Laboratory (LSMS - Laboratoire de Simulation en Mécanique des Solides)
*
* This file is part of Akantu
*
* 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_marigo.hh"
/* -------------------------------------------------------------------------- */
// #ifndef __AKANTU_MATERIAL_MARIGO_INLINE_IMPL_CC__
// #define __AKANTU_MATERIAL_MARIGO_INLINE_IMPL_CC__
namespace akantu {
/* -------------------------------------------------------------------------- */
template <Int dim>
template <typename Args>
inline void MaterialMarigo<dim>::computeStressOnQuad(Args && arguments) {
auto && sigma = arguments["sigma"_n];
auto && grad_u = arguments["grad_u"_n];
auto && dam = arguments["damage"_n];
auto && Y = arguments["Y"_n];
MaterialElastic<dim>::computeStressOnQuad(
std::forward<decltype(arguments)>(arguments));
Y = sigma.doubleDot(Material::gradUToEpsilon<dim>(grad_u)) / 2.;
if (this->damage_in_y) {
Y *= (1 - dam);
}
if (this->yc_limit) {
Y = std::min(Y, this->Yc);
}
if (not this->is_non_local) {
computeDamageAndStressOnQuad(std::forward<decltype(arguments)>(arguments));
}
}
/* -------------------------------------------------------------------------- */
template <Int dim>
template <typename Args>
inline void
MaterialMarigo<dim>::computeDamageAndStressOnQuad(Args && arguments) { // NOLINT(cppcoreguidelines-missing-std-forward)
auto && sigma = arguments["sigma"_n];
auto && dam = arguments["damage"_n];
auto && prev_dam = arguments["previous_damage"_n];
auto && Y = arguments["Y"_n];
auto && Yd = arguments["Yd"_n];
Real Fd = Y - Yd - Sd * prev_dam;
if (Fd > 0) {
dam = (Y - Yd) / Sd;
}
dam = std::max(dam, prev_dam);
dam = std::min(dam, 1.);
sigma *= 1 - dam;
}
/* -------------------------------------------------------------------------- */
template <Int dim>
inline auto MaterialMarigo<dim>::getNbData(const Array<Element> & elements,
const SynchronizationTag & tag) const
-> Int {
Int size = 0;
if (tag == SynchronizationTag::_clh_init_cl) {
size += sizeof(Real) * this->getModel().getNbIntegrationPoints(elements);
}
size += MaterialDamage<dim>::getNbData(elements, tag);
return size;
}
/* -------------------------------------------------------------------------- */
template <Int dim>
inline void
MaterialMarigo<dim>::packData(CommunicationBuffer & buffer,
const Array<Element> & elements,
const SynchronizationTag & tag) const {
if (tag == SynchronizationTag::_clh_init_cl) {
this->packInternalFieldHelper(Yd, buffer, elements);
}
MaterialDamage<dim>::packData(buffer, elements, tag);
}
/* -------------------------------------------------------------------------- */
template <Int dim>
inline void MaterialMarigo<dim>::unpackData(CommunicationBuffer & buffer,
const Array<Element> & elements,
const SynchronizationTag & tag) {
if (tag == SynchronizationTag::_clh_init_cl) {
this->unpackInternalFieldHelper(Yd, buffer, elements);
}
MaterialDamage<dim>::unpackData(buffer, elements, tag);
}
} // namespace akantu
// #endif /* __AKANTU_MATERIAL_MARIGO_INLINE_IMPL_CC__ */

Event Timeline