Building a very simple tensile test (tutorial)

Tutorials

basic
your first simulation
advanced

This page describes how to build a real simulation

Prerequisites

You must follow the previous tutorial steps before starting this tutorial. You need results of previous tutorial steps. These results will be used as input data for this simulation. More precisely, you need this discrete domain a simple discrete domain

Please copy one of this domain in the current folder as it follows

$ cp ./MyDomain/MyFirstDomain.agdd ./

Now, your current directory must look like

├── build
├── build-domain.inp
├── CMakeLists.txt
├── Main.cpp
├── MyDomain
│   └── MyFirstDomain.agdd
├── MyFirstDomain.agdd
├── my-project.inp
├── PlugIn_BuildDomain.cpp
└── PlugIn_BuildDomain.hpp
and the minimal required files are :
├── build
├── CMakeLists.txt
├── Main.cpp
├── MyFirstDomain.agdd
├── Main.py
├── MyDomain
│   └── MyFirstDomain.agdd
├── MyFirstDomain.agdd
├── my-project.inp
├── PlugIn_BuildDomain.py
and the minimal required files are :
├── Main.py
├── MyFirstDomain.agdd

The input file

The goal of this simulation is to clamp the discrete element at the left and load the discrete element at the right. This simulation can be set through input file only. You can create a new input file named tensile.inp with the following input.

<GranOO Version="2.0" TotIteration="10000" OutDir="Results" ThreadNumber="1">

  <PreProcessing>
    <PlugIn Id="_ReadDomain" FileName="MyFirstDomain.agdd"/>
    <PlugIn Id="_Convert" What="ElementPair" To="Beam" YoungModulus="50e9" RadiusRatio="0.6"/>
    <PlugIn Id="_ComputeOptimalTimeStep" Ratio="0.14" />
  </PreProcessing>
   
  <Processing>
    <!-- Loadings section -->
    <PlugIn Id="_ClearLoad" />
    <PlugIn Id="_ApplyForce" X="if((it<1000),it*1e5,0)" Set="left"/>
    <PlugIn Id="_ApplyBondLoad" />
    
    <!-- Integration section -->
    <PlugIn Id="_IntegrateAcceleration" Linear="Yes" Angular="Yes"/>

    <!-- Boundary condition section -->
    <PlugIn Id="_ImposeDisplacement" Clamp="Yes" Set="right"/>
     
    <!-- Misc section -->
    <PlugIn Id="_Check" />
    <PlugIn Id="_SaveDomain" IterLoop="100" Type="gdd"/>
  </Processing>
  
  <PostProcessing>
  </PostProcessing>
  
</GranOO>

Step by step description of input file

The following plugin loads a discrete domain file into the simulation

<PlugIn Id="_ReadDomain" FileName="MyFirstDomain.agdd"/>

The following plugin converts all the ElementPair (described in a previous tutorial step) into mechanical beams. To get full description of what this beam are, you can consult the scientific bibliography.

<PlugIn Id="_Convert" What="ElementPair" To="Beam" YoungModulus="50e9" RadiusRatio="0.6"/>

The following plugin computes the optimal time step. It corresponds to the higher time step that ensures stable simulations.

<PlugIn Id="_ComputeOptimalTimeStep" Ratio="0.14" />

The following plugin clears all the forces and torques applied to elements and bodies. After this plugin the domain is completely relaxed.

<PlugIn Id="_ClearLoad" />

The following plugin applies a force on all the discrete elements indexed by the left SetOf. Here, only one discrete element is concerned. The X=... corresponds to the value of the force along the X axis. A mathematical formula is given that corresponds to : if the iteration is lower than 1,000, the force is 100,000 times the iteration value or zero instead.

<PlugIn Id="_ApplyForce" X="if((it<1000),it*1e5,0)" Set="left"/>

The following plugin computes the mechanical induced by the deformation of beams. The given loads are applied to the connected discrete elements.

<PlugIn Id="_ApplyBondLoad" />

The following plugin applies the velocity verlet integration scheme that computes linear and angular accelerations, velocities and displacements.

<PlugIn Id="_IntegrateAcceleration" Linear="Yes" Angular="Yes"/>

The following plugin imposes displacements to a discrete element set. Here the discrete elements are clamped (they can’t move).

<PlugIn Id="_ImposeDisplacement" Clamp="Yes" Set="right"/>

The following plugin checks if the computation is right.

<PlugIn Id="_Check" />

The following plugin saves the current state of the domain all 100 iterations.

<PlugIn Id="_SaveDomain" IterLoop="100" Type="gdd"/>

Running example and showing results.

Now, check first if your project is compiled with
$ cd build/ && cmake ../ && make && cd ../

Run the example

$ ./build/my-project.exe ./tensile.inp
$ python ./Main.py ./tensile.inp

Show the result

$ granoo-viewer ./Results

You should see the granoo-viewer window. If you press the Read button, you should see an animation where you domain oscillates.