Back to home page

MITgcm

 
 

    


File indexing completed on 2018-03-02 18:41:06 UTC

view on githubraw file Latest commit add29e06 on 2018-01-31 20:35:05 UTC
8e4c181d69 Jean*0001 #     include "GAD_OPTIONS.h"
                0002 
                0003       SUBROUTINE GAD_PQM_HAT_R(bi,bj,ix,iy,
                0004      &           method,mask,fbar,edge,
                0005      &           ohat,fhat,myThid)
                0006 C     |================================================================|
                0007 C     | PQM_HAT_R: reconstruct grid-cell PQM polynomials.              |
                0008 C     |================================================================|
                0009 
                0010           implicit none
                0011 
                0012 C     =============================================== global variables
                0013 #         include "SIZE.h"
                0014 #         include "GRID.h"
                0015 #         include "GAD.h"
                0016 
                0017 C     ====================================================== arguments
                0018 C       bi,bj     :: tile indexing.
                0019 C       ix,iy     :: x-,y-indexing.
                0020 C       method    :: advection scheme.
                0021 C       mask      :: col. of cell-wise mask values.
                0022 C       fbar      :: col. of cell-wise values.
                0023 C       edge      :: col. of edge-wise values/slopes.
                0024 C                    - EDGE(1,:) = VALUE.
                0025 C                    - EDGE(2,:) = DF/DR.
                0026 C       ohat      :: col. of oscl. coeff.
                0027 C                    - OHAT(1,:) = D^1F/DS^1.
                0028 C                    - OHAT(2,:) = D^2F/DS^2.
                0029 C       fhat      :: col. of poly. coeff.
                0030 C                    - FHAT(:,I) = PQM coeff.
                0031 C       myThid    :: thread number.
                0032 C     ================================================================
                0033           integer bi,bj
                0034           integer ix,iy
                0035           integer method
                0036           _RL mask(1-3:Nr+3)
                0037           _RL fbar(1-3:Nr+3)
                0038           _RL edge(1:2,
                0039      &             1-0:Nr+1)
                0040           _RL ohat(1:2,
                0041      &             1-3:Nr+3)
                0042           _RL fhat(1:5,
                0043      &             1-0:Nr+0)
                0044           integer myThid
                0045 
                0046 C     ====================================================== variables
                0047 C       ii,ir     :: local r-indexing.
                0048 C       ff00      :: centre-biased cell value.
                0049 C       ffll,ffrr :: left-, and right-biased cell values.
                0050 C       xhat      :: local coord. scaling.
                0051 C       fell,ferr :: left-, and right-biased edge values.
                0052 C       dell,derr :: left-, and right-biased edge slopes.
                0053 C       dfds      :: linear slope estimates.
                0054 C       uhat      :: "NULL" limited poly. coeff.
                0055 C       lhat      :: "MONO" limited poly. coeff.
                0056 C       scal      :: "WENO" weights.
                0057 C       fmag,fdel :: local perturbation indicators.
                0058 C     ================================================================
                0059           integer ii,ir
                0060           _RL ff00
                0061           _RL ffll,ffrr
                0062           _RL rhat
                0063           _RL fell,ferr
                0064           _RL dell,derr
                0065           _RL dfds(-1:+1)
                0066           _RL uhat(+1:+5)
                0067           _RL lhat(+1:+5)
                0068           _RL scal(+1:+2)
                0069           _RL fmag,fdel
                0070           integer  mono
                0071 
                0072           do  ir = +1, Nr
                0073 
                0074 C     =============================== scale to local grid-cell co-ords
                0075               rhat = drF(ir)  * .5 _d 0
                0076 
                0077 C     =============================== assemble cell mean + edge values
                0078               ff00 = fbar(ir+0)
                0079               ffll = ff00
                0080      &             + mask(ir-1)*(fbar(ir-1)-ff00)
                0081               ffrr = ff00
                0082      &             + mask(ir+1)*(fbar(ir+1)-ff00)
                0083 
                0084               fell = edge(+1,ir-0)
                0085               ferr = edge(+1,ir+1)
                0086 
                0087               dell = edge(+2,ir-0)
                0088               derr = edge(+2,ir+1)
                0089 
                0090               dell = dell * rhat
                0091               derr = derr * rhat
                0092 
                0093 c             select case(method)
                0094 c             case(ENUM_PQM_NULL_LIMIT)
                0095               if ( method.eq.ENUM_PQM_NULL_LIMIT ) then
                0096 C     =============================== "NULL" limited grid-cell profile
                0097               CALL GAD_PQM_FUN_NULL ( ff00,
                0098      &             fell,ferr,dell,derr,lhat,mono)
                0099 
                0100 c             case(ENUM_PQM_MONO_LIMIT)
                0101               elseif ( method.eq.ENUM_PQM_MONO_LIMIT ) then
                0102 C     =============================== "MONO" limited grid-cell profile
                0103               CALL GAD_PLM_FUN_U(ffll,ff00,ffrr,dfds)
                0104 
                0105               CALL GAD_PQM_FUN_MONO ( ff00,ffll,ffrr,
                0106      &             fell,ferr,dell,derr,dfds,lhat,
                0107      &             mono)
                0108 
                0109 c             case(ENUM_PQM_WENO_LIMIT)
                0110               elseif ( method.eq.ENUM_PQM_WENO_LIMIT ) then
                0111 C     =============================== "WENO" limited grid-cell profile
                0112               CALL GAD_PLM_FUN_U(ffll,ff00,ffrr,dfds)
                0113 
                0114               CALL GAD_PQM_FUN_NULL ( ff00,
                0115      &             fell,ferr,dell,derr,uhat,mono)
                0116 
                0117               CALL GAD_PQM_FUN_MONO ( ff00,ffll,ffrr,
                0118      &             fell,ferr,dell,derr,dfds,lhat,
                0119      &             mono)
                0120 
                0121               if ( mono .gt. 0) then
                0122 
                0123 C     =============================== only apply WENO if it is worth it
                0124               fdel = abs(ffrr-ff00)+abs(ff00-ffll)
                0125               fmag = abs(ffll)+abs(ff00)+abs(ffrr)
                0126 
                0127               if (fdel .gt. 1. _d -6 * fmag) then
                0128 
                0129 C     =============================== calc. WENO oscillation weighting
                0130                   CALL GAD_OSC_MUL_R(ir,+2,mask,
                0131      &                 ohat,scal)
                0132 
                0133                   do  ii = +1, +5
                0134 C     =============================== blend limited/un-limited profile
                0135                   lhat(ii) = scal(1) * uhat(ii)
                0136      &                     + scal(2) * lhat(ii)
                0137                   end do
                0138 
                0139               end if
                0140 
                0141               end if
                0142 
                0143 c             end select
                0144               endif
                0145 
                0146               do  ii = +1, +5
                0147 C     =============================== copy polynomial onto output data
                0148                   fhat(ii,ir) = lhat(ii)
                0149               end do
                0150 
                0151           end do
                0152 
                0153           return
                0154 
                0155 c     end subroutine GAD_PQM_HAT_R
                0156       end