1bcb2dfaeSJed Brown# Standalone libCEED 2bcb2dfaeSJed Brown 3bcb2dfaeSJed BrownThe following two examples have no dependencies, and are designed to be self-contained. 4bcb2dfaeSJed BrownFor additional examples that use external discretization libraries (MFEM, PETSc, Nek5000 5bcb2dfaeSJed Brownetc.) see the subdirectories in {file}`examples/`. 6bcb2dfaeSJed Brown 7bcb2dfaeSJed Brown(ex1-volume)= 8bcb2dfaeSJed Brown 9bcb2dfaeSJed Brown## Ex1-Volume 10bcb2dfaeSJed Brown 11bcb2dfaeSJed BrownThis example is located in the subdirectory {file}`examples/ceed`. It illustrates a 12bcb2dfaeSJed Brownsimple usage of libCEED to compute the volume of a given body using a matrix-free 13bcb2dfaeSJed Brownapplication of the mass operator. Arbitrary mesh and solution orders in 1D, 2D, and 3D 14bcb2dfaeSJed Brownare supported from the same code. 15bcb2dfaeSJed Brown 16bcb2dfaeSJed BrownThis example shows how to compute line/surface/volume integrals of a 1D, 2D, or 3D 17bcb2dfaeSJed Browndomain $\Omega$ respectively, by applying the mass operator to a vector of 18bcb2dfaeSJed Brown$1$s. It computes: 19bcb2dfaeSJed Brown 20bcb2dfaeSJed Brown$$ 21bcb2dfaeSJed BrownI = \int_{\Omega} 1 \, dV . 22bcb2dfaeSJed Brown$$ (eq-ex1-volume) 23bcb2dfaeSJed Brown 24bcb2dfaeSJed BrownUsing the same notation as in {ref}`theoretical-framework`, we write here the vector 25bcb2dfaeSJed Brown$u(x)\equiv 1$ in the Galerkin approximation, 26bcb2dfaeSJed Brownand find the volume of $\Omega$ as 27bcb2dfaeSJed Brown 28bcb2dfaeSJed Brown$$ 29bcb2dfaeSJed Brown\sum_e \int_{\Omega_e} v(x) 1 \, dV 30bcb2dfaeSJed Brown$$ (volume-sum) 31bcb2dfaeSJed Brown 32bcb2dfaeSJed Brownwith $v(x) \in \mathcal{V}_p = \{ v \in H^{1}(\Omega_e) \,|\, v \in P_p(\bm{I}), e=1,\ldots,N_e \}$, 33bcb2dfaeSJed Brownthe test functions. 34bcb2dfaeSJed Brown 35bcb2dfaeSJed Brown(ex2-surface)= 36bcb2dfaeSJed Brown 37bcb2dfaeSJed Brown## Ex2-Surface 38bcb2dfaeSJed Brown 39bcb2dfaeSJed BrownThis example is located in the subdirectory {file}`examples/ceed`. It computes the 40bcb2dfaeSJed Brownsurface area of a given body using matrix-free application of a diffusion operator. 41bcb2dfaeSJed BrownSimilar to {ref}`Ex1-Volume`, arbitrary mesh and solution orders in 1D, 2D, and 3D 42bcb2dfaeSJed Brownare supported from the same code. It computes: 43bcb2dfaeSJed Brown 44bcb2dfaeSJed Brown$$ 45bcb2dfaeSJed BrownI = \int_{\partial \Omega} 1 \, dS , 46bcb2dfaeSJed Brown$$ (eq-ex2-surface) 47bcb2dfaeSJed Brown 48bcb2dfaeSJed Brownby applying the divergence theorem. 49bcb2dfaeSJed BrownIn particular, we select $u(\bm x) = x_0 + x_1 + x_2$, for which $\nabla u = [1, 1, 1]^T$, and thus $\nabla u \cdot \hat{\bm n} = 1$. 50bcb2dfaeSJed Brown 51bcb2dfaeSJed BrownGiven Laplace's equation, 52bcb2dfaeSJed Brown 53bcb2dfaeSJed Brown$$ 54bcb2dfaeSJed Brown\nabla \cdot \nabla u = 0, \textrm{ for } \bm{x} \in \Omega , 55bcb2dfaeSJed Brown$$ 56bcb2dfaeSJed Brown 57bcb2dfaeSJed Brownlet us multiply by a test function $v$ and integrate by parts to obtain 58bcb2dfaeSJed Brown 59bcb2dfaeSJed Brown$$ 60bcb2dfaeSJed Brown\int_\Omega \nabla v \cdot \nabla u \, dV - \int_{\partial \Omega} v \nabla u \cdot \hat{\bm n}\, dS = 0 . 61bcb2dfaeSJed Brown$$ 62bcb2dfaeSJed Brown 63*8791656fSJed BrownSince we have chosen $u$ such that $\nabla u \cdot \hat{\bm n} = 1$, the boundary integrand is $v 1 \equiv v$. Hence, similar to {eq}`volume-sum`, we can evaluate the surface integral by applying the volumetric Laplacian as follows 64bcb2dfaeSJed Brown 65bcb2dfaeSJed Brown$$ 66bcb2dfaeSJed Brown\int_\Omega \nabla v \cdot \nabla u \, dV \approx \sum_e \int_{\partial \Omega_e} v(x) 1 \, dS . 67bcb2dfaeSJed Brown$$ 68