::push_back(std::forward(value));
this->nb_added_elements++;
AKANTU_DEBUG_OUT();
}
/* -------------------------------------------------------------------------- */
template inline void SynchronizedArray::erase(UInt i) {
AKANTU_DEBUG_IN();
AKANTU_DEBUG_ASSERT(nb_added_elements == 0,
"Cannot erase element if SynchronizedArray"
<< " is already modified without synchronization");
for (UInt j = 0; j < this->nb_component; ++j)
this->values[i * this->nb_component + j] =
- this->values[(this->size - 1) * this->nb_component + j];
- this->size--;
+ this->values[(this->size_ - 1) * this->nb_component + j];
+ this->size_--;
this->deleted_elements.push_back(i);
AKANTU_DEBUG_OUT();
}
/* -------------------------------------------------------------------------- */
/*
template
template
inline void SynchronizedArray::erase(const iterator & it) {
T * curr = it.getCurrentStorage();
UInt pos = (curr - values) / nb_component;
erase(pos);
}
*/
diff --git a/extra_packages/traction-at-split-node-contact/src/functions/boundary_functions.cc b/extra_packages/traction-at-split-node-contact/src/functions/boundary_functions.cc
index bb60d7467..99985a041 100644
--- a/extra_packages/traction-at-split-node-contact/src/functions/boundary_functions.cc
+++ b/extra_packages/traction-at-split-node-contact/src/functions/boundary_functions.cc
@@ -1,63 +1,73 @@
/**
* @file boundary_functions.cc
*
+ * @author David Simon Kammer
*
+ * @date creation: Tue Dec 02 2014
+ * @date last modification: Fri Feb 23 2018
*
* @brief
*
* @section LICENSE
*
- * Copyright (©) 2010-2012, 2014 EPFL (Ecole Polytechnique Fédérale de Lausanne)
+ * Copyright (©) 2015-2018 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 .
+ *
*/
+/* -------------------------------------------------------------------------- */
#include "boundary_functions.hh"
+#include "communicator.hh"
+/* -------------------------------------------------------------------------- */
namespace akantu {
/* -------------------------------------------------------------------------- */
Real integrateResidual(const std::string & sub_boundary_name,
const SolidMechanicsModel & model, UInt dir) {
Real int_res = 0.;
const Mesh & mesh = model.getMesh();
- const Array & residual = model.getResidual();
+ const Array & residual = model.getInternalForce();
- // do not need try catch, as all subboundaries should be everywhere.
- // try {
const ElementGroup & boundary = mesh.getElementGroup(sub_boundary_name);
- ElementGroup::const_node_iterator nit = boundary.node_begin();
- ElementGroup::const_node_iterator nend = boundary.node_end();
- for (; nit != nend; ++nit) {
- bool is_local_node = mesh.isLocalOrMasterNode(*nit);
+ for (auto & node : boundary.getNodes()) {
+ bool is_local_node = mesh.isLocalOrMasterNode(node);
if (is_local_node) {
- int_res += residual(*nit, dir);
+ int_res += residual(node, dir);
}
}
- // } catch(debug::Exception e) {
- // // AKANTU_ERROR("Error computing integrateResidual. Cannot get
- // SubBoundary: "
- // // << sub_boundary_name << " [" << e.what() << "]");
- // }
- StaticCommunicator::getStaticCommunicator().allReduce(&int_res, 1, _so_sum);
+ mesh.getCommunicator().allReduce(int_res, SynchronizerOperation::_sum);
return int_res;
}
/* -------------------------------------------------------------------------- */
void boundaryFix(Mesh & mesh,
const std::vector & sub_boundary_names) {
std::vector::const_iterator it = sub_boundary_names.begin();
std::vector::const_iterator end = sub_boundary_names.end();
for (; it != end; ++it) {
if (mesh.element_group_find(*it) == mesh.element_group_end()) {
mesh.createElementGroup(
*it, mesh.getSpatialDimension() - 1); // empty element group
}
}
}
} // namespace akantu
diff --git a/extra_packages/traction-at-split-node-contact/src/functions/boundary_functions.hh b/extra_packages/traction-at-split-node-contact/src/functions/boundary_functions.hh
index 89fd859e3..a16426a6c 100644
--- a/extra_packages/traction-at-split-node-contact/src/functions/boundary_functions.hh
+++ b/extra_packages/traction-at-split-node-contact/src/functions/boundary_functions.hh
@@ -1,30 +1,45 @@
/**
* @file boundary_functions.hh
*
* @author David Simon Kammer
*
+ * @date creation: Fri Jan 04 2013
+ * @date last modification: Fri Feb 23 2018
*
* @brief functions for boundaries
*
* @section LICENSE
*
- * Copyright (©) 2010-2012, 2014 EPFL (Ecole Polytechnique Fédérale de Lausanne)
+ * Copyright (©) 2014-2018 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 .
+ *
*/
/* -------------------------------------------------------------------------- */
// akantu
#include "aka_common.hh"
#include "solid_mechanics_model.hh"
namespace akantu {
Real integrateResidual(const std::string & sub_boundary_name,
const SolidMechanicsModel & model, UInt dir);
/// this is a fix so that all subboundaries exist on all procs
void boundaryFix(Mesh & mesh,
const std::vector & sub_boundary_names);
} // namespace akantu
diff --git a/extra_packages/traction-at-split-node-contact/src/functions/node_filter.hh b/extra_packages/traction-at-split-node-contact/src/functions/node_filter.hh
index daad5b664..f6c03790c 100644
--- a/extra_packages/traction-at-split-node-contact/src/functions/node_filter.hh
+++ b/extra_packages/traction-at-split-node-contact/src/functions/node_filter.hh
@@ -1,98 +1,113 @@
/**
* @file node_filter.hh
*
* @author David Simon Kammer
*
+ * @date creation: Tue Dec 02 2014
+ * @date last modification: Tue Feb 20 2018
*
* @brief to filter nodes with functors
*
* @section LICENSE
*
- * Copyright (©) 2010-2012, 2014 EPFL (Ecole Polytechnique Fédérale de Lausanne)
+ * Copyright (©) 2015-2018 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 .
+ *
*/
/* -------------------------------------------------------------------------- */
#ifndef __AST_NODE_FILTER_HH__
#define __AST_NODE_FILTER_HH__
/* -------------------------------------------------------------------------- */
// akantu
#include "aka_common.hh"
#include "mesh_filter.hh"
namespace akantu {
/* -------------------------------------------------------------------------- */
class GeometryFilter : public NodeFilterFunctor {
public:
GeometryFilter(const Mesh & mesh, UInt dir, Real limit)
: NodeFilterFunctor(), mesh(mesh), dir(dir), limit(limit) {
this->positions = &(mesh.getNodes());
};
~GeometryFilter(){};
bool operator()(UInt node) { AKANTU_TO_IMPLEMENT(); };
protected:
const Mesh & mesh;
UInt dir;
Real limit;
const Array * positions;
};
/* -------------------------------------------------------------------------- */
class FilterPositionsGreaterThan : public GeometryFilter {
public:
FilterPositionsGreaterThan(const Mesh & mesh, UInt dir, Real limit)
: GeometryFilter(mesh, dir, limit){};
~FilterPositionsGreaterThan(){};
bool operator()(UInt node) {
AKANTU_DEBUG_IN();
bool to_filter = true;
if ((*this->positions)(node, this->dir) > this->limit)
to_filter = false;
AKANTU_DEBUG_OUT();
return to_filter;
};
};
/* -------------------------------------------------------------------------- */
class FilterPositionsLessThan : public GeometryFilter {
public:
FilterPositionsLessThan(const Mesh & mesh, UInt dir, Real limit)
: GeometryFilter(mesh, dir, limit){};
~FilterPositionsLessThan(){};
bool operator()(UInt node) {
AKANTU_DEBUG_IN();
bool to_filter = true;
if ((*this->positions)(node, this->dir) < this->limit)
to_filter = false;
AKANTU_DEBUG_OUT();
return to_filter;
};
};
/* -------------------------------------------------------------------------- */
// this filter is erase because the convention of filter has changed!!
// filter == true -> keep node
// template
// void applyNodeFilter(Array & nodes, FilterType & filter) {
// Array::iterator<> it = nodes.begin();
// for (; it != nodes.end(); ++it) {
// if (filter(*it)) {
// it = nodes.erase(it);
// }
// }
// };
} // namespace akantu
#endif /* __AST_NODE_FILTER_HH__ */
diff --git a/extra_packages/traction-at-split-node-contact/src/ntn_contact/friction_laws/ntn_friclaw_coulomb.hh b/extra_packages/traction-at-split-node-contact/src/ntn_contact/friction_laws/ntn_friclaw_coulomb.hh
index d910acc3c..0cc6df6dd 100644
--- a/extra_packages/traction-at-split-node-contact/src/ntn_contact/friction_laws/ntn_friclaw_coulomb.hh
+++ b/extra_packages/traction-at-split-node-contact/src/ntn_contact/friction_laws/ntn_friclaw_coulomb.hh
@@ -1,93 +1,108 @@
/**
* @file ntn_friclaw_coulomb.hh
*
* @author David Simon Kammer
*
+ * @date creation: Fri Jun 18 2010
+ * @date last modification: Fri Feb 23 2018
*
* @brief coulomb friction with \mu_s = \mu_k (constant)
*
* @section LICENSE
*
- * Copyright (©) 2010-2012, 2014 EPFL (Ecole Polytechnique Fédérale de Lausanne)
+ * Copyright (©) 2015-2018 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 .
+ *
*/
/* -------------------------------------------------------------------------- */
#ifndef __AST_NTN_FRICLAW_COULOMB_HH__
#define __AST_NTN_FRICLAW_COULOMB_HH__
/* -------------------------------------------------------------------------- */
// simtools
#include "ntn_fricreg_no_regularisation.hh"
namespace akantu {
/* -------------------------------------------------------------------------- */
template
class NTNFricLawCoulomb : public Regularisation {
/* ------------------------------------------------------------------------ */
/* Constructors/Destructors */
/* ------------------------------------------------------------------------ */
public:
NTNFricLawCoulomb(NTNBaseContact * contact, const FrictionID & id = "coulomb",
const MemoryID & memory_id = 0);
virtual ~NTNFricLawCoulomb(){};
/* ------------------------------------------------------------------------ */
/* Methods */
/* ------------------------------------------------------------------------ */
public:
/// register synchronizedarrays for sync
virtual void registerSynchronizedArray(SynchronizedArrayBase & array);
/// dump restart file
virtual void dumpRestart(const std::string & file_name) const;
/// read restart file
virtual void readRestart(const std::string & file_name);
/// function to print the contain of the class
virtual void printself(std::ostream & stream, int indent = 0) const;
protected:
/// compute frictional strength according to friction law
virtual void computeFrictionalStrength();
/* ------------------------------------------------------------------------ */
/* Dumpable */
/* ------------------------------------------------------------------------ */
public:
virtual void addDumpFieldToDumper(const std::string & dumper_name,
const std::string & field_id);
/* ------------------------------------------------------------------------ */
/* Accessors */
/* ------------------------------------------------------------------------ */
/* ------------------------------------------------------------------------ */
/* Class Members */
/* ------------------------------------------------------------------------ */
protected:
// friction coefficient
SynchronizedArray mu;
};
/* -------------------------------------------------------------------------- */
/* inline functions */
/* -------------------------------------------------------------------------- */
/// standard output stream operator
template
inline std::ostream &
operator<<(std::ostream & stream,
const NTNFricLawCoulomb & _this) {
_this.printself(stream);
return stream;
}
} // namespace akantu
#include "ntn_friclaw_coulomb_tmpl.hh"
#endif /* __AST_NTN_FRICLAW_COULOMB_HH__ */
diff --git a/extra_packages/traction-at-split-node-contact/src/ntn_contact/friction_laws/ntn_friclaw_coulomb_tmpl.hh b/extra_packages/traction-at-split-node-contact/src/ntn_contact/friction_laws/ntn_friclaw_coulomb_tmpl.hh
index df0841947..d012fb969 100644
--- a/extra_packages/traction-at-split-node-contact/src/ntn_contact/friction_laws/ntn_friclaw_coulomb_tmpl.hh
+++ b/extra_packages/traction-at-split-node-contact/src/ntn_contact/friction_laws/ntn_friclaw_coulomb_tmpl.hh
@@ -1,153 +1,168 @@
/**
* @file ntn_friclaw_coulomb_tmpl.hh
*
* @author David Simon Kammer
*
+ * @date creation: Tue Dec 02 2014
+ * @date last modification: Fri Feb 23 2018
*
* @brief implementation of coulomb friction
*
* @section LICENSE
*
- * Copyright (©) 2010-2012, 2014 EPFL (Ecole Polytechnique Fédérale de Lausanne)
+ * Copyright (©) 2015-2018 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 .
+ *
*/
/* -------------------------------------------------------------------------- */
#include "dumper_nodal_field.hh"
namespace akantu {
/* -------------------------------------------------------------------------- */
template
NTNFricLawCoulomb::NTNFricLawCoulomb(NTNBaseContact * contact,
const FrictionID & id,
const MemoryID & memory_id)
: Regularisation(contact, id, memory_id),
mu(0, 1, 0., id + ":mu", 0., "mu") {
AKANTU_DEBUG_IN();
Regularisation::registerSynchronizedArray(this->mu);
this->registerParam("mu", this->mu, _pat_parsmod, "friction coefficient");
AKANTU_DEBUG_OUT();
}
/* -------------------------------------------------------------------------- */
template
void NTNFricLawCoulomb::computeFrictionalStrength() {
AKANTU_DEBUG_IN();
// get contact arrays
const SynchronizedArray & is_in_contact =
this->internalGetIsInContact();
const SynchronizedArray & pressure = this->internalGetContactPressure();
// array to fill
SynchronizedArray & strength = this->internalGetFrictionalStrength();
UInt nb_contact_nodes = this->contact->getNbContactNodes();
for (UInt n = 0; n < nb_contact_nodes; ++n) {
// node pair is NOT in contact
if (!is_in_contact(n))
strength(n) = 0.;
// node pair is in contact
else {
// compute frictional strength
strength(n) = this->mu(n) * pressure(n);
}
}
Regularisation::computeFrictionalStrength();
AKANTU_DEBUG_OUT();
}
/* -------------------------------------------------------------------------- */
template
void NTNFricLawCoulomb::registerSynchronizedArray(
SynchronizedArrayBase & array) {
AKANTU_DEBUG_IN();
this->mu.registerDependingArray(array);
AKANTU_DEBUG_OUT();
}
/* -------------------------------------------------------------------------- */
template
void NTNFricLawCoulomb::dumpRestart(
const std::string & file_name) const {
AKANTU_DEBUG_IN();
this->mu.dumpRestartFile(file_name);
Regularisation::dumpRestart(file_name);
AKANTU_DEBUG_OUT();
}
/* -------------------------------------------------------------------------- */
template
void NTNFricLawCoulomb::readRestart(
const std::string & file_name) {
AKANTU_DEBUG_IN();
this->mu.readRestartFile(file_name);
Regularisation::readRestart(file_name);
AKANTU_DEBUG_OUT();
}
/* -------------------------------------------------------------------------- */
template
void NTNFricLawCoulomb::printself(std::ostream & stream,
int indent) const {
AKANTU_DEBUG_IN();
std::string space;
for (Int i = 0; i < indent; i++, space += AKANTU_INDENT)
;
stream << space << "NTNFricLawCoulomb [" << std::endl;
Regularisation::printself(stream, ++indent);
stream << space << "]" << std::endl;
AKANTU_DEBUG_OUT();
}
/* -------------------------------------------------------------------------- */
template
void NTNFricLawCoulomb::addDumpFieldToDumper(
const std::string & dumper_name, const std::string & field_id) {
AKANTU_DEBUG_IN();
#ifdef AKANTU_USE_IOHELPER
// const SynchronizedArray * nodal_filter =
// &(this->contact->getSlaves());
if (field_id == "mu") {
this->internalAddDumpFieldToDumper(
dumper_name, field_id,
new dumper::NodalField(this->mu.getArray()));
}
/*
else if (field_id == "frictional_contact_pressure") {
this->internalAddDumpFieldToDumper(dumper_name,
field_id,
new
DumperIOHelper::NodalField(this->frictional_contact_pressure.getArray()));
}
*/
else {
Regularisation::addDumpFieldToDumper(dumper_name, field_id);
}
#endif
AKANTU_DEBUG_OUT();
}
} // namespace akantu
diff --git a/extra_packages/traction-at-split-node-contact/src/ntn_contact/friction_laws/ntn_friclaw_linear_cohesive.hh b/extra_packages/traction-at-split-node-contact/src/ntn_contact/friction_laws/ntn_friclaw_linear_cohesive.hh
index 26a84a24f..a6bb69a06 100644
--- a/extra_packages/traction-at-split-node-contact/src/ntn_contact/friction_laws/ntn_friclaw_linear_cohesive.hh
+++ b/extra_packages/traction-at-split-node-contact/src/ntn_contact/friction_laws/ntn_friclaw_linear_cohesive.hh
@@ -1,100 +1,115 @@
/**
* @file ntn_friclaw_linear_cohesive.hh
*
* @author David Simon Kammer
*
+ * @date creation: Fri Jun 18 2010
+ * @date last modification: Fri Feb 23 2018
*
* @brief linear cohesive law
*
* @section LICENSE
*
- * Copyright (©) 2010-2012, 2014 EPFL (Ecole Polytechnique Fédérale de Lausanne)
+ * Copyright (©) 2015-2018 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 .
+ *
*/
/* -------------------------------------------------------------------------- */
#ifndef __AST_NTN_FRICLAW_LINEAR_COHESIVE_HH__
#define __AST_NTN_FRICLAW_LINEAR_COHESIVE_HH__
/* -------------------------------------------------------------------------- */
// simtools
#include "ntn_fricreg_no_regularisation.hh"
namespace akantu {
/* -------------------------------------------------------------------------- */
template
class NTNFricLawLinearCohesive : public Regularisation {
/* ------------------------------------------------------------------------ */
/* Constructors/Destructors */
/* ------------------------------------------------------------------------ */
public:
NTNFricLawLinearCohesive(NTNBaseContact * contact,
const FrictionID & id = "linear_cohesive",
const MemoryID & memory_id = 0);
virtual ~NTNFricLawLinearCohesive(){};
/* ------------------------------------------------------------------------ */
/* Methods */
/* ------------------------------------------------------------------------ */
public:
/// register synchronizedarrays for sync
virtual void registerSynchronizedArray(SynchronizedArrayBase & array);
/// dump restart file
virtual void dumpRestart(const std::string & file_name) const;
/// read restart file
virtual void readRestart(const std::string & file_name);
/// function to print the contain of the class
virtual void printself(std::ostream & stream, int indent = 0) const;
protected:
/// compute frictional strength according to friction law
virtual void computeFrictionalStrength();
/* ------------------------------------------------------------------------ */
/* Dumpable */
/* ------------------------------------------------------------------------ */
public:
virtual void addDumpFieldToDumper(const std::string & dumper_name,
const std::string & field_id);
/* ------------------------------------------------------------------------ */
/* Accessors */
/* ------------------------------------------------------------------------ */
/* ------------------------------------------------------------------------ */
/* Class Members */
/* ------------------------------------------------------------------------ */
protected:
// fracture energy
SynchronizedArray G_c;
// peak value of cohesive law
SynchronizedArray tau_c;
// residual value of cohesive law (for slip > d_c)
SynchronizedArray tau_r;
};
/* -------------------------------------------------------------------------- */
/* inline functions */
/* -------------------------------------------------------------------------- */
/// standard output stream operator
template
inline std::ostream &
operator<<(std::ostream & stream,
const NTNFricLawLinearCohesive & _this) {
_this.printself(stream);
return stream;
}
} // namespace akantu
#include "ntn_friclaw_linear_cohesive_tmpl.hh"
#endif /* __AST_NTN_FRICLAW_LINEAR_COHESIVE_HH__ */
diff --git a/extra_packages/traction-at-split-node-contact/src/ntn_contact/friction_laws/ntn_friclaw_linear_cohesive_tmpl.hh b/extra_packages/traction-at-split-node-contact/src/ntn_contact/friction_laws/ntn_friclaw_linear_cohesive_tmpl.hh
index 0e72a085d..bd9fe4f2d 100644
--- a/extra_packages/traction-at-split-node-contact/src/ntn_contact/friction_laws/ntn_friclaw_linear_cohesive_tmpl.hh
+++ b/extra_packages/traction-at-split-node-contact/src/ntn_contact/friction_laws/ntn_friclaw_linear_cohesive_tmpl.hh
@@ -1,174 +1,189 @@
/**
* @file ntn_friclaw_linear_cohesive_tmpl.hh
*
* @author David Simon Kammer
*
+ * @date creation: Tue Dec 02 2014
+ * @date last modification: Fri Feb 23 2018
*
* @brief implementation of linear cohesive law
*
* @section LICENSE
*
- * Copyright (©) 2010-2012, 2014 EPFL (Ecole Polytechnique Fédérale de Lausanne)
+ * Copyright (©) 2015-2018 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 .
+ *
*/
/* -------------------------------------------------------------------------- */
//#include "dumper_text.hh"
namespace akantu {
/* -------------------------------------------------------------------------- */
template
NTNFricLawLinearCohesive::NTNFricLawLinearCohesive(
NTNBaseContact * contact, const FrictionID & id, const MemoryID & memory_id)
: Regularisation(contact, id, memory_id),
G_c(0, 1, 0., id + ":G_c", 0., "G_c"),
tau_c(0, 1, 0., id + ":tau_c", 0., "tau_c"),
tau_r(0, 1, 0., id + ":tau_r", 0., "tau_r") {
AKANTU_DEBUG_IN();
Regularisation::registerSynchronizedArray(this->G_c);
Regularisation::registerSynchronizedArray(this->tau_c);
Regularisation::registerSynchronizedArray(this->tau_r);
this->registerParam("G_c", this->G_c, _pat_parsmod, "fracture energy");
this->registerParam("tau_c", this->tau_c, _pat_parsmod,
"peak shear strength");
this->registerParam("tau_r", this->tau_r, _pat_parsmod,
"residual shear strength");
AKANTU_DEBUG_OUT();
}
/* -------------------------------------------------------------------------- */
template
void NTNFricLawLinearCohesive::computeFrictionalStrength() {
AKANTU_DEBUG_IN();
// get arrays
const SynchronizedArray & is_in_contact =
this->internalGetIsInContact();
// const SynchronizedArray & slip = this->internalGetSlip();
const SynchronizedArray & slip = this->internalGetCumulativeSlip();
// array to fill
SynchronizedArray & strength = this->internalGetFrictionalStrength();
UInt nb_contact_nodes = this->contact->getNbContactNodes();
for (UInt n = 0; n < nb_contact_nodes; ++n) {
// node pair is NOT in contact
if (!is_in_contact(n))
strength(n) = 0.;
// node pair is in contact
else {
if (this->G_c(n) == 0.) {
// strength(n) = 0.;
strength(n) = this->tau_r(n);
} else {
Real slope = (this->tau_c(n) - this->tau_r(n)) *
(this->tau_c(n) - this->tau_r(n)) / (2 * this->G_c(n));
// no strength < tau_r
strength(n) =
std::max(this->tau_c(n) - slope * slip(n), this->tau_r(n));
// strength(n) = std::max(this->tau_c(n) - slope * slip(n), 0.); // no
// negative strength
}
}
}
Regularisation::computeFrictionalStrength();
AKANTU_DEBUG_OUT();
}
/* -------------------------------------------------------------------------- */
template
void NTNFricLawLinearCohesive::registerSynchronizedArray(
SynchronizedArrayBase & array) {
AKANTU_DEBUG_IN();
this->G_c.registerDependingArray(array);
AKANTU_DEBUG_OUT();
}
/* -------------------------------------------------------------------------- */
template
void NTNFricLawLinearCohesive::dumpRestart(
const std::string & file_name) const {
AKANTU_DEBUG_IN();
this->G_c.dumpRestartFile(file_name);
this->tau_c.dumpRestartFile(file_name);
this->tau_r.dumpRestartFile(file_name);
Regularisation::dumpRestart(file_name);
AKANTU_DEBUG_OUT();
}
/* -------------------------------------------------------------------------- */
template
void NTNFricLawLinearCohesive::readRestart(
const std::string & file_name) {
AKANTU_DEBUG_IN();
this->G_c.readRestartFile(file_name);
this->tau_c.readRestartFile(file_name);
this->tau_r.readRestartFile(file_name);
Regularisation::readRestart(file_name);
AKANTU_DEBUG_OUT();
}
/* -------------------------------------------------------------------------- */
template
void NTNFricLawLinearCohesive::printself(std::ostream & stream,
int indent) const {
AKANTU_DEBUG_IN();
std::string space;
for (Int i = 0; i < indent; i++, space += AKANTU_INDENT)
;
stream << space << "NTNFricLawLinearCohesive [" << std::endl;
Regularisation::printself(stream, ++indent);
stream << space << "]" << std::endl;
AKANTU_DEBUG_OUT();
}
/* -------------------------------------------------------------------------- */
template
void NTNFricLawLinearCohesive::addDumpFieldToDumper(
const std::string & dumper_name, const std::string & field_id) {
AKANTU_DEBUG_IN();
#ifdef AKANTU_USE_IOHELPER
// const SynchronizedArray * nodal_filter =
// &(this->contact->getSlaves());
if (field_id == "G_c") {
this->internalAddDumpFieldToDumper(
dumper_name, field_id,
new dumper::NodalField(this->G_c.getArray()));
} else if (field_id == "tau_c") {
this->internalAddDumpFieldToDumper(
dumper_name, field_id,
new dumper::NodalField(this->tau_c.getArray()));
} else if (field_id == "tau_r") {
this->internalAddDumpFieldToDumper(
dumper_name, field_id,
new dumper::NodalField(this->tau_r.getArray()));
} else {
Regularisation::addDumpFieldToDumper(dumper_name, field_id);
}
#endif
AKANTU_DEBUG_OUT();
}
} // namespace akantu
diff --git a/extra_packages/traction-at-split-node-contact/src/ntn_contact/friction_laws/ntn_friclaw_linear_slip_weakening.hh b/extra_packages/traction-at-split-node-contact/src/ntn_contact/friction_laws/ntn_friclaw_linear_slip_weakening.hh
index c0cdb03e0..b95d989c0 100644
--- a/extra_packages/traction-at-split-node-contact/src/ntn_contact/friction_laws/ntn_friclaw_linear_slip_weakening.hh
+++ b/extra_packages/traction-at-split-node-contact/src/ntn_contact/friction_laws/ntn_friclaw_linear_slip_weakening.hh
@@ -1,102 +1,117 @@
/**
* @file ntn_friclaw_linear_slip_weakening.hh
*
* @author David Simon Kammer
*
+ * @date creation: Fri Jun 18 2010
+ * @date last modification: Fri Feb 23 2018
*
* @brief linear slip weakening
*
* @section LICENSE
*
- * Copyright (©) 2010-2012, 2014 EPFL (Ecole Polytechnique Fédérale de Lausanne)
+ * Copyright (©) 2015-2018 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 .
+ *
*/
/* -------------------------------------------------------------------------- */
#ifndef __AST_NTN_FRICLAW_LINEAR_SLIP_WEAKENING_HH__
#define __AST_NTN_FRICLAW_LINEAR_SLIP_WEAKENING_HH__
/* -------------------------------------------------------------------------- */
// simtools
#include "ntn_friclaw_coulomb.hh"
namespace akantu {
/* -------------------------------------------------------------------------- */
template
class NTNFricLawLinearSlipWeakening : public NTNFricLawCoulomb {
/* ------------------------------------------------------------------------ */
/* Constructors/Destructors */
/* ------------------------------------------------------------------------ */
public:
NTNFricLawLinearSlipWeakening(NTNBaseContact * contact,
const FrictionID & id = "linear_slip_weakening",
const MemoryID & memory_id = 0);
virtual ~NTNFricLawLinearSlipWeakening(){};
/* ------------------------------------------------------------------------ */
/* Methods */
/* ------------------------------------------------------------------------ */
public:
/// register synchronizedarrays for sync
virtual void registerSynchronizedArray(SynchronizedArrayBase & array);
/// dump restart file
virtual void dumpRestart(const std::string & file_name) const;
/// read restart file
virtual void readRestart(const std::string & file_name);
/// function to print the contain of the class
virtual void printself(std::ostream & stream, int indent = 0) const;
protected:
/// compute frictional strength according to friction law
virtual void computeFrictionalStrength();
/// computes the friction coefficient as a function of slip
virtual void computeFrictionCoefficient();
/* ------------------------------------------------------------------------ */
/* Dumpable */
/* ------------------------------------------------------------------------ */
public:
virtual void addDumpFieldToDumper(const std::string & dumper_name,
const std::string & field_id);
/* ------------------------------------------------------------------------ */
/* Accessors */
/* ------------------------------------------------------------------------ */
/* ------------------------------------------------------------------------ */
/* Class Members */
/* ------------------------------------------------------------------------ */
protected:
// static coefficient of friction
SynchronizedArray mu_s;
// kinetic coefficient of friction
SynchronizedArray mu_k;
// Dc the length over which slip weakening happens
SynchronizedArray d_c;
};
/* -------------------------------------------------------------------------- */
/* inline functions */
/* -------------------------------------------------------------------------- */
/// standard output stream operator
template
inline std::ostream &
operator<<(std::ostream & stream,
const NTNFricLawLinearSlipWeakening & _this) {
_this.printself(stream);
return stream;
}
} // namespace akantu
#include "ntn_friclaw_linear_slip_weakening_tmpl.hh"
#endif /* __AST_NTN_FRICLAW_LINEAR_SLIP_WEAKENING_HH__ */
diff --git a/extra_packages/traction-at-split-node-contact/src/ntn_contact/friction_laws/ntn_friclaw_linear_slip_weakening_no_healing.hh b/extra_packages/traction-at-split-node-contact/src/ntn_contact/friction_laws/ntn_friclaw_linear_slip_weakening_no_healing.hh
index aa69eb866..9711597b5 100644
--- a/extra_packages/traction-at-split-node-contact/src/ntn_contact/friction_laws/ntn_friclaw_linear_slip_weakening_no_healing.hh
+++ b/extra_packages/traction-at-split-node-contact/src/ntn_contact/friction_laws/ntn_friclaw_linear_slip_weakening_no_healing.hh
@@ -1,81 +1,96 @@
/**
* @file ntn_friclaw_linear_slip_weakening_no_healing.hh
*
* @author David Simon Kammer
*
+ * @date creation: Fri Jun 18 2010
+ * @date last modification: Fri Feb 23 2018
*
* @brief linear slip weakening
*
* @section LICENSE
*
- * Copyright (©) 2010-2012, 2014 EPFL (Ecole Polytechnique Fédérale de Lausanne)
+ * Copyright (©) 2015-2018 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 .
+ *
*/
/* -------------------------------------------------------------------------- */
#ifndef __AST_NTN_FRICLAW_LINEAR_SLIP_WEAKENING_NO_HEALING_HH__
#define __AST_NTN_FRICLAW_LINEAR_SLIP_WEAKENING_NO_HEALING_HH__
/* -------------------------------------------------------------------------- */
#include "ntn_friclaw_linear_slip_weakening.hh"
namespace akantu {
/* -------------------------------------------------------------------------- */
template
class NTNFricLawLinearSlipWeakeningNoHealing
: public NTNFricLawLinearSlipWeakening {
/* ------------------------------------------------------------------------ */
/* Constructors/Destructors */
/* ------------------------------------------------------------------------ */
public:
NTNFricLawLinearSlipWeakeningNoHealing(
NTNBaseContact * contact,
const FrictionID & id = "linear_slip_weakening_no_healing",
const MemoryID & memory_id = 0);
virtual ~NTNFricLawLinearSlipWeakeningNoHealing(){};
/* ------------------------------------------------------------------------ */
/* Methods */
/* ------------------------------------------------------------------------ */
public:
/// function to print the contain of the class
virtual void printself(std::ostream & stream, int indent = 0) const;
protected:
/// computes the friction coefficient as a function of slip
virtual void computeFrictionCoefficient();
/* ------------------------------------------------------------------------ */
/* Dumpable */
/* ------------------------------------------------------------------------ */
/* ------------------------------------------------------------------------ */
/* Accessors */
/* ------------------------------------------------------------------------ */
/* ------------------------------------------------------------------------ */
/* Class Members */
/* ------------------------------------------------------------------------ */
protected:
};
/* -------------------------------------------------------------------------- */
/* inline functions */
/* -------------------------------------------------------------------------- */
/// standard output stream operator
template
inline std::ostream & operator<<(
std::ostream & stream,
const NTNFricLawLinearSlipWeakeningNoHealing