MercuryDPM
Trunk
|
Before you read about how to write your own code, we recommend you to work through the Tutorials. These tutorials explain the basic construction of the codes. After this, you will be familiar with the code design. You also will compile, run and visualise the simulations, so you will know the general tools available to you.
To explain how to creat your own code, a single particle bouncing between two walls will be created from a scratch; we will call it PingPong.cpp. Some of you want to use the terminal and some others an IDE, so we will show you both ways.
The first thing you need is a place to put your code. You can create your own code in one of the existing Driver directories, but we recommend you creating your own directory. This is how you do it: These steps are also explained by the figure below, the numbers indicate the steps.
Now let's take a look how we can implement the PingPong example.
The basic steps to create a simple Mercury program are:
Here the user includes the headers to use in the simulations. The first header calls <Mercury3D.h> is the base one. Furthermore, this pinpong tutorial must have walls and the type of model (species) to be used.
There are different type of walls, you can find further information in Different types of walls.
There are several contact models and species to interact with combined classes. You can find more information in Contact Models in MercuryDPM.
1.1.1 Constructor: General and unchangeable parameters during the simulation
1.1.1 Member functions
2.1 User specifications
If the user wants to implement a new contact model interaction (a new species), you could get more information of how clicking Creating a new species.
The user can also write a program reading information from previous results or programs. For this, the restart option must be included in the main function. You could get further information in How to restart MercuryDPM driver codes