xref: /libCEED/examples/README.md (revision dc7d240c1c3ecbc40e893ea38e37c8e19d48593c)
1# libCEED: Examples
2
3This page provides a brief description of the examples for the libCEED library.
4
5## Basic libCEED Examples
6
7Two examples are provided that rely only upon libCEED without any external
8libraries.
9
10### Example 1
11
12This example uses the mass matrix to compute the length, area, or volume of a
13region, depending upon runtime parameters.
14
15### Example 2
16
17This example uses the diffusion matrix to compute the surface area of a region,
18depending upon runtime parameters.
19
20## Bakeoff Problems
21
22This section provides a brief description of the bakeoff problems, used as examples
23for the libCEED library. These bakeoff problems are high-order benchmarks designed
24to test and compare the performance of high-order finite element codes.
25
26For further documentation, readers may wish to consult the
27[CEED documentation](http://ceed.exascaleproject.org/bps/) of the bakeoff problems.
28
29### Bakeoff Problem 1
30
31Bakeoff problem 1 is the *L<sup>2</sup>* projection problem into the finite element space.
32
33The supplied examples solve *_B_ u = f*, where *_B_* is the mass matrix.
34
35The nodal points, *p*, are Gauss-Legendre-Lobatto, and the quadrature points, *q* are Gauss-Legendre. There is one more quadrature point in each dimension than nodal point, *q = p + 1*.
36
37### Bakeoff Problem 2
38
39Bakeoff problem 2 is the *L<sup>2</sup>* projection problem into the finite element space on a vector system.
40
41The supplied examples solve *_B_ _u_ = f*, where *_B_* is the mass matrix.
42
43The nodal points, *p*, are Gauss-Legendre-Lobatto, and the quadrature points, *q* are Gauss-Legendre. There is one more quadrature point in each dimension than nodal point, *q = p + 1*.
44
45### Bakeoff Problem 3
46
47Bakeoff problem 3 is the Poisson problem.
48
49The supplied examples solve *_A_ u = f*, where *_A_* is the Poisson operator.
50
51The nodal points, *p*, are Gauss-Legendre-Lobatto, and the quadrature points, *q* are Gauss-Legendre. There is one more quadrature point in each dimension than nodal point, *q = p + 1*.
52
53### Bakeoff Problem 4
54
55Bakeoff problem 4 is the Poisson problem on a vector system.
56
57The supplied examples solve *_A_ _u_ = f*, where *_A_* is the Laplace operator for the Poisson equation.
58
59The nodal points, *p*, are Gauss-Legendre-Lobatto, and the quadrature points, *q* are Gauss-Legendre. There is one more quadrature point in each dimension than nodal point, *q = p + 1*.
60
61### Bakeoff Problem 5
62
63Bakeoff problem 5 is the Poisson problem.
64
65The supplied examples solve *_A_ u = f*, where *_A_* is the Poisson operator.
66
67The nodal points, *p*, are Gauss-Legendre-Lobatto, and the quadrature points, *q* are Gauss-Legendre-Lobatto. The nodal points and quadrature points are collocated.
68
69### Bakeoff Problem 6
70
71Bakeoff problem 6 is the Poisson problem on a vector system.
72
73The supplied examples solve *_A_ _u_ = f*, where *_A_* is the Laplace operator for the Poisson equation.
74
75The nodal points, *p*, are Gauss-Legendre-Lobatto, and the quadrature points, *q* are Gauss-Legendre-Lobatto. The nodal points and quadrature points are collocated.
76
77## Navier-Stokes Solver
78
79The Navier-Stokes problem solves the compressible Navier-Stokes equations using an explicit time integration. A more detailed description of the problem formulation
80can be found in the `navier-stokes` folder.
81
82## Running Examples
83
84To build the examples, set the `MFEM_DIR`, `PETSC_DIR` and `NEK5K_DIR` variables
85and run:
86
87```console
88# libCEED examples on CPU and GPU
89cd ceed
90make
91./ex1 -ceed /cpu/self
92./ex1 -ceed /gpu/occa
93cd ..
94
95# MFEM+libCEED examples on CPU and GPU
96cd mfem
97make
98./bp1 -ceed /cpu/self -no-vis
99./bp3 -ceed /gpu/occa -no-vis
100cd ..
101
102# Nek5000+libCEED examples on CPU and GPU
103cd nek
104make
105./nek-examples.sh -e bp1 -ceed /cpu/self -b 3
106./nek-examples.sh -e bp3 -ceed /gpu/occa -b 3
107cd ..
108
109# PETSc+libCEED examples on CPU and GPU
110cd petsc
111make
112./bpsraw -problem bp1 -ceed /cpu/self
113./bpsraw -problem bp2 -ceed /gpu/occa
114./bpsraw -problem bp3 -ceed /cpu/self
115./bpsraw -problem bp4 -ceed /gpu/occa
116./bpsraw -problem bp5 -ceed /cpu/self
117./bpsraw -problem bp6 -ceed /gpu/occa
118cd ..
119
120cd navier-stokes
121make
122./navierstokes -ceed /cpu/self
123./navierstokes -ceed /gpu/occa
124cd ..
125```
126
127The above code assumes a GPU-capable machine with the OCCA backend
128enabled. Depending on the available backends, other CEED resource specifiers can
129be provided with the `-ceed` option.
130