1 // Copyright (c) 2017-2022, 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 /// @file 9 /// Linear elasticity manufactured solution true solution for solid mechanics example using PETSc 10 11 #ifndef MANUFACTURED_TRUE_H 12 #define MANUFACTURED_TRUE_H 13 14 #include <math.h> 15 16 // ----------------------------------------------------------------------------- 17 // True solution for linear elasticity manufactured solution 18 // ----------------------------------------------------------------------------- 19 CEED_QFUNCTION(MMSTrueSoln)(void *ctx, const CeedInt Q, 20 const CeedScalar *const *in, 21 CeedScalar *const *out) { 22 // Inputs 23 const CeedScalar *coords = in[0]; 24 25 // Outputs 26 CeedScalar *true_soln = out[0]; 27 28 // Quadrature Point Loop 29 CeedPragmaSIMD 30 for (CeedInt i=0; i<Q; i++) { 31 // Setup 32 CeedScalar x = coords[i+0*Q], y = coords[i+1*Q], z = coords[i+2*Q]; 33 34 // True solution 35 // -- Component 1 36 true_soln[i+0*Q] = exp(2*x)*sin(3*y)*cos(4*z)/1e8; 37 38 // -- Component 2 39 true_soln[i+1*Q] = exp(3*y)*sin(4*z)*cos(2*x)/1e8; 40 41 // -- Component 3 42 true_soln[i+2*Q] = exp(4*z)*sin(2*x)*cos(3*y)/1e8; 43 44 } // End of Quadrature Point Loop 45 46 return 0; 47 } 48 // ----------------------------------------------------------------------------- 49 50 #endif // End MANUFACTURED_TRUE_H 51