xref: /libCEED/examples/README.md (revision efc78312550893c11c7921bf7c4699a3e027cc68)
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: ex1-volume
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: ex2-surface
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## PETSc+libCEED 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`](./navierstokes) folder.
81
82## PETSc+libCEED Surface Area Examples
83
84These examples use the mass operator to compute the surface area of a cube or a discrete cubed-sphere, using PETSc.
85
86These examples show in particular the constructions of geometric factors to handle problems in which the elements topological dimension is different from the
87geometrical dimension and for which the coordinate transformation Jacobian from the 2D reference space to a manifold embedded in 3D physical space is a non-square matrix.
88
89## Running Examples
90
91To build the examples, set the `MFEM_DIR`, `PETSC_DIR` and `NEK5K_DIR` variables
92and run:
93
94```console
95# libCEED examples on CPU and GPU
96cd ceed
97make
98./ex1-volume -ceed /cpu/self
99./ex1-volume -ceed /gpu/occa
100./ex2-surface -ceed /cpu/self
101./ex2-surface -ceed /gpu/occa
102cd ..
103
104# MFEM+libCEED examples on CPU and GPU
105cd mfem
106make
107./bp1 -ceed /cpu/self -no-vis
108./bp3 -ceed /gpu/occa -no-vis
109cd ..
110
111# Nek5000+libCEED examples on CPU and GPU
112cd nek
113make
114./nek-examples.sh -e bp1 -ceed /cpu/self -b 3
115./nek-examples.sh -e bp3 -ceed /gpu/occa -b 3
116cd ..
117
118# PETSc+libCEED examples on CPU and GPU
119cd petsc
120make
121./bpsraw -problem bp1 -ceed /cpu/self
122./bpsraw -problem bp2 -ceed /gpu/occa
123./bpsraw -problem bp3 -ceed /cpu/self
124./bpsraw -problem bp4 -ceed /gpu/occa
125./bpsraw -problem bp5 -ceed /cpu/self
126./bpsraw -problem bp6 -ceed /gpu/occa
127cd ..
128
129cd petsc
130make
131./area -problem cube -ceed /cpu/self -petscspace_degree 3
132./area -problem cube -ceed /gpu/occa -petscspace_degree 3
133./area -problem sphere -ceed /cpu/self -petscspace_degree 3 -dm_refine 2
134./area -problem sphere -ceed /gpu/occa -petscspace_degree 3 -dm_refine 2
135
136cd navier-stokes
137make
138./navierstokes -ceed /cpu/self
139./navierstokes -ceed /gpu/occa
140cd ..
141```
142
143The above code assumes a GPU-capable machine with the OCCA backend
144enabled. Depending on the available backends, other CEED resource specifiers can
145be provided with the `-ceed` option. Other command line arguments can be found in the
146[`petsc`](./petsc/README.md) folder.
147