Changeset 109


Ignore:
Timestamp:
08/07/12 16:57:48 (12 years ago)
Author:
dubos
Message:

Added Rayleigh friction
Tested : DCMIP 2.1 and DCMIP2.2 (with/without)

Location:
codes/icosagcm/trunk/src
Files:
2 edited

Legend:

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

    r98 r109  
    77  TYPE(t_field),POINTER,SAVE :: f_due_diss2(:) 
    88 
    9   TYPE(t_field),POINTER,SAVE :: f_theta(:) 
     9  TYPE(t_field),POINTER,SAVE :: f_theta(:), f_phi(:), f_pk(:), f_pks(:), f_p(:) 
    1010  TYPE(t_field),POINTER,SAVE :: f_dtheta_diss(:) 
    1111  TYPE(t_field),POINTER,SAVE :: f_dtheta_rhodz_diss(:) 
     
    2323  REAL,SAVE :: cgradrot 
    2424  REAL,SAVE :: cdivgrad 
     25 
     26  INTEGER, SAVE :: rayleigh_friction_type, rayleigh_shear 
     27  REAL, save    :: rayleigh_tau 
    2528   
    2629  INTEGER,SAVE :: idissip 
     
    3841    CALL allocate_field(f_dtheta_diss,field_t,type_real,llm) 
    3942    CALL allocate_field(f_dtheta_rhodz_diss,field_t,type_real,llm) 
     43 
     44    CALL allocate_field(f_phi,field_t,type_real,llm) 
     45    CALL allocate_field(f_pk,field_t,type_real,llm) 
     46    CALL allocate_field(f_p,field_t,type_real,llm+1) 
     47    CALL allocate_field(f_pks,field_t,type_real) 
    4048     
    4149    ALLOCATE(tau_graddiv(llm)) 
     
    6674  REAL(rstd)            :: zz, zvert, fact 
    6775  INTEGER               :: l 
     76  CHARACTER(len=255)    :: rayleigh_friction_key 
    6877   
    6978             
    7079  INTEGER :: i,j,n,ind,it,iter 
     80 
     81   rayleigh_friction_key='none' 
     82   CALL getin("rayleigh_friction_type",rayleigh_friction_key) 
     83   SELECT CASE(TRIM(rayleigh_friction_key)) 
     84   CASE('none') 
     85      rayleigh_friction_type=0 
     86      PRINT *, 'No Rayleigh friction' 
     87   CASE('dcmip2_schaer_noshear') 
     88      rayleigh_friction_type=1 
     89      rayleigh_shear=0 
     90      PRINT *, 'Rayleigh friction : Schaer-like mountain without shear DCMIP2.1' 
     91   CASE('dcmip2_schaer_shear') 
     92      rayleigh_shear=1 
     93      rayleigh_friction_type=2 
     94      PRINT *, 'Rayleigh friction : Schaer-like mountain with shear DCMIP2.2' 
     95   CASE DEFAULT 
     96      PRINT *, 'Bad selector : rayleigh_friction_type =', TRIM(rayleigh_friction_key), ' in dissip_gcm.f90/init_dissip' 
     97      STOP 
     98   END SELECT 
     99 
     100   IF(rayleigh_friction_type>0) THEN 
     101      rayleigh_tau=0. 
     102      CALL getin("rayleigh_friction_tau",rayleigh_tau) 
     103      rayleigh_tau = rayleigh_tau / scale_factor 
     104      IF(rayleigh_tau<=0) THEN 
     105         PRINT *, 'Forbidden : negative value for rayleigh_friction_tau =',rayleigh_tau 
     106         STOP 
     107      END IF 
     108   END IF 
    71109 
    72110    CALL allocate_dissip 
     
    382420  
    383421   
    384   SUBROUTINE dissip(f_ue,f_due,f_ps,f_theta_rhodz,f_dtheta_rhodz) 
     422  SUBROUTINE dissip(f_ue,f_due,f_ps,f_phis,f_theta_rhodz,f_dtheta_rhodz) 
    385423  USE icosa 
    386424  USE theta2theta_rhodz_mod 
     425  USE pression_mod 
     426  USE exner_mod 
     427  USE geopotential_mod 
    387428  IMPLICIT NONE 
    388429    TYPE(t_field),POINTER :: f_ue(:) 
    389430    TYPE(t_field),POINTER :: f_due(:) 
    390     TYPE(t_field),POINTER :: f_ps(:) 
     431    TYPE(t_field),POINTER :: f_ps(:), f_phis(:) 
    391432    TYPE(t_field),POINTER :: f_theta_rhodz(:) 
    392433    TYPE(t_field),POINTER :: f_dtheta_rhodz(:) 
    393434 
    394435    REAL(rstd),POINTER         :: due(:,:) 
     436    REAL(rstd),POINTER         :: phi(:,:), ue(:,:) 
    395437    REAL(rstd),POINTER         :: due_diss1(:,:) 
    396438    REAL(rstd),POINTER         :: due_diss2(:,:) 
     
    398440    REAL(rstd),POINTER         :: dtheta_rhodz_diss(:,:) 
    399441 
    400     INTEGER :: ind 
     442    INTEGER :: ind, shear 
    401443    INTEGER :: l,i,j,n 
    402444     
     
    407449    CALL theta2theta_rhodz(f_ps,f_dtheta_diss,f_dtheta_rhodz_diss) 
    408450     
     451    IF(rayleigh_friction_type>0) THEN 
     452       CALL pression(f_ps, f_p) 
     453       CALL exner(f_ps, f_p, f_pks, f_pk) 
     454       CALL geopotential(f_phis,f_pks,f_pk,f_theta,f_phi) 
     455    END IF 
     456 
    409457    DO ind=1,ndomain 
    410458      CALL swap_dimensions(ind) 
     
    430478        ENDDO 
    431479      ENDDO 
    432     ENDDO 
     480 
     481      IF(rayleigh_friction_type>0) THEN 
     482         phi=f_phi(ind) 
     483         ue=f_ue(ind) 
     484         DO l=1,llm 
     485            DO j=jj_begin,jj_end 
     486               DO i=ii_begin,ii_end 
     487                  n=(j-1)*iim+i 
     488                  CALL relax(t_right, u_right) 
     489                  CALL relax(t_lup,   u_lup) 
     490                  CALL relax(t_ldown, u_ldown) 
     491               ENDDO 
     492            ENDDO 
     493         END DO 
     494      END IF 
     495   END DO 
     496 
     497    CONTAINS 
     498      SUBROUTINE relax(shift_t, shift_u) 
     499        USE dcmip_initial_conditions_test_1_2_3 
     500        REAL(rstd) :: z, ulon,ulat, lon,lat, & ! input to test2_schaer_mountain 
     501             p,hyam,hybm,w,t,phis,ps,rho,q, &   ! unused input/output to test2_schaer_mountain 
     502             fz, u3d(3), uref 
     503        REAL(rstd), PARAMETER :: zh=2e4,ztop=3e4  ! DCMIP values 
     504        LOGICAL :: hybrid_eta 
     505        INTEGER :: shift_u, shift_t, zcoords, nn 
     506        z = (phi(n,l)+phi(n+shift_t,l))/(2.*g) 
     507        IF(z>zh) THEN  ! relax only in the sponge layer z>zh 
     508!           PRINT *, 'z>zh : z,zh,l',z,zh,l 
     509!           STOP 
     510           nn = n+shift_u 
     511           CALL xyz2lonlat(xyz_e(nn,:),lon,lat) 
     512           zcoords = 1 ; hybrid_eta = .FALSE. ! use z instead of p or hyam/hybm 
     513           CALL test2_schaer_mountain(lon,lat,p,z,zcoords,hybrid_eta, & 
     514                hyam,hybm,shear,ulon,ulat,w,t,phis,ps,rho,q) 
     515!           u3d = ulon*elon_e(nn,:) + ulat*elat_e(nn,:) 
     516           u3d = ulon*elon_e(nn,:) ! ulat=0 
     517           uref = sum(u3d*ep_e(nn,:)) 
     518 
     519           fz = sin((pi/2)*(z-zh)/(ztop-zh)) 
     520           fz = fz*fz/rayleigh_tau 
     521!           fz = 1/rayleigh_tau 
     522           due(nn,l) = due(nn,l) - fz*(ue(nn,l)-uref) 
     523!           due(nn,l) = due(nn,l) - fz*ue(nn,l) 
     524         END IF 
     525       END SUBROUTINE relax 
    433526       
    434527  END SUBROUTINE dissip 
  • codes/icosagcm/trunk/src/timeloop_gcm.f90

    r99 r109  
    129129 
    130130      CASE ('adam_bashforth') 
    131         CALL dissip(f_u,f_du,f_ps,f_theta_rhodz,f_dtheta_rhodz) 
     131        CALL dissip(f_u,f_du,f_ps,f_phis, f_theta_rhodz,f_dtheta_rhodz) 
    132132        CALL adam_bashforth_scheme 
    133133 
Note: See TracChangeset for help on using the changeset viewer.