Page MenuHomec4science

domain_akantu_compound.cc
No OneTemporary

File Metadata

Created
Sun, Aug 4, 03:34

domain_akantu_compound.cc

/**
* @file domain_akantu_compound.cc
*
* @author Guillaume Anciaux <guillaume.anciaux@epfl.ch>
* @author Till Junge <till.junge@epfl.ch>
*
* @date Mon Jul 21 10:32:33 2014
*
* @brief This is the model wrapping Akantu
*
* @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 "domain_akantu_compound.hh"
#include "communicator.hh"
/* -------------------------------------------------------------------------- */
#include <solid_mechanics_model.hh>
#if defined(AKANTU_USE_MPI)
# include "static_communicator.hh"
//# include "static_communicator_mpi.hh"
# include "mpi_type_wrapper.hh"
#endif
/* -------------------------------------------------------------------------- */
__BEGIN_LIBMULTISCALE__
/* -------------------------------------------------------------------------- */
template <UInt Dim>
DomainAkantuCompound<Dim>::DomainAkantuCompound(DomainID ID,CommGroup GID):
DomainAkantu<Dim>(ID,GID),
DomainAkantuDynamic<Dim>(ID, GID),
DomainAkantuStatic<Dim>(ID, GID),
is_static(false) {
}
/* -------------------------------------------------------------------------- */
template <UInt Dim>
DomainAkantuCompound<Dim>::~DomainAkantuCompound(){
}
/* -------------------------------------------------------------------------- */
template <UInt Dim>
void DomainAkantuCompound<Dim>::init(){
if (!Communicator::getCommunicator().amIinGroup(this->getGroupID())) return;
#if defined(AKANTU_USE_MPI)
using akantu::StaticCommunicator;
using akantu::StaticCommunicatorMPI;
// since initialize(argc, argv) has not been called in libmultiscale, this call creates the communicator
StaticCommunicator & comm = StaticCommunicator::getStaticCommunicator(akantu::_communicator_mpi);
StaticCommunicatorMPI & mpi_st_comm = comm.getRealStaticCommunicator<StaticCommunicatorMPI>();
MPI_Comm mpi_comm = Communicator::getCommunicator().getMpiGroup(this->getGroupID());
mpi_st_comm.getMPITypeWrapper().setMPICommunicator(mpi_comm);
#else
LM_ASSERT(Communicator::getCommunicator().getNBprocsOnGroup(this->getGroupID()) == 1,
"You try to use Akantu with more than one processor, but Akantu has been compiled without the AKANTU_PARALLEL option")
#endif
DomainAkantu<Dim>::init();
if (!this->is_static) {
DomainAkantuDynamic<Dim>::init();
this->velocity = new VecAkantu(this->model->getVelocity());
this->acceleration = new VecAkantu(this->model->getAcceleration());
}
else {
DomainAkantuStatic<Dim>::init();
}
/* -------------------- */
// initialize the vectors
/* -------------------- */
this->position0 = new VecAkantu(this->model->getFEEngine().getMesh().getNodes());
this->displacement = new VecAkantu(this->model->getDisplacement());
this->applied_force = new VecAkantu(this->model->getForce());
this->residual = new VecAkantu(this->model->getResidual());
this->mass = new VecAkantu(this->model->getMass());
/// PUT TRACTION BOUNDARY CONDITIONS HERE!
if (this->haveToApplyNeumann()) { // a valid surface tag is >= 1
this->checkBoundaryInputSanity();
}
this->model->updateResidual();
this->mesh_container.setRelease(INITIAL_MODEL_RELEASE);
if (!this->is_static) {
// call init for heat transfer model
if(this->heat_transfer_flag)
this->initHeatTransfer();
this->elems.setHeatTransferFlag(this->heat_transfer_flag);
this->elems.setRef();
}
}
/* -------------------------------------------------------------------------- */
template <UInt Dim>
void DomainAkantuCompound<Dim>::performStep1(){
if (!this->is_static) {
DomainAkantuDynamic<Dim>::performStep1();
} else {
DomainAkantuStatic<Dim>::performStep1();
}
}
/* -------------------------------------------------------------------------- */
template <UInt Dim>
void DomainAkantuCompound<Dim>::performStep2(){
if (!this->is_static) {
DomainAkantuDynamic<Dim>::performStep2();
} else {
DomainAkantuStatic<Dim>::performStep2();
}
}
/* -------------------------------------------------------------------------- */
template <UInt Dim>
void DomainAkantuCompound<Dim>::performStep3(){
if (!this->is_static) {
DomainAkantuDynamic<Dim>::performStep3();
} else {
DomainAkantuStatic<Dim>::performStep3();
}
}
/* -------------------------------------------------------------------------- */
/* LMDESC AKANTU
This domain implements the plugin with Akantu Finite Element library.
*/
/* LMHERITANCE domain_akantu_dynamic domain_akantu_static */
/* LMEXAMPLE
Section MultiScale AtomsUnits\\
...\\
GEOMETRY myGeom CUBE BBOX -1 1 -1 1 -1 1\\
MODEL AKANTU fe\\
...\\
endSection\\ \\
Section AKANTU:fe AtomsUnits\\
DOMAIN_GEOMETRY myGeom\\
MESH_FILENAME mesh.msh\\
MATERIAL_FILENAME material.dat\\
TIMESTEP 1\\
PBC 0 1\\
endSection\\
*/
template <UInt Dim>
void DomainAkantuCompound<Dim>::declareParams(){
DomainAkantu<Dim>::declareParams();
DomainAkantuDynamic<Dim>::declareParams();
DomainAkantuStatic<Dim>::declareParams();
/* LMKEYWORD IS_STATIC
Specify whether to use dynamics or statics.
Defaults to dynamics
*/
this->parseTag("IS_STATIC", is_static, false);
}
/* -------------------------------------------------------------------------- */
template class DomainAkantuCompound<1>;
template class DomainAkantuCompound<2>;
template class DomainAkantuCompound<3>;
/* -------------------------------------------------------------------------- */
__END_LIBMULTISCALE__
/* -------------------------------------------------------------------------- */

Event Timeline