xref: /libCEED/tests/t320-basis-f.h (revision 07a3c987f923dfb7c6f273ad1a1f0014162d9df8)
1*07a3c987Svaleriabarra ! Copyright (c) 2017, Lawrence Livermore National Security, LLC. Produced at
2*07a3c987Svaleriabarra ! the Lawrence Livermore National Laboratory. LLNL-CODE-734707. All Rights
3*07a3c987Svaleriabarra ! reserved. See files LICENSE and NOTICE for details.
4*07a3c987Svaleriabarra !
5*07a3c987Svaleriabarra ! This file is part of CEED, a collection of benchmarks, miniapps, software
6*07a3c987Svaleriabarra ! libraries and APIs for efficient high-order finite element and spectral
7*07a3c987Svaleriabarra ! element discretizations for exascale applications. For more information and
8*07a3c987Svaleriabarra ! source code availability see http://github.com/ceed.
9*07a3c987Svaleriabarra !
10*07a3c987Svaleriabarra ! The CEED research is supported by the Exascale Computing Project 17-SC-20-SC,
11*07a3c987Svaleriabarra ! a collaborative effort of two U.S. Department of Energy organizations (Office
12*07a3c987Svaleriabarra ! of Science and the National Nuclear Security Administration) responsible for
13*07a3c987Svaleriabarra ! the planning and preparation of a capable exascale ecosystem, including
14*07a3c987Svaleriabarra ! software, applications, hardware, advanced system engineering and early
15*07a3c987Svaleriabarra ! testbed platforms, in support of the nation's exascale computing imperative.
16*07a3c987Svaleriabarra !
1752bfb9bbSJeremy L Thompson !-----------------------------------------------------------------------
1852bfb9bbSJeremy L Thompson       subroutine buildmats(qref,qweight,interp,grad)
1952bfb9bbSJeremy L Thompson       integer p,q,d
2052bfb9bbSJeremy L Thompson       parameter(p=6)
2152bfb9bbSJeremy L Thompson       parameter(q=4)
2252bfb9bbSJeremy L Thompson       parameter(d=2)
2352bfb9bbSJeremy L Thompson 
2452bfb9bbSJeremy L Thompson       real*8 qref(d*q)
2552bfb9bbSJeremy L Thompson       real*8 qweight(q)
2652bfb9bbSJeremy L Thompson       real*8 interp(p*q)
2752bfb9bbSJeremy L Thompson       real*8 grad(d*p*q)
2852bfb9bbSJeremy L Thompson       real*8 x1,x2
2952bfb9bbSJeremy L Thompson 
3052bfb9bbSJeremy L Thompson       qref=(/2.d-1,6.d-1,1.d0/3.d0,2.d-1,2.d-1,2.d-1,1.d0/3.d0,6.d-1/)
3152bfb9bbSJeremy L Thompson       qweight=(/25.d0/96.d0,25.d0/96.d0,-27.d0/96.d0,25.d0/96.d0/)
3252bfb9bbSJeremy L Thompson 
3352bfb9bbSJeremy L Thompson       do i=0,q-1
3452bfb9bbSJeremy L Thompson         x1 = qref(0*q+i+1)
3552bfb9bbSJeremy L Thompson         x2 = qref(1*q+i+1);
3652bfb9bbSJeremy L Thompson !       Interp
3752bfb9bbSJeremy L Thompson         interp(i*P+1)=2.*(x1+x2-1.)*(x1+x2-1./2.);
3852bfb9bbSJeremy L Thompson         interp(i*P+2)=-4.*x1*(x1+x2-1.);
3952bfb9bbSJeremy L Thompson         interp(i*P+3)=2.*x1*(x1-1./2.);
4052bfb9bbSJeremy L Thompson         interp(i*P+4)=-4.*x2*(x1+x2-1.);
4152bfb9bbSJeremy L Thompson         interp(i*P+5)=4.*x1*x2;
4252bfb9bbSJeremy L Thompson         interp(i*P+6)=2.*x2*(x2-1./2.);
4352bfb9bbSJeremy L Thompson !       Grad
4452bfb9bbSJeremy L Thompson         grad((i+0)*P+1)=2.*(1.*(x1+x2-1./2.)+(x1+x2-1.)*1.);
4552bfb9bbSJeremy L Thompson         grad((i+Q)*P+1)=2.*(1.*(x1+x2-1./2.)+(x1+x2-1.)*1.);
4652bfb9bbSJeremy L Thompson         grad((i+0)*P+2)=-4.*(1.*(x1+x2-1.)+x1*1.);
4752bfb9bbSJeremy L Thompson         grad((i+Q)*P+2)=-4.*(x1*1.);
4852bfb9bbSJeremy L Thompson         grad((i+0)*P+3)=2.*(1.*(x1-1./2.)+x1*1.);
4952bfb9bbSJeremy L Thompson         grad((i+Q)*P+3)=2.*0.;
5052bfb9bbSJeremy L Thompson         grad((i+0)*P+4)=-4.*(x2*1.);
5152bfb9bbSJeremy L Thompson         grad((i+Q)*P+4)=-4.*(1.*(x1+x2-1.)+x2*1.);
5252bfb9bbSJeremy L Thompson         grad((i+0)*P+5)=4.*(1.*x2);
5352bfb9bbSJeremy L Thompson         grad((i+Q)*P+5)=4.*(x1*1.);
5452bfb9bbSJeremy L Thompson         grad((i+0)*P+6)=2.*0.;
5552bfb9bbSJeremy L Thompson         grad((i+Q)*P+6)=2.*(1.*(x2-1./2.)+x2*1.);
5652bfb9bbSJeremy L Thompson       enddo
5752bfb9bbSJeremy L Thompson 
5852bfb9bbSJeremy L Thompson       end
5952bfb9bbSJeremy L Thompson !-----------------------------------------------------------------------
60