// Copyright (c) 2017, Lawrence Livermore National Security, LLC. Produced at // the Lawrence Livermore National Laboratory. LLNL-CODE-734707. All Rights // reserved. See files LICENSE and NOTICE for details. // // This file is part of CEED, a collection of benchmarks, miniapps, software // libraries and APIs for efficient high-order finite element and spectral // element discretizations for exascale applications. For more information and // source code availability see http://github.com/ceed. // // The CEED research is supported by the Exascale Computing Project 17-SC-20-SC, // a collaborative effort of two U.S. Department of Energy organizations (Office // of Science and the National Nuclear Security Administration) responsible for // the planning and preparation of a capable exascale ecosystem, including // software, applications, hardware, advanced system engineering and early // testbed platforms, in support of the nation's exascale computing imperative. /// @file /// libCEED QFunctions for diffusion operator example for a scalar field on the sphere using PETSc #ifndef __CUDACC__ # include #endif // ***************************************************************************** // This QFunction sets up the geometric factors required for integration and // coordinate transformations when reference coordinates have a different // dimension than the one of physical coordinates // // Reference (parent) 2D coordinates: X \in [-1, 1]^2 // // Global 3D physical coordinates given by the mesh: xx \in [-R, R]^3 // with R radius of the sphere // // Local 3D physical coordinates on the 2D manifold: x \in [-l, l]^3 // with l half edge of the cube inscribed in the sphere // // Change of coordinates matrix computed by the library: // (physical 3D coords relative to reference 2D coords) // dxx_j/dX_i (indicial notation) [3 * 2] // // Change of coordinates x (on the 2D manifold) relative to xx (phyisical 3D): // dx_i/dxx_j (indicial notation) [3 * 3] // // Change of coordinates x (on the 2D manifold) relative to X (reference 2D): // (by chain rule) // dx_i/dX_j [3 * 2] = dx_i/dxx_k [3 * 3] * dxx_k/dX_j [3 * 2] // // modJ is given by the magnitude of the cross product of the columns of dx_i/dX_j // // The quadrature data is stored in the array qdata. // // We require the determinant of the Jacobian to properly compute integrals of // the form: int( u v ) // // qdata[0]: modJ * w // // We use the Moore–Penrose (left) pseudoinverse of dx_i/dX_j, to compute dX_i/dx_j (and its transpose), // needed to properly compute integrals of the form: int( gradv gradu ) // // dX_i/dx_j [2 * 3] = (dx_i/dX_j)+ = (dxdX^T dxdX)^(-1) dxdX // // Stored: dX_i/dx_j * dX_j/dx_i (in Voigt convention) // in qdata[1:3] as // [dXdxdXdxT11 dXdxdXdxT12] // [dXdxdXdxT21 dXdxdXdxT22] // ***************************************************************************** // ----------------------------------------------------------------------------- CEED_QFUNCTION(SetupDiffGeo)(void *ctx, CeedInt Q, const CeedScalar *const *in, CeedScalar *const *out) { const CeedScalar *X = in[0], *J = in[1], *w = in[2]; CeedScalar *qdata = out[0]; // Quadrature Point Loop CeedPragmaSIMD for (CeedInt i=0; i