Ignore:
Timestamp:
06/15/16 22:35:17 (8 years ago)
Author:
dubos
Message:

Dry/moist output cleanup

File:
1 edited

Legend:

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

    r428 r434  
    9393    END IF 
    9494 
    95     CALL theta_rhodz2temperature(f_ps,f_theta_rhodz,f_buf_i) ;  
    96     CALL Tv2T(f_buf_i,f_q,f_buf1_i) 
     95!    CALL theta_rhodz2temperature(f_ps,f_theta_rhodz,f_buf_i) 
     96!    CALL Tv2T(f_buf_i,f_q,f_buf1_i) 
     97    CALL diagnose_temperature(f_ps, f_theta_rhodz, f_q, f_buf_i) 
     98 
    9799    IF(init) THEN 
    98100       CALL output_field("temp_init",f_buf_i) 
     
    234236  END SUBROUTINE compute_prognostic_vel_to_horiz 
    235237 
     238  SUBROUTINE diagnose_temperature(f_ps,f_theta_rhodz,f_q,f_temp) 
     239    USE icosa 
     240    USE pression_mod 
     241    IMPLICIT NONE 
     242    TYPE(t_field), POINTER :: f_ps(:)           ! IN 
     243    TYPE(t_field), POINTER :: f_theta_rhodz(:)  ! IN 
     244    TYPE(t_field), POINTER :: f_q(:)            ! IN 
     245    TYPE(t_field), POINTER :: f_temp(:)         ! OUT 
     246     
     247    REAL(rstd), POINTER :: ps(:) 
     248    REAL(rstd), POINTER :: theta_rhodz(:,:,:) 
     249    REAL(rstd), POINTER :: q(:,:,:) 
     250    REAL(rstd), POINTER :: temp(:,:) 
     251    INTEGER :: ind 
     252     
     253    DO ind=1,ndomain 
     254       IF (.NOT. assigned_domain(ind)) CYCLE 
     255       CALL swap_dimensions(ind) 
     256       CALL swap_geometry(ind) 
     257       ps=f_ps(ind) 
     258       theta_rhodz=f_theta_rhodz(ind) 
     259       q=f_q(ind) 
     260       temp=f_temp(ind) 
     261       CALL compute_diagnose_temp(ps,theta_rhodz,q,temp) 
     262    END DO 
     263  END SUBROUTINE diagnose_temperature 
     264   
     265  SUBROUTINE compute_diagnose_temp(ps,theta_rhodz,q,temp) 
     266    USE omp_para 
     267    USE pression_mod 
     268    REAL(rstd),INTENT(IN)  :: ps(iim*jjm) 
     269    REAL(rstd),INTENT(IN)  :: theta_rhodz(iim*jjm,llm,nqdyn) 
     270    REAL(rstd),INTENT(IN)  :: q(iim*jjm,llm,nqtot) 
     271    REAL(rstd),INTENT(OUT) :: temp(iim*jjm,llm) 
     272 
     273    REAL(rstd)  :: p(iim*jjm,llm+1) 
     274    REAL(rstd) :: Rd, p_ik, theta_ik, temp_ik, qv, chi, Rmix 
     275    INTEGER :: ij,l 
     276 
     277    Rd = kappa*cpp 
     278    CALL compute_pression(ps,p,0) 
     279    DO l=ll_begin,ll_end 
     280       DO ij=ij_begin,ij_end 
     281          p_ik = .5*(p(ij,l)+p(ij,l+1)) 
     282          theta_ik = g*theta_rhodz(ij,l,1)/(p(ij,l)-p(ij,l+1)) 
     283          qv = q(ij,l,1) ! water vaper mixing ratio = mv/md 
     284          SELECT CASE(caldyn_thermo) 
     285          CASE(thermo_theta) 
     286             temp_ik = theta_ik*((p_ik/preff)**kappa) 
     287          CASE(thermo_entropy) 
     288             temp_ik = Treff*exp((theta_ik + Rd*log(p_ik/preff))/cpp) 
     289          CASE(thermo_moist) 
     290             Rmix = Rd+qv*Rv 
     291             chi = ( theta_ik + Rmix*log(p_ik/preff) ) / (cpp + qv*cppv) ! log(T/Treff) 
     292             temp_ik = Treff*exp(chi) 
     293          END SELECT 
     294          IF(physics_thermo==thermo_fake_moist) temp_ik=temp_ik/(1+0.608*qv) 
     295          temp(ij,l)=temp_ik 
     296       END DO 
     297    END DO 
     298  END SUBROUTINE compute_diagnose_temp 
     299 
    236300  SUBROUTINE Tv2T(f_Tv, f_q, f_T) 
    237301    TYPE(t_field), POINTER :: f_TV(:) 
     
    247311       CALL swap_geometry(ind) 
    248312       Tv=f_Tv(ind) 
    249        q=f_q(ind) 
    250313       T=f_T(ind) 
    251        T=Tv/(1+0.608*q(:,:,1)) 
    252     END DO 
    253      
     314       SELECT CASE(physics_thermo) 
     315       CASE(thermo_dry) 
     316          T=Tv 
     317       CASE(thermo_fake_moist) 
     318          q=f_q(ind) 
     319          T=Tv/(1+0.608*q(:,:,1)) 
     320       END SELECT 
     321    END DO 
    254322  END SUBROUTINE Tv2T 
    255323 
Note: See TracChangeset for help on using the changeset viewer.