Ignore:
Timestamp:
06/14/16 21:54:26 (8 years ago)
Author:
dubos
Message:

theta-related cleanup

File:
1 edited

Legend:

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

    r354 r428  
    22  IMPLICIT NONE 
    33  PRIVATE 
    4  
     4   
    55  PUBLIC :: compute_geopotential 
    66CONTAINS 
     7   
     8  SUBROUTINE thetarhodz2geopot(f_ps,f_phis,f_theta_rhodz, f_p,f_theta,f_phi) ! FIXME : never called, dry only 
     9    USE icosa 
     10    USE omp_para 
     11    USE pression_mod 
     12    USE theta2theta_rhodz_mod 
     13    TYPE(t_field), POINTER :: f_ps(:), f_phis(:), f_theta_rhodz(:), &  ! IN                                        
     14         f_p(:), f_theta(:), f_phi(:)               ! OUT                                                          
     15    REAL(rstd),POINTER :: pk(:,:), p(:,:), theta(:,:,:), theta_rhodz(:,:,:), & 
     16         phi(:,:), phis(:), ps(:) 
     17    INTEGER :: ind 
     18     
     19    DO ind=1,ndomain 
     20       IF (.NOT. assigned_domain(ind)) CYCLE 
     21       CALL swap_dimensions(ind) 
     22       CALL swap_geometry(ind) 
     23       ps = f_ps(ind) 
     24       p  = f_p(ind) 
     25!$OMP BARRIER                                                                                                      
     26       CALL compute_pression(ps,p,0) 
     27!$OMP BARRIER                                                                                                      
     28       theta_rhodz = f_theta_rhodz(ind) 
     29       theta = f_theta(ind) 
     30       CALL compute_theta_rhodz2theta(ps, theta_rhodz,theta,0) 
     31       phis = f_phis(ind) 
     32       phi = f_phi(ind) 
     33       CALL compute_geopotential(phis,p,theta,phi,0) 
     34    END DO 
    735 
    8   SUBROUTINE geopotential(f_phis,f_pks,f_pk,f_theta,f_phi) ! ORPHAN 
    9   USE icosa 
    10     TYPE(t_field), POINTER :: f_phis(:) 
    11     TYPE(t_field), POINTER :: f_pks(:) 
    12     TYPE(t_field), POINTER :: f_pk(:) 
    13     TYPE(t_field), POINTER :: f_theta(:) 
    14     TYPE(t_field), POINTER :: f_phi(:) 
    15    
    16     REAL(rstd), POINTER :: phis(:) 
    17     REAL(rstd), POINTER :: pks(:) 
    18     REAL(rstd), POINTER :: pk(:,:) 
    19     REAL(rstd), POINTER :: theta(:,:) 
    20     REAL(rstd), POINTER :: phi(:,:) 
    21     INTEGER :: ind 
     36  END SUBROUTINE thetarhodz2geopot 
    2237 
    23     DO ind=1,ndomain 
    24       IF (.NOT. assigned_domain(ind)) CYCLE 
    25       CALL swap_dimensions(ind) 
    26       CALL swap_geometry(ind) 
    27       phis=f_phis(ind) 
    28       pks=f_pks(ind) 
    29       pk=f_pk(ind) 
    30       theta=f_theta(ind) 
    31       phi=f_phi(ind) 
    32       CALL compute_geopotential(phis,pks,pk,theta,phi,0) 
    33     ENDDO 
    34    
    35   END SUBROUTINE geopotential 
    36    
    37   SUBROUTINE compute_geopotential(phis,pks,pk,theta,phi,offset) 
    38   USE icosa 
    39   USE omp_para 
    40   IMPLICIT NONE 
     38 
     39  SUBROUTINE compute_geopotential(phis,p,theta,phi,offset) 
     40    USE icosa 
     41    USE omp_para 
     42    REAL(rstd),INTENT(IN) :: p(iim*jjm,llm+1) 
    4143    REAL(rstd),INTENT(IN) :: phis(iim*jjm) 
    42     REAL(rstd),INTENT(IN) :: pks(iim*jjm) 
    43     REAL(rstd),INTENT(IN) :: pk(iim*jjm,llm) 
    44     REAL(rstd),INTENT(IN) :: theta(iim*jjm,llm) 
     44    REAL(rstd),INTENT(IN) :: theta(iim*jjm,llm,nqdyn) 
    4545    REAL(rstd),INTENT(OUT) :: phi(iim*jjm,llm) 
    4646    INTEGER,INTENT(IN) :: offset 
    4747    INTEGER :: i,j,ij,l 
     48    REAL(rstd) :: mg_ij, p_ij, exner_ij 
    4849 
    4950!!! Compute geopotential 
     
    5758! flush pks, pk thetha, phis 
    5859!$OMP BARRIER 
    59    IF(is_omp_level_master) THEN 
    60      DO j=jj_begin-offset,jj_end+offset 
    61        DO i=ii_begin-offset,ii_end+offset 
    62          ij=(j-1)*iim+i 
    63          phi( ij,1 ) = phis( ij ) + theta(ij,1) * ( pks(ij) - pk(ij,1) ) 
    64        ENDDO 
    65      ENDDO 
     60    IF(is_omp_level_master) THEN 
     61       DO j=jj_begin-offset,jj_end+offset 
     62          DO i=ii_begin-offset,ii_end+offset 
     63             ij=(j-1)*iim+i 
     64             phi( ij,1 ) = phis( ij ) 
     65          END DO 
     66       END DO 
    6667           
    6768    ! for other layers 
    68      DO l = 2, llm 
     69     DO l = 1, llm-1 
    6970       DO j=jj_begin-offset,jj_end+offset 
    7071         DO i=ii_begin-offset,ii_end+offset 
    7172           ij=(j-1)*iim+i 
    72            phi(ij,l) = phi(ij,l-1) + 0.5 * ( theta(ij,l)  + theta(ij,l-1) )  &  
    73                                          * (  pk(ij,l-1) -  pk(ij,l)    ) 
     73           mg_ij = p(ij,l+1)-p(ij,l) 
     74           ! v=RT/p=(kappa.cpp).Theta.(p/preff)**kappa /p 
     75           p_ij=.5*(p(ij,l+1)+p(ij,l)) 
     76           exner_ij = (p_ij/preff)**kappa ! NB : no cpp factor 
     77           phi(ij,l+1) = phi(ij,l) + (kappa*cpp)*mg_ij*theta(ij,l,1)*exner_ij/p_ij 
    7478         ENDDO 
    7579       ENDDO 
Note: See TracChangeset for help on using the changeset viewer.