Page MenuHomec4science

kelvin.cpp
No OneTemporary

File Metadata

Created
Mon, May 13, 09:03

kelvin.cpp

/**
* @file
*
* @author Lucas Frérot <lucas.frerot@epfl.ch>
*
* @section LICENSE
*
* Copyright (©) 2017 EPFL (Ecole Polytechnique Fédérale de
* Lausanne) Laboratory (LSMS - Laboratoire de Simulation en Mécanique des
* Solides)
*
* Tamaas 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.
*
* Tamaas 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 Tamaas. If not, see <http://www.gnu.org/licenses/>.
*
*/
/* -------------------------------------------------------------------------- */
#include "kelvin.hh"
#include "elasto_plastic_model.hh"
/* -------------------------------------------------------------------------- */
__BEGIN_TAMAAS__
/* -------------------------------------------------------------------------- */
/* -------------------------------------------------------------------------- */
/* Constructors */
/* -------------------------------------------------------------------------- */
template <>
Kelvin<model_type::volume_2d, 0>::Kelvin(Model* model)
: VolumePotential(model) {
initialize(trait::components, trait::components);
}
template <>
Kelvin<model_type::volume_2d, 1>::Kelvin(Model* model)
: VolumePotential(model) {
initialize(trait::voigt, trait::components);
}
template <>
Kelvin<model_type::volume_2d, 2>::Kelvin(Model* model)
: VolumePotential(model) {
initialize(trait::voigt, trait::voigt);
}
/* -------------------------------------------------------------------------- */
/* Operator implementation */
/* -------------------------------------------------------------------------- */
template <model_type type, UInt derivative>
void Kelvin<type, derivative>::applyIf(GridBase<Real>& source,
GridBase<Real>& out,
filter_t pred) const {
Real nu = this->model->getPoissonRatio(), mu = this->model->getShearModulus();
influence::Kelvin<trait::dimension, derivative> kelvin(mu, nu);
detail::KelvinHelper<type, decltype(kelvin)> helper;
auto apply = [&](auto&& source_buffer, auto&& out_buffer) {
helper.applyIntegral(source_buffer, out_buffer, this->wavevectors,
this->model->getSystemSize().front(), kelvin);
helper.applyFreeTerm(source_buffer, out_buffer, kelvin);
helper.makeFundamentalGreatAgain(out_buffer);
};
this->fourierApplyIf(apply, source, out, pred);
}
/* -------------------------------------------------------------------------- */
/* Template instanciation */
/* -------------------------------------------------------------------------- */
template class Kelvin<model_type::volume_2d, 0>;
template class Kelvin<model_type::volume_2d, 1>;
template class Kelvin<model_type::volume_2d, 2>;
/* -------------------------------------------------------------------------- */
__END_TAMAAS__

Event Timeline