diff --git a/test/test_model/test_solid_mechanics_model/test_materials/test_material_non_local/CMakeLists.txt b/test/test_model/test_solid_mechanics_model/test_materials/test_material_non_local/CMakeLists.txt index 2dbe60dec..5014cfb25 100644 --- a/test/test_model/test_solid_mechanics_model/test_materials/test_material_non_local/CMakeLists.txt +++ b/test/test_model/test_solid_mechanics_model/test_materials/test_material_non_local/CMakeLists.txt @@ -1,58 +1,59 @@ #=============================================================================== # @file CMakeLists.txt # # @author Nicolas Richart # # @date creation: Mon Jan 20 2014 # @date last modification: Mon Jan 20 2014 # # @brief configuration for materials tests # # @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(test_material_non_local_mesh_2 mesh.geo 2 2 OUTPUT mesh_2.msh) add_mesh(test_material_non_local_mesh mesh.geo 2 1 OUTPUT mesh.msh) +add_mesh(test_material_damage_non_local_mesh mesh_section_gap.geo 2 1 OUTPUT mesh_section_gap.msh) add_mesh(test_two_materials_mesh two_materials.geo 2 1 OUTPUT two_materials.msh) register_test(test_material_damage_non_local SOURCES test_material_damage_non_local.cc - DEPENDENCIES test_material_non_local_mesh + DEPENDENCIES test_material_damage_non_local_mesh FILES_TO_COPY material_damage_non_local.dat DIRECTORIES_TO_CREATE paraview PACKAGE damage_non_local ) register_test(test_material_damage_non_local_two_materials SOURCES test_material_damage_non_local_two_materials.cc DEPENDENCIES test_two_materials_mesh FILES_TO_COPY two_materials_non_local.dat DIRECTORIES_TO_CREATE paraview PACKAGE damage_non_local ) register_test(test_material_non_local SOURCES test_material_non_local.cc custom_non_local_test_material.cc DEPENDENCIES test_material_non_local_mesh FILES_TO_COPY material.dat PACKAGE damage_non_local ) diff --git a/test/test_model/test_solid_mechanics_model/test_materials/test_material_non_local/material_damage_non_local.dat b/test/test_model/test_solid_mechanics_model/test_materials/test_material_non_local/material_damage_non_local.dat index d7dabd2da..d97958b96 100644 --- a/test/test_model/test_solid_mechanics_model/test_materials/test_material_non_local/material_damage_non_local.dat +++ b/test/test_model/test_solid_mechanics_model/test_materials/test_material_non_local/material_damage_non_local.dat @@ -1,15 +1,15 @@ Yd0 = 94e3 material marigo_non_local remove_wf [ name = concrete rho = 3900 # density E = 370e9 # young's modulus nu = 0.22 # poisson's ratio Yd = Yd0 uniform [ 0, 0.1 * Yd0 ] Sd = 2.748e6 non_local weight_function [ update_rate = 10 - radius = 1e-3 + radius = 0.15 damage_limit = 0.99 ] ] diff --git a/test/test_model/test_solid_mechanics_model/test_materials/test_material_non_local/test_material_damage_non_local.cc b/test/test_model/test_solid_mechanics_model/test_materials/test_material_non_local/test_material_damage_non_local.cc index 13e302956..f3746a951 100644 --- a/test/test_model/test_solid_mechanics_model/test_materials/test_material_non_local/test_material_damage_non_local.cc +++ b/test/test_model/test_solid_mechanics_model/test_materials/test_material_non_local/test_material_damage_non_local.cc @@ -1,96 +1,126 @@ /** * @file test_material_damage_non_local.cc * * @author Nicolas Richart + * @author Clément Roux-Langlois * * @date creation: Tue Sep 13 2011 * @date last modification: Thu Apr 03 2014 * - * @brief test for non-local damage materials + * @brief test for non-local damage materials on a 2D plate with a section gap + * the sample should break at the notch * * @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 "solid_mechanics_model.hh" /* -------------------------------------------------------------------------- */ using namespace akantu; int main(int argc, char *argv[]) { debug::setDebugLevel(dblWarning); akantu::initialize("material_damage_non_local.dat", argc, argv); - UInt max_steps = 40000; + UInt max_steps = 1100; const UInt spatial_dimension = 2; Mesh mesh(spatial_dimension); - mesh.read("mesh.msh"); + mesh.read("mesh_section_gap.msh"); mesh.createGroupsFromMeshData("physical_names"); SolidMechanicsModel model(mesh); /// model initialization model.initFull(); Real time_step = model.getStableTimeStep(); - model.setTimeStep(time_step/10.); + model.setTimeStep(time_step/2.5); std::cout << model << std::endl; model.applyBC(BC::Dirichlet::FixedValue(0.0), "Fixed"); // Boundary condition (Neumann) Matrix stress(2,2); - stress.eye(3e6); + stress.eye(5e8); model.applyBC(BC::Neumann::FromHigherDim(stress), "Traction"); - model.setBaseName("damage_non_local"); - model.addDumpField("displacement"); + /* model.setBaseName("damage_non_local"); + model.addDumpFieldVector("displacement"); model.addDumpField("mass" ); model.addDumpField("velocity" ); model.addDumpField("acceleration"); model.addDumpField("force" ); model.addDumpField("residual" ); model.addDumpField("damage" ); model.addDumpField("stress" ); model.addDumpField("strain" ); - model.dump(); + model.dump();*/ for(UInt s = 0; s < max_steps; ++s) { model.explicitPred(); model.updateResidual(); model.updateAcceleration(); model.explicitCorr(); if(s % 100 == 0) std::cout << "Step " << s+1 << "/" << max_steps < & lower_bounds = mesh.getLowerBounds(); + const Vector & upper_bounds = mesh.getUpperBounds(); + Real L = upper_bounds(0) - lower_bounds(0); + Real H = upper_bounds(1) - lower_bounds(1); + + const ElementTypeMapArray & filter = model.getMaterial(0).getElementFilter(); + ElementTypeMapArray::type_iterator it = filter.firstType(spatial_dimension); + ElementTypeMapArray::type_iterator end = filter.lastType(spatial_dimension); + Vector barycenter(spatial_dimension); + for(; it != end; ++it) { + UInt nb_elem = mesh.getNbElement(*it); + const UInt nb_gp = model.getFEEngine().getNbQuadraturePoints(*it); + Array & material_damage_array = model.getMaterial(0).getArray("damage", *it); + UInt cpt = 0; + for(UInt nel = 0; nel < nb_elem ; ++nel){ + mesh.getBarycenter(nel,*it,barycenter.storage()); + if( (std::abs(barycenter(0)-(L/2)+0.025)<0.025) + && (std::abs(barycenter(1)-(H/2)+0.025)<0.025) ) { + if (material_damage_array(cpt,0) < 0.9){ + // std::cout << "barycenter(0) = " << barycenter(0) << ", barycenter(1) = " + // << barycenter(1) <