diff --git a/packages/embedded.cmake b/packages/embedded.cmake new file mode 100644 index 000000000..273af36ce --- /dev/null +++ b/packages/embedded.cmake @@ -0,0 +1,44 @@ +#=============================================================================== +# @file embedded.cmake +# +# @author Lucas Frérot +# +# @date creation: Tue Oct 16 2012 +# @date last modification: Thu Jun 12 2014 +# +# @brief package descrition for embedded model use +# +# @section LICENSE +# +# Copyright (©) 2010-2012, 2014 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 . +# +#=============================================================================== + +package_declare(embedded + DESCRIPTION "Add support for the embedded solid mechanics model" + DEPENDS CGAL) + +package_declare_sources(embedded + model/solid_mechanics/materials/material_embedded_includes.hh + + model/solid_mechanics/embedded_interface_model.hh + model/solid_mechanics/embedded_interface_model.cc + + model/solid_mechanics/materials/material_reinforcement.hh + model/solid_mechanics/materials/material_reinforcement.cc + model/solid_mechanics/materials/material_reinforcement_inline_impl.cc + ) diff --git a/src/common/aka_config.hh.in b/src/common/aka_config.hh.in index 22736544a..b3083bd37 100644 --- a/src/common/aka_config.hh.in +++ b/src/common/aka_config.hh.in @@ -1,90 +1,91 @@ /** * @file aka_config.hh.in * * @author Nicolas Richart * * @date Fri Jan 13 12:34:54 2012 * * @brief Compilation time configuration of Akantu * * @section LICENSE * * Copyright (©) 2010-2011 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 __AKANTU_AKA_CONFIG_HH__ #define __AKANTU_AKA_CONFIG_HH__ #define AKANTU_VERSION @AKANTU_VERSION@ #define AKANTU_VERSION_MAJOR @AKANTU_MAJOR_VERSION@ #define AKANTU_VERSION_MINOR @AKANTU_MINOR_VERSION@ #define AKANTU_VERSION_PATCH @AKANTU_PATCH_VERSION@ #cmakedefine AKANTU_USE_BLAS #cmakedefine AKANTU_USE_LAPACK #cmakedefine AKANTU_PARALLEL #cmakedefine AKANTU_USE_MPI #cmakedefine AKANTU_USE_SCOTCH #cmakedefine AKANTU_USE_PTSCOTCH #cmakedefine AKANTU_SCOTCH_NO_EXTERN #cmakedefine AKANTU_USE_MUMPS #cmakedefine AKANTU_USE_PETSC #cmakedefine AKANTU_USE_IOHELPER #cmakedefine AKANTU_USE_QVIEW #cmakedefine AKANTU_USE_BLACKDYNAMITE #cmakedefine AKANTU_USE_NLOPT #cmakedefine AKANTU_USE_CPPARRAY #cmakedefine AKANTU_USE_OBSOLETE_GETTIMEOFDAY #cmakedefine AKANTU_EXTRA_MATERIALS #cmakedefine AKANTU_DAMAGE_NON_LOCAL #cmakedefine AKANTU_STRUCTURAL_MECHANICS #cmakedefine AKANTU_HEAT_TRANSFER #cmakedefine AKANTU_COHESIVE_ELEMENT #cmakedefine AKANTU_PARALLEL_COHESIVE_ELEMENT #cmakedefine AKANTU_IGFEM #cmakedefine AKANTU_USE_CGAL +#cmakedefine AKANTU_EMBEDDED // BOOST Section #cmakedefine AKANTU_BOOST_CHRONO #cmakedefine AKANTU_BOOST_SYSTEM // Experimental part #cmakedefine AKANTU_CORE_CXX11 // Debug tools //#cmakedefine AKANTU_NDEBUG #cmakedefine AKANTU_DEBUG_TOOLS #cmakedefine READLINK_COMMAND @READLINK_COMMAND@ #cmakedefine ADDR2LINE_COMMAND @ADDR2LINE_COMMAND@ #define __aka_inline__ inline #endif /* __AKANTU_AKA_CONFIG_HH__ */ diff --git a/src/model/solid_mechanics/embedded_interface_model.cc b/src/model/solid_mechanics/embedded_interface_model.cc new file mode 100644 index 000000000..f530438ce --- /dev/null +++ b/src/model/solid_mechanics/embedded_interface_model.cc @@ -0,0 +1,75 @@ +/** + * @file embedded_interface_model.cc + * + * @author Lucas Frérot + * + * @date creation: Mon Mar 9 2015 + * @date last modification: Mon Mar 9 2015 + * + * @brief Model of Solid Mechanics with embedded interfaces + * + * @section LICENSE + * + * Copyright (©) 2010-2012, 2014 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 "aka_common.hh" + +#include "embedded_interface_model.hh" +#include "material_reinforcement.hh" + +/* -------------------------------------------------------------------------- */ + +__BEGIN_AKANTU__ + +EmbeddedInterfaceModel::EmbeddedInterfaceModel(Mesh & mesh, + UInt spatial_dimension, + const ID & id, + const MemoryID & memory_id) : + SolidMechanicsModel(mesh, spatial_dimension, id, memory_id), + interface_mesh(NULL), + interface_container(mesh) +{} + +EmbeddedInterfaceModel::~EmbeddedInterfaceModel() +{} + +void EmbeddedInterfaceModel::initModel() { + SolidMechanicsModel::initModel(); + + registerFEEngineObject("EmbeddedInterfaceFEEngine", *interface_mesh, spatial_dimension); + +} + +void EmbeddedInterfaceModel::initMaterials() { + SolidMechanicsModel::initMaterials(); +} + +void EmbeddedInterfaceModel::initInterface(const std::list & interface_list) { + +} + +void EmbeddedInterfaceModel::assembleStiffnessMatrix() { + +} + + +__END_AKANTU__ + diff --git a/src/model/solid_mechanics/embedded_interface_model.hh b/src/model/solid_mechanics/embedded_interface_model.hh new file mode 100644 index 000000000..24a3e99f0 --- /dev/null +++ b/src/model/solid_mechanics/embedded_interface_model.hh @@ -0,0 +1,112 @@ +/** + * @file embedded_interface_model.hh + * + * @author Lucas Frérot + * + * @date creation: Mon Mar 9 2015 + * @date last modification: Mon Mar 9 2015 + * + * @brief Model of Solid Mechanics with embedded interfaces + * + * @section LICENSE + * + * Copyright (©) 2010-2012, 2014 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 __AKANTU_EMBEDDED_INTERFACE_MODEL_HH__ +#define __AKANTU_EMBEDDED_INTERFACE_MODEL_HH__ + +#include "aka_common.hh" + +#include "solid_mechanics_model.hh" +#include "mesh.hh" + +#include "mesh_geom_container.hh" + +#include + +/* -------------------------------------------------------------------------- */ + +__BEGIN_AKANTU__ + +typedef CGAL::Cartesian K; + +class EmbeddedInterfaceModel : public SolidMechanicsModel { + + typedef CGAL::Segment_3 Interface; + typedef FEEngineTemplate MyFEEngineType; + + /* ------------------------------------------------------------------------ */ + /* Constructors/Destructors */ + /* ------------------------------------------------------------------------ */ +public: + /// Constructor + EmbeddedInterfaceModel(Mesh & mesh, + UInt spatial_dimension = _all_dimensions, + const ID & id = "embedded_interface_model", + const MemoryID & memory_id = 0); + + /// Destructor + virtual ~EmbeddedInterfaceModel(); + + /* ------------------------------------------------------------------------ */ + /* Methods */ + /* ------------------------------------------------------------------------ */ +public: + /// Initialise the model + virtual void initModel(); + + /// Initialise the materials + virtual void initMaterials(); + + /// Initialise the interface mesh + void initInterface(const std::list & interface_list); + +public: + /// Assemble the stiffness matrix of the model + virtual void assembleStiffnessMatrix(); + + /* ------------------------------------------------------------------------ */ + /* Accessors */ + /* ------------------------------------------------------------------------ */ +public: + /// get interface mesh + AKANTU_GET_MACRO(InterfaceMesh, *interface_mesh, Mesh &); + + /// get associated elements + AKANTU_GET_MACRO_BY_ELEMENT_TYPE(InterfaceAssociatedElements, + interface_mesh->getData("associated_element"), + Element); + + /* ------------------------------------------------------------------------ */ + /* Class Members */ + /* ------------------------------------------------------------------------ */ +protected: + /// Interface mesh (weak reference) + Mesh * interface_mesh; + + /// Geom object to build the interface mesh + MeshGeomContainer interface_container; + +}; + +__END_AKANTU__ + +#endif // __AKANTU_EMBEDDED_INTERFACE_MODEL_HH__ diff --git a/src/model/solid_mechanics/material_list.hh b/src/model/solid_mechanics/material_list.hh index e682c277e..81a2985eb 100644 --- a/src/model/solid_mechanics/material_list.hh +++ b/src/model/solid_mechanics/material_list.hh @@ -1,98 +1,105 @@ /** * @file material_list.hh * * @author Nicolas Richart * * @date creation: Tue Oct 29 2013 * @date last modification: Fri Sep 19 2014 * * @brief List of materials and all includes * * @section LICENSE * * Copyright (©) 2014 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 __AKANTU_MATERIAL_LIST_HH__ #define __AKANTU_MATERIAL_LIST_HH__ #include "aka_config.hh" /* -------------------------------------------------------------------------- */ /* Material list */ /* -------------------------------------------------------------------------- */ #ifndef AKANTU_CMAKE_LIST_MATERIALS // elastic materials #include "material_elastic.hh" #include "material_neohookean.hh" #include "material_elastic_orthotropic.hh" #include "material_elastic_linear_anisotropic.hh" // visco-elastic materials #include "material_standard_linear_solid_deviatoric.hh" // damage laws #include "material_marigo.hh" #include "material_mazars.hh" // small-deformation plasticity #include "material_linear_isotropic_hardening.hh" #endif #define AKANTU_CORE_MATERIAL_LIST \ ((2, (elastic , MaterialElastic ))) \ ((2, (neohookean , MaterialNeohookean ))) \ ((2, (elastic_orthotropic, MaterialElasticOrthotropic ))) \ ((2, (elastic_anisotropic, MaterialElasticLinearAnisotropic ))) \ ((2, (sls_deviatoric , MaterialStandardLinearSolidDeviatoric))) \ ((2, (marigo , MaterialMarigo ))) \ ((2, (mazars , MaterialMazars ))) \ ((2, (plastic_linear_isotropic_hardening, MaterialLinearIsotropicHardening))) #if defined(AKANTU_EXTRA_MATERIALS) # include "material_extra_includes.hh" #else # define AKANTU_EXTRA_MATERIAL_LIST # define AKANTU_DAMAGE_NON_LOCAL_MATERIAL_EXTRA_LIST #endif #if defined(AKANTU_COHESIVE_ELEMENT) # include "material_cohesive_includes.hh" #else # define AKANTU_COHESIVE_MATERIAL_LIST #endif #if defined(AKANTU_DAMAGE_NON_LOCAL) # include "material_non_local_includes.hh" #else # define AKANTU_DAMAGE_NON_LOCAL_MATERIAL_LIST #endif +#if defined(AKANTU_EMBEDDED) +# include "material_embedded_includes.hh" +#else +# define AKANTU_EMBEDDED_MATERIAL_LIST +#endif + #define AKANTU_MATERIAL_LIST \ AKANTU_CORE_MATERIAL_LIST \ AKANTU_COHESIVE_MATERIAL_LIST \ AKANTU_DAMAGE_NON_LOCAL_MATERIAL_LIST \ AKANTU_EXTRA_MATERIAL_LIST \ - AKANTU_DAMAGE_NON_LOCAL_MATERIAL_EXTRA_LIST + AKANTU_DAMAGE_NON_LOCAL_MATERIAL_EXTRA_LIST \ + AKANTU_EMBEDDED_MATERIAL_LIST #endif /* __AKANTU_MATERIAL_LIST_HH__ */ diff --git a/src/model/solid_mechanics/materials/material_embedded_includes.hh b/src/model/solid_mechanics/materials/material_embedded_includes.hh new file mode 100644 index 000000000..4b501435d --- /dev/null +++ b/src/model/solid_mechanics/materials/material_embedded_includes.hh @@ -0,0 +1,37 @@ +/** + * @file material_embedded_includes.hh + * + * @author Lucas Frérot + * + * @date creation: Fri Mar 13 2015 + * @date last modification: Fri Mar 13 2015 + * + * @brief List of includes for embedded elements + * + * @section LICENSE + * + * Copyright (©) 2015 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 AKANTU_CMAKE_LIST_MATERIALS +# include "material_reinforcement.hh" +#endif + +#define AKANTU_EMBEDDED_MATERIAL_LIST \ + ((2, (reinforcement, MaterialReinforcement ))) diff --git a/src/model/solid_mechanics/materials/material_reinforcement.cc b/src/model/solid_mechanics/materials/material_reinforcement.cc new file mode 100644 index 000000000..04bd1ddca --- /dev/null +++ b/src/model/solid_mechanics/materials/material_reinforcement.cc @@ -0,0 +1,212 @@ +/** + * @file material_reinforcement.cc + * + * @author Lucas Frérot + * + * @date creation: Thu Mar 12 2015 + * @date last modification: Thu Mar 12 2015 + * + * @brief Reinforcement material + * + * @section LICENSE + * + * Copyright (©) 2010-2012, 2014 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 "material_reinforcement.hh" + +__BEGIN_AKANTU__ + +template +MaterialReinforcement::MaterialReinforcement(SolidMechanicsModel & model, const ID & id): + Material(model, id), + model(NULL), + directing_cosines("directing_cosines", *this), + reinforcement_stiffness("reinforcement_stiffness", *this), + area("area", *this), + shape_derivatives() +{ + this->model = dynamic_cast(&model); + + const UInt steel_dof = Mesh::getNbNodesPerElement(_segment_2) * d; + const UInt voigt_size = static_cast(d * (d - (d - 1) / 2.)); + + directing_cosines.initialize(steel_dof * voigt_size); +} + +/* -------------------------------------------------------------------------- */ + +template +MaterialReinforcement::~MaterialReinforcement() +{} + +/* -------------------------------------------------------------------------- */ + +template +void MaterialReinforcement::initBackgroundShapeDerivatives() { + AKANTU_DEBUG_IN(); + + AKANTU_DEBUG_OUT(); +} + +/* -------------------------------------------------------------------------- */ + +template +void MaterialReinforcement::assembleStiffnessMatrix(GhostType ghost_type) { + AKANTU_DEBUG_IN(); + + AKANTU_DEBUG_OUT(); +} + +/* -------------------------------------------------------------------------- */ + +template +void MaterialReinforcement::computeStiffness(const ElementType & type, GhostType ghost_type) { + // This methods should be virtual pure +} + +/* -------------------------------------------------------------------------- */ + +template +void MaterialReinforcement::filterInterfaceBackgroundElements(Array & filter, + const ElementType & type, + const ElementType & interface_type, + GhostType ghost_type, + GhostType interface_ghost_type) { + AKANTU_DEBUG_IN(); + + filter.clear(); + + Array & elements = model->getInterfaceAssociatedElements(interface_type, interface_ghost_type); + + for (Array::scalar_iterator it = elements.begin() ; + it != elements.end() ; + ++it) { + if (it->type == type) filter.push_back(it->element); + } + + AKANTU_DEBUG_OUT(); +} + +/* -------------------------------------------------------------------------- */ + +template +void MaterialReinforcement::computeDirectingCosines(const ElementType & type, GhostType ghost_type) { + AKANTU_DEBUG_IN(); + + Mesh & interface_mesh = this->model->getInterfaceMesh(); + + const UInt nb_nodes_per_element = Mesh::getNbNodesPerElement(type); + const UInt steel_dof = nb_nodes_per_element * d; + const UInt voigt_size = static_cast(d * (d - (d - 1) / 2.)); + const UInt nb_quad_points = model->getFEEngine().getNbQuadraturePoints(type, ghost_type); + + Array node_coordinates(this->element_filter(type, ghost_type).getSize(), steel_dof); + + this->model->getFEEngine().template extractNodalToElementField(interface_mesh, + interface_mesh.getNodes(), + node_coordinates, + type, + ghost_type, + this->element_filter(type, ghost_type)); + + Array::matrix_iterator + directing_cosines_it = directing_cosines(type, ghost_type).begin(steel_dof, voigt_size); + + Array::matrix_iterator node_coordinates_it = node_coordinates.begin(d, nb_nodes_per_element); + Array::matrix_iterator node_coordinates_end = node_coordinates.end(d, nb_nodes_per_element); + + for (; node_coordinates_it != node_coordinates_end ; ++node_coordinates_it) { + for (UInt i = 0 ; i < nb_quad_points ; i++, ++directing_cosines_it) { + Matrix & nodes = *node_coordinates_it; + Matrix & cosines = *directing_cosines_it; + + computeDirectingCosinesOnQuad(nodes, cosines); + } + } + + AKANTU_DEBUG_OUT(); +} + +/* -------------------------------------------------------------------------- */ + +template +void MaterialReinforcement::assembleStiffnessMatrix(const ElementType & type, GhostType ghost_type) { + AKANTU_DEBUG_IN(); + + AKANTU_DEBUG_OUT(); +} + +/* -------------------------------------------------------------------------- */ + +/// In this function, type and ghost type refer to background elements +template +void MaterialReinforcement::computeBackgroundShapeDerivatives(const ElementType & type, GhostType ghost_type) { + AKANTU_DEBUG_IN(); + + Mesh & mesh = model->getMesh(); + Mesh & interface_mesh = model->getInterfaceMesh(); + + FEEngine & engine = model->getFEEngine(); + FEEngine & interface_engine = model->getFEEngine("EmbeddedInterfaceFEEngine"); + + ElementTypeMapArray quad_pos_map; + interface_engine.interpolateOnQuadraturePoints(interface_mesh.getNodes(), quad_pos_map); + + Mesh::type_iterator interface_type = interface_mesh.firstType(); + Mesh::type_iterator interface_last = interface_mesh.lastType(); + + for (; interface_type != interface_last ; ++interface_type) { + Array filter; + + filterInterfaceBackgroundElements(filter, type, *interface_type, ghost_type, _not_ghost); + + const UInt nb_elements = filter.getSize(); + const UInt nb_nodes = Mesh::getNbNodesPerElement(type); + const UInt nb_quad_per_element = interface_engine.getNbQuadraturePoints(*interface_type); + + shape_derivatives(*interface_type).alloc(nb_elements * nb_quad_per_element, d * nb_nodes, type, ghost_type); + + Array & background_shapesd = shape_derivatives(*interface_type)(type, ghost_type); + Array & quad_pos = quad_pos_map(*interface_type); + + Array::scalar_iterator filter_it = filter.begin(); + Array::scalar_iterator filter_end = filter.end(); + + Array::matrix_iterator shapesd_it = background_shapesd.begin(d, nb_nodes); + + Array::vector_iterator quad_pos_it = quad_pos.begin(d); + + for (; filter_it != filter_end ; ++filter_it) { + for (UInt i = 0 ; i < nb_quad_per_element ; i++, ++shapesd_it, ++quad_pos_it); + //engine.computeShapeDerivatives(*quad_pos_it, *filter_it, type, *shapesd_it, ghost_type); + } + } + + AKANTU_DEBUG_OUT(); +} + +/* -------------------------------------------------------------------------- */ + +INSTANSIATE_MATERIAL(MaterialReinforcement); + +/* -------------------------------------------------------------------------- */ + +__END_AKANTU__ diff --git a/src/model/solid_mechanics/materials/material_reinforcement.hh b/src/model/solid_mechanics/materials/material_reinforcement.hh new file mode 100644 index 000000000..a3133dcf2 --- /dev/null +++ b/src/model/solid_mechanics/materials/material_reinforcement.hh @@ -0,0 +1,108 @@ +/** + * @file material_reinforcement.hh + * + * @author Lucas Frérot + * + * @date creation: Thu Mar 12 2015 + * @date last modification: Thu Mar 12 2015 + * + * @brief Reinforcement material + * + * @section LICENSE + * + * Copyright (©) 2010-2012, 2014 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 __AKANTU_MATERIAL_REINFORCEMENT_HH__ +#define __AKANTU_MATERIAL_REINFORCEMENT_HH__ + +#include "aka_common.hh" + +#include "material.hh" +#include "embedded_interface_model.hh" + +/* -------------------------------------------------------------------------- */ + +__BEGIN_AKANTU__ + +template +class MaterialReinforcement : public Material { + +public: + /// Constructor + MaterialReinforcement(SolidMechanicsModel & model, const ID & id = ""); + + /// Destructor + virtual ~MaterialReinforcement(); + +public: + /// Init the background shape derivatives + virtual void initBackgroundShapeDerivatives(); + + /// Assemble stiffness matrix + virtual void assembleStiffnessMatrix(GhostType ghost_type); + + /// Compute the stiffness parameter for elements of a type + virtual void computeStiffness(const ElementType & type, GhostType ghost_type); + +protected: + /// Compute the directing cosines matrix for one element type + void computeDirectingCosines(const ElementType & type, GhostType ghost_type); + + /// Compute the directing cosines matrix on quadrature points + inline void computeDirectingCosinesOnQuad(const Matrix & nodes, + Matrix & cosines); + + /// Assemble the stiffness matrix for an element type (typically _segment_2) + void assembleStiffnessMatrix(const ElementType & type, GhostType ghost_type); + + /// Compute the background shape derivatives for a type (typically _triangle_3 / _tetrahedron_4) + void computeBackgroundShapeDerivatives(const ElementType & type, GhostType ghost_type); + + /// Filter elements crossed by interface of a type + void filterInterfaceBackgroundElements(Array & filter, + const ElementType & type, + const ElementType & interface_type, + GhostType ghost_type, + GhostType interface_ghost_type); + +protected: + /// Embedded model + EmbeddedInterfaceModel * model; + + /// C matrix on quad + InternalField directing_cosines; + + /// D on quad + InternalField reinforcement_stiffness; + + /// Cross-sectional area + InternalField area; + + /// Background mesh shape derivatives + ElementTypeMap< ElementTypeMapArray > shape_derivatives; + +}; + +#include "material_reinforcement_inline_impl.cc" + +__END_AKANTU__ + +#endif // __AKANTU_MATERIAL_REINFORCEMENT_HH__ diff --git a/src/model/solid_mechanics/materials/material_reinforcement_inline_impl.cc b/src/model/solid_mechanics/materials/material_reinforcement_inline_impl.cc new file mode 100644 index 000000000..12ce265fc --- /dev/null +++ b/src/model/solid_mechanics/materials/material_reinforcement_inline_impl.cc @@ -0,0 +1,56 @@ +/** + * @file material_reinforcement_inline_impl.cc + * + * @author Lucas Frérot + * + * @date creation: Thu Mar 12 2015 + * @date last modification: Thu Mar 12 2015 + * + * @brief Reinforcement material + * + * @section LICENSE + * + * Copyright (©) 2010-2012, 2014 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 . + * + */ + +/* -------------------------------------------------------------------------- */ + +template +inline void MaterialReinforcement::computeDirectingCosinesOnQuad(const Matrix & nodes, + Matrix & cosines) { + AKANTU_DEBUG_IN(); + + AKANTU_DEBUG_ASSERT(nodes.cols() == 2, "Higher order reinforcement elements not implemented"); + + const Vector & a = nodes(0), b = nodes(1); + + cosines.clear(); + + Real sq_length = 0.; + for (UInt i = 0 ; i < d ; i++) { + sq_length += Math::pow<2, Real>(b(i) - a(i)); + } + + // Fill the first row of cosine matrix + for (UInt i = 0 ; i < d ; i++) { + cosines(0, i) = Math::pow<2, Real>(b(i) - a(i)) / sq_length; + } + + AKANTU_DEBUG_OUT(); +} +