Skip to main content

Tutorial 0 (hello GeLB!)

Let's not waste much time, and start showing you some hands-on examples!

Prerequisite for this tutorial

To get the most out of this tutorial, please make sure you followed our Getting started guide, which shows you how to install the GeLB compiler (gelbc) and plugins for your editor / IDE.

All good? OK, let's go!

It seems that most self-respecting programming languages need a "hello world" example, which demonstrates the basic syntax. Unfortunately, GeLB does not (currently) have nice printing capabilities, so it cannot even say hello. That is not to say that GeLB is not self-respecting! Everyone is different, and GeLB wants to operate on numbers -- instead of a greeting, we will show you how to increment a vector. Granted, this is not much more exciting than printing a message, but it will give us the opportunity to go over the most important elements that you need in all GeLB programs. Rest assured -- once you are done with this tutorial, in the following ones we will show you how to create much more interesting simulations using GeLB.

Some preparation#

Let's start by creating a new directory for our simulation:

mkdir -p ~/gelb_tutorials/tutorial_0 # (Linux / OSX)
Separate directory (folder) for each simulation

When executed, most GeLB programs will generate files containing the output of your simulation. To avoid confusion, create a separate directory for each new simulation.

Open your editor/IDE, and create a new file in that directory. We will call it tutorial_0.gelb.

General structure of a .gelb file#

Each GeLB program should start with two assignment-like lines, which specify the name and the description of the simulation:

simulation_name = "tutorial 0 (incrementing a vector using GeLB)";
simulation_description = "A longer description, which may extend over several lines";

Afterwards, we have a series of standard blocks, which correspond to the concepts discussed in the previous section, as follows:

global_constants {
// optional block, for global constants (if any)
}
lattices {
// ...
}
initializer MyInitializer {
// ...
}
dynamic MyDynamic {
// ...
}
gauge MyGauge {
// ...
}
node_classes {
// ...
}
geometry {
// ...
}

As discussed in the main concepts, there are a few elements (blocks) which you will encounter over and over again...

TODO

TODO#

TODO

TODO#

TODO

TODO#

TODO

TODO#

TODO

TODO#

TODO

TODO#

TODO