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/theta_rhodz.f90

    r387 r428  
    11MODULE theta2theta_rhodz_mod 
    22  USE field_mod 
    3    
     3  PRIVATE 
    44  TYPE(t_field), POINTER, SAVE  :: f_p(:) 
    5   TYPE(t_field), POINTER, SAVE  :: f_pks(:) 
    6   TYPE(t_field), POINTER, SAVE  :: f_pk(:) 
    7  
    8   PRIVATE :: f_p,f_pk,f_pks  
     5 
     6  PUBLIC :: init_theta2theta_rhodz, theta_rhodz2theta, & 
     7       theta_rhodz2temperature, temperature2theta_rhodz, & 
     8       theta2theta_rhodz, & 
     9       compute_theta2theta_rhodz, compute_theta_rhodz2theta 
    910 
    1011CONTAINS 
     
    1415  USE field_mod 
    1516  IMPLICIT NONE 
    16     CALL allocate_field(f_p,field_t,type_real,llm+1,name='p (theta2theta_rhodz_mod)') 
    17     CALL allocate_field(f_pk,field_t,type_real,llm,name='pk (theta2theta_rhodz_mod)') 
    18     CALL allocate_field(f_pks,field_t,type_real,name='pks (theta2theta_rhodz_mod)') 
    19      
     17    CALL allocate_field(f_p,field_t,type_real,llm+1,name='p (theta2theta_rhodz_mod)')     
    2018  END SUBROUTINE init_theta2theta_rhodz 
    21  
    2219 
    2320 
     
    6158    REAL(rstd), POINTER :: temp(:,:) 
    6259    REAL(rstd), POINTER :: p(:,:) 
    63     REAL(rstd), POINTER :: pk(:,:) 
    64     REAL(rstd), POINTER :: pks(:) 
    6560    INTEGER :: ind 
    6661 
     
    7166      ps=f_ps(ind) 
    7267      p=f_p(ind) 
    73       pks=f_pks(ind) 
    74       pk=f_pk(ind) 
    7568      theta_rhodz=f_theta_rhodz(ind) 
    7669      temp=f_temp(ind) 
     
    7972      CALL compute_pression(ps,p,0) 
    8073!$OMP BARRIER 
    81       CALL compute_exner(ps,p,pks,pk,0) 
    82 !$OMP BARRIER 
    83       CALL compute_theta_rhodz2temperature(p, pk, theta_rhodz(:,:,1),temp,0) 
     74      CALL compute_theta_rhodz2temperature(p, theta_rhodz(:,:,1),temp,0) 
    8475    ENDDO 
    8576!$OMP BARRIER 
     
    10091    REAL(rstd), POINTER :: temp(:,:) 
    10192    REAL(rstd), POINTER :: p(:,:) 
    102     REAL(rstd), POINTER :: pk(:,:) 
    103     REAL(rstd), POINTER :: pks(:) 
    10493    INTEGER :: ind 
    10594 
     
    11099      ps=f_ps(ind) 
    111100      p=f_p(ind) 
    112       pks=f_pks(ind) 
    113       pk=f_pk(ind) 
    114101      theta_rhodz=f_theta_rhodz(ind) 
    115102      temp=f_temp(ind) 
     
    118105      CALL compute_pression(ps,p,0) 
    119106!$OMP BARRIER 
    120       CALL compute_exner(ps,p,pks,pk,0) 
    121 !$OMP BARRIER 
    122       CALL compute_temperature2theta_rhodz(p, pk, temp, theta_rhodz(:,:,1), 0) 
     107      CALL compute_temperature2theta_rhodz(p, temp, theta_rhodz(:,:,1), 0) 
    123108    ENDDO 
    124109!$OMP BARRIER 
     
    213198 
    214199 
    215   SUBROUTINE compute_theta_rhodz2temperature(p,pk,theta_rhodz,temp,offset) 
     200  SUBROUTINE compute_theta_rhodz2temperature(p,theta_rhodz,temp,offset) 
    216201  USE icosa 
    217202  USE pression_mod 
     
    220205  IMPLICIT NONE 
    221206    REAL(rstd),INTENT(IN) :: p(iim*jjm,llm+1) 
    222     REAL(rstd),INTENT(IN) :: pk(iim*jjm,llm) 
    223207    REAL(rstd),INTENT(IN) :: theta_rhodz(iim*jjm,llm) 
    224208    REAL(rstd),INTENT(OUT) :: temp(iim*jjm,llm) 
    225209    INTEGER,INTENT(IN) :: offset 
     210    REAL(rstd) :: pk_ij 
    226211    INTEGER :: i,j,ij,l 
    227212         
     
    232217        DO i=ii_begin-offset,ii_end+offset 
    233218          ij=(j-1)*iim+i 
    234           temp(ij,l) = ( theta_rhodz(ij,l) / ((p(ij,l)-p(ij,l+1))/g) ) * pk(ij,l) / cpp 
     219          pk_ij=((.5/preff)*(p(ij,l)+p(ij,l+1)))**kappa 
     220          temp(ij,l) = ( theta_rhodz(ij,l) / ((p(ij,l)-p(ij,l+1))/g) ) * pk_ij 
    235221        ENDDO 
    236222      ENDDO 
     
    241227  END SUBROUTINE compute_theta_rhodz2temperature 
    242228 
    243   SUBROUTINE compute_temperature2theta_rhodz(p,pk,temp,theta_rhodz,offset) 
     229  SUBROUTINE compute_temperature2theta_rhodz(p,temp,theta_rhodz,offset) 
    244230  USE icosa 
    245231  USE pression_mod 
     
    248234  IMPLICIT NONE 
    249235    REAL(rstd),INTENT(IN)  :: p(iim*jjm,llm+1) 
    250     REAL(rstd),INTENT(IN)  :: pk(iim*jjm,llm) 
    251236    REAL(rstd),INTENT(OUT) :: theta_rhodz(iim*jjm,llm) 
    252237    REAL(rstd),INTENT(IN)  :: temp(iim*jjm,llm) 
    253238    INTEGER,INTENT(IN) :: offset 
     239    REAL(rstd) :: pk_ij 
    254240    INTEGER :: i,j,ij,l 
    255241 
     
    262248        DO i=ii_begin-offset,ii_end+offset 
    263249          ij=(j-1)*iim+i 
    264           theta_rhodz(ij,l) = temp(ij,l) * ((p(ij,l)-p(ij,l+1))/g) / (pk(ij,l) / cpp ) 
     250          pk_ij=((.5/preff)*(p(ij,l)+p(ij,l+1)))**kappa 
     251          theta_rhodz(ij,l) = temp(ij,l) * ((p(ij,l)-p(ij,l+1))/g) / pk_ij 
    265252        ENDDO 
    266253      ENDDO 
Note: See TracChangeset for help on using the changeset viewer.