Page MenuHomec4science

needleman.cc
No OneTemporary

File Metadata

Created
Wed, Jan 22, 11:53

needleman.cc

/**
* @file needleman.cc
*
* @author Guillaume Anciaux <guillaume.anciaux@epfl.ch>
* @author Till Junge <till.junge@epfl.ch>
*
* @date Wed Jan 15 17:00:43 2014
*
* @brief Needleman style discrete dislocation coupler between DD and FEM
*
* @section LICENSE
*
* Copyright (©) 2010-2011 EPFL (Ecole Polytechnique Fédérale de Lausanne)
* Laboratory (LSMS - Laboratoire de Simulation en Mécanique des Solides)
*
* LibMultiScale 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.
*
* LibMultiScale 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 LibMultiScale. If not, see <http://www.gnu.org/licenses/>.
*
*/
#include "lm_common.hh"
#include "needleman.hh"
#include "lib_bridging.hh"
/* -------------------------------------------------------------------------- */
__BEGIN_LIBMULTISCALE__
template <typename DomainDD, typename DomainC,UInt Dim>
void Needleman<DomainDD,DomainC,Dim>::init(){
// initialize the bridging_zone object
bridging_nodes.init();
// //forward name
// sprintf(temp,"%s-bridging",Parent::name.c_str());
// bridging_sources.setName(temp);
// // initialize the bridging_zone object
// bridging_sources.init();
}
/* -------------------------------------------------------------------------- */
template <typename DomainDD, typename DomainC,UInt Dim>
void Needleman<DomainDD,DomainC,Dim>::coupling(CouplingStage stage){
if (stage != COUPLING_STEP3) return;
// since dislocations move I must recompute their positions and associations with elements
recomputeBridgingInformationOnNodes();
applyStressesOnNodes();
applyStressesOnSources();
// apply boundary conditions to the FEM zone from image stresses of the dislocation stress fields
applyBoundaryConditionToFEM();
}
/* -------------------------------------------------------------------------- */
template <typename DomainDD, typename DomainC,UInt Dim>
void Needleman<DomainDD,DomainC,Dim>::recomputeBridgingInformationOnNodes(){
LM_FATAL("to adapt");
// construct sublist of coupled nodes
// bridging_nodes.buildPointList();
// // build positions of atom vector
// bridging_nodes.buildPositions();
// // build shape matrix
// bridging_nodes.buildShapeMatrix(bridging_nodes->pointList->nbElem());
// //filter unmatched atomic DOFs
// bridging_nodes.filterPointListForUnmatched();
// //filter assoc vector
// bridging_nodes.filterAssoc();
}
/* -------------------------------------------------------------------------- */
template <typename DomainDD, typename DomainC,UInt Dim>
void Needleman<DomainDD,DomainC,Dim>::applyStressesOnNodes(){
// assign the stress to nodes
IteratorDDNodesSubset itnodes = bridging_nodes.pointList.getIterator();
RefDDNode nd = itnodes.getFirst();
UInt i = 0;
RefElem el;
while (!itnodes.end()){
// assoc return the element index in which poUInt i resides
// elementList is a conatiner of elements
el = bridging_nodes.meshList.getContainerElems().get(bridging_nodes.getAssoc(i));
// conversion from 2D to 3D (temporary ?)
nd.stress(0) = el.stress(0);
nd.stress(1) = el.stress(1);
nd.stress(2) = 0;
nd.stress(3) = el.stress(2);
nd.stress(4) = 0;
nd.stress(5) = 0;
++i;
nd = itnodes.getNext();
}
}
/* -------------------------------------------------------------------------- */
template <typename DomainDD, typename DomainC,UInt Dim>
void Needleman<DomainDD,DomainC,Dim>::applyStressesOnSources(){
// // assign the stress to sources
// IteratorDDSourcesSubset itsources = bridging_sources->pointList->getIterator();
// RefDDSource nd = itsources.getFirst();
// UInt i = 0;
// RefElem el;
// while (!itsources.end()){
// // assoc return the element index in which poUInt i resides
// // elementList is a conatiner of elements
// el = bridging_sources->elementList.get(bridging_sources->getAssoc(i));
// // conversion from 2D to 3D (temporary ?)
// nd.stress(0) = el.stress(0);
// nd.stress(1) = el.stress(1);
// nd.stress(2) = 0;
// nd.stress(3) = el.stress(2);
// nd.stress(4) = 0;
// nd.stress(5) = 0;
// ++i;
// nd = itsources.getNext();
// }
}
/* -------------------------------------------------------------------------- */
template <typename DomainDD, typename DomainC,UInt Dim>
void Needleman<DomainDD,DomainC,Dim>:: applyBoundaryConditionToFEM(){
ContainerElems contElem = Parent::domC.getContainerElems();
LM_FATAL("what was that ?");
//contElem.boundarycontainerSwitch(1);
IteratorElems itElem = contElem.getIterator();
RefElem el = itElem.getFirst();
ContainerNodes contNodes = Parent::domC.getContainerNodes();
while(!itElem.end()){
std::vector< UInt > nodes;
el.globalIndexes(nodes);
Real nx,ny,nz;
el.normal(nx,ny,nz);
Real normals[3];
normals[0] = nx;normals[1] = ny;normals[2] = 0;
UInt nnodes = nodes.size();
Real quadrature_point[2]={0.,0.};
Real h = el.length();
for (UInt n = 0 ; n < nnodes ; ++n){
RefNode nd = contNodes.get(n);
quadrature_point[0] += nd.position0(0);
quadrature_point[1] += nd.position0(1);
}
quadrature_point[0] /= 2;
quadrature_point[1] /= 2;
Real tractions[3];
Parent::domA.imageForce(quadrature_point,normals,tractions);
for (UInt n = 0 ; n < nnodes ; ++n){
RefNode nd = contNodes.get(n);
Real fx = nd.force(0)*h;
Real fy = nd.force(1)*h;
nd.setForce(0,fx+0.5*tractions[0]);
nd.setForce(0,fy+0.5*tractions[1]);
}
el = itElem.getNext();
}
LM_FATAL("what was that");
// contElem.boundarycontainerSwitch(0);
}
/* -------------------------------------------------------------------------- */
/* LMDESC NEEDLEMAN
Needleman style discrete dislocation coupler between DD and FEM
*/
/* LMEXAMPLE
Will be added
*/
template <typename DomainDD, typename DomainC,UInt Dim>
void Needleman<DomainDD,DomainC,Dim>::declareParams(){
}
/* -------------------------------------------------------------------------- */
DECLARE_DD_CONTINUUM_TEMPLATE(Needleman)
__END_LIBMULTISCALE__

Event Timeline