Changeset 120 for codes


Ignore:
Timestamp:
02/01/13 00:12:53 (11 years ago)
Author:
dubos
Message:

RK4 time stepping scheme

File:
1 edited

Legend:

Unmodified
Added
Removed
  • codes/icosagcm/trunk/src/timeloop_gcm.f90

    r110 r120  
    124124        CALL leapfrog_scheme 
    125125 
     126      CASE ('runge_kutta') 
     127        CALL rk_scheme 
     128 
    126129      CASE ('leapfrog_matsuno') 
    127130        CALL  leapfrog_matsuno_scheme 
     
    133136      CASE default 
    134137        PRINT*,'Bad selector for variable scheme : <', TRIM(scheme),             & 
    135                ' > options are <euler>, <leapfrog>, <leapfrog_matsuno>, <adam_bashforth>' 
     138               ' > options are <euler>, <runge_kutta>, <leapfrog>, <leapfrog_matsuno>, <adam_bashforth>' 
    136139        STOP 
    137140         
     
    157160       
    158161    END SUBROUTINE Euler_scheme 
    159      
     162 
     163    SUBROUTINE RK_scheme 
     164      IMPLICIT NONE 
     165      INTEGER :: ind, stage 
     166      REAL(rstd), DIMENSION(4), PARAMETER :: coef = (/ 1., 4./3., 2., 4. /) 
     167      REAL(rstd) :: tau 
     168 
     169      stage = MOD(it,4)+1 
     170      tau = dt*coef(stage) 
     171 
     172      DO ind=1,ndomain 
     173         ps=f_ps(ind)   ; u=f_u(ind)   ; theta_rhodz=f_theta_rhodz(ind) 
     174         psm1=f_psm1(ind) ; um1=f_um1(ind) ; theta_rhodzm1=f_theta_rhodzm1(ind) 
     175         dps=f_dps(ind) ; du=f_du(ind) ; dtheta_rhodz=f_dtheta_rhodz(ind) 
     176 
     177         IF (stage==1) THEN 
     178            psm1(:)=ps(:) ; um1(:,:)=u(:,:) ; theta_rhodzm1(:,:)=theta_rhodz(:,:) 
     179         END IF 
     180         ps(:)=psm1(:)+tau*dps(:) 
     181         u(:,:)=um1(:,:)+tau*du(:,:) 
     182         theta_rhodz(:,:)=theta_rhodzm1(:,:)+tau*dtheta_rhodz(:,:) 
     183      END DO 
     184    END SUBROUTINE RK_scheme 
     185 
    160186    SUBROUTINE leapfrog_scheme 
    161187    IMPLICIT NONE 
Note: See TracChangeset for help on using the changeset viewer.