xref: /libCEED/examples/README.md (revision 02219a082eb38cf2d3edc97fbfe55fa395a4dc99)
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 that rely only upon libCEED without any external libraries are provided in the [ceed/](./ceed) folder.
8For more details, please see the dedicated [documentation section](https://libceed.org/en/latest/examples/ceed/index.html).
9
10## Bakeoff Problems
11
12<!-- bps-inclusion -->
13
14The Center for Efficient Exascale Discretizations (CEED) uses Bakeoff Problems (BPs) to test and compare the performance of high-order finite element implementations.
15The definitions of the problems are given on the ceed [website](https://ceed.exascaleproject.org/bps/).
16Each of the following bakeoff problems that use external discretization libraries (such as deal.II, MFEM, PETSc, and Nek5000) are located in the subdirectories `deal.II/`, `mfem/`, `petsc/`, and `nek5000/`, respectively.
17
18Here we provide a short summary:
19
20:::{list-table}
21:header-rows: 1
22:widths: auto
23* - User code
24  - Supported BPs
25* - `deal.II`
26  - * BP1 (scalar mass operator) with $Q=P+1$
27    * BP2 (vector mass operator) with $Q=P+1$
28    * BP3 (scalar Laplace operator) with $Q=P+1$
29    * BP4 (vector Laplace operator) with $Q=P+1$
30    * BP5 (collocated scalar Laplace operator) with $Q=P$
31    * BP6 (collocated vector Laplace operator) with $Q=P$
32* - `mfem`
33  - * BP1 (scalar mass operator) with $Q=P+1$
34    * BP3 (scalar Laplace operator) with $Q=P+1$
35* - `petsc`
36  - * BP1 (scalar mass operator) with $Q=P+1$
37    * BP2 (vector mass operator) with $Q=P+1$
38    * BP3 (scalar Laplace operator) with $Q=P+1$
39    * BP4 (vector Laplace operator) with $Q=P+1$
40    * BP5 (collocated scalar Laplace operator) with $Q=P$
41    * BP6 (collocated vector Laplace operator) with $Q=P$
42* - `nek5000`
43  - * BP1 (scalar mass operator) with $Q=P+1$
44    * BP3 (scalar Laplace operator) with $Q=P+1$
45:::
46
47These are all **T-vector**-to-**T-vector** and include parallel scatter, element scatter, element evaluation kernel, element gather, and parallel gather (with the parallel gathers/scatters done externally to libCEED).
48
49BP1 and BP2 are $L^2$ projections, and thus have no boundary condition.
50The rest of the BPs have homogeneous Dirichlet boundary conditions.
51
52The BPs are parametrized by the number $P$ of Gauss-Legendre-Lobatto nodal points (with $P=p+1$, and $p$ the degree of the basis polynomial) for the Lagrange polynomials, as well as the number of quadrature points, $Q$.
53A $Q$-point Gauss-Legendre quadrature is used for all BPs except BP5 and BP6, which choose $Q = P$ and Gauss-Legendre-Lobatto quadrature to collocate with the interpolation nodes.
54This latter choice is popular in applications that use spectral element methods because it produces a diagonal mass matrix (enabling easy explicit time integration) and significantly reduces the number of floating point operations to apply the operator.
55
56<!-- bps-exclusion -->
57
58For a more detailed description of the operators employed in the BPs, please see the dedicated [BPs documentation section](https://libceed.org/en/latest/examples/bps.html).
59
60## PETSc+libCEED Fluid Dynamics Navier-Stokes Mini-App
61
62The Navier-Stokes problem solves the compressible Navier-Stokes equations using an explicit or implicit time integration.
63A more detailed description of the problem formulation can be found in the [fluids/](./fluids) folder and the corresponding [fluids documentation page](https://libceed.org/en/latest/examples/fluids/index.html).
64
65## PETSc+libCEED Solid Mechanics Elasticity Mini-App
66
67This example solves the steady-state static momentum balance equations using unstructured high-order finite/spectral element spatial discretizations.
68A more detailed description of the problem formulation can be found in the [solids/](./solids) folder and the corresponding [solids documentation page](https://libceed.org/en/latest/examples/solids/index.html).
69
70## PETSc+libCEED Surface Area Examples
71
72These examples, located in the [petsc/](./petsc) folder, use the mass operator to compute the surface area of a cube or a discrete cubed-sphere, using PETSc.
73For a detailed description, please see the corresponding [area documentation page](https://libceed.org/en/latest/examples/petsc/index.html#area).
74
75## PETSc+libCEED Bakeoff Problems on the Cubed-Sphere
76
77These examples, located in the [petsc/](./petsc) folder, reproduce the Bakeoff Problems 1-6 on a discrete cubed-sphere, using PETSc.
78For a detailed description, please see the corresponding [problems on the cubed-sphere documentation page](https://libceed.org/en/latest/examples/petsc/index.html#bakeoff-problems-on-the-cubed-sphere).
79
80## libCEED Python Examples
81
82These Jupyter notebooks explore the concepts of the libCEED API, including how to install the Python interface and the usage of each API object, with interactive examples.
83The basic libCEED C examples in `/ceed` folder are also available as Python examples.
84
85## libCEED Rust Examples
86
87The basic libCEED C examples in `/ceed` folder are also available as Rust examples.
88
89## Running Examples
90
91To build the examples, set the `DEAL_II_DIR`, `MFEM_DIR`, `PETSC_DIR`, and `NEK5K_DIR` variables and, from the `examples/` directory, run
92
93```{include} ../README.md
94:start-after: <!-- running-examples-inclusion -->
95:end-before: <!-- running-examples-exclusion -->
96```
97