xref: /libCEED/examples/fluids/qfunctions/strong_boundary_conditions.h (revision 681d0ea73ee05192cf73f31e6e4a886b41175395)
1 // Copyright (c) 2017-2024, 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 #include <ceed.h>
8 
9 #include "setupgeo_helpers.h"
10 
11 CEED_QFUNCTION(SetupStrongBC)(void *ctx, CeedInt Q, const CeedScalar *const *in, CeedScalar *const *out) {
12   const CeedScalar(*coords)[CEED_Q_VLA]       = (const CeedScalar(*)[CEED_Q_VLA])in[0];
13   const CeedScalar(*dxdX_q)[3][CEED_Q_VLA]    = (const CeedScalar(*)[3][CEED_Q_VLA])in[1];
14   const CeedScalar(*multiplicity)[CEED_Q_VLA] = (const CeedScalar(*)[CEED_Q_VLA])in[2];
15   CeedScalar(*coords_stored)[CEED_Q_VLA]      = (CeedScalar(*)[CEED_Q_VLA])out[0];
16   CeedScalar(*scale_stored)                   = out[1];
17   CeedScalar(*dXdx_q)[CEED_Q_VLA]             = (CeedScalar(*)[CEED_Q_VLA])out[2];
18 
19   CeedPragmaSIMD for (CeedInt i = 0; i < Q; i++) {
20     for (int j = 0; j < 3; j++) coords_stored[j][i] = coords[j][i];
21     scale_stored[i] = 1.0 / multiplicity[0][i];
22     CeedScalar dXdx[2][3];
23     InvertBoundaryMappingJacobian_3D(Q, i, dxdX_q, dXdx);
24     dXdx_q[0][i] = dXdx[0][0];
25     dXdx_q[1][i] = dXdx[0][1];
26     dXdx_q[2][i] = dXdx[0][2];
27     dXdx_q[3][i] = dXdx[1][0];
28     dXdx_q[4][i] = dXdx[1][1];
29     dXdx_q[5][i] = dXdx[1][2];
30   }
31   return 0;
32 }
33