diff --git a/test/test_model/test_solid_mechanics_model/test_cohesive/test_cohesive_extrinsic_implicit/CMakeLists.txt b/test/test_model/test_solid_mechanics_model/test_cohesive/test_cohesive_extrinsic_implicit/CMakeLists.txt index fd6209326..0f11d4de5 100644 --- a/test/test_model/test_solid_mechanics_model/test_cohesive/test_cohesive_extrinsic_implicit/CMakeLists.txt +++ b/test/test_model/test_solid_mechanics_model/test_cohesive/test_cohesive_extrinsic_implicit/CMakeLists.txt @@ -1,41 +1,37 @@ #=============================================================================== # @file CMakeLists.txt # # @author Mauro Corrado # # @date Fri May 01 11:56:18 2015 # # @brief checking correct assembling of stiffness matrix in case of cohe elems # # @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 # #=============================================================================== register_test(test_assembling_K_cohe_elements SOURCES test_assembling_K_cohe_elements.cc - FILES_TO_COPY quadrangle.msh material.dat + FILES_TO_COPY quadrangle.msh material.dat K_matrix_verified PACKAGE cohesive_element ) - -#add_mesh(test_cohesive_buildfacets_mesh mesh.geo 3 2) -#add_dependencies(test_cohesive_buildfacets test_cohesive_buildfacets_mesh) - diff --git a/test/test_model/test_solid_mechanics_model/test_cohesive/test_cohesive_extrinsic_implicit/K_matrix_verified b/test/test_model/test_solid_mechanics_model/test_cohesive/test_cohesive_extrinsic_implicit/K_matrix_verified new file mode 100644 index 000000000..9ae429d9d --- /dev/null +++ b/test/test_model/test_solid_mechanics_model/test_cohesive/test_cohesive_extrinsic_implicit/K_matrix_verified @@ -0,0 +1,120 @@ +%%MatrixMarket matrix coordinate real symmetric +20 20 118 +17 17 80000 +17 18 0 +17 13 -1.81898940354586e-12 +17 14 0 +17 7 -10000 +17 8 5000 +17 15 -20000 +17 16 0 +18 18 80000 +18 13 0 +18 14 -20000 +18 7 5000 +18 8 -10000 +18 15 0 +18 16 -1.81898940354586e-12 +13 13 40000 +13 14 0 +13 7 -10000 +13 8 -5000 +13 15 -10000 +13 16 -5000 +14 14 40000 +14 7 5000 +14 8 -9.09494701772928e-13 +14 15 -5000 +14 16 -10000 +7 7 20000 +7 8 -5000 +7 15 -9.09494701772928e-13 +7 16 -5000 +8 8 20000 +8 15 5000 +8 16 -10000 +15 15 40000 +15 16 0 +16 16 40000 +17 11 -10000 +17 12 -5000 +17 5 -10000 +17 6 -5000 +18 11 5000 +18 12 -9.09494701772928e-13 +18 5 -5000 +18 6 -10000 +11 11 21320.8409773605 +11 12 -4882.11803623535 +11 5 -9.09494701772928e-13 +11 6 -5000 +11 13 -10000 +11 14 5000 +12 12 19800.7540266124 +12 5 5000 +12 6 -10000 +12 13 5000 +12 14 -10000 +5 5 20000 +5 6 5000 +5 13 -10000 +5 14 -5000 +6 6 20000 +6 13 5000 +6 14 -9.09494701772928e-13 +17 9 -1.81898940354586e-12 +17 10 0 +17 3 -10000 +17 4 5000 +17 19 -10000 +17 20 5000 +18 9 0 +18 10 -20000 +18 3 5000 +18 4 -10000 +18 19 -5000 +18 20 -9.09494701772928e-13 +9 9 40000 +9 10 0 +9 3 -10000 +9 4 -5000 +9 19 -10000 +9 20 -5000 +10 10 40000 +10 3 5000 +10 4 -9.09494701772928e-13 +10 19 -5000 +10 20 -10000 +3 3 20000 +3 4 -5000 +3 19 -9.09494701772928e-13 +3 20 -5000 +4 4 20000 +4 19 5000 +4 20 -10000 +19 19 21320.8409773605 +19 20 5117.88196376465 +20 20 19800.7540266124 +17 1 -10000 +17 2 -5000 +18 1 -5000 +18 2 -10000 +15 1 -9.09494701772928e-13 +15 2 -5000 +15 9 -10000 +15 10 5000 +16 1 5000 +16 2 -10000 +16 9 5000 +16 10 -10000 +1 1 20000 +1 2 5000 +1 9 -10000 +1 10 -5000 +2 2 20000 +2 9 5000 +2 10 -9.09494701772928e-13 +11 19 -1320.84097736047 +11 20 -117.881963764652 +12 19 -117.881963764652 +12 20 199.245973387621 diff --git a/test/test_model/test_solid_mechanics_model/test_cohesive/test_cohesive_extrinsic_implicit/quadrangle.msh b/test/test_model/test_solid_mechanics_model/test_cohesive/test_cohesive_extrinsic_implicit/quadrangle.msh index 5f9c0fc91..22a9d7f77 100644 --- a/test/test_model/test_solid_mechanics_model/test_cohesive/test_cohesive_extrinsic_implicit/quadrangle.msh +++ b/test/test_model/test_solid_mechanics_model/test_cohesive/test_cohesive_extrinsic_implicit/quadrangle.msh @@ -1,22 +1,22 @@ $MeshFormat 2.2 0 8 $EndMeshFormat $Nodes 9 1 1 1 0 2 -1 1 0 3 -1 -1 0 4 1 -1 0 -5 2.750244476601438e-12 1 0 -6 -1 2.750244476601438e-12 0 -7 -2.750244476601438e-12 -1 0 -8 1 -2.750244476601438e-12 0 +5 0 1 0 +6 -1 0 0 +7 0 -1 0 +8 1 0 0 9 0 0 0 $EndNodes $Elements 4 1 3 2 7 6 9 7 4 8 2 3 2 7 6 9 6 3 7 3 3 2 7 6 9 5 2 6 4 3 2 7 6 9 8 1 5 $EndElements diff --git a/test/test_model/test_solid_mechanics_model/test_cohesive/test_cohesive_extrinsic_implicit/test_assembling_K_cohe_elements.cc b/test/test_model/test_solid_mechanics_model/test_cohesive/test_cohesive_extrinsic_implicit/test_assembling_K_cohe_elements.cc index 24acdfee9..911aaba82 100644 --- a/test/test_model/test_solid_mechanics_model/test_cohesive/test_cohesive_extrinsic_implicit/test_assembling_K_cohe_elements.cc +++ b/test/test_model/test_solid_mechanics_model/test_cohesive/test_cohesive_extrinsic_implicit/test_assembling_K_cohe_elements.cc @@ -1,118 +1,92 @@ /** * @file matrix_assembling_cohesive_elements.cc * * @author Mauro Corrado * * @date creation: Thu April 30 2015 * * @brief Test to check the correct matrix assembling for cohesive elements * with degenerated nodes * * @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 . * */ /* -------------------------------------------------------------------------- */ #include #include #include /* -------------------------------------------------------------------------- */ #include "solid_mechanics_model_cohesive.hh" #include "material_cohesive.hh" /* -------------------------------------------------------------------------- */ using namespace akantu; int main(int argc, char *argv[]) { initialize("material.dat", argc, argv); debug::setDebugLevel(dblWarning); const UInt spatial_dimension = 2; Mesh mesh(spatial_dimension); mesh.read("quadrangle.msh"); SolidMechanicsModelCohesive model(mesh); /// model initialization model.initFull(SolidMechanicsModelCohesiveOptions(_static, true)); // CohesiveElementInserter inserter(mesh); model.limitInsertion(_y, -0.001, 0.001); model.updateAutomaticInsertion(); /// boundary conditions Array & boundary = model.getBlockedDOFs(); Array & position = mesh.getNodes(); Array & displacement = model.getDisplacement(); for (UInt n = 0; n < mesh.getNbNodes(); ++n) { if (position(n,1) < -0.99){ boundary(n,1) = true; boundary(n,0) = true; } if (position(n,1) > 0.99 && position(n,0) < -0.99) boundary(n,1) = true; } - model.setBaseName("test_K"); - model.addDumpFieldVector("displacement"); - model.addDumpField("residual" ); - model.addDumpField("stress" ); - model.addDumpField("blocked_dofs"); - model.dump(); - - // Dumping cohesive elements - model.setBaseNameToDumper("cohesive elements", "cohe_test_K"); - model.addDumpFieldVectorToDumper("cohesive elements", "displacement"); - model.addDumpFieldToDumper("cohesive elements", "damage"); - model.dump("cohesive elements"); - Real increment = 0.004; Real error; for (UInt n = 0; n < mesh.getNbNodes(); ++n) { if (position(n,1) > 0.99 && position(n,0) < -0.99) displacement(n,1) += increment; } - model.solveStepCohesive<_scm_newton_raphson_tangent, _scc_increment>(1e-13, error, 100); - - model.dump(); - model.dump("cohesive elements"); - - // Matrix matrix = getStiffnessMatrix(); + model.solveStepCohesive<_scm_newton_raphson_tangent, _scc_increment>(1e-13, error, 10); /// save the matrix - model.getStiffnessMatrix().saveMatrix("K_matrix.txt"); - - /// print the matrix to screen - std::ifstream K_matrix; - K_matrix.open("K_matrix.txt"); - std::string current_line; - while(getline(K_matrix, current_line)) - std::cout << current_line << std::endl; - K_matrix.close(); + model.getStiffnessMatrix().saveMatrix("K_matrix_test"); finalize(); return EXIT_SUCCESS; } diff --git a/test/test_model/test_solid_mechanics_model/test_cohesive/test_cohesive_extrinsic_implicit/test_assembling_K_cohe_elements.sh b/test/test_model/test_solid_mechanics_model/test_cohesive/test_cohesive_extrinsic_implicit/test_assembling_K_cohe_elements.sh new file mode 100755 index 000000000..bca1ece5e --- /dev/null +++ b/test/test_model/test_solid_mechanics_model/test_cohesive/test_cohesive_extrinsic_implicit/test_assembling_K_cohe_elements.sh @@ -0,0 +1,3 @@ +#!/bin/bash + +./test_assembling_K_cohe_elements && diff K_matrix_verified K_matrix_test >/dev/null 2>&1 diff --git a/test/test_model/test_solid_mechanics_model/test_cohesive/test_cohesive_extrinsic_implicit/test_assembling_K_cohe_elements.verified b/test/test_model/test_solid_mechanics_model/test_cohesive/test_cohesive_extrinsic_implicit/test_assembling_K_cohe_elements.verified deleted file mode 100644 index cbb10b5ac..000000000 --- a/test/test_model/test_solid_mechanics_model/test_cohesive/test_cohesive_extrinsic_implicit/test_assembling_K_cohe_elements.verified +++ /dev/null @@ -1,120 +0,0 @@ -%%MatrixMarket matrix coordinate real symmetric -20 20 118 -17 17 80000 -17 18 0 -17 13 -3.7310154965553e-12 -17 14 -2.75040292763151e-08 -17 7 -9999.99999997708 -17 8 5000 -17 15 -20000 -17 16 2.75031197816133e-08 -18 18 80000 -18 13 -2.75031197816133e-08 -18 14 -20000 -18 7 5000 -18 8 -10000.0000000229 -18 15 2.75040292763151e-08 -18 16 -3.7310154965553e-12 -13 13 40000 -13 14 9.09494701772928e-13 -13 7 -9999.99999994042 -13 8 -4999.99999998625 -13 15 -10000.0000000046 -13 16 -5000 -14 14 40000 -14 7 5000.00000001375 -14 8 5.04179989979647e-08 -14 15 -5000 -14 16 -9999.99999999541 -7 7 19999.9999999679 -7 8 -5000 -7 15 -5.04204070717051e-08 -7 16 -5000.00000001375 -8 8 20000.0000000321 -8 15 4999.99999998625 -8 16 -10000.0000000596 -15 15 40000 -15 16 -9.09494701772928e-13 -16 16 40000 -17 11 -10000.0000000321 -17 12 -4999.99999998625 -17 5 -10000.0000000229 -17 6 -5000 -18 11 5000.00000001375 -18 12 -2.29205738833116e-08 -18 5 -5000 -18 6 -9999.99999997708 -11 11 21320.8409773377 -11 12 -4882.1180362384 -11 5 5.04179989979647e-08 -11 6 -5000.00000001375 -11 13 -9999.99999999541 -11 14 5000 -12 12 19800.7540265798 -12 5 4999.99999998625 -12 6 -9999.99999994042 -12 13 5000 -12 14 -10000.0000000046 -5 5 20000.0000000321 -5 6 5000 -5 13 -10000.0000000596 -5 14 -4999.99999998625 -6 6 19999.9999999679 -6 13 5000.00000001375 -6 14 -5.04204070717051e-08 -17 9 -3.7310154965553e-12 -17 10 -2.75040292763151e-08 -17 3 -9999.99999997708 -17 4 5000 -17 19 -9999.99999996791 -17 20 5000.00000001375 -18 9 -2.75031197816133e-08 -18 10 -20000 -18 3 5000 -18 4 -10000.0000000229 -18 19 -4999.99999998625 -18 20 2.29168222176668e-08 -9 9 40000 -9 10 9.09494701772928e-13 -9 3 -9999.99999994042 -9 4 -4999.99999998625 -9 19 -10000.0000000046 -9 20 -5000 -10 10 40000 -10 3 5000.00000001375 -10 4 5.04179989979647e-08 -10 19 -5000 -10 20 -9999.99999999541 -3 3 19999.9999999679 -3 4 -5000 -3 19 -5.04204070717051e-08 -3 20 -5000.00000001375 -4 4 20000.0000000321 -4 19 4999.99999998625 -4 20 -10000.0000000596 -19 19 21320.8409773835 -19 20 5117.8819637616 -20 20 19800.754026644 -17 1 -10000.0000000229 -17 2 -5000 -18 1 -5000 -18 2 -9999.99999997708 -15 1 5.04179989979647e-08 -15 2 -5000.00000001375 -15 9 -9999.99999999541 -15 10 5000 -16 1 4999.99999998625 -16 2 -9999.99999994042 -16 9 5000 -16 10 -10000.0000000046 -1 1 20000.0000000321 -1 2 5000 -1 9 -10000.0000000596 -1 10 -4999.99999998625 -2 2 19999.9999999679 -2 9 5000.00000001375 -2 10 -5.04204070717051e-08 -11 19 -1320.84097736057 -11 20 -117.881963761601 -12 19 -117.881963761601 -12 20 199.245973388092