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## 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 -ceed /cpu/self 99./ex1 -ceed /gpu/occa 100cd .. 101 102# MFEM+libCEED examples on CPU and GPU 103cd mfem 104make 105./bp1 -ceed /cpu/self -no-vis 106./bp3 -ceed /gpu/occa -no-vis 107cd .. 108 109# Nek5000+libCEED examples on CPU and GPU 110cd nek 111make 112./nek-examples.sh -e bp1 -ceed /cpu/self -b 3 113./nek-examples.sh -e bp3 -ceed /gpu/occa -b 3 114cd .. 115 116# PETSc+libCEED examples on CPU and GPU 117cd petsc 118make 119./bpsraw -problem bp1 -ceed /cpu/self 120./bpsraw -problem bp2 -ceed /gpu/occa 121./bpsraw -problem bp3 -ceed /cpu/self 122./bpsraw -problem bp4 -ceed /gpu/occa 123./bpsraw -problem bp5 -ceed /cpu/self 124./bpsraw -problem bp6 -ceed /gpu/occa 125cd .. 126 127cd navier-stokes 128make 129./navierstokes -ceed /cpu/self 130./navierstokes -ceed /gpu/occa 131cd .. 132 133cd petsc 134make 135./area -problem cube -ceed /cpu/self -petscspace_degree 3 136./area -problem cube -ceed /gpu/occa -petscspace_degree 3 137./area -problem sphere -ceed /cpu/self -petscspace_degree 3 -dm_refine 2 138./area -problem sphere -ceed /gpu/occa -petscspace_degree 3 -dm_refine 2 139``` 140 141The above code assumes a GPU-capable machine with the OCCA backend 142enabled. Depending on the available backends, other CEED resource specifiers can 143be provided with the `-ceed` option. Other command line arguments can be found in the 144[`petsc`](./petsc/README.md) folder. 145