1 // Copyright (c) 2017-2026, Lawrence Livermore National Security, LLC and other CEED contributors.
2 // All Rights Reserved. See the top-level LICENSE and NOTICE files for details.
3 //
4 // SPDX-License-Identifier: BSD-2-Clause
5 //
6 // This file is part of CEED: http://github.com/ceed
7
8 #include <ceed.h>
9
10 // Interpolation matrices for cell-to-face of Q1 hexahedral element onto it's "5" face (in PETSc)
11 // Nodes are at Gauss-Lobatto points and quadrature points are Gauss, all over [-1,1] domain range
12 const CeedScalar Q1_interp_gauss[4][8] = {
13 {0.62200846792814612, 0, 0.16666666666666669, 0, 0.16666666666666669, 0, 0.044658198738520463, 0},
14 {0.16666666666666669, 0, 0.62200846792814612, 0, 0.044658198738520463, 0, 0.16666666666666669, 0},
15 {0.16666666666666669, 0, 0.044658198738520463, 0, 0.62200846792814612, 0, 0.16666666666666669, 0},
16 {0.044658198738520463, 0, 0.16666666666666669, 0, 0.16666666666666669, 0, 0.62200846792814612, 0}
17 };
18 const CeedScalar Q1_grad_gauss[3][4][8] = {
19 {{-0.31100423396407312, 0.31100423396407312, -0.083333333333333343, 0.083333333333333343, -0.083333333333333343, 0.083333333333333343,
20 -0.022329099369260232, 0.022329099369260232},
21 {-0.083333333333333343, 0.083333333333333343, -0.31100423396407312, 0.31100423396407312, -0.022329099369260232, 0.022329099369260232,
22 -0.083333333333333343, 0.083333333333333343},
23 {-0.083333333333333343, 0.083333333333333343, -0.022329099369260232, 0.022329099369260232, -0.31100423396407312, 0.31100423396407312,
24 -0.083333333333333343, 0.083333333333333343},
25 {-0.022329099369260232, 0.022329099369260232, -0.083333333333333343, 0.083333333333333343, -0.083333333333333343, 0.083333333333333343,
26 -0.31100423396407312, 0.31100423396407312} },
27 {{-0.39433756729740643, 0, 0.39433756729740643, 0, -0.10566243270259357, 0, 0.10566243270259357, 0},
28 {-0.39433756729740643, 0, 0.39433756729740643, 0, -0.10566243270259357, 0, 0.10566243270259357, 0},
29 {-0.10566243270259357, 0, 0.10566243270259357, 0, -0.39433756729740643, 0, 0.39433756729740643, 0},
30 {-0.10566243270259357, 0, 0.10566243270259357, 0, -0.39433756729740643, 0, 0.39433756729740643, 0}},
31 {{-0.39433756729740643, 0, -0.10566243270259357, 0, 0.39433756729740643, 0, 0.10566243270259357, 0},
32 {-0.10566243270259357, 0, -0.39433756729740643, 0, 0.10566243270259357, 0, 0.39433756729740643, 0},
33 {-0.39433756729740643, 0, -0.10566243270259357, 0, 0.39433756729740643, 0, 0.10566243270259357, 0},
34 {-0.10566243270259357, 0, -0.39433756729740643, 0, 0.10566243270259357, 0, 0.39433756729740643, 0}}
35 };
36
37 const CeedScalar Q1_interp_gauss_lobatto[4][8] = {
38 {1, 0, 0, 0, 0, 0, 0, 0},
39 {0, 0, 1, 0, 0, 0, 0, 0},
40 {0, 0, 0, 0, 1, 0, 0, 0},
41 {0, 0, 0, 0, 0, 0, 1, 0}
42 };
43 /* clang-format off */
44 const CeedScalar Q1_grad_gauss_lobatto[3][4][8] = {
45 {{-0.5, 0.5, 0, 0, 0, 0, 0, 0},
46 {0, 0, -0.5, 0.5, 0, 0, 0, 0},
47 {0, 0, 0, 0, -0.5, 0.5, 0, 0},
48 {0, 0, 0, 0, 0, 0, -0.5, 0.5}},
49 {{-0.5, 0, 0.5, 0, 0, 0, 0, 0},
50 {-0.5, 0, 0.5, 0, 0, 0, 0, 0},
51 {0, 0, 0, 0, -0.5, 0, 0.5, 0},
52 {0, 0, 0, 0, -0.5, 0, 0.5, 0}},
53 {{-0.5, 0, 0, 0, 0.5, 0, 0, 0},
54 {0, 0, -0.5, 0, 0, 0, 0.5, 0},
55 {-0.5, 0, 0, 0, 0.5, 0, 0, 0},
56 {0, 0, -0.5, 0, 0, 0, 0.5, 0}}
57 };
58 /* clang-format on */
59
GetCellToFaceTabulation(CeedQuadMode quad_mode,CeedInt * P,CeedInt * Q,const CeedScalar ** interp,const CeedScalar ** grad)60 static void GetCellToFaceTabulation(CeedQuadMode quad_mode, CeedInt *P, CeedInt *Q, const CeedScalar **interp, const CeedScalar **grad) {
61 if (P) *P = 8;
62 if (Q) *Q = 4;
63
64 if (quad_mode == CEED_GAUSS) {
65 *interp = (const CeedScalar *)Q1_interp_gauss;
66 *grad = (const CeedScalar *)Q1_grad_gauss;
67 }
68 if (quad_mode == CEED_GAUSS_LOBATTO) {
69 *interp = (const CeedScalar *)Q1_interp_gauss_lobatto;
70 *grad = (const CeedScalar *)Q1_grad_gauss_lobatto;
71 }
72 }
73