Ignore:
Timestamp:
03/18/13 15:44:08 (11 years ago)
Author:
ymipsl
Message:

Various optimisations

  • dissipation is not called every timestep (similar way than LMDZ)
  • transfert size of halos has been reduced : need to synchronise redondant data between tiles at itau_sync timestep

YM

File:
1 edited

Legend:

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

    r146 r148  
    88  TYPE(t_field),POINTER :: f_gradq3d(:) 
    99  TYPE(t_field),POINTER :: f_cc(:)  ! starting point of backward-trajectory (Miura approach) 
    10  
     10  TYPE(t_field),POINTER :: f_one_over_sqrt_leng(:) 
     11  
    1112  REAL(rstd), PARAMETER :: pente_max=2.0 ! for vlz 
    1213 
     
    1920    REAL(rstd),POINTER :: tangent(:,:) 
    2021    REAL(rstd),POINTER :: normal(:,:) 
     22    REAL(rstd),POINTER :: one_over_sqrt_leng(:) 
    2123    INTEGER :: ind 
    2224 
     
    2527    CALL allocate_field(f_gradq3d,field_t,type_real,llm,3, name='gradq3d') 
    2628    CALL allocate_field(f_cc,field_u,type_real,llm,3, name='cc') 
     29    CALL allocate_field(f_one_over_sqrt_leng,field_t,type_real, name='one_over_sqrt_leng') 
    2730 
    2831    DO ind=1,ndomain 
     
    3134       normal=f_normal(ind) 
    3235       tangent=f_tangent(ind) 
    33        CALL init_advect(normal,tangent) 
     36       one_over_sqrt_leng=f_one_over_sqrt_leng(ind) 
     37       CALL init_advect(normal,tangent,one_over_sqrt_leng) 
    3438    END DO 
    3539 
     
    4953    TYPE(t_field),POINTER :: f_rhodz(:)    ! mass field at beginning of macro time step 
    5054 
    51     REAL(rstd),POINTER :: q(:,:,:), normal(:,:), tangent(:,:), gradq3d(:,:,:), cc(:,:,:) 
     55    REAL(rstd),POINTER :: q(:,:,:), normal(:,:), tangent(:,:), one_over_sqrt_leng(:), gradq3d(:,:,:), cc(:,:,:) 
    5256    REAL(rstd),POINTER :: hfluxt(:,:), wfluxt(:,:) 
    5357    REAL(rstd),POINTER :: rhodz(:,:), u(:,:)  
     
    106110       rhodz   = f_rhodz(ind) 
    107111       wfluxt  = f_wfluxt(ind)  
     112 
    108113       DO k = 1, nqtot 
    109           CALL vlz(k==nqtot,0.5, wfluxt,rhodz,q(:,:,k)) 
    110        END DO 
     114          CALL vlz(k==nqtot,0.5, wfluxt,rhodz,q(:,:,k),1) 
     115       END DO 
     116 
    111117       CALL compute_backward_traj(tangent,normal,u,0.5*dt*itau_adv, cc)  
    112118    END DO 
    113119 
    114     CALL transfert_request(f_q,req_i1)      ! necessary ? 
    115     CALL transfert_request(f_rhodz,req_i1)  ! necessary ? 
     120!    CALL transfert_request(f_q,req_i1)      ! necessary ? 
     121!    CALL transfert_request(f_rhodz,req_i1)  ! necessary ? 
    116122 
    117123    ! horizontal transport - split in two to place transfer of gradq3d 
     
    123129          q       = f_q(ind) 
    124130          gradq3d = f_gradq3d(ind) 
    125           CALL compute_gradq3d(q(:,:,k),gradq3d) 
     131          one_over_sqrt_leng=f_one_over_sqrt_leng(ind) 
     132          CALL compute_gradq3d(q(:,:,k),one_over_sqrt_leng,gradq3d) 
    126133       END DO 
    127134 
    128135       CALL transfert_request(f_gradq3d,req_i1) 
     136 
     137 
    129138 
    130139       DO ind=1,ndomain 
     
    140149    END DO  
    141150     
    142     CALL transfert_request(f_q,req_i1)      ! necessary ? 
    143     CALL transfert_request(f_rhodz,req_i1)  ! necessary ? 
     151!    CALL transfert_request(f_q,req_i1)      ! necessary ? 
     152!    CALL transfert_request(f_rhodz,req_i1)  ! necessary ? 
    144153     
    145154    ! 1/2 vertical transport 
     
    151160       wfluxt  = f_wfluxt(ind)  
    152161       DO k = 1,nqtot 
    153           CALL vlz(k==nqtot, 0.5,wfluxt,rhodz, q(:,:,k)) 
     162          CALL vlz(k==nqtot, 0.5,wfluxt,rhodz, q(:,:,k),0) 
    154163       END DO 
    155164    END DO 
     
    159168  END SUBROUTINE advect_tracer 
    160169 
    161   SUBROUTINE vlz(update_mass, fac,wfluxt,mass, q) 
     170  SUBROUTINE vlz(update_mass, fac,wfluxt,mass, q, halo) 
    162171    ! 
    163172    !     Auteurs:   P.Le Van, F.Hourdin, F.Forget, T. Dubos 
     
    168177    !     wfluxt >0 for upward transport 
    169178    !    ******************************************************************** 
     179    USE trace 
    170180    IMPLICIT NONE 
    171181    LOGICAL, INTENT(IN)       :: update_mass 
     
    173183    REAL(rstd), INTENT(INOUT) :: mass(iim*jjm,llm) 
    174184    REAL(rstd), INTENT(INOUT) :: q(iim*jjm,llm) 
     185    INTEGER, INTENT(IN) :: halo 
    175186 
    176187    REAL(rstd) :: dq(iim*jjm,llm), & ! increase of q 
     
    182193    INTEGER :: i,ij,l,j 
    183194 
     195    CALL trace_start("vlz") 
     196 
    184197    ! finite difference of q 
    185198    DO l=2,llm 
    186        DO j=jj_begin-1,jj_end+1 
    187           DO i=ii_begin-1,ii_end+1 
     199       DO j=jj_begin-halo,jj_end+halo 
     200          DO i=ii_begin-halo,ii_end+halo 
    188201             ij=(j-1)*iim+i 
    189202             dzqw(ij,l)=q(ij,l)-q(ij,l-1) 
     
    196209    ! dzq = slope*dz, i.e. the reconstructed q varies by dzq inside level l 
    197210    DO l=2,llm-1 
    198        DO j=jj_begin-1,jj_end+1 
    199           DO i=ii_begin-1,ii_end+1 
     211       DO j=jj_begin-halo,jj_end+halo 
     212          DO i=ii_begin-halo,ii_end+halo 
    200213             ij=(j-1)*iim+i 
    201214             IF(dzqw(ij,l)*dzqw(ij,l+1).gt.0.) THEN 
     
    211224 
    212225    ! 0 slope in top and bottom layers 
    213     DO j=jj_begin-1,jj_end+1 
    214        DO i=ii_begin-1,ii_end+1 
     226    DO j=jj_begin-halo,jj_end+halo 
     227       DO i=ii_begin-halo,ii_end+halo 
    215228          ij=(j-1)*iim+i 
    216229          dzq(ij,1)=0. 
     
    222235    ! then amount of q leaving level l/l+1 = wq = w * qq 
    223236    DO l = 1,llm-1 
    224        DO j=jj_begin-1,jj_end+1 
    225           DO i=ii_begin-1,ii_end+1 
     237       DO j=jj_begin-halo,jj_end+halo 
     238          DO i=ii_begin-halo,ii_end+halo 
    226239             ij=(j-1)*iim+i 
    227240             w = fac*wfluxt(ij,l+1) 
     
    238251    END DO 
    239252    ! wq = 0 at top and bottom 
    240     DO j=jj_begin-1,jj_end+1 
    241        DO i=ii_begin-1,ii_end+1 
     253    DO j=jj_begin-halo,jj_end+halo 
     254       DO i=ii_begin-halo,ii_end+halo 
    242255          ij=(j-1)*iim+i 
    243256          wq(ij,llm+1)=0. 
     
    248261    ! update q, mass is updated only after all q's have been updated 
    249262    DO l=1,llm 
    250        DO j=jj_begin-1,jj_end+1 
    251           DO i=ii_begin-1,ii_end+1 
     263       DO j=jj_begin-halo,jj_end+halo 
     264          DO i=ii_begin-halo,ii_end+halo 
    252265             ij=(j-1)*iim+i 
    253266             newmass = mass(ij,l) + fac*(wfluxt(ij,l)-wfluxt(ij,l+1)) 
     
    258271    END DO 
    259272 
     273    CALL trace_end("vlz") 
     274 
    260275  END SUBROUTINE vlz 
    261276 
Note: See TracChangeset for help on using the changeset viewer.