Page MenuHomec4science

arlequin_template.cc
No OneTemporary

File Metadata

Created
Sat, Jul 6, 21:25

arlequin_template.cc

/**
* @file arlequin_template.cc
*
* @author Guillaume Anciaux <guillaume.anciaux@epfl.ch>
*
* @date Mon Nov 25 15:05:56 2013
*
* @brief Internal class to factor code for the Arlequin kind methods
*
* @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 "arlequin_template.hh"
#include "bridging.hh"
#include "bridging_atomic_continuum.hh"
#include "factory_multiscale.hh"
#include "lib_bridging.hh"
#include "lm_common.hh"
#include <fstream>
/* -------------------------------------------------------------------------- */
__BEGIN_LIBMULTISCALE__
ArlequinTemplate::ArlequinTemplate(const std::string &name)
: LMObject(name), CouplingAtomicContinuum(name),
bridging_zone(this->getID() + "-bridging"),
MDboundary_zone(this->getID() + "-boundary"),
weightFE("weight-fe-" + name), weightMD("weight-md-" + name),
lambdasC("lambdas-fe-" + name), lambdasA("lambdas-md-" + name) {
quality = 1e-3;
multi_time_step = 1;
size_constraint = 0;
/* registering computes for outer world */
FilterManager::getManager().addObject(this->weightFE);
FilterManager::getManager().addObject(this->lambdasC);
FilterManager::getManager().addObject(this->weightMD);
FilterManager::getManager().addObject(this->lambdasA);
}
/* -------------------------------------------------------------------------- */
ArlequinTemplate::~ArlequinTemplate() { clearAll(); }
/* -------------------------------------------------------------------------- */
void ArlequinTemplate::init() {}
/* -------------------------------------------------------------------------- */
void ArlequinTemplate::clearAll() {
// Parent::domA.getRefManager().DetachVector(A,&this->atomes_rec);
A.clear();
rhs.clear();
}
/* -------------------------------------------------------------------------- */
void ArlequinTemplate::allocate(UInt t) {
size_constraint = t;
const UInt Dim = spatial_dimension;
DUMP("initial number of atoms in rec " << size_constraint, DBG_INFO_STARTUP);
DUMP("allocation of " << Dim * (size_constraint) << " Reals",
DBG_INFO_STARTUP);
A.assign(size_constraint, 0);
rhs.resize(size_constraint, Dim);
rhs.to_array().setZero();
DUMP("Attach vector A", DBG_INFO_STARTUP);
bridging_zone.attachVector(A);
}
/* -------------------------------------------------------------------------- */
void ArlequinTemplate::buildContinuumConstraintMatrix() {
if (size_constraint == 0)
return;
this->bridging_zone.buildContinuumConstraint(
A, this->bridging_zone.node_shape, lambdasC);
}
/* -------------------------------------------------------------------------- */
void ArlequinTemplate::buildAtomsConstraintMatrix() {
A += 1. / lambdasA.getArray().to_array();
}
/* -------------------------------------------------------------------------- */
void ArlequinTemplate::cleanRHS() {
rhs.resize(this->bridging_zone.getNumberLocalMatchedPoints(),
spatial_dimension);
rhs.to_array().setZero();
}
/* -------------------------------------------------------------------------- */
void ArlequinTemplate::buildContinuumRHS([[gnu::unused]] ArrayView field) {
LM_TOIMPLEMENT;
// bridging_zone.buildRHS(rhs, field);
}
/* -------------------------------------------------------------------------- */
void ArlequinTemplate::applyContinuumCorrection(ArrayView field) {
this->bridging_zone.applyContinuumConstraint(field, rhs, lambdasC);
}
/* --------------------------------------------------------------------- */
/* LMDESC ArlequinTemplate
This class is used internally. \\
It is to be used
while two zones are declared, one for the coupling
and one for providing a stiff boundary condition to the atoms. \\
In the coupling a linear weight function is built.
*/
/* LMHERITANCE dof_association */
void ArlequinTemplate::declareParams() {
this->addSubParsableObject(bridging_zone);
this->addSubParsableObject(MDboundary_zone);
this->addSubParsableObject(weightFE);
this->addSubParsableObject(weightMD);
/* LMKEYWORD BOUNDARY
Set the boundary geometry where the atom velocities are to be fixed from
the
interpolated finite element velocities.
*/
this->parseKeyword("BOUNDARY", boundary_geom);
/* LMKEYWORD CHECK_COHERENCY
Perform a systematic check of the communication scheme.
\textbf{Be careful, it is extremely computationally expensive}
*/
this->parseTag("CHECK_COHERENCY", check_coherency, false);
}
/* --------------------------------------------------------------------------
*/
__END_LIBMULTISCALE__

Event Timeline