diff --git a/test/test_parallel_cohesive/CMakeLists.txt b/test/test_parallel_cohesive/CMakeLists.txt index 12522eb2e..0d1d2034f 100644 --- a/test/test_parallel_cohesive/CMakeLists.txt +++ b/test/test_parallel_cohesive/CMakeLists.txt @@ -1,22 +1,23 @@ #=============================================================================== # @file CMakeLists.txt # # @author Marco Vocialta # # # @brief configuration for cohesive elements tests # # @section LICENSE # # Copyright (©) 2010-2012, 2014 EPFL (Ecole Polytechnique Fédérale de Lausanne) # Laboratory (LSMS - Laboratoire de Simulation en Mécanique des Solides) # # @section DESCRIPTION # #=============================================================================== add_akantu_test(test_cohesive_parallel_intrinsic "test_cohesive_parallel_intrinsic") add_akantu_test(test_cohesive_facet_stress_synchronizer "test_cohesive_facet_stress_synchronizer") add_akantu_test(test_cohesive_parallel_extrinsic "test_cohesive_parallel_extrinsic") add_akantu_test(test_cohesive_parallel_extrinsic_IG_TG "test_cohesive_parallel_extrinsic_IG_TG") add_akantu_test(test_cohesive_parallel_buildfragments "test_cohesive_parallel_buildfragments") +add_akantu_test(test_cohesive_parallel_insertion "test_cohesive_parallel_insertion") diff --git a/test/test_parallel_cohesive/test_cohesive_parallel_insertion/3d_spherical_inclusion.geo b/test/test_parallel_cohesive/test_cohesive_parallel_insertion/3d_spherical_inclusion.geo new file mode 100644 index 000000000..6f87f12e1 --- /dev/null +++ b/test/test_parallel_cohesive/test_cohesive_parallel_insertion/3d_spherical_inclusion.geo @@ -0,0 +1,100 @@ +dx = 0.1; +w = 2; +radius = 0.2; + +Point(1) = {0,0,0,dx}; +Point(2) = {0,.3,0,dx}; +Point(3) = {0,-.3,0,dx}; +Point(4) = {w,0,0,dx}; +Point(5) = {w,.3,0,dx}; +Point(6) = {w,-.3,0,dx}; +Point(7) = {0,0,w,dx}; +Point(8) = {0,.3,w,dx}; +Point(9) = {0,-.3,w,dx}; +Point(10) = {w,0,w,dx}; +Point(11) = {w,.3,w,dx}; +Point(12) = {w,-.3,w,dx}; +Point(13) = {0.5*w,0,0.5*w,dx}; +Point(14) = {0.5*w+radius,0,0.5*w+radius,dx}; +Point(15) = {0.5*w-radius,0,0.5*w+radius,dx}; +Point(16) = {0.5*w+radius,0,0.5*w-radius,dx}; +Point(17) = {0.5*w-radius,0,0.5*w-radius,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(8) = {8, 11}; +Line(9) = {7, 10}; +Line(10) = {9, 12}; +Line(11) = {8, 7}; +Line(12) = {11, 10}; +Line(13) = {10, 12}; +Line(14) = {7, 9}; +Line(15) = {2, 8}; +Line(16) = {1, 7}; +Line(17) = {3, 9}; +Line(18) = {5, 11}; +Line(19) = {4, 10}; +Line(20) = {6, 12}; +Line Loop(21) = {18, 12, -19, -3}; +Plane Surface(22) = {21}; +Line Loop(23) = {19, 13, -20, 6}; +Plane Surface(24) = {23}; +Line Loop(25) = {11, -16, 1, 15}; +Plane Surface(26) = {25}; +Line Loop(27) = {14, -17, -5, 16}; +Plane Surface(28) = {27}; +Line Loop(29) = {8, 12, -9, -11}; +Plane Surface(30) = {29}; +Line Loop(31) = {9, 13, -10, -14}; +Plane Surface(32) = {31}; +Line Loop(33) = {2, 3, -4, 1}; +Plane Surface(34) = {33}; +Line Loop(35) = {7, 6, -4, 5}; +Plane Surface(36) = {35}; +Line Loop(37) = {18, -8, -15, 2}; +Plane Surface(38) = {37}; +Line Loop(39) = {7, 20, -10, -17}; +Plane Surface(40) = {39}; +Circle(41) = {16, 13, 14}; +Circle(42) = {14, 13, 15}; +Circle(43) = {15, 13, 17}; +Circle(44) = {17, 13, 16}; +Translate {0.5, 0, 0.5} { + Duplicata { Line{44, 43, 42, 41}; } +} +Translate {-0.5, 0, 0.5} { + Duplicata { Line{44, 43, 42, 41}; } +} +Translate {0.5, 0, -0.5} { + Duplicata { Line{44, 43, 42, 41}; } +} +Translate {-0.5, 0, -0.5} { + Duplicata { Line{44, 43, 42, 41}; } +} +Line Loop(61) = {9, -19, -4, 16}; +Line Loop(62) = {52, 51, 50, 49}; +Line Loop(63) = {57, 60, 59, 58}; +Line Loop(64) = {44, 41, 42, 43}; +Line Loop(65) = {55, 54, 53, 56}; +Line Loop(66) = {48, 47, 46, 45}; +Plane Surface(67) = {61, 62, 63, 64, 65, 66}; +Plane Surface(68) = {62}; +Plane Surface(69) = {63}; +Plane Surface(70) = {64}; +Plane Surface(71) = {66}; +Plane Surface(72) = {65}; +Surface Loop(73) = {26, 30, 38, 22, 34, 67, 68, 69, 70, 72, 71}; +Volume(74) = {73}; +Surface Loop(75) = {32, 24, 40, 36, 28, 67, 68, 69, 70, 72, 71}; +Volume(76) = {75}; +Physical Surface("interface") = {67}; +Physical Surface("coh1") = {68}; +Physical Surface("coh2") = {69}; +Physical Surface("coh3") = {70}; +Physical Surface("coh4") = {71}; +Physical Surface("coh5") = {72}; +Physical Volume("bulk") = {74, 76}; diff --git a/test/test_parallel_cohesive/test_cohesive_parallel_insertion/CMakeLists.txt b/test/test_parallel_cohesive/test_cohesive_parallel_insertion/CMakeLists.txt new file mode 100644 index 000000000..5ace6a7a0 --- /dev/null +++ b/test/test_parallel_cohesive/test_cohesive_parallel_insertion/CMakeLists.txt @@ -0,0 +1,39 @@ +#=============================================================================== +# @file CMakeLists.txt +# +# @author Fabian Barras +# +# @date creation: Fri Aug 7 09:07:44 2015 +# +# @brief Tests parallel insertion of cohesive elements +# +# @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 . +# +# @section DESCRIPTION +# +#=============================================================================== + +add_mesh(3d_spherical_inclusion_parallel 3d_spherical_inclusion.geo 3 2) + +register_test(test_cohesive_parallel_insertion_along_physical_surfaces + SOURCES test_cohesive_parallel_insertion_along_physical_surfaces.cc + DEPENDENCIES 3d_spherical_inclusion_parallel + FILES_TO_COPY input_file.dat + PACKAGE parallel_cohesive_element + ) diff --git a/test/test_parallel_cohesive/test_cohesive_parallel_insertion/input_file.dat b/test/test_parallel_cohesive/test_cohesive_parallel_insertion/input_file.dat new file mode 100644 index 000000000..bbd74ab72 --- /dev/null +++ b/test/test_parallel_cohesive/test_cohesive_parallel_insertion/input_file.dat @@ -0,0 +1,67 @@ +material elastic [ + name = bulk + rho = 2500 + nu = 0.29 + E = 70e9 +# finite_deformation = 1 +] + +material cohesive_exponential [ + name = coh1 + sigma_c = 1.5e6 + beta = 1 + delta_c = 1e-4 + exponential_penalty = true + contact_tangent = 1.0 +] + +material cohesive_exponential [ + name = coh2 + sigma_c = 1.5e6 + beta = 1 + delta_c = 1e-4 + exponential_penalty = true + contact_tangent = 1.0 +] + +material cohesive_exponential [ + name = coh3 + sigma_c = 1.5e6 + beta = 1 + delta_c = 1e-4 + exponential_penalty = true + contact_tangent = 1.0 +] + +material cohesive_exponential [ + name = coh4 + sigma_c = 1.5e6 + beta = 1 + delta_c = 1e-4 + exponential_penalty = true + contact_tangent = 1.0 +] + +material cohesive_exponential [ + name = coh5 + sigma_c = 1.5e6 + beta = 1 + delta_c = 1e-4 + exponential_penalty = true + contact_tangent = 1.0 +] + +material cohesive_exponential [ + name = interface + sigma_c = 1.5e6 + beta = 1 + delta_c = 1e-4 + exponential_penalty = true + contact_tangent = 1.0 +] + +mesh parameters [ + + cohesive_surfaces = coh1,coh2,coh3,coh4,coh5,interface + +] \ No newline at end of file diff --git a/test/test_parallel_cohesive/test_cohesive_parallel_insertion/test_cohesive_parallel_insertion_along_physical_surfaces.cc b/test/test_parallel_cohesive/test_cohesive_parallel_insertion/test_cohesive_parallel_insertion_along_physical_surfaces.cc new file mode 100644 index 000000000..92c4c3b28 --- /dev/null +++ b/test/test_parallel_cohesive/test_cohesive_parallel_insertion/test_cohesive_parallel_insertion_along_physical_surfaces.cc @@ -0,0 +1,128 @@ +/** + * @file test_cohesive_insertion_along_physical_surfaces.cc + * @author Fabian Barras + * @date Fri Aug 7 09:07:44 2015 + * + * @brief Test parallel intrinsic insertion of cohesive elements along physical surfaces + * + * @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[]) { + + initialize("input_file.dat", argc, argv); + + Math::setTolerance(1e-15); + + const UInt spatial_dimension = 3; + + 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("3d_spherical_inclusion.msh"); + + partition = new MeshPartitionScotch(mesh, spatial_dimension); + partition->partitionate(psize); + + } + SolidMechanicsModelCohesive model(mesh); + model.initParallel(partition); + mesh.createGroupsFromMeshData("physical_names"); + model.initFull(SolidMechanicsModelCohesiveOptions(_static)); + + std::vector surfaces_name = {"interface", "coh1", "coh2", "coh3", "coh4", "coh5"}; + UInt nb_surf = surfaces_name.size(); + + for (ghost_type_t::iterator gt = ghost_type_t::begin(); gt != ghost_type_t::end(); ++gt) { + + std::string ghost_str; + + if(*gt == 1) ghost_str = "ghost"; + else ghost_str = "not ghost"; + + Mesh::type_iterator it = mesh.firstType(spatial_dimension, *gt, _ek_cohesive); + Mesh::type_iterator end = mesh.lastType(spatial_dimension, *gt, _ek_cohesive); + + for(; it != end; ++it) { + + Array & material_id = mesh.getMeshFacets().getData("physical_names")(mesh.getFacetType(*it), *gt); + + for (UInt i = 0; i < nb_surf; ++i) { + + UInt expected_insertion = 0; + + for(UInt m = 0; m " << inserted_elements << " inserted elements of type " << ghost_str + << " out of " + << expected_insertion << std::endl); + } + } + } + + /*std::string paraview_folder = "paraview/test_intrinsic_insertion_along_physical_surfaces/"; + model.setDirectory(paraview_folder); + model.setBaseName("bulk"); + model.addDumpField("partitions"); + model.dump(); + model.setDirectoryToDumper("cohesive elements", paraview_folder); + model.setBaseNameToDumper("cohesive elements", "one_cohesive_element"); + model.addDumpFieldToDumper("cohesive elements", "partitions"); + model.addDumpFieldToDumper("cohesive elements", "material_index"); + model.dump("cohesive elements"); + */ + + model.assembleStiffnessMatrix(); + + finalize(); + + return EXIT_SUCCESS; +} diff --git a/test/test_parallel_cohesive/test_cohesive_parallel_insertion/test_cohesive_parallel_insertion_along_physical_surfaces.sh b/test/test_parallel_cohesive/test_cohesive_parallel_insertion/test_cohesive_parallel_insertion_along_physical_surfaces.sh new file mode 100755 index 000000000..47c6b9eb4 --- /dev/null +++ b/test/test_parallel_cohesive/test_cohesive_parallel_insertion/test_cohesive_parallel_insertion_along_physical_surfaces.sh @@ -0,0 +1,3 @@ +#!/bin/bash + +mpirun -np 8 test_cohesive_parallel_insertion_along_physical_surfaces