Page MenuHomec4science

bem_grid_teboulle.cpp
No OneTemporary

File Metadata

Created
Sat, Nov 16, 02:18

bem_grid_teboulle.cpp

/**
*
* @author Lucas Frérot <lucas.frerot@epfl.ch>
*
* @section LICENSE
*
* Copyright (©) 2016 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 "bem_grid_teboulle.hh"
#include "surface_statistics.hh"
/* -------------------------------------------------------------------------- */
namespace tamaas {
BemGridTeboulle::BemGridTeboulle(Surface<Real>& s)
: BemGridKato(s), z(s.sizes(), 3), tractions_old(s.sizes(), 3) {}
/* -------------------------------------------------------------------------- */
BemGridTeboulle::~BemGridTeboulle() {}
/* -------------------------------------------------------------------------- */
void BemGridTeboulle::computeEquilibrium(Real tol,
const Grid<Real, 1>& g_target) {
this->computeInfluence();
Real f = 0, l = 0;
Real t[2] = {1, 1};
UInt n_iter = 0;
TAMAAS_ASSERT(g_target.dataSize() == 3,
"Applied pressure must have only 3 components");
// Real surface_mean = SurfaceStatistics::computeAverage(this->surface, 0);
// this->surface -= (surface_mean + g_target(2));
do {
applyInfluenceFunctions(z, displacements);
computeGaps(displacements);
updateGradient(const_cast<Grid<Real, 1>&>(g_target));
beta = computeLambda();
gaps /= lipschitz;
z -= gaps;
BemGrid::projectOnFrictionCone(z, mu);
tractions = z;
t[1] = (1. + std::sqrt(4 * t[0] * t[0] + 1)) / 2.;
l = 1 + (t[0] - 1) / t[1];
z -= tractions_old;
z *= l;
z += tractions_old;
t[0] = t[1];
tractions_old = tractions;
lambda -= beta;
f = computeStoppingCriterion();
printFriendlyMessage(n_iter, f);
} while (f > tol && n_iter++ < this->max_iter);
gaps *= lipschitz;
// computeDisplacementsFromTractions();
// computeGaps(displacements);
}
} // namespace tamaas

Event Timeline