Changeset 199 for codes/icosagcm/trunk


Ignore:
Timestamp:
07/07/14 15:16:06 (10 years ago)
Author:
dubos
Message:

Isothermal state of rest - untested

File:
1 edited

Legend:

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

    r192 r199  
    11MODULE etat0_mod 
     2  USE icosa 
     3  PRIVATE 
     4 
    25    CHARACTER(len=255),SAVE :: etat0_type 
    36!$OMP THREADPRIVATE(etat0_type) 
     7 
     8    REAL(rstd) :: etat0_temp 
     9 
     10    PUBLIC :: etat0, etat0_type 
    411 
    512CONTAINS 
     
    4552     
    4653    SELECT CASE (TRIM(etat0_type)) 
     54    CASE ('isothermal') 
     55       CALL getin_etat0_isothermal 
     56       CALL etat0_collocated(init_mass, f_phis,f_ps,f_mass,f_theta_rhodz,f_u, f_q) 
    4757    CASE ('williamson91.6') 
     58       init_mass=.FALSE. 
    4859       CALL etat0_williamson_new(f_phis,f_mass,f_theta_rhodz,f_u, f_q) 
    49        init_mass=.FALSE. 
    5060    CASE ('jablonowsky06') 
    5161       CALL etat0_jablonowsky06(f_ps,f_phis,f_theta_rhodz,f_u, f_q) 
     
    95105 
    96106  END SUBROUTINE etat0 
    97           
     107 
     108  SUBROUTINE etat0_collocated(init_mass, f_ps,f_mass,f_phis,f_theta_rhodz,f_u, f_q) 
     109    IMPLICIT NONE 
     110    LOGICAL, INTENT(IN) :: init_mass 
     111    TYPE(t_field),POINTER :: f_ps(:) 
     112    TYPE(t_field),POINTER :: f_mass(:) 
     113    TYPE(t_field),POINTER :: f_phis(:) 
     114    TYPE(t_field),POINTER :: f_theta_rhodz(:) 
     115    TYPE(t_field),POINTER :: f_u(:) 
     116    TYPE(t_field),POINTER :: f_q(:) 
     117   
     118    REAL(rstd),POINTER :: ps(:) 
     119    REAL(rstd),POINTER :: mass(:,:) 
     120    REAL(rstd),POINTER :: phis(:) 
     121    REAL(rstd),POINTER :: theta_rhodz(:,:) 
     122    REAL(rstd),POINTER :: u(:,:) 
     123    REAL(rstd),POINTER :: q(:,:,:) 
     124    INTEGER :: ind 
     125 
     126    DO ind=1,ndomain 
     127      IF (.NOT. assigned_domain(ind)) CYCLE 
     128      CALL swap_dimensions(ind) 
     129      CALL swap_geometry(ind) 
     130      ps=f_ps(ind) 
     131      mass=f_mass(ind) 
     132      phis=f_phis(ind) 
     133      theta_rhodz=f_theta_rhodz(ind) 
     134      u=f_u(ind) 
     135      q=f_q(ind) 
     136      CALL compute_etat0_collocated(init_mass, ps,mass, phis, theta_rhodz, u, q) 
     137    ENDDO 
     138  END SUBROUTINE etat0_collocated 
     139 
     140  SUBROUTINE compute_etat0_collocated(init_mass, ps,mass, phis, theta_rhodz, u, q) 
     141    USE icosa 
     142    USE disvert_mod 
     143    USE theta2theta_rhodz_mod 
     144    USE wind_mod 
     145    IMPLICIT NONE 
     146    LOGICAL, INTENT(IN) :: init_mass 
     147    REAL(rstd),INTENT(INOUT) :: ps(iim*jjm) 
     148    REAL(rstd),INTENT(INOUT) :: mass(iim*jjm,llm) 
     149    REAL(rstd),INTENT(OUT) :: phis(iim*jjm) 
     150    REAL(rstd),INTENT(OUT) :: theta_rhodz(iim*jjm,llm) 
     151    REAL(rstd),INTENT(OUT) :: u(3*iim*jjm,llm) 
     152    REAL(rstd),INTENT(OUT) :: q(iim*jjm,llm,nqtot) 
     153 
     154    REAL(rstd) :: lon_i(iim*jjm) 
     155    REAL(rstd) :: lat_i(iim*jjm) 
     156    REAL(rstd) :: temp_i(iim*jjm,llm) 
     157    REAL(rstd) :: ulon_i(iim*jjm,llm) 
     158    REAL(rstd) :: ulat_i(iim*jjm,llm) 
     159 
     160    REAL(rstd) :: lon_e(3*iim*jjm) 
     161    REAL(rstd) :: lat_e(3*iim*jjm) 
     162    REAL(rstd) :: ps_e(3*iim*jjm) 
     163    REAL(rstd) :: mass_e(3*iim*jjm,llm) 
     164    REAL(rstd) :: phis_e(3*iim*jjm) 
     165    REAL(rstd) :: temp_e(3*iim*jjm,llm) 
     166    REAL(rstd) :: ulon_e(3*iim*jjm,llm) 
     167    REAL(rstd) :: ulat_e(3*iim*jjm,llm) 
     168    REAL(rstd) :: q_e(3*iim*jjm,llm,nqtot) 
     169 
     170    INTEGER :: l,i,j,ij 
     171 
     172    DO l=1,llm 
     173       DO j=jj_begin-1,jj_end+1 
     174          DO i=ii_begin-1,ii_end+1 
     175             ij=(j-1)*iim+i 
     176             CALL xyz2lonlat(xyz_i(ij,:)/radius,lon_i(ij),lat_i(ij)) 
     177             CALL xyz2lonlat(xyz_e(ij+u_right,:)/radius,lon_e(ij+u_right),lat_e(ij+u_right)) 
     178             CALL xyz2lonlat(xyz_e(ij+u_lup,:)/radius,lon_e(ij+u_lup),lat_e(ij+u_lup)) 
     179             CALL xyz2lonlat(xyz_e(ij+u_ldown,:)/radius,lon_e(ij+u_ldown),lat_e(ij+u_ldown)) 
     180          END DO 
     181       END DO 
     182    END DO 
     183 
     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 
     208    SELECT CASE (TRIM(etat0_type)) 
     209    CASE ('isothermal') 
     210       CALL compute_etat0_isothermal(ngrid, phis, ps, temp, ulon, ulat, q) 
     211    END SELECT 
     212 
     213  END SUBROUTINE compute_etat0_ngrid 
     214 
     215!----------------------------- Resting isothermal state -------------------------------- 
     216 
     217  SUBROUTINE getin_etat0_isothermal 
     218    etat0_temp=300; 
     219    CALL getin("etat0_temp",etat0_temp) 
     220  END SUBROUTINE getin_etat0_isothermal 
     221 
     222  SUBROUTINE compute_etat0_isothermal(ngrid, phis, ps, temp, ulon, ulat, q) 
     223    IMPLICIT NONE   
     224    INTEGER, INTENT(IN)    :: ngrid 
     225    REAL(rstd),INTENT(OUT) :: phis(ngrid) 
     226    REAL(rstd),INTENT(OUT) :: ps(ngrid) 
     227    REAL(rstd),INTENT(OUT) :: temp(ngrid,llm) 
     228    REAL(rstd),INTENT(OUT) :: ulon(ngrid,llm) 
     229    REAL(rstd),INTENT(OUT) :: ulat(ngrid,llm) 
     230    REAL(rstd),INTENT(OUT) :: q(ngrid,llm,nqtot) 
     231    phis(:)=0 
     232    ps(:)=preff 
     233    temp(:,:)=etat0_temp 
     234    ulon(:,:)=0 
     235    ulat(:,:)=0 
     236    q(:,:,:)=0 
     237  END SUBROUTINE compute_etat0_isothermal 
     238 
    98239END MODULE etat0_mod 
    99  
Note: See TracChangeset for help on using the changeset viewer.