Page MenuHomec4science

test_node_selection.cc
No OneTemporary

File Metadata

Created
Fri, Nov 1, 12:52

test_node_selection.cc

/**
* @file test_periodic_plate.cc
* @author Aurelia Isabel Cuba Ramos <aurelia.cubaramos@epfl.ch>
* @date Thu Jan 21 10:11:04 2016
*
* @brief Test for correct application of periodic boundary conditions
*
* @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 <http://www.gnu.org/licenses/>.
*
*/
/* -------------------------------------------------------------------------- */
/* -------------------------------------------------------------------------- */
#include <iostream>
/* -------------------------------------------------------------------------- */
#include "solid_mechanics_model_RVE.hh"
using namespace akantu;
int main(int argc, char *argv[]) {
akantu::initialize("material_test_boundary.dat", argc, argv);
const UInt spatial_dimension = 2;
Mesh mesh(spatial_dimension);
mesh.read("periodic_plate.msh");
SolidMechanicsModelRVE model(mesh, false);
MeshDataMaterialSelector<std::string> * mat_selector;
mat_selector = new MeshDataMaterialSelector<std::string>("physical_names", model);
model.setMaterialSelector(*mat_selector);
/// model initialization
model.initFull();
/// apply macroscopic deformation gradient at corner nodes
/// consider a constant strain field
Matrix<Real> grad_u_macro(spatial_dimension, spatial_dimension, 0.);
grad_u_macro(0,1) = 1.;
// grad_u_macro(1,1) = 0.5;
// grad_u_macro(0,0) = 1.;
/// fix top right node
// UInt node = corner_nodes(2);
// boun(node,0) = true; disp(node,0) = 0.;
// boun(node,1) = true; disp(node,1) = 0.;
// /// apply gradu*x at bottom right and top left
// node = corner_nodes(0);
// x(0) = pos(node,0); x(1) = pos(node,1);
// appl_disp.mul<false>(grad_u_macro,x);
// boun(node,0) = true; disp(node,0) = appl_disp(0);
// boun(node,1) = true; disp(node,1) = appl_disp(1);
// node = corner_nodes(1);
// x(0) = pos(node,0); x(1) = pos(node,1);
// appl_disp.mul<false>(grad_u_macro,x);
// boun(node,0) = true; disp(node,0) = appl_disp(0);
// boun(node,1) = true; disp(node,1) = appl_disp(1);
// node = corner_nodes(3);
// x(0) = pos(node,0); x(1) = pos(node,1);
// appl_disp.mul<false>(grad_u_macro,x);
// boun(node,0) = true; disp(node,0) = appl_disp(0);
// boun(node,1) = true; disp(node,1) = appl_disp(1);
model.applyBoundaryConditions(grad_u_macro);
model.setBaseName ("periodic-plate" );
model.addDumpFieldVector("displacement");
model.addDumpField ("stress" );
model.addDumpField ("grad_u" );
model.addDumpField ("blocked_dofs" );
model.addDumpField ("material_index" );
// model.addDumpField ("" );
model.dump();
/// solve system
model.assembleStiffnessMatrix();
Real error = 0;
bool converged= model.solveStep<_scm_newton_raphson_tangent_not_computed, _scc_increment>(1e-12, error, 2);
AKANTU_DEBUG_ASSERT(converged, "Did not converge");
Real average_strain = model.averageTensorField(0,1, "strain");
std::cout << "the average strain is: " << average_strain << std::endl;
model.dump();
finalize();
return EXIT_SUCCESS;
}

Event Timeline