source: codes/icosagcm/trunk/src/etat0.f90 @ 195

Last change on this file since 195 was 192, checked in by dubos, 10 years ago

Fixed DCMIP5 physics/etat0

File size: 3.5 KB
Line 
1MODULE etat0_mod
2    CHARACTER(len=255),SAVE :: etat0_type
3!$OMP THREADPRIVATE(etat0_type)
4
5CONTAINS
6 
7  SUBROUTINE etat0(f_ps,f_mass,f_phis,f_theta_rhodz,f_u, f_q)
8    USE icosa
9    USE mpipara, ONLY : is_mpi_root
10    USE disvert_mod
11    USE etat0_williamson_mod, ONLY : etat0_williamson_new
12    USE etat0_jablonowsky06_mod, ONLY : etat0_jablonowsky06=>etat0
13    USE etat0_academic_mod, ONLY : etat0_academic=>etat0 
14    USE etat0_dcmip1_mod, ONLY : etat0_dcmip1=>etat0
15    USE etat0_dcmip2_mod, ONLY : etat0_dcmip2=>etat0
16    USE etat0_dcmip3_mod, ONLY : etat0_dcmip3=>etat0 
17    USE etat0_dcmip4_mod, ONLY : etat0_dcmip4=>etat0 
18    USE etat0_dcmip5_mod, ONLY : etat0_dcmip5=>etat0 
19    USE etat0_heldsz_mod, ONLY : etat0_heldsz=>etat0 
20    USE dynetat0_gcm_mod, ONLY : dynetat0_start=>etat0 
21    USE dynetat0_hz_mod,  ONLY : dynetat0_hz=>etat0 
22
23    IMPLICIT NONE
24    TYPE(t_field),POINTER :: f_ps(:)
25    TYPE(t_field),POINTER :: f_mass(:)
26    TYPE(t_field),POINTER :: f_phis(:)
27    TYPE(t_field),POINTER :: f_theta_rhodz(:)
28    TYPE(t_field),POINTER :: f_u(:)
29    TYPE(t_field),POINTER :: f_q(:)
30   
31    REAL(rstd),POINTER :: ps(:), mass(:,:)
32    LOGICAL :: init_mass
33    INTEGER :: ind,i,j,ij,l
34
35    ! most etat0 routines set ps and not mass
36    ! in that case and if caldyn_eta == eta_lag
37    ! the initial distribution of mass is taken to be the same
38    ! as what the mass coordinate would dictate
39    ! however if etat0_XXX defines mass then the flag init_mass must be set to .FALSE.
40    ! otherwise mass will be overwritten
41    init_mass = (caldyn_eta == eta_lag)
42
43    etat0_type='jablonowsky06'
44    CALL getin("etat0",etat0_type)
45   
46    SELECT CASE (TRIM(etat0_type))
47    CASE ('williamson91.6')
48       CALL etat0_williamson_new(f_phis,f_mass,f_theta_rhodz,f_u, f_q)
49       init_mass=.FALSE.
50    CASE ('jablonowsky06')
51       CALL etat0_jablonowsky06(f_ps,f_phis,f_theta_rhodz,f_u, f_q)
52    CASE ('academic')
53       CALL etat0_academic(f_ps,f_phis,f_theta_rhodz,f_u, f_q)
54    CASE ('held_suarez')
55       PRINT *,"Held & Suarez (1994) test case"
56       CALL etat0_heldsz(f_ps,f_phis,f_theta_rhodz,f_u, f_q)
57    CASE ('dcmip1')
58       CALL etat0_dcmip1(f_ps,f_phis,f_theta_rhodz,f_u, f_q)
59    CASE ('dcmip2_mountain','dcmip2_schaer_noshear','dcmip2_schaer_shear')
60       CALL etat0_dcmip2(f_ps,f_phis,f_theta_rhodz,f_u, f_q)
61    CASE ('dcmip3')
62       CALL etat0_dcmip3(f_ps,f_phis,f_theta_rhodz,f_u, f_q)
63     CASE ('dcmip4')
64        IF(nqtot<2) THEN
65           IF (is_mpi_root)  THEN
66              PRINT *, "nqtot must be at least 2 for test case DCMIP4"
67           END IF
68           STOP
69        END IF
70       CALL etat0_dcmip4(f_ps,f_phis,f_theta_rhodz,f_u, f_q)
71     CASE ('dcmip5')
72       CALL etat0_dcmip5(f_ps,f_phis,f_theta_rhodz,f_u, f_q)
73     CASE ('readnf_start') 
74          print*,"readnf_start used"   
75       CALL dynetat0_start(f_ps,f_phis,f_theta_rhodz,f_u,f_q) 
76        CASE ('readnf_hz') 
77          print*,"readnf_hz used"
78       CALL dynetat0_hz(f_ps,f_phis,f_theta_rhodz,f_u,f_q) 
79   CASE DEFAULT
80       PRINT*, 'Bad selector for variable etat0 <',etat0_type, &
81            '> options are <jablonowsky06>, <academic>, <dcmip[1-4]> '
82       STOP
83    END SELECT
84
85    IF(init_mass) THEN ! initialize mass distribution using ps
86!       !$OMP BARRIER
87       DO ind=1,ndomain
88          IF (.NOT. assigned_domain(ind)) CYCLE
89          CALL swap_dimensions(ind)
90          CALL swap_geometry(ind)
91          mass=f_mass(ind); ps=f_ps(ind)
92          CALL compute_rhodz(.TRUE., ps, mass)
93       END DO
94    END IF
95
96  END SUBROUTINE etat0
97         
98END MODULE etat0_mod
99
Note: See TracBrowser for help on using the repository browser.