1 // Copyright (c) 2017, Lawrence Livermore National Security, LLC. Produced at 2 // the Lawrence Livermore National Laboratory. LLNL-CODE-734707. All Rights 3 // reserved. See files LICENSE and NOTICE for details. 4 // 5 // This file is part of CEED, a collection of benchmarks, miniapps, software 6 // libraries and APIs for efficient high-order finite element and spectral 7 // element discretizations for exascale applications. For more information and 8 // source code availability see http://github.com/ceed. 9 // 10 // The CEED research is supported by the Exascale Computing Project 17-SC-20-SC, 11 // a collaborative effort of two U.S. Department of Energy organizations (Office 12 // of Science and the National Nuclear Security Administration) responsible for 13 // the planning and preparation of a capable exascale ecosystem, including 14 // software, applications, hardware, advanced system engineering and early 15 // testbed platforms, in support of the nation's exascale computing imperative. 16 17 /// @file 18 /// Constant forcing term for solid mechanics example using PETSc 19 20 #ifndef CONSTANT_H 21 #define CONSTANT_H 22 23 #include <math.h> 24 25 #ifndef PHYSICS_STRUCT 26 #define PHYSICS_STRUCT 27 typedef struct Physics_private *Physics; 28 struct Physics_private { 29 CeedScalar nu; // Poisson's ratio 30 CeedScalar E; // Young's Modulus 31 }; 32 #endif 33 34 // ----------------------------------------------------------------------------- 35 // Constant forcing term along specified vector 36 // ----------------------------------------------------------------------------- 37 CEED_QFUNCTION(SetupConstantForce)(void *ctx, const CeedInt Q, 38 const CeedScalar *const *in, 39 CeedScalar *const *out) { 40 // Inputs 41 const CeedScalar *q_data = in[1]; 42 43 // Outputs 44 CeedScalar *force = out[0]; 45 46 // Context 47 const CeedScalar *forcing_vector = (CeedScalar(*))ctx; 48 49 // Quadrature Point Loop 50 CeedPragmaSIMD 51 for (CeedInt i=0; i<Q; i++) { 52 // Setup 53 CeedScalar wdetJ = q_data[i]; 54 55 // Forcing function 56 // -- Component 1 57 force[i+0*Q] = forcing_vector[0]*wdetJ; 58 59 // -- Component 2 60 force[i+1*Q] = forcing_vector[1]*wdetJ; 61 62 // -- Component 3 63 force[i+2*Q] = forcing_vector[2]*wdetJ; 64 65 } // End of Quadrature Point Loop 66 67 return 0; 68 } 69 // ----------------------------------------------------------------------------- 70 71 #endif // End of CONSTANT_H 72