Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F85693613
hooke.cpp
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Tue, Oct 1, 07:27
Size
2 KB
Mime Type
text/x-c++
Expires
Thu, Oct 3, 07:27 (2 d)
Engine
blob
Format
Raw Data
Handle
21242108
Attached To
rTAMAAS tamaas
hooke.cpp
View Options
/*
* SPDX-License-Indentifier: AGPL-3.0-or-later
*
* Copyright (©) 2016-2022 EPFL (École Polytechnique Fédérale de Lausanne),
* Laboratory (LSMS - Laboratoire de Simulation en Mécanique des Solides)
* Copyright (©) 2020-2022 Lucas Frérot
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published
* by the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program 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 Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
*/
/* -------------------------------------------------------------------------- */
#include "hooke.hh"
#include "influence.hh"
#include "loop.hh"
#include "model.hh"
/* -------------------------------------------------------------------------- */
namespace tamaas {
template <model_type type>
void Hooke<type>::apply(GridBase<Real>& strain, GridBase<Real>& stress) const {
constexpr auto dim = model_type_traits<type>::dimension;
const influence::ElasticHelper<dim> elasticity(
this->model->getShearModulus(), this->model->getPoissonRatio());
// Checking incompressibility
if (elasticity.nu == 0.5)
TAMAAS_EXCEPTION("Incompressibility error");
// Checking number of components
if (strain.getNbComponents() == dim * dim) {
Loop::loop(
[elasticity] CUDA_LAMBDA(MatrixProxy<Real, dim, dim> sigma,
MatrixProxy<const Real, dim, dim> epsilon) {
sigma = elasticity(epsilon);
},
range<MatrixProxy<Real, dim, dim>>(stress),
range<MatrixProxy<const Real, dim, dim>>(strain));
}
// in case we have voigt notation
else if (strain.getNbComponents() == voigt_size<dim>::value) {
Loop::loop(
[elasticity] CUDA_LAMBDA(SymMatrixProxy<Real, dim> sigma,
SymMatrixProxy<const Real, dim> epsilon) {
sigma = elasticity(epsilon);
},
range<SymMatrixProxy<Real, dim>>(stress),
range<SymMatrixProxy<const Real, dim>>(strain));
}
else
TAMAAS_EXCEPTION("Strain components do not match dimension");
}
/* -------------------------------------------------------------------------- */
template class Hooke<model_type::basic_1d>;
template class Hooke<model_type::basic_2d>;
template class Hooke<model_type::surface_1d>;
template class Hooke<model_type::surface_2d>;
template class Hooke<model_type::volume_1d>;
template class Hooke<model_type::volume_2d>;
} // namespace tamaas
Event Timeline
Log In to Comment