1 | module climat_forcage_mois_mod |
---|
2 | |
---|
3 | ! forcage avec champs mensuels |
---|
4 | ! equilibre climatique avec 1 seul snapshot climatique |
---|
5 | ! lecture fichiers snapshots climat Temp et Precip mensuels (2 fichiers) |
---|
6 | ! nouvelle version avec liste des variables utilisées par le module |
---|
7 | ! C. Dumas 02/2015 |
---|
8 | |
---|
9 | USE module3D_phy,only:nx,ny,S,S0,slv,Tann,Tjuly,Tmois,acc,coefbmshelf,ro,num_param,num_rep_42,dirnameinp |
---|
10 | use netcdf |
---|
11 | use io_netcdf_grisli |
---|
12 | !USE printtable |
---|
13 | |
---|
14 | implicit none |
---|
15 | |
---|
16 | ! 1=decalaration variables |
---|
17 | !------------------------- |
---|
18 | |
---|
19 | !integer :: nft ! NFT est le nombre de lignes a lire dans le fichier contenant le forcage climatique |
---|
20 | |
---|
21 | |
---|
22 | integer,parameter :: nbmois=12 |
---|
23 | !integer,parameter :: ntr=1 ! nb of snapshot files : 1 pour stationnaire - ntr is now explicitely specified in the climat module |
---|
24 | !integer :: itr ! index of snapshot |
---|
25 | !real,dimension(:),allocatable :: TDATE ! time for climate forcing |
---|
26 | !real,dimension(:),allocatable :: indexco2 ! index en co2 du forcage |
---|
27 | !real :: co2 ! co2 a l'instant t |
---|
28 | !real :: coefindex ! pour le calcul du climat en fn de l'index |
---|
29 | !real,dimension(:),allocatable :: alphaT ! index temperature |
---|
30 | !real,dimension(:),allocatable :: alphaP ! index precipitation |
---|
31 | !real,dimension(:),allocatable :: SPERT ! sealevel forcing |
---|
32 | |
---|
33 | !real,dimension(ntr) :: ttr ! le co2 des snapshots (len=ntr) |
---|
34 | !real :: ttrfile ! pour lecture du co2 des snapshots |
---|
35 | !real alphaTTR(ntr) ! Le alphaT de l'index glaciologiq. aux snapshots |
---|
36 | |
---|
37 | real,dimension(nx,ny) :: Ssnap ! altitude de surface dans le snapshot |
---|
38 | real,dimension(nx,ny,nbmois) :: Tm ! temperature mensuelle |
---|
39 | real,dimension(nx,ny,nbmois) :: Pm ! precipitation mensuelle |
---|
40 | |
---|
41 | real,dimension(nx,ny,nbmois) :: Tm_surf ! surface temperature (after topo. correction) 13 nbmois pour modulo |
---|
42 | real,dimension(nx,ny,nbmois) :: Pm_surf ! surface precipitation (after topo. correction) |
---|
43 | |
---|
44 | real,dimension(nx,ny) :: ZS !< surface topography above sea level |
---|
45 | |
---|
46 | real,dimension(nx,ny,nbmois) :: lapserate ! lapse rate |
---|
47 | real :: psolid=2. ! temp limit between liquid and solid precip |
---|
48 | |
---|
49 | character(len=200) :: filin ! nom temporaire |
---|
50 | !character(len=100) :: file_temporel ! forcage temporel |
---|
51 | !character(len=100),dimension(ntr) :: filtr_t, filtr_p ! snapshot file name |
---|
52 | character(len=100) :: filtr_t1,filtr_p1 ! snapshot file name |
---|
53 | |
---|
54 | |
---|
55 | contains |
---|
56 | |
---|
57 | ! 2=lecture des inputs |
---|
58 | !-------------------- |
---|
59 | |
---|
60 | subroutine input_clim ! routine qui permet d'initialiser les variables climatiques |
---|
61 | |
---|
62 | ! variables locales |
---|
63 | !------------------- |
---|
64 | |
---|
65 | implicit none |
---|
66 | integer :: i,j,mo,ti,tj |
---|
67 | character(len=8) :: control ! label to check clim. forc. file (filin) is usable |
---|
68 | integer :: l ! In snapshot files:the first column is the mask, read but not used |
---|
69 | real :: T_surf_ref ! variable de travail calcul temp a l'instant t a la surface S |
---|
70 | character(len=100) :: file_ncdf !< fichier netcdf issue des fichiers .dat |
---|
71 | real*8, dimension(:,:,:), pointer :: data_3D => null() ! donnees lues dans le netcdf |
---|
72 | |
---|
73 | ! lecture des fichiers snapshots pour tout geoplace |
---|
74 | ! ------------------------------------------------- |
---|
75 | write(6,*) 'lecture fichiers snapshots' |
---|
76 | |
---|
77 | !temperature |
---|
78 | filin=TRIM(dirnameinp)//TRIM(filtr_t1) |
---|
79 | call Read_ncdf_var('t2m',trim(filin),data_3D) ! Temperature |
---|
80 | Tm(:,:,:)=data_3D(:,:,:) |
---|
81 | ! ancienne lecture fichiers txt |
---|
82 | !!$ filin=trim(dirnameinp)//'climat_forcage_mois_file/'//trim(filtr_t1) |
---|
83 | !!$ write(6,*) 'lecture fichier ', trim(filin) |
---|
84 | !!$ |
---|
85 | !!$ open(20,file=trim(filin)) |
---|
86 | !!$ do j=1,ny |
---|
87 | !!$ do i=1,nx |
---|
88 | !!$ read(20,*) ti, tj, (Tm(i,j,mo),mo=1,12) |
---|
89 | !!$ end do |
---|
90 | !!$ end do |
---|
91 | !!$ close(20) |
---|
92 | |
---|
93 | !precipitation |
---|
94 | filin=TRIM(dirnameinp)//TRIM(filtr_p1) |
---|
95 | call Read_ncdf_var('pr',trim(filin),data_3D) ! precipitation |
---|
96 | Pm(:,:,:)=data_3D(:,:,:) |
---|
97 | |
---|
98 | ! conversion en m/an : |
---|
99 | ! Fichier ERA' en mm/jour |
---|
100 | ! FIchier NCEP2 en mm/s |
---|
101 | !!$ do mo=1,nbmois |
---|
102 | !!$ if (mo.eq.1.or.mo.eq.3.or.mo.eq.5.or.mo.eq.7.or.mo.eq.8.or.mo.eq.10.or.mo.eq.12) then |
---|
103 | !!$! Pm(:,:,mo)= Pm(:,:,mo)*31. ! ERA int |
---|
104 | !!$ Pm(:,:,mo)= Pm(:,:,mo)*86400.*31./1000. ! NCEP2 |
---|
105 | !!$ elseif (mo.eq.4.or.mo.eq.6.or.mo.eq.9.or.mo.eq.11) then |
---|
106 | !!$! Pm(:,:,mo)= Pm(:,:,mo)*30. ! ERA int |
---|
107 | !!$ Pm(:,:,mo)= Pm(:,:,mo)*86400.*30./1000. ! NCEP2 |
---|
108 | !!$ elseif (mo.eq.2) then |
---|
109 | !!$! Pm(:,:,mo)= Pm(:,:,mo)*28.25 ! ERA int |
---|
110 | !!$ Pm(:,:,mo)= Pm(:,:,mo)*86400.*28.25/1000. ! NCEP2 |
---|
111 | !!$ else |
---|
112 | !!$ print*,'ERREUR CONVERSION Precip input_clim climat_forcage_mois_mod' |
---|
113 | !!$ endif |
---|
114 | !!$ enddo |
---|
115 | |
---|
116 | |
---|
117 | ! ancienne lecture fichiers txt |
---|
118 | !!$ filin=trim(dirnameinp)//'climat_forcage_mois_file/'//trim(filtr_p1) |
---|
119 | !!$ write(6,*) 'lecture fichier ', trim(filin) |
---|
120 | !!$ |
---|
121 | !!$ open(20,file=trim(filin)) |
---|
122 | !!$ do j=1,ny |
---|
123 | !!$ do i=1,nx |
---|
124 | !!$ read(20,*) ti, tj, (Pm(i,j,mo),mo=1,12) |
---|
125 | !!$ end do |
---|
126 | !!$ end do |
---|
127 | !!$ close(20) |
---|
128 | |
---|
129 | |
---|
130 | |
---|
131 | !print*,'dans climat-forcage-mois' |
---|
132 | !print*,'Tm et Pm', Tm(100,100,3,1), Pm(100,100,3,1) |
---|
133 | |
---|
134 | ! Correction d'altitude pour que la temperature des snapshots soit celle |
---|
135 | ! sur l'altitude de reference S0 |
---|
136 | |
---|
137 | ! ATTENTION. Pour l'instant Ssnap(:,:,itr)= S topo initiale |
---|
138 | ! ensuite il faudra lire Ssnap dans le fichier forcage |
---|
139 | Ssnap(:,:)=S0(:,:) |
---|
140 | |
---|
141 | end subroutine input_clim |
---|
142 | |
---|
143 | |
---|
144 | |
---|
145 | !------------------------------------------------------------------------------- |
---|
146 | ! lecture de la namelist |
---|
147 | subroutine init_forclim |
---|
148 | |
---|
149 | real,dimension(12) :: lect_lapse ! lecture lapse rate |
---|
150 | integer :: mo |
---|
151 | |
---|
152 | ! fichiers snapshots |
---|
153 | namelist/snap_forcage_mois/filtr_t1,filtr_p1 |
---|
154 | |
---|
155 | ! dmr moved up since namelist declaration should be in the header |
---|
156 | namelist/lapse_month/lect_lapse |
---|
157 | |
---|
158 | ! formats pour les ecritures dans 42 |
---|
159 | 428 format(A) |
---|
160 | rewind(num_param) ! pour revenir au debut du fichier param_list.dat |
---|
161 | read(num_param,snap_forcage_mois) |
---|
162 | write(num_rep_42,428)'!___________________________________________________________' |
---|
163 | write(num_rep_42,428) '&snap_forcage_mois ! module climat_forcage_mois_mod' |
---|
164 | write(num_rep_42,'(A,A)') 'filtr_t1 = ', filtr_t1 |
---|
165 | write(num_rep_42,'(A,A)') 'filtr_p1 = ', filtr_p1 |
---|
166 | write(num_rep_42,*)'/' |
---|
167 | write(num_rep_42,428) '! fichiers temperature et precip : 12 mois' |
---|
168 | write(num_rep_42,*) |
---|
169 | |
---|
170 | ! lapserate |
---|
171 | rewind(num_param) ! pour revenir au debut du fichier param_list.dat |
---|
172 | read(num_param,lapse_month) |
---|
173 | write(num_rep_42,428)'!___________________________________________________________' |
---|
174 | write(num_rep_42,428) '&lapse_month ! module climat_forcage_mois_mod' |
---|
175 | write(num_rep_42,'(A,12(f0.2,","))') 'lapse_month = ', lect_lapse |
---|
176 | write(num_rep_42,*)'/' |
---|
177 | write(num_rep_42,428) '! laspe rates janvier -> decembre en deg/km' |
---|
178 | write(num_rep_42,*) |
---|
179 | |
---|
180 | ! pour repasser en deg/m et copier dans lapserate |
---|
181 | do mo=1,nbmois |
---|
182 | lapserate(:,:,mo)=lect_lapse(mo)/1000. |
---|
183 | enddo |
---|
184 | |
---|
185 | ! coefbmshelf coefficient pour la fusion basale sous les ice shelves |
---|
186 | ! ici pas d'evolution temporelle donc coefbmshelf est fixe |
---|
187 | coefbmshelf=1. |
---|
188 | |
---|
189 | end subroutine init_forclim |
---|
190 | |
---|
191 | |
---|
192 | !--------------------------------------------------------------------- |
---|
193 | !forcage climatique au cours du temps |
---|
194 | subroutine forclim |
---|
195 | |
---|
196 | integer i,j,mo |
---|
197 | |
---|
198 | ! Correction d'altitude pour la temperature y compris sur les lacs |
---|
199 | ! Zs est l'altitude de la surface qu'elle soit mer, glace ou lac |
---|
200 | |
---|
201 | do j=1,ny |
---|
202 | do i=1,nx |
---|
203 | ZS(I,J)=max(slv(i,j),S(I,J)) |
---|
204 | do mo=1,nbmois |
---|
205 | Tm_surf(i,j,mo)= - lapserate(i,j,mo) * (Zs(i,j)-S0(i,j)) + Tm(i,j,mo) |
---|
206 | Pm_surf(i,j,mo)= Pm(i,j,mo)*exp(0.05*(Tm_surf(i,j,mo)-Tm(i,j,mo))) |
---|
207 | end do |
---|
208 | end do |
---|
209 | end do |
---|
210 | |
---|
211 | !print*,'dans climat-forcage-mois aprec correction altitude surface' |
---|
212 | !print*,'Tm_surf et Pm_surf :', Tm_surf(100,100,3), Pm_surf(100,100,3) |
---|
213 | |
---|
214 | |
---|
215 | ! Tm_surf dans Tmois pour visibilite dans tous le code |
---|
216 | Tmois(:,:,:)=tm_surf(:,:,:) |
---|
217 | |
---|
218 | ! calcul de Tann et Tjuly pour les sorties : |
---|
219 | Tann(:,:)=sum(Tmois,dim=3)/12. ! moy annuelle |
---|
220 | Tjuly(:,:)=Tmois(:,:,7) ! temp juillet |
---|
221 | |
---|
222 | acc(:,:)=sum(Pm_surf,dim=3,mask=Tmois < psolid) ! /12. |
---|
223 | acc(:,:)=acc(:,:)*1000./ro |
---|
224 | |
---|
225 | END subroutine forclim |
---|
226 | |
---|
227 | |
---|
228 | end module climat_forcage_mois_mod |
---|