Initialize project (tutorial)

Tutorials

basic
your first simulation
advanced

This page describes how to start a new granoo project

Now, you are ready to build your own first simulation from scratch. This new tutorial section will describe how to do this task. GranOO embeds a tool named granoo3-project that help users to start and manage their projects. In the granoo terminology a project corresponds to a family of simulation.

The main steps for building a simulation

Generally, building a new simulation consists in :

  • writing some plugins to add your specific treatments,
  • compiling these plugins (C++ only) to build an executable file,
  • editing the input file to describe the simulation (loadings, boundaries conditions, etc.) and
  • launching the simulation.

The following sections will show how to start, compile and run a new blank project.

Building the project template

The following terminal commands show how to create a new blank project thanks to the granoo3-project utility. To start a new blank project named my-project simply type (in a new empty folder).

:prompt: granoo3-project --start --cpp
Starting new project...
Project Name ? my-project
Project "my-project" was created
Do you want to add a plugin ? [(y)es or (n)o] -> n
-> Good bye ! 

The given answers create a new directory named my-project in the current directory.

.
└── my-project
    ├── CMakeLists.txt
    ├── Main.cpp
    └── my-project.inp

Where :

  • CMakeLists.txt is a file used by the cmake program to manage the compilation process,
  • Main.cpp is a C++ source file that simply contains the standard C++ main() function required to execute a binary file,
  • my-project.inp is the input file that manages and describes the simulation.
:prompt: granoo3-project --start --py
Starting new project...
Project Name ? my-project
Project "my-project" was created
Do you want to add a plugin ? [(y)es or (n)o] -> n
-> Good bye ! 

The given answers create a new directory named my-project in the current directory.

.
└── my-project
    ├── Main.py
    └── my-project.inp

Where :

  • Main.py is a Python source file that simply contains the standard main() function,
  • my-project.inp is the input file that manages and describes the simulation.

Compiling your project

As for examples, the compilation process is managed by cmake. To compile your project, simply type.

:prompt: mkdir build
:prompt: cd build
:prompt: cmake ../
:prompt: make
:prompt: cd ../

Running your project

Now, to run your project, type

:prompt: ./build/my-project.exe ./my-project.inp
:prompt: python Main.py ./my-project.inp

At this stage, your simulation fails ! It’s normal, please follow up the tutorial to fix and overcome your granoo project.