Hello World (Skeleton)#
This tutorial is designed to show how to run a simple LFRic application. It is not intended to be a complete tutorial on how to write an application, but rather to show how to run an application that is already written.
The application is a simple skeleton that does not do anything useful, but is designed as a demonstration and test of the basic infrastructure required to run LFRic applications.
Here it is used to show you how to build and run an application and to enable you to test that you have the necessary software installed and configured correctly to run LFRic in it’s most basic form.
The application is located in the LFRic core repository at
applications/skeleton.
Once you have cloned the LFRic core repository and set up your environment with the required dependencies as described in the Software dependencies of LFRic section of the installation guide, you should be able to build and run the application with the following commands.
Info
The application used in this example does not do any IO and so does not link to the IO library XIOS.
cd applications/skeleton
make build
Attention
The build command for applications in the lfric_apps repository is different. Please see the lfric_apps build instructions for details.
This will build the application and place the executable in the bin directory. the build command also creates a working directory where all the source code is copied and the different steps required in the build are completed. For example, both the PSy layer, generated by PSyclone, and the configuration source code generated from the Rose metadata can be found in the working directory.
The application can then be run with the canned example with the following command.
cd example
../bin/skeleton configuration.nml
This will run the application with the configuration file provided in the example directory.
Upon completion of the run the output will finish with the following message.
20260604105713.475+0100:INFO : skeleton application completed.
If you look back through the output you will see that the application has printed out information at each time step it is running like this:
20260604105713.469+0100:S3:INFO : skeleton: Running algorithm
20260604105713.470+0100:S3:INFO : Min/max field_1 = 0.00000000E+00 0.00000000E+00
20260604105713.470+0100:S3:INFO : skeleton: finished algorithm
The first part of each line is a date and time stamp, followed by the time step number (e.g. S3). The final part of the message prefix is the log level (INFO in this case) and then the message itself as defined in the source code. The messages are printed by the application at different stages of the run to show what it is doing. In this case, it is showing that it is running an algorithm, printing out the minimum and maximum values of a field before finishing.