Changeset 201 for codes/icosagcm/trunk


Ignore:
Timestamp:
07/08/14 15:03:32 (10 years ago)
Author:
dubos
Message:

Simplified etat0 : isothermal, jablonowsky06

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

Legend:

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

    r199 r201  
    1313   
    1414  SUBROUTINE etat0(f_ps,f_mass,f_phis,f_theta_rhodz,f_u, f_q) 
    15     USE icosa 
    1615    USE mpipara, ONLY : is_mpi_root 
    1716    USE disvert_mod 
     
    5453    CASE ('isothermal') 
    5554       CALL getin_etat0_isothermal 
    56        CALL etat0_collocated(init_mass, f_phis,f_ps,f_mass,f_theta_rhodz,f_u, f_q) 
     55       CALL etat0_collocated(f_phis,f_ps,f_mass,f_theta_rhodz,f_u, f_q) 
    5756    CASE ('williamson91.6') 
    5857       init_mass=.FALSE. 
    5958       CALL etat0_williamson_new(f_phis,f_mass,f_theta_rhodz,f_u, f_q) 
    6059    CASE ('jablonowsky06') 
    61        CALL etat0_jablonowsky06(f_ps,f_phis,f_theta_rhodz,f_u, f_q) 
     60!       CALL etat0_jablonowsky06(f_ps,f_phis,f_theta_rhodz,f_u, f_q) 
     61       CALL etat0_collocated(f_phis,f_ps,f_mass,f_theta_rhodz,f_u, f_q) 
    6262    CASE ('academic') 
    6363       CALL etat0_academic(f_ps,f_phis,f_theta_rhodz,f_u, f_q) 
     
    106106  END SUBROUTINE etat0 
    107107 
    108   SUBROUTINE etat0_collocated(init_mass, f_ps,f_mass,f_phis,f_theta_rhodz,f_u, f_q) 
     108  SUBROUTINE etat0_collocated(f_phis,f_ps,f_mass,f_theta_rhodz,f_u, f_q) 
     109    USE mpipara 
    109110    IMPLICIT NONE 
    110     LOGICAL, INTENT(IN) :: init_mass 
    111111    TYPE(t_field),POINTER :: f_ps(:) 
    112112    TYPE(t_field),POINTER :: f_mass(:) 
     
    134134      u=f_u(ind) 
    135135      q=f_q(ind) 
    136       CALL compute_etat0_collocated(init_mass, ps,mass, phis, theta_rhodz, u, q) 
     136      CALL compute_etat0_collocated(ps,mass, phis, theta_rhodz, u, q) 
     137 
    137138    ENDDO 
    138139  END SUBROUTINE etat0_collocated 
    139140 
    140   SUBROUTINE compute_etat0_collocated(init_mass, ps,mass, phis, theta_rhodz, u, q) 
    141     USE icosa 
     141  SUBROUTINE compute_etat0_collocated(ps,mass, phis, theta_rhodz, u, q) 
    142142    USE disvert_mod 
    143143    USE theta2theta_rhodz_mod 
    144144    USE wind_mod 
     145    USE etat0_jablonowsky06_mod, ONLY : compute_jablonowsky06 => compute_etat0_new 
    145146    IMPLICIT NONE 
    146     LOGICAL, INTENT(IN) :: init_mass 
    147147    REAL(rstd),INTENT(INOUT) :: ps(iim*jjm) 
    148148    REAL(rstd),INTENT(INOUT) :: mass(iim*jjm,llm) 
     
    182182    END DO 
    183183 
    184     CALL compute_etat0_ngrid(iim*jjm,lon_i,lat_i, phis, ps, mass, temp_i, ulon_i, ulat_i, q) 
    185     IF(init_mass) THEN 
    186        CALL compute_rhodz(.TRUE., ps, mass) 
    187     END IF 
    188     CALL compute_temperature2theta_rhodz(ps,temp_i,theta_rhodz,0) ! FIXME - works with shallow-water ? 
    189  
    190     CALL compute_etat0_ngrid(3*iim*jjm,lon_e,lat_e, phis_e,ps_e,mass_e, temp_e, ulon_e, ulat_e, q_e) 
    191     CALL compute_wind_from_lonlat_compound(ulon_e, ulat_e, u) 
    192  
    193   END SUBROUTINE compute_etat0_collocated 
    194  
    195   SUBROUTINE compute_etat0_ngrid(ngrid,lon,lat, phis, ps, mass, temp, ulon, ulat, q) 
    196     IMPLICIT NONE   
    197     INTEGER, INTENT(IN)    :: ngrid 
    198     REAL(rstd),INTENT(IN)  :: lon(ngrid) 
    199     REAL(rstd),INTENT(IN)  :: lat(ngrid) 
    200     REAL(rstd),INTENT(OUT) :: phis(ngrid) 
    201     REAL(rstd),INTENT(INOUT) :: ps(ngrid) 
    202     REAL(rstd),INTENT(INOUT) :: mass(ngrid,llm) 
    203     REAL(rstd),INTENT(OUT) :: temp(ngrid,llm) 
    204     REAL(rstd),INTENT(OUT) :: ulon(ngrid,llm) 
    205     REAL(rstd),INTENT(OUT) :: ulat(ngrid,llm) 
    206     REAL(rstd),INTENT(OUT) :: q(ngrid,llm,nqtot) 
    207  
    208184    SELECT CASE (TRIM(etat0_type)) 
    209185    CASE ('isothermal') 
    210        CALL compute_etat0_isothermal(ngrid, phis, ps, temp, ulon, ulat, q) 
     186       CALL compute_etat0_isothermal(iim*jjm, phis, ps, temp_i, ulon_i, ulat_i, q) 
     187       CALL compute_etat0_isothermal(3*iim*jjm, phis_e, ps_e, temp_e, ulon_e, ulat_e, q_e) 
     188    CASE('jablonowsky06') 
     189       CALL compute_jablonowsky06(iim*jjm,lon_i,lat_i, phis, ps, temp_i, ulon_i, ulat_i) 
     190       CALL compute_jablonowsky06(3*iim*jjm,lon_e,lat_e, phis_e, ps_e, temp_e, ulon_e, ulat_e) 
    211191    END SELECT 
    212192 
    213   END SUBROUTINE compute_etat0_ngrid 
     193    CALL compute_temperature2theta_rhodz(ps,temp_i,theta_rhodz,0)        
     194    CALL compute_wind_perp_from_lonlat_compound(ulon_e, ulat_e, u) 
     195 
     196  END SUBROUTINE compute_etat0_collocated 
    214197 
    215198!----------------------------- Resting isothermal state -------------------------------- 
    216199 
    217200  SUBROUTINE getin_etat0_isothermal 
    218     etat0_temp=300; 
    219     CALL getin("etat0_temp",etat0_temp) 
     201    etat0_temp=300 
     202    CALL getin("etat0_isothermal_temp",etat0_temp) 
    220203  END SUBROUTINE getin_etat0_isothermal 
    221204 
  • codes/icosagcm/trunk/src/etat0_jablonowsky06.f90

    r186 r201  
    66  REAL(rstd),PARAMETER :: ps0=1e5 
    77  REAL(rstd),PARAMETER :: u0=35 
    8 !  REAL(rstd),PARAMETER :: u0=0 
    98  REAL(rstd),PARAMETER :: T0=288 
    109  REAL(rstd),PARAMETER :: DeltaT=4.8e5 
     
    1211  REAL(rstd),PARAMETER :: Gamma=0.005 
    1312  REAL(rstd),PARAMETER :: up0=1 
    14   PUBLIC  test_etat0_jablonowsky06, etat0, compute_etat0_jablonowsky06 
     13  PUBLIC  test_etat0_jablonowsky06, etat0, compute_etat0_jablonowsky06, compute_etat0_new 
    1514CONTAINS 
    1615   
     
    248247 
    249248  END SUBROUTINE compute_etat0_jablonowsky06 
     249 
     250  SUBROUTINE compute_etat0_new(ngrid,lat,lon, phis, ps, temp, ulon, ulat) 
     251    USE disvert_mod 
     252    IMPLICIT NONE   
     253    INTEGER, INTENT(IN) :: ngrid 
     254    REAL(rstd),INTENT(IN) :: lat(ngrid) 
     255    REAL(rstd),INTENT(IN) :: lon(ngrid) 
     256    REAL(rstd),INTENT(OUT) :: phis(ngrid) 
     257    REAL(rstd),INTENT(OUT) :: ps(ngrid) 
     258    REAL(rstd),INTENT(OUT) :: temp(ngrid,llm) 
     259    REAL(rstd),INTENT(OUT) :: ulon(ngrid,llm) 
     260    REAL(rstd),INTENT(OUT) :: ulat(ngrid,llm) 
     261     
     262    INTEGER :: l,ij 
     263    REAL(rstd) :: eta(llm) 
     264    REAL(rstd) :: etav(llm) 
     265    REAL(rstd) :: etas, etavs, Tave, phis_ave, r2 
     266     
     267    DO l=1,llm 
     268       eta(l)  = 0.5 *( ap(l)/ps0+bp(l) + ap(l+1)/ps0+bp(l+1) ) 
     269       etav(l) = (eta(l)-eta0)*Pi/2 
     270    ENDDO 
     271    etas  = ap(1)+bp(1) 
     272    etavs = (etas-eta0)*Pi/2 
     273         
     274    phis_ave=T0*g/Gamma*(1-etas**(Rd*Gamma/g)) 
     275    DO ij=1,ngrid 
     276       ps(ij)=ps0 
     277       phis(ij) = phis_ave + u0*cos(etavs)**1.5*( (-2*sin(lat(ij))**6 * (cos(lat(ij))**2+1./3) + 10./63 )*u0*cos(etavs)**1.5  & 
     278            +(8./5*cos(lat(ij))**3 * (sin(lat(ij))**2 + 2./3) - Pi/4)*radius*Omega ) 
     279    ENDDO 
     280 
     281    DO l=1,llm 
     282       Tave=T0*eta(l)**(Rd*Gamma/g) 
     283       IF (etat>eta(l)) Tave=Tave+DeltaT*(etat-eta(l))**5 
     284       DO ij=1,ngrid 
     285          r2 = arc(Pi/9,2*Pi/9, lon(ij),lat(ij))**2 
     286          temp(ij,l) = Tave + 0.75*(eta(l)*Pi*u0/Rd)*sin(etav(l))*cos(etav(l))**0.5  & 
     287               * ( (-2*sin(lat(ij))**6*(cos(lat(ij))**2+1./3)+10./63)*2*u0*cos(etav(l))**1.5 & 
     288               + (8./5*cos(lat(ij))**3*(sin(lat(ij))**2+2./3)-Pi/4)*radius*Omega) 
     289          ulon(ij,l) = u0*cos(etav(l))**1.5*sin(2*lat(ij))**2 + up0*exp(-r2/0.01) 
     290          ulat(ij,l) = 0 
     291       ENDDO 
     292    ENDDO 
     293     
     294     
     295  END SUBROUTINE compute_etat0_new 
    250296   
    251297END MODULE etat0_jablonowsky06_mod 
  • codes/icosagcm/trunk/src/vector.f90

    r12 r201  
    4747      
    4848    END SUBROUTINE cross_product2 
    49      
     49 
     50    FUNCTION arc(lon1,lat1, lon2,lat2) 
     51      REAL(rstd) :: lon1,lat1, lon2,lat2, arc2, & 
     52           x1,x2,x3,y1,y2,y3,z1,z2,z3 
     53      x1=cos(lat1)*cos(lon1) 
     54      x2=cos(lat2)*cos(lon2) 
     55      y1=cos(lat1)*sin(lon1) 
     56      y2=cos(lat2)*sin(lon2) 
     57      z1=sin(lat1) 
     58      z2=sin(lat2) 
     59      x3=y1*z2-y2*z1 
     60      y3=z1*x2-z2*x1 
     61      z3=x1*y2-x2*y1 
     62      arc=ASIN(SQRT(x3*x3+y3*y3+z3*z3)) 
     63    END FUNCTION arc 
     64 
    5065END MODULE vector 
Note: See TracChangeset for help on using the changeset viewer.