diff --git a/simulations/CMakeLists.txt b/simulations/CMakeLists.txt new file mode 100644 index 000000000..d3cc16ae0 --- /dev/null +++ b/simulations/CMakeLists.txt @@ -0,0 +1,65 @@ +#=============================================================================== +# @file CMakeLists.txt +# @author Nicolas Richart +# @author Guillaume Anciaux +# @date Fri Jun 11 09:46:59 2010 +# +# @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 . +# +# @section DESCRIPTION +# +#=============================================================================== + +cmake_minimum_required(VERSION 2.6) +enable_language(CXX) +set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake") + +project(akantu_examples) + +find_package(Akantu REQUIRED) +find_package(GMSH REQUIRED) + +find_package(Boost REQUIRED) +if(Boost_FOUND) + include_directories(${Boost_INCLUDE_DIRS}) +endif() + +if(AKANTU_CORE_CXX11) + message(TOTO) + add_definition(-std=c++11) +endif() + +include(cmake/AkantuExamplesMacros.cmake) + +include_directories(${AKANTU_INCLUDE_DIR}) + +if(CMAKE_CXX_FLAGS STREQUAL "") + set(CMAKE_CXX_FLAGS "-Wall" CACHE STRING "Flags used by the compiler during all build types." FORCE) +endif() + +set(CMAKE_CXX_FLAGS_PROFILING "-g -pg" CACHE STRING "Flags used by the compiler during profiling builds") +set(CMAKE_EXE_LINKER_FLAGS_PROFILING "-pg" CACHE STRING "Flags used by the linker during profiling builds") +set(CMAKE_SHARED_LINKER_FLAGS_PROFILING "-pg" CACHE STRING "Flags used by the linker during profiling builds") +mark_as_advanced(CMAKE_CXX_FLAGS_PROFILING) +mark_as_advanced(CMAKE_EXE_LINKER_FLAGS_PROFILING) +mark_as_advanced(CMAKE_SHARED_LINKER_FLAGS_PROFILING) + +#=============================================================================== +add_example(double_cantilever_beam_tests "Double cantilever beam fracture") + diff --git a/simulations/cmake/AkantuExamplesMacros.cmake b/simulations/cmake/AkantuExamplesMacros.cmake new file mode 100644 index 000000000..375ff02ea --- /dev/null +++ b/simulations/cmake/AkantuExamplesMacros.cmake @@ -0,0 +1,131 @@ +#=============================================================================== +# @file AkantuTestAndExamples.cmake +# @author Nicolas Richart +# @author Guillaume Anciaux +# @date Mon Oct 25 09:46:59 2010 +# +# @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 . +# +# @section DESCRIPTION +# +#=============================================================================== + +#=============================================================================== +macro(manage_examples et_name desc build_all label) + string(TOUPPER ${et_name} upper_name) + + option(AKANTU_BUILD${label}${upper_name} "${desc}") + mark_as_advanced(AKANTU_BUILD_${upper_name}) + + if(${build_all}) + set(AKANTU_BUILD${label}${upper_name}_OLD + ${AKANTU_BUILD${label}${upper_name}} + CACHE INTERNAL "${desc}" FORCE) + + set(AKANTU_BUILD${label}${upper_name} ON + CACHE INTERNAL "${desc}" FORCE) + else(${build_all}) + if(DEFINED AKANTU_BUILD${label}${upper_name}_OLD) + set(AKANTU_BUILD${label}${upper_name} + ${AKANTU_BUILD${label}${upper_name}_OLD} + CACHE BOOL "${desc}" FORCE) + + unset(AKANTU_BUILD${label}${upper_name}_OLD + CACHE) + endif(DEFINED AKANTU_BUILD${label}${upper_name}_OLD) + endif(${build_all}) + + if(AKANTU_BUILD${label}${upper_name}) + add_subdirectory(${et_name}) + endif(AKANTU_BUILD${label}${upper_name}) +endmacro() + +#=============================================================================== +# Examples +#=============================================================================== +if(AKANTU_EXAMPLES) + option(AKANTU_EXAMPLES_BUILD_ALL "Build all examples") +endif(AKANTU_EXAMPLES) + +#=============================================================================== +function(register_example example_name) + set(multi_variables + SOURCES FILES_TO_COPY DEPENDS DIRECTORIES_TO_CREATE COMPILE_OPTIONS USE + ) + + cmake_parse_arguments(_opt_pkg + "" + "" + "${multi_variables}" + ${ARGN} + ) + + + set(_deps_OK TRUE) + if(_opt_pkg_USE) + foreach(_use ${_opt_pkg_USE}) + string(TOUPPER ${_use} _u_use) + if(AKANTU_HAS_${_u_use}) + list(APPEND _example_INCLUDE_DIRS ${AKANTU_${_u_use}_INCLUDE_DIR}) + list(APPEND _example_LIBRARIES ${AKANTU_${_u_use}_LIBRARIES}) + else() + message("${example_name} use ${_use} but Akantu has been compiled without this package") + set(_deps_OK FALSE) + endif() + endforeach() + endif() + + if(_deps_OK) + include_directories(${_example_INCLUDE_DIRS}) + add_executable(${example_name} ${_opt_pkg_UNPARSED_ARGUMENTS} ${_opt_pkg_SOURCES}) + target_link_libraries(${example_name} akantu ${_example_LIBRARIES}) + if(_opt_pkg_DEPENDS) + add_dependencies(${example_name} ${_opt_pkg_DEPENDS}) + endif() + + + if(_opt_pkg_COMPILE_OPTIONS) + set_target_properties(${test_name} + PROPERTIES COMPILE_DEFINITIONS "${_opt_pkg_COMPILE_OPTIONS}") + endif() + + # copy the needed files to the build folder + if(_opt_pkg_FILES_TO_COPY) + foreach(_file ${_opt_pkg_FILES_TO_COPY}) + file(COPY ${_file} DESTINATION .) + endforeach() + endif() + + # create the needed folders in the build folder + if(_opt_pkg_DIRECTORIES_TO_CREATE) + foreach(_dir ${_opt_pkg_DIRECTORIES_TO_CREATE}) + if(IS_ABSOLUTE ${dir}) + file(MAKE_DIRECTORY ${_dir}) + else() + file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${_dir}) + endif() + endforeach() + endif() + endif() +endfunction() + +#=============================================================================== +macro(add_example example_name desc) + manage_examples(${example_name} ${desc} AKANTU_EXAMPLES_BUILD_ALL _EXAMPLE_) +endmacro() diff --git a/simulations/cmake/FindEPSN.cmake b/simulations/cmake/FindEPSN.cmake new file mode 100644 index 000000000..4dae8c6ed --- /dev/null +++ b/simulations/cmake/FindEPSN.cmake @@ -0,0 +1,53 @@ +#=============================================================================== +# @file FindEPSN.cmake +# @author Nicolas Richart +# @date Tue Aug 25 16:53:57 2010 +# +# @brief The find_package file for EPSN +# +# @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 . +# +#=============================================================================== + +#=============================================================================== +find_path(EPSN_DIR EPSNConfig.cmake + PATHS $ENV{EPSN_TOP} + ) + + +if(EPSN_DIR) + include(${EPSN_DIR}/EPSNConfig.cmake) + set(EPSN_LIB_PATH ${EPSN_DIR}/lib + ${EPSN_LIBRARIES_DIR} + ) + find_library(EPSN_COMMON_LIBRARY epsn_common + PATHS ${EPSN_LIB_PATH} + ) + find_library(EPSN_SIMULATION_LIBRARY epsn_simulation + PATHS ${EPSN_LIB_PATH} + ) + include(${EPSN_DIR}/EPSNLibraryDepends.cmake) + + set(EPSN_LIBRARIES ${EPSN_SIMULATION_LIBRARY} ${EPSN_COMMON_LIBRARY}) +endif(EPSN_DIR) + +#=============================================================================== +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(EPSN DEFAULT_MSG + EPSN_LIBRARIES EPSN_INCLUDE_DIR) diff --git a/simulations/cmake/FindPTScotch.cmake b/simulations/cmake/FindPTScotch.cmake new file mode 100644 index 000000000..2199f1e7a --- /dev/null +++ b/simulations/cmake/FindPTScotch.cmake @@ -0,0 +1,84 @@ +#=============================================================================== +# @file FindPTScotch.cmake +# @author Nicolas Richart +# @date Tue Aug 25 16:53:57 2010 +# +# @brief The find_package file for PT-Scotch +# +# @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 . +# +#=============================================================================== + +#=============================================================================== +#if(PTSCOTCH_DIR) +# set(PTSCOTCH_LIBRARY "NOTFOUND" CACHE INTERNAL "Cleared" FORCE) +#endif(PTSCOTCH_DIR) + +find_library(PTSCOTCH_LIBRARY ptscotch + PATHS ${PTSCOTCH_DIR} + PATH_SUFFIXES src/libscotch lib + ) + +find_library(PTSCOTCH_LIBRARY_ERR ptscotcherr + PATHS ${PTSCOTCH_DIR} + PATH_SUFFIXES src/libscotch lib + ) + +find_library(PTSCOTCH_LIBRARY_ESMUMPS ptesmumps + PATHS ${PTSCOTCH_DIR} + PATH_SUFFIXES src/libscotch lib + ) + +find_path(PTSCOTCH_INCLUDE_PATH ptscotch.h + PATHS ${PTSCOTCH_DIR} + PATH_SUFFIXES include scotch src/libscotch include/scotch + ) + +#=============================================================================== +mark_as_advanced(PTSCOTCH_LIBRARY) +mark_as_advanced(PTSCOTCH_LIBRARY_ERR) +mark_as_advanced(PTSCOTCH_LIBRARY_ESMUMPS) +mark_as_advanced(PTSCOTCH_INCLUDE_PATH) + +set(PTSCOTCH_LIBRARIES_ALL ${PTSCOTCH_LIBRARY} ${PTSCOTCH_LIBRARY_ERR}) + +if(PTSCOTCH_LIBRARY_ESMUMPS) + set(PTSCOTCH_LIBRARIES_ALL ${PTSCOTCH_LIBRARY_ESMUMPS} ${PTSCOTCH_LIBRARIES_ALL}) +endif() + +set(PTSCOTCH_LIBRARIES ${PTSCOTCH_LIBRARIES_ALL} CACHE INTERNAL "Libraries for PT-Scotch" FORCE) + +#=============================================================================== +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(PTSCOTCH DEFAULT_MSG + PTSCOTCH_LIBRARY PTSCOTCH_LIBRARY_ERR PTSCOTCH_INCLUDE_PATH) + + +if(PTSCOTCH_INCLUDE_PATH) + file(STRINGS ${PTSCOTCH_INCLUDE_PATH}/scotch.h PTSCOTCH_INCLUDE_CONTENT) + string(REGEX MATCH "_cplusplus" _match ${PTSCOTCH_INCLUDE_CONTENT}) + if(_match) + add_definitions(-DAKANTU_PTSCOTCH_NO_EXTERN) + endif() +endif() + +#=============================================================================== +if(NOT PTSCOTCH_FOUND) + set(PTSCOTCH_DIR "" CACHE PATH "Location of PT-Scotch library.") +endif(NOT PTSCOTCH_FOUND) diff --git a/simulations/cmake/FindQVIEW.cmake b/simulations/cmake/FindQVIEW.cmake new file mode 100644 index 000000000..de0d823a3 --- /dev/null +++ b/simulations/cmake/FindQVIEW.cmake @@ -0,0 +1,48 @@ +#=============================================================================== +# @file FindIOHelper.cmake +# @author Guillaume Anciaux +# @date Mon Jun 27 16:29:57 2010 +# +# @brief The find_package file for libQVIEW +# +# @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 . +# +#=============================================================================== + +find_library(QVIEW_LIBRARIES NAME qview + PATHS ${QVIEW_DIR} + PATH_SUFFIXES lib + ) +#=============================================================================== +#string(REGEX REPLACE ":" ";" DEFAULT_INCLUDE_PATH $ENV{C_INCLUDE_PATH}) +#MESSAGE(${DEFAULT_INCLUDE_PATH}) +find_path(QVIEW_INCLUDE_PATH libqview.h + PATHS ${QVIEW_DIR} ENV C_INCLUDE_PATH + PATH_SUFFIXES include src + ) +#=============================================================================== +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(QVIEW DEFAULT_MSG + QVIEW_LIBRARIES QVIEW_INCLUDE_PATH) + +#=============================================================================== +if(NOT QVIEW_FOUND) + set(QVIEW_DIR "" CACHE PATH "Location of QVIEW library.") +endif(NOT QVIEW_FOUND) + diff --git a/simulations/double_cantilever_beam_tests/CMakeLists.txt b/simulations/double_cantilever_beam_tests/CMakeLists.txt new file mode 100644 index 000000000..509254938 --- /dev/null +++ b/simulations/double_cantilever_beam_tests/CMakeLists.txt @@ -0,0 +1,41 @@ +# @file CMakeLists.txt +# @author Fabian Barras +# @date Wed Jan 22 15:09:31 2014 +# +# @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 . +# +#=============================================================================== + +#=============================================================================== +add_mesh(mesh_dcb_2d mesh_dcb_2d.geo 2 2) + +register_example(test_dcb_2d + test_dcb_2d.cc) + +add_dependencies(test_dcb_2d + mesh_dcb_2d) + +#=============================================================================== +configure_file( + ${CMAKE_CURRENT_SOURCE_DIR}/input_test.dat + ${CMAKE_CURRENT_BINARY_DIR}/input_test.dat + COPYONLY + ) + +file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/paraview) \ No newline at end of file diff --git a/simulations/double_cantilever_beam_tests/input_test.dat b/simulations/double_cantilever_beam_tests/input_test.dat new file mode 100644 index 000000000..9b3c2aa40 --- /dev/null +++ b/simulations/double_cantilever_beam_tests/input_test.dat @@ -0,0 +1,22 @@ +material elastic [ + name = bulk + rho = 2500 + nu = 0.29 + E = 70e9 +# finite_deformation = 1 +] + +material cohesive_exponential [ + name = coh + sigma_c = 1.5e6 + beta = 1 + delta_c = 1e-4 + exponential_penalty = true + contact_tangent = 1.0 +] + +mesh parameters [ + + cohesive_surfaces = coh + +] diff --git a/simulations/double_cantilever_beam_tests/mesh_dcb_2d.geo b/simulations/double_cantilever_beam_tests/mesh_dcb_2d.geo new file mode 100644 index 000000000..01f9cd604 --- /dev/null +++ b/simulations/double_cantilever_beam_tests/mesh_dcb_2d.geo @@ -0,0 +1,26 @@ +dx = 0.0025; + +Point(1) = {0,0,0,dx}; +Point(2) = {0,0.05,0,dx}; +Point(3) = {0,-0.05,0,dx}; +Point(4) = {1,0,0,dx}; +Point(5) = {1,0.05,0,dx}; +Point(6) = {1,-0.05,0,dx}; +Line(1) = {1, 2}; +Line(2) = {2, 5}; +Line(3) = {5, 4}; +Line(4) = {1, 4}; +Line(5) = {1, 3}; +Line(6) = {6, 4}; +Line(7) = {3, 6}; +Line Loop(8) = {2, 3, -4, 1}; +Plane Surface(9) = {-8}; +Line Loop(10) = {5, 7, 6, -4}; +Plane Surface(11) = {10}; +Physical Surface("bulk") = {9,11}; +Physical Line("coh") = {4}; + +Transfinite Surface "*"; +Recombine Surface "*"; + +Mesh.SecondOrderIncomplete = 1; \ No newline at end of file diff --git a/simulations/double_cantilever_beam_tests/test_dcb_2d.cc b/simulations/double_cantilever_beam_tests/test_dcb_2d.cc new file mode 100644 index 000000000..29c295b88 --- /dev/null +++ b/simulations/double_cantilever_beam_tests/test_dcb_2d.cc @@ -0,0 +1,218 @@ +/** + * @file test_dcb_2d.cc + * @author Fabian Barras + * @date Wed Sep 19 14:28:27 2014 + * + * @brief 2D DCB test to verify the convergence to a same solution + * + * @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 . + * + */ + +/* -------------------------------------------------------------------------- */ +#include +#include +#include +/* -------------------------------------------------------------------------- */ +#include "aka_common.hh" +#include "mesh.hh" +#include "mesh_io.hh" +#include "mesh_io_msh.hh" +#include "mesh_utils.hh" +#include "solid_mechanics_model_cohesive.hh" +#include "material.hh" +#include "material_cohesive.hh" + +/* -------------------------------------------------------------------------- */ +using namespace akantu; + +int main(int argc, char *argv[]) { + + std::cout << " ./test_dcb_2d [ =true =test_dcb_2d ] " << std::endl; + + //debug::setDebugLevel(dblWarning); + initialize("input_test.dat", argc, argv); + + // Math::setTolerance(1.e-13); + Real tolerance = Math::getTolerance(); + + const UInt spatial_dimension = 2; + const Real final_opening =std::atof(argv[1]); + const UInt step = std::atoi(argv[2]); + bool bool_dump = true; + std::string simulation_name = "test_dcb_2d"; + + if (argc > 3) bool_dump = std::atoi(argv[3]); + if (argc > 4) simulation_name = argv[4]; + + std::cout << "final opening = " << final_opening << " nb_steps = " << step; + if (bool_dump) std::cout << " paraview_folder: paraview/" << simulation_name << std::endl; + else std::cout << std::endl; + + Mesh mesh(spatial_dimension); + + StaticCommunicator & comm = StaticCommunicator::getStaticCommunicator(); + Int psize = comm.getNbProc(); + Int prank = comm.whoAmI(); + akantu::MeshPartition * partition = NULL; + + if(prank==0){ + + mesh.read("mesh_dcb_2d.msh"); + + //CohesiveElementInserter inserter(mesh); + //inserter.setLimit(_y, -1e-8, 1e-8); + //inserter.insertIntrinsicElements(); + + partition = new MeshPartitionScotch(mesh, spatial_dimension); + partition->partitionate(psize); + + } + + SolidMechanicsModelCohesive model(mesh); + + model.initParallel(partition); + + model.initFull(SolidMechanicsModelCohesiveOptions(_static)); + + model.limitInsertion(_y, -1e-8, 1e-8); + model.insertIntrinsicElements(); + + mesh.createGroupsFromMeshData("physical_names"); + + const Array & nodes = mesh.getNodes(); + Array top_boundary_nodes, bot_boundary_nodes; + Array & blockedDOFs = model.getBlockedDOFs(); + Array & displacement = model.getDisplacement(); + UInt nb_nodes = mesh.getNbNodes(); + + for (UInt i = 0; i < nb_nodes; ++i) { + + if(std::abs(nodes(i,0)-1)0.)&&((nodes(i,1)<0.02))){ + + top_boundary_nodes.push_back(i); + blockedDOFs(i,1) = true; + std::cout << "+"<< std::endl; + + } else if ((nodes(i,1)<0.)&&((nodes(i,1)>-0.02))){ + + bot_boundary_nodes.push_back(i); + blockedDOFs(i,1) = true; + std::cout << "-"<< std::endl; + } + } + + if (std::abs(nodes(i,0)) < tolerance) { + + blockedDOFs(i,0) = true; + blockedDOFs(i,1) = true; + } + } + + model.synchronizeBoundaries(); + model.updateResidual(); + + std::cout << mesh.getNbElement(_cohesive_2d_6) << std::endl; + + if (bool_dump) { + + std::stringstream paraview_folder; + + paraview_folder << "paraview" + <<"/" + << simulation_name + << "/"; + + model.setDirectory(paraview_folder.str()); + model.setBaseName("bulk"); + model.addDumpFieldVector("displacement"); + model.addDumpField("stress"); + model.addDumpField("partitions"); + //model.addDumpField("strain"); + model.dump(); + + model.setDirectoryToDumper("cohesive elements", "test_unique"); + model.setBaseNameToDumper("cohesive elements", "one_cohesive_element"); + model.addDumpFieldVectorToDumper("cohesive elements", "displacement"); + model.dump("cohesive elements"); + } + + model.assembleStiffnessMatrix(); + + Real opening = final_opening/step; + + std::ofstream node_f; + node_f.open("/home/fabarras/clement_outputs/node_coords.out"); + std::ofstream displ_f; + displ_f.open("/home/fabarras/clement_outputs/displ.out"); + + for (UInt n = 0; n < nb_nodes; ++n) { + for (UInt d = 0; d < spatial_dimension; ++d) { + + node_f << nodes(n,d) << " "; + } + node_f << std::endl; + } + + + for (UInt stp = 0; stp (1e-8, error, 500); + + std::cout << "Error after convergence: " << error << std::endl; + + if (bool_dump){ + model.dump(); + model.dump("cohesive elements"); + } + + if (stp%5 == 0) { + for (UInt n = 0; n < nb_nodes; ++n) { + for (UInt d = 0; d < spatial_dimension; ++d) { + + displ_f << displacement(n,d) << " "; + } + } + std::cout << stp << std::endl; + } + } + + node_f.close(); + displ_f.close(); + + finalize(); + + return EXIT_SUCCESS; +} + +