Back to home page

MITgcm

 
 

    


File indexing completed on 2018-03-02 18:41:04 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_PPM_P3E_R(bi,bj,ix,iy,
                0004      &           mask,fbar,edge,myThid)
                0005 C     |================================================================|
                0006 C     | PPM_P3E_R: approximate edge values with degree-3 polynomials.  |
                0007 C     | Fixed grid-spacing variant in R.                               |
                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           integer bi,bj,ix,iy
                0019           _RL mask(1-3:Nr+3)
                0020           _RL fbar(1-3:Nr+3)
                0021           _RL edge(1-0:Nr+1)
                0022           integer myThid
                0023 
                0024 C     ====================================================== variables
                0025           integer ir
                0026           _RL mloc(-2:+1)
                0027           _RL floc(-2:+1)
                0028           _RL ftmp
                0029 
                0030           do  ir = +1, Nr+1
                0031 
                0032 C     ================ mask local stencil: expand from centre outwards
                0033               mloc(-1) = mask(ir-1)
                0034               mloc(+0) = mask(ir+0)
                0035 
                0036               floc(-1) = fbar(ir+0)
                0037      &          + mloc(-1)*(fbar(ir-1)-fbar(ir+0))
                0038               floc(+0) = fbar(ir-1)
                0039      &          + mloc(+0)*(fbar(ir+0)-fbar(ir-1))
                0040 
                0041               mloc(-2) = mask(ir-2) * mloc(-1)
                0042 
                0043               ftmp = 2. _d 0 * floc(-1) - floc(+0)
                0044               floc(-2) = ftmp
                0045      &          + mloc(-2)*(fbar(ir-2)-ftmp)
                0046 
                0047               mloc(+1) = mask(ir+1) * mloc(+0)
                0048 
                0049               ftmp = 2. _d 0 * floc(+0) - floc(-1)
                0050               floc(+1) = ftmp
                0051      &          + mloc(+1)*(fbar(ir+1)-ftmp)
                0052 
                0053 C     ================ centred, 3rd-order interpolation for edge value
                0054               edge(ir) =
                0055      &      -(1. _d 0 / 12. _d 0)*(floc(-2)+floc(+1))
                0056      &      +(7. _d 0 / 12. _d 0)*(floc(-1)+floc(+0))
                0057 
                0058           end do
                0059 
                0060           return
                0061 
                0062 c     end subroutine GAD_PPM_P3E_R
                0063       end