!-------------------------------------- LICENCE BEGIN ------------------------------------ !Environment Canada - Atmospheric Science and Technology License/Disclaimer, ! version 3; Last Modified: May 7, 2008. !This is free but copyrighted software; you can use/redistribute/modify it under the terms !of the Environment Canada - Atmospheric Science and Technology License/Disclaimer !version 3 or (at your option) any later version that should be found at: !http://collaboration.cmc.ec.gc.ca/science/rpn.comm/license.html ! !This software is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; !without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. !See the above mentioned License/Disclaimer for more details. !You should have received a copy of the License/Disclaimer along with this software; !if not, you can write to: EC-RPN COMM Group, 2121 TransCanada, suite 500, Dorval (Quebec), !CANADA, H9P 1J3; or send e-mail to service.rpn@ec.gc.ca !-------------------------------------- LICENCE END -------------------------------------- ***s/r vdfds - Computes the first difference g of a function f * at unevenly spaced points (vectorized version) *subroutine vdfds (F_g, F_f, F_hr, np, n, F_alfa, F_beta) 1 #include "impnone.cdk"
* integer n,np real F_g(np,n), F_f(np,n), F_hr(n), F_alfa, F_beta * *AUTHOR * *REVISION * v2_30 L. Corbeil - Version parallele * *OBJECT * - GIVEN A FUNCTION F AT N UNEVENLY SPACED POINTS, THIS ROUTINE * - CALCULATES ITS FIRST DIFFERENCE G AT THESE POINTS. * - HR MUST CONTAIN THE INVERSE OF THE INTERVAL LENGTHS. * - BOUNDARY CONDITIONS SPECIFIED BY ALFA,BETA, (SEE BELOW). * *ARGUMENTS * Name I/O Description *---------------------------------------------------------------- * F_g O Result * F_f I Function to be differenced * F_hr I Inverse of the interval lengths * F_alfa I Used for boundary conditions * F_beta I Used for boundary conditions *---------------------------------------------------------------------- * ** integer i, pt real a(np) * * --------------------------------------------------------------- * do i=1,n-1 do pt=1,np F_g(pt,i+1) = F_hr(i)*(F_f(pt,i+1)-F_f(pt,i)) enddo enddo * do pt=1,np a(pt) = F_g(pt,2) enddo * do i=2,n-1 do pt=1,np F_g(pt,i) = (F_hr(i)*F_g(pt,i+1)+F_hr(i-1)*F_g(pt,i)) $ /(F_hr(i)+F_hr(i-1)) enddo enddo * * BOUNDARIES do pt=1,np F_g(pt,1) = F_alfa*a(pt) +(1.-F_alfa)*F_g(pt,2) F_g(pt,n) = F_beta*F_g(pt,n) +(1.-F_beta)*F_g(pt,n-1) enddo * * --------------------------------------------------------------- * return end