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