<jupyter_start><jupyter_text>Standalone libCEED examplesThis is a tutorial for [libCEED](https://github.com/CEED/libCEED/), the low-level API library for efficient high-order discretization methods developed by the co-design [Center for Efficient Exascale Discretizations](https://ceed.exascaleproject.org/) (CEED) of the [Exascale Computing Project](https://www.exascaleproject.org/) (ECP).While libCEED's focus is on high-order finite/spectral element method implementations, the approach is mostly algebraic and thus applicable to other discretizations in factored form, as explained in the [user manual](https://libceed.readthedocs.io/).  Common notationFor most of our examples, the spatial discretizationuses high-order finite elements/spectral elements, namely, the high-order Lagrangepolynomials defined over $P$ non-uniformly spaced nodes, theGauss-Legendre-Lobatto (GLL) points, and quadrature points $\{q_i\}_{i=1}^Q$, withcorresponding weights $\{w_i\}_{i=1}^Q$ (typically the ones given by Gaussor Gauss-Lobatto quadratures, that are built in the library).We discretize the domain, $\Omega \subset \mathbb{R}^d$ (with $d=1,2,3$,typically) by letting $\Omega = \bigcup_{e=1}^{N_e}\Omega_e$, with $N_e$disjoint elements. For most examples we use unstructured meshes for which the elementsare hexahedra (although this is not a requirement in libCEED).The physical coordinates are denoted by $\mathbf{x}=(x,y,z)\in\Omega_e$,while the reference coordinates are represented as$\boldsymbol{X}=(X,Y,Z) \equiv (X_1,X_2,X_3) \in I=[-1,1]^3$(for $d=3$). Ex1-Volume Mathematical formulationThis example is located in the subdirectory `examples/ceed`. It illustrates asimple usage of libCEED to compute the volume of a given body using a matrix-freeapplication of the mass operator. Arbitrary mesh and solution orders in 1D, 2D and 3Dare supported from the same code.This example shows how to compute line/surface/volume integrals of a 1D, 2D, or 3Ddomain $\Omega$ respectively, by applying the mass operator to a vector of$1$s. It computes:$$   I = \int_{\Omega} 1 \, dV .$$We write here the vector $u(x)\equiv 1$ in the Galerkin approximation,and find the volume of $\Omega$ as$$   \sum_e \int_{\Omega_e} v(x) 1 \, dV$$with $v(x) \in \mathcal{V}_p = \{ v \in H^{1}(\Omega_e) \,|\, v \in P_p(\boldsymbol{I}), e=1,\ldots,N_e \}$,the test functions.  Executing the exampleClone or download libCEED by running<jupyter_code>! git clone https://github.com/CEED/libCEED.git<jupyter_output><empty_output><jupyter_text>Then move to the libCEED folder<jupyter_code>cd libCEED<jupyter_output><empty_output><jupyter_text>And compile the library by running<jupyter_code>! make<jupyter_output><empty_output><jupyter_text>Move to the examples folder<jupyter_code>cd examples/<jupyter_output><empty_output><jupyter_text>Then move to the standalone libCEED's examples folder<jupyter_code>cd ceed/<jupyter_output><empty_output><jupyter_text>And compile the examples by running<jupyter_code>! make<jupyter_output><empty_output><jupyter_text>Now run `ex1-volume` by running<jupyter_code>! ./ex1-volume -d 3 -g<jupyter_output>Selected options: [command line option] : <current value>
  Ceed specification [-c] : /cpu/self
  Mesh dimension     [-d] : 3
  Mesh order         [-m] : 4
  Solution order     [-o] : 4
  Num. 1D quadr. pts [-q] : 6
  Approx. # unknowns [-s] : 262144
  QFunction source   [-g] : gallery

Mesh size: nx = 16, ny = 16, nz = 16
Number of mesh nodes     : 274625
Number of solution nodes : 274625
Computing the quadrature data for the mass operator ... done.
Computing the mesh volume using the formula: vol = 1^T.M.1 ... done.
Exact mesh volume    :  2.3561944901923
Computed mesh volume :  2.3561944901921
Volume error         : -2.7444713168734e-13<jupyter_text>This example shows how to compute line/surface/volume integrals of a 1D, 2D, or 3D domain Ω respectively, by applying the mass operator to a vector of 1s. The command line option `-d` specifies the dimensionality of the domain Ω. The option `-g` specifies that the mass operator is, in this case, selected from a gallery of available built-in operators in the library.  Ex2-Surface Mathematical formulationThis example is located in the subdirectory `examples/ceed`. It computes thesurface area of a given body using matrix-free application of a diffusion operator.Arbitrary mesh and solution orders in 1D, 2D and 3D are supported from the same code.Similarly to the Ex1-Volume example, it computes:\begin{equation}\label{eq-ex2-surface}\tag{eq. 1}   I =  \int_{\partial \Omega} 1 \, dS ,\end{equation}by applying the divergence theorem.In particular, we select $u(\mathbf x) = x_0 + x_1 + x_2$, for which $\nabla u = [1, 1, 1]^T$, and thus $\nabla u \cdot \hat{\mathbf n} = 1$.Given Laplace's equation,$$   \nabla \cdot \nabla u = 0, \textrm{ for  } \mathbf{x} \in \Omega ,$$let us multiply by a test function $v$ and integrate by parts to obtain$$   \int_\Omega \nabla v \cdot \nabla u \, dV - \int_{\partial \Omega} v \nabla u \cdot \hat{\mathbf n}\, dS = 0 .$$Since we have chosen $u$ such that $\nabla u \cdot \hat{\mathbf n} = 1$, the boundary integrand is $v 1 \equiv v$. Hence, similar to the previous example, we can evaluate the surface integral by applying the volumetric Laplacian as follows$$   \int_\Omega \nabla v \cdot \nabla u \, dV \approx \sum_e \int_{\partial \Omega_e} v(x) 1 \, dS .$$  Executing the exampleAssuming the steps above, you should be in the `examples/ceed/` subdirectory and have already compiled the example.Now run `ex2-surface` by running<jupyter_code>! ./ex2-surface -d 3 -g<jupyter_output>Selected options: [command line option] : <current value>
  Ceed specification [-c] : /cpu/self
  Mesh dimension     [-d] : 3
  Mesh order         [-m] : 4
  Solution order     [-o] : 4
  Num. 1D quadr. pts [-q] : 6
  Approx. # unknowns [-s] : 262144
  QFunction source   [-g] : gallery

Mesh size: nx = 16, ny = 16, nz = 16
Number of mesh nodes     : 274625
Number of solution nodes : 274625
Computing the quadrature data for the diffusion operator ... done.
Computing the mesh surface area using the formula: sa = 1^T.|K.x| ... done.
Exact mesh surface area    :  6
Computed mesh surface area :  5.9773703490853
Surface area error         : -0.022629650914673
{'fraction_non_alphanumeric': 0.10834132310642378, 'fraction_numerical': 0.030680728667305847, 'mean_word_length': 4.308736217133164, 'pattern_counts': {'":': 0, '<': 33, '<?xml version=': 0, '>': 33, 'https://': 5, 'lorem ipsum': 0, 'www.': 1, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '8', 'dir': 'jupyter-structured-clean-dedup', 'id': '189737', 'license': 'BSD-2-Clause', 'n_tokens_mistral': 2107, 'n_tokens_neox': 1929, 'n_words': 759, 'path': 'examples/tutorials/tutorial-6-shell.ipynb', 'repo_name': 'rscohn2/libCEED', 'size': '6258'}