Page MenuHomec4science

domain_continuum.cc
No OneTemporary

File Metadata

Created
Fri, Nov 15, 20:43

domain_continuum.cc

/**
* @file domain_continuum.cc
*
* @author Guillaume Anciaux <guillaume.anciaux@epfl.ch>
*
* @date Wed Nov 06 20:35:11 2013
*
* @brief Mother of all continuum domains
*
* @section LICENSE
*
* Copyright INRIA and CEA
*
* The LibMultiScale is a C++ parallel framework for the multiscale
* coupling methods dedicated to material simulations. This framework
* provides an API which makes it possible to program coupled simulations
* and integration of already existing codes.
*
* This Project was initiated in a collaboration between INRIA Futurs Bordeaux
* within ScAlApplix team and CEA/DPTA Ile de France.
* The project is now continued at the Ecole Polytechnique Fédérale de Lausanne
* within the LSMS/ENAC laboratory.
*
* This software is governed by the CeCILL-C license under French law and
* abiding by the rules of distribution of free software. You can use,
* modify and/ or redistribute the software under the terms of the CeCILL-C
* license as circulated by CEA, CNRS and INRIA at the following URL
* "http://www.cecill.info".
*
* As a counterpart to the access to the source code and rights to copy,
* modify and redistribute granted by the license, users are provided only
* with a limited warranty and the software's author, the holder of the
* economic rights, and the successive licensors have only limited
* liability.
*
* In this respect, the user's attention is drawn to the risks associated
* with loading, using, modifying and/or developing or reproducing the
* software by the user in light of its specific status of free software,
* that may mean that it is complicated to manipulate, and that also
* therefore means that it is reserved for developers and experienced
* professionals having in-depth computer knowledge. Users are therefore
* encouraged to load and test the software's suitability as regards their
* requirements in conditions enabling the security of their systems and/or
* data to be ensured and, more generally, to use and operate it in the
* same conditions as regards security.
*
* The fact that you are presently reading this means that you have had
* knowledge of the CeCILL-C license and that you accept its terms.
*
*/
/* -------------------------------------------------------------------------- */
#include "lm_common.hh"
#include "lib_continuum.hh"
#include "lib_dumper.hh"
#include "lib_filter.hh"
#include "lib_stimulation.hh"
#include "filter_manager.hh"
#include "action_manager.hh"
#include "factory_multiscale_inline_impl.hh"
#include "geometry_manager.hh"
#include "xml_parser_restart.hh"
#include "domain_continuum.hh"
/* -------------------------------------------------------------------------- */
__BEGIN_LIBMULTISCALE__
/* -------------------------------------------------------------------------- */
template <typename ContElems, typename ContNodes, UInt Dim>
DomainContinuum<ContElems,ContNodes,Dim>::DomainContinuum(DomainID ID,CommGroup GID) :
DomainContinuumInterface(ID,GID),
ComponentLMOutTyped<ContainerMesh<ContNodes,ContElems>,OUTPUT_REF>(Dim),
arlequin_flag(false), mesh_container(nodes,elems),
slave_displacements_computed(false) ,
prestressed_periodicity_flag(false)
{
setDim(Dim);
geometries.resize(10);
}
/* -------------------------------------------------------------------------- */
template <typename ContElems, typename ContNodes, UInt Dim>
DomainContinuum<ContElems,ContNodes,Dim>::~DomainContinuum(){
}
/* -------------------------------------------------------------------------- */
template <typename ContElems, typename ContNodes, UInt Dim>
typename DomainContinuum<ContElems,ContNodes,Dim>::ContainerPoints &
DomainContinuum<ContElems,ContNodes,Dim>::getContainer(){
Cube c;
c.setDim(getDim());
Communicator & myComm = Communicator::getCommunicator();
if (myComm.amIinGroup(getGroupID())){
getDomainDimensions(c);
mesh_container.getBoundingBox() = c;
}
mesh_container.setCommGroup(getGroupID());
return mesh_container;
}
/* -------------------------------------------------------------------------- */
template <typename ContElems, typename ContNodes, UInt Dim>
typename DomainContinuum<ContElems,ContNodes,Dim>::ContainerPoints &
DomainContinuum<ContElems,ContNodes,Dim>::getOutput(){
return this->getContainer();
}
/* -------------------------------------------------------------------------- */
template <typename ContElems, typename ContNodes, UInt Dim>
std::vector< std::pair<UInt ,UInt > > &
DomainContinuum<ContElems,ContNodes,Dim>::getPBCpairs(){
return pbc_pairs;
}
/* -------------------------------------------------------------------------- */
template <typename ContElems, typename ContNodes,UInt Dim>
inline void DomainContinuum<ContElems,ContNodes,Dim>::connect(FilterManager & f){
f.create<DomainContinuum<ContElems,ContNodes,Dim> >(*this);
}
/* -------------------------------------------------------------------------- */
template <typename ContElems, typename ContNodes,UInt Dim>
inline void DomainContinuum<ContElems,ContNodes,Dim>::connect(ActionManager & f){
f.create<DomainContinuum<ContElems,ContNodes,Dim> >(*this);
}
/* -------------------------------------------------------------------------- */
template <typename ContElems, typename ContNodes,UInt Dim>
inline void DomainContinuum<ContElems,ContNodes,Dim>::readXMLFile(const std::string & filename){
XMLRestartParser<Dim> parser;
DUMP("Setting Dummy simulation from libMultiScale XML Data format " << filename,DBG_INFO);
if (parser.parseFile(filename,this->restart_continue_if_notfound)){
DUMP("restart was not performed because file was not found",DBG_WARNING);
return;
}
this->setCurrentStep(current_step);
DUMP("read done " << filename,DBG_INFO);
typename ContNodes::iterator it = getContainerNodes().getIterator();
typename ContNodes::Ref n = it.getFirst();
UnitsConverter unit;
unit.setInUnits(atomic_unit_system);
UInt cpt=0;
UInt cpt2=0;
#ifndef LM_OPTIMIZED
UInt total = getContainerNodes().nbElem();
#endif // LM_OPTIMIZED
DUMP("total = " << total,DBG_DETAIL);
for (n = it.getFirst(); !it.end() ; n = it.getNext()){
Real X[Dim];
n.getPositions0(X);
if (cpt2%100 == 0) DUMP("passing node number " << cpt2 << "/" << total << " reloaded",DBG_INFO);
++cpt2;
if (!parser.isDofRegistered(X)) continue;
Real U[Dim];
parser.assignDispField(X,U);
for (UInt i = 0; i < Dim; ++i) n.displacement(i) = U[i];
Real V[Dim];
parser.assignVelField(X,V);
for (UInt i = 0; i < Dim; ++i) n.velocity(i) = V[i];
if (cpt%100 == 0) DUMP("node number " << cpt << "/" << total << " reloaded",DBG_INFO);
++cpt;
}
DUMP("associated " << cpt << " over " << total,DBG_INFO);
performStep2();
}
/* -------------------------------------------------------------------------- */
template <typename ContElems, typename ContNodes,UInt Dim>
ContElems & DomainContinuum<ContElems,ContNodes,Dim>::getContainerElems(){
Cube c;
c.setDim(getDim());
Communicator & myComm = Communicator::getCommunicator();
if (myComm.amIinGroup(getGroupID())){
getDomainDimensions(c);
elems.getBoundingBox() = c;
}
elems.setCommGroup(getGroupID());
return elems;
}
/* -------------------------------------------------------------------------- */
template <typename ContElems, typename ContNodes,UInt Dim>
ContNodes & DomainContinuum<ContElems,ContNodes,Dim>::getContainerNodes(){
Cube c;
c.setDim(getDim());
Communicator & myComm = Communicator::getCommunicator();
if (myComm.amIinGroup(getGroupID())){
getDomainDimensions(c);
nodes.getBoundingBox() = c;
}
nodes.setCommGroup(getGroupID());
return nodes;
}
/* -------------------------------------------------------------------------- */
template <typename ContElems, typename ContNodes,UInt Dim>
Geometry & DomainContinuum<ContElems,ContNodes,Dim>::getGeom(){
return *GeometryManager::getManager().getGeometry(geometries[0]);
}
/* -------------------------------------------------------------------------- */
/* LMDESC DomainContinuum
This section describe the section that is associated
with continuum mechanics model. It is the starting
point of every Continuum Mechanics plugins.
*/
template <typename ContElems, typename ContNodes,UInt Dim>
inline void DomainContinuum<ContElems,ContNodes,Dim>::declareParams(){
DomainInterface::declareParams();
/* LMKEYWORD DOMAIN_GEOMETRY
Specify the geometry/region describing the domain
*/
this->parseKeyword("DOMAIN_GEOMETRY",geometries[0]);
/* LMKEYWORD CONSTRAINED_GEOMETRY
For minimization purpose (obsolete). This provided a region
not included in the computation of the objective function and the gradient.
*/
this->parseKeyword("CONSTRAINED_GEOMETRY",geom_constrained,invalidGeom);
/* LMKEYWORD TIMESTEP
Specify the explicit integration timestep
*/
this->parseKeyword("TIMESTEP",timeStep);
/* LMKEYWORD PRESTRESSED_PERIODICITY
set whether the corrective displacement of slaves should be considered
*/
this->parseKeyword("PRESTRESSED_PERIODICITY",prestressed_periodicity_flag,false);
}
/* -------------------------------------------------------------------------- */
#ifdef LIBMULTISCALE_USE_LIBMESH
template class DomainContinuum<ContainerElemsLibMesh<1>,ContainerNodesLibMesh<1>,1>;
template class DomainContinuum<ContainerElemsLibMesh<2>,ContainerNodesLibMesh<2>,2>;
template class DomainContinuum<ContainerElemsLibMesh<3>,ContainerNodesLibMesh<3>,3>;
#endif
#ifdef LIBMULTISCALE_USE_SIMULPACK
template class DomainContinuum<ContainerElemsSimulPack<2>,ContainerNodesSimulPack<2>,2>;
template class DomainContinuum<ContainerElemsSimulPack<3>,ContainerNodesSimulPack<3>,3>;
#endif
#ifdef LIBMULTISCALE_USE_MECA1D
template class DomainContinuum<ContainerElemsMeca1D,ContainerNodesMeca1D,1>;
#endif
#ifdef LIBMULTISCALE_USE_AKANTU
template class DomainContinuum<ContainerElemsAkantu<1>,ContainerNodesAkantu<1>,1>;
template class DomainContinuum<ContainerElemsAkantu<2>,ContainerNodesAkantu<2>,2>;
template class DomainContinuum<ContainerElemsAkantu<3>,ContainerNodesAkantu<3>,3>;
#endif
__END_LIBMULTISCALE__

Event Timeline