******************************************************************* * * Derivative Function Vector Calculation JAJ 10/00 * DeVries 5.55 and 5.56 * in general, derivatives could depend on * time and all x-vector components * SUBROUTINE derivs(time,xin,F) double precision time,xin(2),F(2) double precision drag ! drag term double precision vtol double precision m, k, g, gamma common /params/ m, k, g, gamma parameter (vtol = 1.0d-10) * xin(1) is the particle position * xin(2) is the particle velocity *********************************************************************** ***> You may change the drag and acceleration equations as * ***> necessary or desired using defined constants and the particle * ***> position and/or velocity (defined above). * *********************************************************************** * F(i) are the output derivatives F(1) = xin(2) ! velocity drag = 2*gamma*xin(2) ! linear velocity drag model F(2) = - k*dsin(xin(1))/m - drag ! acceleration for pendulum * F(2) = - k*xin(1)/m - drag ! acceleration 500 format ('# frict=0 ',1PE14.6,' > ',1PE14.6,' xin(2)=',1PE14.6) return end *************************************************************