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## PETSc+libCEED Bakeoff Problems on the Cubed-Sphere 90 91These examples reproduce the Bakeoff Problems 1-6 on a discrete cubed-sphere, using PETSc. 92 93## Running Examples 94 95To build the examples, set the `MFEM_DIR`, `PETSC_DIR` and `NEK5K_DIR` variables 96and run: 97 98```console 99# libCEED examples on CPU and GPU 100cd ceed 101make 102./ex1-volume -ceed /cpu/self 103./ex1-volume -ceed /gpu/occa 104./ex2-surface -ceed /cpu/self 105./ex2-surface -ceed /gpu/occa 106cd .. 107 108# MFEM+libCEED examples on CPU and GPU 109cd mfem 110make 111./bp1 -ceed /cpu/self -no-vis 112./bp3 -ceed /gpu/occa -no-vis 113cd .. 114 115# Nek5000+libCEED examples on CPU and GPU 116cd nek 117make 118./nek-examples.sh -e bp1 -ceed /cpu/self -b 3 119./nek-examples.sh -e bp3 -ceed /gpu/occa -b 3 120cd .. 121 122# PETSc+libCEED examples on CPU and GPU 123cd petsc 124make 125./bps -problem bp1 -ceed /cpu/self 126./bps -problem bp2 -ceed /gpu/occa 127./bps -problem bp3 -ceed /cpu/self 128./bps -problem bp4 -ceed /gpu/occa 129./bps -problem bp5 -ceed /cpu/self 130./bps -problem bp6 -ceed /gpu/occa 131cd .. 132 133cd petsc 134make 135./bpsraw -problem bp1 -ceed /cpu/self 136./bpsraw -problem bp2 -ceed /gpu/occa 137./bpsraw -problem bp3 -ceed /cpu/self 138./bpsraw -problem bp4 -ceed /gpu/occa 139./bpsraw -problem bp5 -ceed /cpu/self 140./bpsraw -problem bp6 -ceed /gpu/occa 141cd .. 142 143cd petsc 144make 145./bpssphere -problem bp1 -ceed /cpu/self 146./bpssphere -problem bp2 -ceed /gpu/occa 147./bpssphere -problem bp3 -ceed /cpu/self 148./bpssphere -problem bp4 -ceed /gpu/occa 149./bpssphere -problem bp5 -ceed /cpu/self 150./bpssphere -problem bp6 -ceed /gpu/occa 151cd .. 152 153cd petsc 154make 155./area -problem cube -ceed /cpu/self -petscspace_degree 3 156./area -problem cube -ceed /gpu/occa -petscspace_degree 3 157./area -problem sphere -ceed /cpu/self -petscspace_degree 3 -dm_refine 2 158./area -problem sphere -ceed /gpu/occa -petscspace_degree 3 -dm_refine 2 159 160cd navier-stokes 161make 162./navierstokes -ceed /cpu/self -petscspace_degree 1 163./navierstokes -ceed /gpu/occa -petscspace_degree 1 164cd .. 165``` 166 167The above code assumes a GPU-capable machine with the OCCA backend 168enabled. Depending on the available backends, other CEED resource specifiers can 169be provided with the `-ceed` option. Other command line arguments can be found in the 170[`petsc`](./petsc/README.md) folder. 171