[9] | 1 | module climat_forcage_mois_mod |
---|
| 2 | |
---|
| 3 | ! forcage avec champs mensuels |
---|
[11] | 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 |
---|
[9] | 8 | |
---|
[11] | 9 | USE module3D_phy,only:nx,ny,S,S0,slv,Tann,Tjuly,Tmois,acc,coefbmshelf,ro,num_param,num_rep_42,dirnameinp |
---|
[17] | 10 | use netcdf |
---|
| 11 | use io_netcdf_grisli |
---|
[9] | 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 | |
---|
[17] | 22 | integer,parameter :: nbmois=12 |
---|
[9] | 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 |
---|
[17] | 38 | real,dimension(nx,ny,nbmois) :: Tm ! temperature mensuelle |
---|
| 39 | real,dimension(nx,ny,nbmois) :: Pm ! precipitation mensuelle |
---|
[9] | 40 | |
---|
[17] | 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) |
---|
[9] | 43 | |
---|
| 44 | real,dimension(nx,ny) :: ZS !< surface topography above sea level |
---|
| 45 | |
---|
[17] | 46 | real,dimension(nx,ny,nbmois) :: lapserate ! lapse rate |
---|
[9] | 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 |
---|
[65] | 66 | ! integer :: i,j,mo,ti,tj |
---|
| 67 | ! integer :: l ! In snapshot files:the first column is the mask, read but not used |
---|
| 68 | ! real :: T_surf_ref ! variable de travail calcul temp a l'instant t a la surface S |
---|
| 69 | ! character(len=100) :: file_ncdf !< fichier netcdf issue des fichiers .dat |
---|
[17] | 70 | real*8, dimension(:,:,:), pointer :: data_3D => null() ! donnees lues dans le netcdf |
---|
[9] | 71 | |
---|
| 72 | ! lecture des fichiers snapshots pour tout geoplace |
---|
| 73 | ! ------------------------------------------------- |
---|
| 74 | write(6,*) 'lecture fichiers snapshots' |
---|
| 75 | |
---|
| 76 | !temperature |
---|
[17] | 77 | filin=TRIM(dirnameinp)//TRIM(filtr_t1) |
---|
| 78 | call Read_ncdf_var('t2m',trim(filin),data_3D) ! Temperature |
---|
| 79 | Tm(:,:,:)=data_3D(:,:,:) |
---|
| 80 | ! ancienne lecture fichiers txt |
---|
| 81 | !!$ filin=trim(dirnameinp)//'climat_forcage_mois_file/'//trim(filtr_t1) |
---|
| 82 | !!$ write(6,*) 'lecture fichier ', trim(filin) |
---|
| 83 | !!$ |
---|
| 84 | !!$ open(20,file=trim(filin)) |
---|
| 85 | !!$ do j=1,ny |
---|
| 86 | !!$ do i=1,nx |
---|
| 87 | !!$ read(20,*) ti, tj, (Tm(i,j,mo),mo=1,12) |
---|
| 88 | !!$ end do |
---|
| 89 | !!$ end do |
---|
| 90 | !!$ close(20) |
---|
[9] | 91 | |
---|
| 92 | !precipitation |
---|
[17] | 93 | filin=TRIM(dirnameinp)//TRIM(filtr_p1) |
---|
| 94 | call Read_ncdf_var('pr',trim(filin),data_3D) ! precipitation |
---|
| 95 | Pm(:,:,:)=data_3D(:,:,:) |
---|
[9] | 96 | |
---|
[17] | 97 | ! conversion en m/an : |
---|
| 98 | ! Fichier ERA' en mm/jour |
---|
[18] | 99 | ! FIchier NCEP2 en mm/s |
---|
[27] | 100 | !!$ do mo=1,nbmois |
---|
| 101 | !!$ 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 |
---|
| 102 | !!$! Pm(:,:,mo)= Pm(:,:,mo)*31. ! ERA int |
---|
| 103 | !!$ Pm(:,:,mo)= Pm(:,:,mo)*86400.*31./1000. ! NCEP2 |
---|
| 104 | !!$ elseif (mo.eq.4.or.mo.eq.6.or.mo.eq.9.or.mo.eq.11) then |
---|
| 105 | !!$! Pm(:,:,mo)= Pm(:,:,mo)*30. ! ERA int |
---|
| 106 | !!$ Pm(:,:,mo)= Pm(:,:,mo)*86400.*30./1000. ! NCEP2 |
---|
| 107 | !!$ elseif (mo.eq.2) then |
---|
| 108 | !!$! Pm(:,:,mo)= Pm(:,:,mo)*28.25 ! ERA int |
---|
| 109 | !!$ Pm(:,:,mo)= Pm(:,:,mo)*86400.*28.25/1000. ! NCEP2 |
---|
| 110 | !!$ else |
---|
| 111 | !!$ print*,'ERREUR CONVERSION Precip input_clim climat_forcage_mois_mod' |
---|
| 112 | !!$ endif |
---|
| 113 | !!$ enddo |
---|
[9] | 114 | |
---|
[18] | 115 | |
---|
[17] | 116 | ! ancienne lecture fichiers txt |
---|
| 117 | !!$ filin=trim(dirnameinp)//'climat_forcage_mois_file/'//trim(filtr_p1) |
---|
| 118 | !!$ write(6,*) 'lecture fichier ', trim(filin) |
---|
| 119 | !!$ |
---|
| 120 | !!$ open(20,file=trim(filin)) |
---|
| 121 | !!$ do j=1,ny |
---|
| 122 | !!$ do i=1,nx |
---|
| 123 | !!$ read(20,*) ti, tj, (Pm(i,j,mo),mo=1,12) |
---|
| 124 | !!$ end do |
---|
| 125 | !!$ end do |
---|
| 126 | !!$ close(20) |
---|
[9] | 127 | |
---|
| 128 | |
---|
[17] | 129 | |
---|
[9] | 130 | !print*,'dans climat-forcage-mois' |
---|
| 131 | !print*,'Tm et Pm', Tm(100,100,3,1), Pm(100,100,3,1) |
---|
| 132 | |
---|
| 133 | ! Correction d'altitude pour que la temperature des snapshots soit celle |
---|
| 134 | ! sur l'altitude de reference S0 |
---|
| 135 | |
---|
| 136 | ! ATTENTION. Pour l'instant Ssnap(:,:,itr)= S topo initiale |
---|
| 137 | ! ensuite il faudra lire Ssnap dans le fichier forcage |
---|
| 138 | Ssnap(:,:)=S0(:,:) |
---|
| 139 | |
---|
| 140 | end subroutine input_clim |
---|
| 141 | |
---|
| 142 | |
---|
| 143 | |
---|
| 144 | !------------------------------------------------------------------------------- |
---|
| 145 | ! lecture de la namelist |
---|
| 146 | subroutine init_forclim |
---|
| 147 | |
---|
| 148 | real,dimension(12) :: lect_lapse ! lecture lapse rate |
---|
| 149 | integer :: mo |
---|
| 150 | |
---|
| 151 | ! fichiers snapshots |
---|
| 152 | namelist/snap_forcage_mois/filtr_t1,filtr_p1 |
---|
| 153 | |
---|
[22] | 154 | ! dmr moved up since namelist declaration should be in the header |
---|
| 155 | namelist/lapse_month/lect_lapse |
---|
| 156 | |
---|
[9] | 157 | ! formats pour les ecritures dans 42 |
---|
| 158 | 428 format(A) |
---|
| 159 | rewind(num_param) ! pour revenir au debut du fichier param_list.dat |
---|
| 160 | read(num_param,snap_forcage_mois) |
---|
| 161 | write(num_rep_42,428)'!___________________________________________________________' |
---|
| 162 | write(num_rep_42,428) '&snap_forcage_mois ! module climat_forcage_mois_mod' |
---|
| 163 | write(num_rep_42,'(A,A)') 'filtr_t1 = ', filtr_t1 |
---|
| 164 | write(num_rep_42,'(A,A)') 'filtr_p1 = ', filtr_p1 |
---|
| 165 | write(num_rep_42,*)'/' |
---|
| 166 | write(num_rep_42,428) '! fichiers temperature et precip : 12 mois' |
---|
| 167 | write(num_rep_42,*) |
---|
| 168 | |
---|
| 169 | ! lapserate |
---|
| 170 | rewind(num_param) ! pour revenir au debut du fichier param_list.dat |
---|
| 171 | read(num_param,lapse_month) |
---|
| 172 | write(num_rep_42,428)'!___________________________________________________________' |
---|
| 173 | write(num_rep_42,428) '&lapse_month ! module climat_forcage_mois_mod' |
---|
| 174 | write(num_rep_42,'(A,12(f0.2,","))') 'lapse_month = ', lect_lapse |
---|
| 175 | write(num_rep_42,*)'/' |
---|
| 176 | write(num_rep_42,428) '! laspe rates janvier -> decembre en deg/km' |
---|
| 177 | write(num_rep_42,*) |
---|
| 178 | |
---|
| 179 | ! pour repasser en deg/m et copier dans lapserate |
---|
[17] | 180 | do mo=1,nbmois |
---|
[9] | 181 | lapserate(:,:,mo)=lect_lapse(mo)/1000. |
---|
| 182 | enddo |
---|
| 183 | |
---|
| 184 | ! coefbmshelf coefficient pour la fusion basale sous les ice shelves |
---|
| 185 | ! ici pas d'evolution temporelle donc coefbmshelf est fixe |
---|
| 186 | coefbmshelf=1. |
---|
| 187 | |
---|
| 188 | end subroutine init_forclim |
---|
| 189 | |
---|
| 190 | |
---|
| 191 | !--------------------------------------------------------------------- |
---|
| 192 | !forcage climatique au cours du temps |
---|
| 193 | subroutine forclim |
---|
| 194 | |
---|
| 195 | integer i,j,mo |
---|
| 196 | |
---|
| 197 | ! Correction d'altitude pour la temperature y compris sur les lacs |
---|
| 198 | ! Zs est l'altitude de la surface qu'elle soit mer, glace ou lac |
---|
| 199 | |
---|
| 200 | do j=1,ny |
---|
| 201 | do i=1,nx |
---|
| 202 | ZS(I,J)=max(slv(i,j),S(I,J)) |
---|
[17] | 203 | do mo=1,nbmois |
---|
[9] | 204 | Tm_surf(i,j,mo)= - lapserate(i,j,mo) * (Zs(i,j)-S0(i,j)) + Tm(i,j,mo) |
---|
| 205 | Pm_surf(i,j,mo)= Pm(i,j,mo)*exp(0.05*(Tm_surf(i,j,mo)-Tm(i,j,mo))) |
---|
| 206 | end do |
---|
| 207 | end do |
---|
| 208 | end do |
---|
| 209 | |
---|
| 210 | !print*,'dans climat-forcage-mois aprec correction altitude surface' |
---|
| 211 | !print*,'Tm_surf et Pm_surf :', Tm_surf(100,100,3), Pm_surf(100,100,3) |
---|
| 212 | |
---|
| 213 | |
---|
| 214 | ! Tm_surf dans Tmois pour visibilite dans tous le code |
---|
| 215 | Tmois(:,:,:)=tm_surf(:,:,:) |
---|
| 216 | |
---|
| 217 | ! calcul de Tann et Tjuly pour les sorties : |
---|
| 218 | Tann(:,:)=sum(Tmois,dim=3)/12. ! moy annuelle |
---|
| 219 | Tjuly(:,:)=Tmois(:,:,7) ! temp juillet |
---|
| 220 | |
---|
| 221 | acc(:,:)=sum(Pm_surf,dim=3,mask=Tmois < psolid) ! /12. |
---|
| 222 | acc(:,:)=acc(:,:)*1000./ro |
---|
| 223 | |
---|
| 224 | END subroutine forclim |
---|
| 225 | |
---|
| 226 | |
---|
| 227 | end module climat_forcage_mois_mod |
---|