!=========================================================================== ! subroutine der1_pre_st(ierror,error, & xbegin,xend,ybegin,yend,zbegin,zend, & bnd2A, bnd3A, bnd3B, bnd4C, bnd6D, bnd8E, & iperx,ipery,iperz, orderi, orderb, & biL, biR, bjL, bjR, bkL, bkR, & fiL, fiR, fjL, fjR, fkL, fkR, & iiL, iiR, ijL, ijR, ikL, ikR, & dfiL,dfiR,dfjL,dfjR,dfkL,dfkR, & piL, piR, pjL, pjR, pkL, pkR, & nproLx,nproRx,nproLy,nproRy,nproLz,nproRz, & proL,proR,promax,dx,dy,dz,rdx,rdy,rdz,width) ! include 'der1_include_st.h' ! !====================================================================== ! ! Initialize IERROR to zero implying no errors ! ierror = 0 ! ! Boundaries of usable f patch piL = iiL - biL piR = iiR + biR pjL = ijL - bjL pjR = ijR + bjR pkL = ikL - bkL pkR = ikR + bkR ! ! Is the usable patch width larger than the width of f? if( min0(piL-fiL,fiR-piR,pjL-fjL,fjR-pjR,pkL-fkL,fkR-pkR) & .lt. 0) then ierror = -10 error = 'DER_1_ST: Interior + Green width > function width' return endif ! ! Is the interior width larger than the width of df? if( min0(iiL-dfiL,dfiR-iiR,ijL-dfjL,dfjR-ijR,ikL-dfkL,dfkR-ikR) & .lt. 0) then ierror = -20 error = 'DER_1_ST: Interior width > derivative width' return endif ! ! Is the f array sufficiently big for df? if( min0( ((iiR-iiL)-(dfiR-dfiL)), & ((ijR-ijL)-(dfjR-dfjL)), & ((ikR-ikL)-(dfkR-dfkL))) & .lt. 0) then ierror = -30 error = 'DER_1_ST: Interior width < derivative width' return endif ! ! Have the number of green cells gone negative anywhere? if( min0(biL,biR,bjL,bjR,bkL,bkR) .lt. 0 ) then ierror = -40 error = 'DER_1_ST: Green cell width < zero' return endif ! ! Has the interior width gone negative? if( min0(iiR-iiL,ijR-ijL,ikR-ikL) .lt. 0 ) then ierror = -50 error = 'DER_1_ST: Interior Width < zero' return endif ! ! Has the grid spacing gone negative? if(( dx .le. 0.d0 ) .or. & ( dy .le. 0.d0 ) .or. & ( dz .le. 0.d0 )) then ierror = -60 error = 'DER_1_ST: dx or dy or dz =< zero' return endif ! ! Grid Spacing (reciprocal) rdx = 1.d0/dx rdy = 1.d0/dy rdz = 1.d0/dz ! ! Stencil Widths ! ! Centered stencils ! proL = -1 proR = -1 ! if( orderi .eq. 2 ) then proL = 0 proR = 0 elseif( orderi .eq. 4 ) then proL = 1 proR = 1 elseif( orderi .eq. 6 ) then proL = 2 proR = 2 elseif( orderi .eq. 8 ) then proL = 3 proR = 3 endif width = proL + proR ! if( ( proL .lt. 0) .or. ( proR .lt. 0) ) then ierror = -80 error = 'DER_1_ST: No such scheme' return endif ! if( (iperx .lt. 0) .or. ( iperx .gt. 1) .or. & (ipery .lt. 0) .or. ( ipery .gt. 1) .or. & (iperz .lt. 0) .or. ( iperz .gt. 1) ) then ierror = -90 error = 'DER_1_ST: Periodicity flags are set incorrectly' return endif ! ! Find maximum protrusion. ! promax = max0( proL, proR ) ! ! Determine where to begin Interior DO loops and how many ! boundary points need to be closed. Periodic domains ! will always (better) have enough green cells. ! ! X-direction if(( biL .ge. promax ) .or. (iperx .eq. 1)) then nproLx = 0 xbegin = iiL else nproLx = promax - biL xbegin = iiL + nproLx endif ! if(( biR .ge. promax ) .or. (iperx .eq. 1)) then nproRx = 0 xend = iiR - 1 else nproRx = promax - biR xend = (iiR - 1) - nproRx endif ! ! Y-direction ! if(( bjL .ge. promax ) .or. (ipery .eq. 1)) then nproLy = 0 ybegin = ijL else nproLy = promax - bjL ybegin = ijL + nproLy endif ! if(( bjR .ge. promax ) .or. (ipery .eq. 1)) then nproRy = 0 yend = ijR - 1 else nproRy = promax - bjR yend = (ijR - 1) - nproRy endif ! ! Z-direction ! if(( bkL .ge. promax ) .or. (iperz .eq. 1)) then nproLz = 0 zbegin = ikL else nproLz = promax - bkL zbegin = ikL + nproLz endif ! if(( bkR .ge. promax ) .or. (iperz .eq. 1)) then nproRz = 0 zend = ikR - 1 else nproRz = promax - bkR zend = (ikR - 1) - nproRz endif ! ! Set up Boundary stencil coefficients ! (Note that we do not currently evaluate derivatives ! outside of the function grid.) ! ! 2nd-order Interior ! ! O = Function point ! X = Derivative point ! ! X-=-O-=-X-=-O-=-X-=-O-=-X-=-O-=-X-=-O-=-X-=-O-=-X ! 2A-----2E-----2E-----2E-----2E-----2E-----2E----2A ! ! ! --Right side bnd2A(1) = +( 1.d0) bnd2A(2) = -( 1.d0) ! --Left side ! ! 4th-order Interior ! ! O = Function point ! X = Derivative point ! ! X-=-O-=-X-=-O-=-X-=-O-=-X-=-O-=-X-=-O-=-X-=-O-=-X ! 3B-----3A-----4E-----4E-----4E-----4E-----3A----3B ! ! ! --Right side bnd3A(1) = -(1.d0/24.d0) bnd3A(2) = +(3.d0/24.d0) bnd3A(3) = +(21.d0/24.d0) bnd3A(4) = -(23.d0/24.d0) ! --Left side ! ! --Right side bnd3B(1) = -( 71.d0/24.d0) bnd3B(2) = +(141.d0/24.d0) bnd3B(3) = -( 93.d0/24.d0) bnd3B(4) = +( 23.d0/24.d0) ! --Left side ! 4E - Centered Difference ! --Right side bnd4C(1) = -( 1.d0/24.d0) bnd4C(2) = +(27.d0/24.d0) bnd4C(3) = -(27.d0/24.d0) bnd4C(4) = +( 1.d0/24.d0) ! --Left side ! 6E - Centered Difference ! --Right side bnd6D(1) = +( 9.d0/1920.d0) bnd6D(2) = -( 125.d0/1920.d0) bnd6D(3) = +(2250.d0/1920.d0) bnd6D(4) = -(2250.d0/1920.d0) bnd6D(5) = +( 125.d0/1920.d0) bnd6D(6) = -( 9.d0/1920.d0) ! --Left side ! 8E - Centered Difference ! --Right side bnd8E(1) = -( 75.d0/107520.d0) bnd8E(2) = +( 1029.d0/107520.d0) bnd8E(3) = -( 8575.d0/107520.d0) bnd8E(4) = +(128625.d0/107520.d0) bnd8E(5) = -(128625.d0/107520.d0) bnd8E(6) = +( 8575.d0/107520.d0) bnd8E(7) = -( 1029.d0/107520.d0) bnd8E(8) = +( 75.d0/107520.d0) ! --Left side ! return end !===========================================================================