source: trunk/LMDZ.MARS/libf/phymars/phys_state_var_init_mod.F90 @ 4031

Last change on this file since 4031 was 4009, checked in by aslmd, 5 weeks ago

MESOSCALE: setting off subgrid slopes for mesoscale. still has to add a dimension with index 1 to many surface fields.

File size: 6.7 KB
Line 
1MODULE phys_state_var_init_mod
2
3CONTAINS
4
5      SUBROUTINE phys_state_var_init(ngrid,nlayer,nq,tname, &
6                                     day_ini,day_end,hour_ini,pdaysec,ptimestep, &
7                                     prad,pg,pr,pcpp, &
8                                     dyn_nqperes,dyn_nqfils)! MVals: variables isotopes
9
10!=======================================================================
11!
12!   purpose:
13!   -------
14!
15!   Allocate arrays in modules
16!   Fill geometrical arrays
17!   Fill a first set of physical constants
18!   -- was done previously in inifis
19!
20!=======================================================================
21!   
22!   authors: Ehouarn Millour and Aymeric Spiga
23!            14/04/2014
24!
25!   arguments:
26!   ----------
27!
28!   input:
29!   ------
30!
31!    ngrid                 Size of the horizontal grid.
32!    nlayer                Number of vertical layers.
33!    nq                    Number of tracers.
34!
35!=======================================================================
36
37      use init_print_control_mod, only: init_print_control
38      use slope_mod, only: ini_slope_mod,end_slope_mod
39      use comsaison_h, only: ini_comsaison_h,end_comsaison_h
40      use surfdat_h, only: ini_surfdat_h,end_surfdat_h
41      use comgeomfi_h, only: ini_comgeomfi_h,end_comgeomfi_h
42      use comsoil_h, only: ini_comsoil_h,end_comsoil_h
43      use dimradmars_mod, only: ini_dimradmars_mod,end_dimradmars_mod
44      use yomlw_h, only: ini_yomlw_h,end_yomlw_h
45      use conc_mod, only: ini_conc_mod,end_conc_mod
46      use turb_mod, only: ini_turb_mod,end_turb_mod
47      use comcstfi_h, only: init_comcstfi_h
48      use tracer_mod, only: ini_tracer_mod,end_tracer_mod
49      use time_phylmdz_mod, only: init_time
50      use compute_dtau_mod, only: ini_compute_dtau_mod, &
51                                  end_compute_dtau_mod
52      use rocketduststorm_mod, only: ini_rocketduststorm_mod, &
53                                     end_rocketduststorm_mod
54      use calchim_mod, only: ini_calchim_mod,end_calchim_mod
55      use watercloud_mod, only: ini_watercloud_mod, &
56                                end_watercloud_mod
57      use nonoro_gwd_ran_mod, only: ini_nonoro_gwd_ran, &
58                                    end_nonoro_gwd_ran
59      use nonoro_gwd_mix_mod, only: ini_nonoro_gwd_mix, &
60                                    end_nonoro_gwd_mix
61      use dust_param_mod, only: ini_dust_param_mod, &
62                                end_dust_param_mod
63      use dust_rad_adjust_mod, only: ini_dust_rad_adjust_mod, &
64                                     end_dust_rad_adjust_mod
65      use comslope_mod, ONLY: nslope,end_comslope_h,ini_comslope_h
66      use paleoclimate_mod, ONLY: end_paleoclimate_h,ini_paleoclimate_h
67      use netcdf
68#ifndef MESOSCALE
69      USE mod_phys_lmdz_para, ONLY: is_master,bcast
70#endif
71
72      IMPLICIT NONE
73     
74      integer,      intent(in) :: ngrid, nlayer, nq
75      character(*), intent(in) :: tname(nq)
76      integer,      intent(in) :: day_ini, day_end
77      real,         intent(in) :: hour_ini
78      real,         intent(in) :: pdaysec, ptimestep, prad, pg, pr, pcpp
79!MVals isotopes
80      integer,      intent(in) :: dyn_nqperes
81      integer,      intent(in) :: dyn_nqfils(nq)
82      character(10) :: filename  ! name of the startfi.nc
83      integer       :: ncid, status, nslope_dim_id
84      integer       :: nslope_read
85
86
87      filename = "startfi.nc"
88#ifndef MESOSCALE
89      if(is_master) then
90        status = nf90_open(filename, nf90_nowrite, ncid)
91        if (status /= nf90_noerr) then
92          nslope=1
93        else
94          status = nf90_inq_dimid(ncid, "nslope", nslope_dim_id)
95          if (status /= nf90_noerr) then
96            nslope=1
97          else
98            status = nf90_inquire_dimension(ncid, nslope_dim_id, len = nslope_read)
99            if (status /= nf90_noerr) then
100              call abort_physic("phys_state_var_init","nslope present but not readable",1)
101            else
102              nslope=nslope_read
103            endif
104          endif
105        endif
106      endif
107      call bcast(nslope)
108#else
109      print *, "subgrid slopes temporarily switched off in mesoscale, nslope=1"
110      nslope=1
111#endif
112
113      ! set dimension and allocate arrays in tracer_mod
114      call end_tracer_mod
115      call ini_tracer_mod(nq,tname,dyn_nqperes,dyn_nqfils)! MVals: variables isotopes
116
117      ! initialize "print_control" constants/flags ("prt_level","lunout", etc.)
118      call init_print_control
119     
120      ! set parameters in comcstfi_h
121      call init_comcstfi_h(prad,pcpp,pg,pr)
122
123      ! Initialize some "temporal and calendar" related variables
124      call init_time(day_ini,day_end,hour_ini,pdaysec,ptimestep)
125
126      ! allocate "slope_mod" arrays
127      call end_slope_mod
128      call ini_slope_mod(ngrid)
129
130      ! allocate "comsaison_h" arrays
131      call end_comsaison_h
132      call ini_comsaison_h(ngrid)
133
134      ! allocate "surfdat_h" arrays
135      call end_surfdat_h
136      call ini_surfdat_h(ngrid,nq,nslope)
137
138      ! allocate "comgeomfi_h" arrays
139      call end_comgeomfi_h
140      call ini_comgeomfi_h(ngrid)
141
142      ! allocate "comsoil_h" arrays
143      call end_comsoil_h
144      call ini_comsoil_h(ngrid,nslope)
145
146      ! set some variables in "dimradmars_mod"
147      call end_dimradmars_mod
148      call ini_dimradmars_mod(ngrid,nlayer,nslope)
149
150      ! allocate arrays in "yomlw_h"
151      call end_yomlw_h
152      call ini_yomlw_h(ngrid)
153
154      ! allocate arrays in "conc_mod" (aeronomars)
155      call end_conc_mod
156      call ini_conc_mod(ngrid,nlayer)
157
158      ! allocate arrays in "turb_mod"
159      call end_turb_mod
160      call ini_turb_mod(ngrid,nlayer)
161
162      ! allocate arrays in "compute_dtau_mod":
163      call end_compute_dtau_mod
164      call ini_compute_dtau_mod(ngrid)
165
166      ! allocate arrays in "rocketduststorm_mod":
167      call end_rocketduststorm_mod
168      call ini_rocketduststorm_mod(ngrid)
169
170      ! allocate arrays in "calchim_mod" (aeronomars)
171      call end_calchim_mod
172      call ini_calchim_mod(ngrid,nlayer,nq)
173
174      ! allocate arrays in "watercloud_mod"
175      call end_watercloud_mod
176      call ini_watercloud_mod(ngrid,nlayer,nq)
177
178      ! allocate arrays in "nonoro_gwd_ran_mod"
179      call end_nonoro_gwd_ran
180      call ini_nonoro_gwd_ran(ngrid,nlayer)
181
182      ! allocate arrays in "nonoro_gwd_mix_mod"
183      call end_nonoro_gwd_mix
184      call ini_nonoro_gwd_mix(ngrid,nlayer,nq)
185
186      ! allocate arrays in "dust_param_mod"
187      call end_dust_param_mod
188      call ini_dust_param_mod(ngrid)
189     
190      ! allocate arrays in "dust_rad_adjust_mod"
191      call end_dust_rad_adjust_mod
192      call ini_dust_rad_adjust_mod(ngrid)
193
194      ! allocate arrays in "comslope_mod"
195      call end_comslope_h
196      call ini_comslope_h(ngrid,nslope)
197
198      ! allocate arrays in "paleoclimate_mod"
199      call end_paleoclimate_h
200      call ini_paleoclimate_h(ngrid,nslope)
201
202      END SUBROUTINE phys_state_var_init
203
204END MODULE phys_state_var_init_mod
Note: See TracBrowser for help on using the repository browser.