Introduction to input file (tutorial)

Tutorials

basic
your first simulation
advanced

This page describes the usage of *.inp input file

A granoo computation is described through input *.inp files. These files are written in the xml language. Input files simply describe the chronological sequence of macro-commands (named PlugIn in the GranOO terminology) which must be triggered in a computation. These PlugIns are embedded into a <STEP> xml tag.. Generally, a simulation contains three main steps : the PreProcessing, Processing and PostProcessing steps.

The Processing step corresponds to the main time loop required by the explicit time scheme. It means that the PlugIn written in this section are triggered at each time step during the simulation. The PreProcessing and PostProcessing PlugIn are triggered just one time before and after the time loop respectively.

Note that these three sections must be embedded in a <GranOO.../> xml tag. This tag is used to define global settings of simulation output directory, number of thread,etc…

Below, you will find the input file that corresponds to the granular rain example available in the somewhere/tags/3.0/Example/00104_{dem}{mechanical}{granular}_SPHERICAL-RAIN path.

<GRANOO Version="3" OutDir="TEST" ThreadNumber="1" Verbose="No">

  <STEP Label="pre-processing">
    <NEW-GROUND Type="Box" DimX="1." DimY="0.25" DimZ="1." ID="Boundary"/>
  </STEP>

  <STEP Label="processing" TotalTime="2." TimeStep="2e-5">
    <AddElement xMaxPos=".4" yPos="0." zMaxPos=".4" rMax="0.02"
    		MaxNumber="2000" EveryIter="100"/>
    <CLEAR-LOAD/>
    <APPLY-GRAVITY X="0." Y="-10." Z="0."/>
    <MANAGE-COLLISION Between="Body/Ground"
    		      BroadPhase="Raw" NarrowPhase="WithSphere"
    		      CallBack="Standard2" NormalStiffness="1e5" RestitutionCoeff="0.1" StaticFriction="0.3"/>    
    <MANAGE-COLLISION Between="Body/Body"
    		      BroadPhase="Lcm" SkipNarrowPhase="True"
    		      CallBack="Standard2" NormalStiffness="1e5" RestitutionCoeff="0.1" StaticFriction="0.3" />
    <INTEGRATE-ACCELERATION Linear="Yes" Angular="Yes"/>
    <CHECK/>
    <SAVE-DOMAIN EveryIter="1000" />
  </STEP>

</GRANOO>

In this example, only the pre-processing and processing steps are used. You can note that the TotalTime TimeStep xml attributes of the processing step allows to define the main time loop. The NEW-GROUND, AddElement or CLEAR-LOAD Xml tags correspond to the GranOO macro-commands (also named PlugIn). The PlugIn which are written in capital letters correspond to the GranOO standard plugins which are defined in the somewhere/tags/3.0/Lib/GranOO3/PlugIn C++ source files.

Practical work

Ok, please try to build this example (see the first tutorial step) and run the simulation with this input file and see the result with the granoo3-viewer program. Now, we will highlight that the plugin order is important. For instance, move the CLEAR-LOAD just before the INTEGRATE-ACCELERATION. You must obtain something like :

<GRANOO Version="3" OutDir="TEST" ThreadNumber="1" Verbose="No">

  <STEP Label="pre-processing">
    <NEW-GROUND Type="Box" DimX="1." DimY="0.25" DimZ="1." ID="Boundary"/>
  </STEP>

  <STEP Label="processing" TotalTime="2." TimeStep="2e-5">
    <AddElement xMaxPos=".4" yPos="0." zMaxPos=".4" rMax="0.02"
    		MaxNumber="2000" EveryIter="100"/>
    <APPLY-GRAVITY X="0." Y="-10." Z="0."/>
    <MANAGE-COLLISION Between="Body/Ground"
    		      BroadPhase="Raw" NarrowPhase="WithSphere"
    		      CallBack="Standard2" NormalStiffness="1e5" RestitutionCoeff="0.1" StaticFriction="0.3"/>
    <MANAGE-COLLISION Between="Body/Body"
    		      BroadPhase="Lcm" SkipNarrowPhase="True"
    		      CallBack="Standard2" NormalStiffness="1e5" RestitutionCoeff="0.1" StaticFriction="0.3" />
    <CLEAR-LOAD/>	
    <INTEGRATE-ACCELERATION Linear="Yes" Angular="Yes"/>
    <CHECK/>
    <SAVE-DOMAIN EveryIter="1000" />
  </STEP>

</GRANOO>

Now, re-run your simulation (note that you can skip the compilation process with cmake and make because you do not change the c++ source files) and observe the results. These results should be very different !

If you do not understand why these results have changed, it means that you probably have to improve your understanding of the discrete element method. This is important, this tutorial is not an introduction to the discrete element method nor the c++ and the python languages… You must get by yourself some backgrounds on such topics.

Please go to the next tutorial step…