xref: /libCEED/examples/nek/README.md (revision 9ba83ac0e4b1fca39d6fa6737a318a9f0cbc172d)
1## libCEED + Nek5000 Examples
2
3### Prerequisites
4
5Nek5000 v19.0 or greater must be [installed](https://nek5000.mcs.anl.gov/getstarted/) to run these examples.
6It is assumed to exist at `../../../Nek5000` (a sibling to the libCEED directory) or at a path defined in the environment variable `NEK5K_DIR`.
7For example, you could set
8```sh
9    export NEK5K_DIR=/scratch/Nek5000
10```
11if that is where it is located.
12
13The Nek5000 examples depend on the Nek5000 tools: `genbox`, `genmap`, and `reatore2`.
14They can be built using
15```sh
16   ( cd $NEK5K_DIR/tools && ./maketools genbox genmap reatore2 )
17```
18See also the [Nek5000 documentation](https://nek5000.mcs.anl.gov/getstarted/).
19
20### Building the Nek5000 examples
21
22You can build the Nek5000 libCEED examples with the command `make bps`.
23
24You can also build the Nek5000 libCEED examples by invoking `nek-examples.sh` script.
25```sh
26  ./nek-examples.sh -m
27```
28
29By default, the examples are built with MPI.
30To build the examples without MPI, set the environment variable `MPI=0`.
31
32Note: Nek5000 examples must be built sequentially.
33Due to the Nek5000 build process, multiple examples cannot be built in parallel.
34At present, there is only one Nek5000 example file to build, which handles both CEED BP 1 and CEED BP 3.
35
36### Running Nek5000 examples
37
38You can run the Nek5000 libCEED examples by invoking `nek-examples.sh` script.
39The syntax is:
40```sh
41  ./nek-examples.sh -c <ceed_backend> -e <example_name> \
42                   -n <mpi_ranks> -b <box_geometry>
43```
44The different options that can be used for the script are listed below:
45```
46options:
47   -h|-help     Print this usage information and exit
48   -c|-ceed     Ceed backend to be used for the run (optional, default: /cpu/self)
49   -e|-example  Example name (optional, default: bp1)
50   -n|-np       Specify number of MPI ranks for the run (optional, default: 1)
51   -t|-test     Run in test mode (not on by default)
52   -b|-box      Box case in boxes sub-directory found along with this script (default: 2x2x2)
53   -clean       clean the examples directory
54   -m|-make     Make the examples
55```
56The only mandatory argument is `-b` or `-box` which sets the box geometry to be used.
57This geometry should be found in `./boxes` directory.
58
59For example, you can run bp1 as follows:
60```sh
61  ./run-nek-example.sh -ceed /cpu/self -e bp1 -n 4 -b 3
62```
63which is the same as running:
64```sh
65  ./run-nek-example.sh -b 3
66```
67