- Timestamp:
- 06/18/19 11:50:42 (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/SOURCES/bmelt-ismip6-param_mod.f90
r252 r264 17 17 module bmelt_ismip6_param_mod 18 18 19 use module3D_phy,only: nx,ny,dx,dy,ro,rofresh,row,cl,S,H,sealevel_2d,flot,bmelt,dirnameinp,num_param,num_rep_42 19 use module3D_phy,only: nx,ny,dx,dy,ro,rofresh,row,cl,S,H,sealevel_2d,flot,bmelt,dirnameinp,num_param,num_rep_42,time,dt 20 20 ! note: the geom. (nx,ny,dx,dy) come from module_geoplace 21 21 ! note: the densities come from param_phy_mod … … 40 40 integer :: Nbasin !< number of oceanic basin 41 41 42 ! For initMIP, we need to read an anomaly of bmelt...: 43 integer :: bmelt_time !< pour selectionner le type de calcul de bmelt 44 double precision,dimension(nx,ny) :: bmelt_anom !< anomalie de bmelt pour exp initMIP abmb 45 double precision,dimension(nx,ny,nzoc) :: TF_0 !> thermal_forcing initial 46 double precision,dimension(:,:,:,:),allocatable :: TF_anom !< anomalie de thermal_forcing pour exp ISMIP 47 real,dimension(:),allocatable :: time_snap !> date des snapshots indice : nb de nb_snap 48 real :: time_depart_snaps !> temps du debut premier snapshot 49 integer :: nb_snap !> nombre de snapshots 42 50 contains 43 51 … … 49 57 50 58 51 real*8, dimension(:), pointer :: tab1d => null() !< 2d array real pointer, needed for netcdf readings 52 real*8, dimension(:,:), pointer :: tab2d => null() !< 2d array real pointer, needed for netcdf readings 53 real*8, dimension(:,:,:), pointer :: tab3d => null() !< 3d array real pointer, needed for netcdf readings 59 real*8, dimension(:), pointer :: tab1d => null() !< 2d array real pointer, needed for netcdf readings 60 real*8, dimension(:,:), pointer :: tab2d => null() !< 2d array real pointer, needed for netcdf readings 61 real*8, dimension(:,:,:), pointer :: tab3d => null() !< 3d array real pointer, needed for netcdf readings 62 real*8, dimension(:,:,:,:), pointer :: tab4d => null() !< 4d array real pointer, needed for netcdf readings 54 63 55 64 character(len=100) :: file_inputs !< files read … … 57 66 character(len=100) :: file_basinNumbers !< files read 58 67 character(len=100) :: file_coef !< files read 59 60 integer i,j !juste pour les verifs 68 character(len=100) :: file_bmelt_anom !< files read 69 70 integer :: i,j !juste pour les verifs 71 integer :: err ! recuperation d'erreur 61 72 62 73 namelist/bmelt_ismip6_param/file_TF,file_basinNumbers,file_coef,gamma0 74 namelist/bmelt_anom_initMIP/file_bmelt_anom,nb_snap,time_depart_snaps,bmelt_time 63 75 64 76 rewind(num_param) ! loop back at the beginning of the param_list.dat file … … 100 112 thermal_forcing(:,:,:) = 3.5 101 113 endwhere 102 114 TF_0(:,:,:) = thermal_forcing(:,:,:) 115 116 ! ______ Anomalies... 117 118 rewind(num_param) ! pour revenir au debut du fichier param_list.dat 119 read(num_param,bmelt_anom_initMIP) 120 121 write(num_rep_42,'(A)')'! module bmelt_ismip6_param ' 122 write(num_rep_42,bmelt_anom_initMIP) 123 write(num_rep_42,'(A)')'! file_bmelt_anom = fichier anomalie bmelt ' 124 write(num_rep_42,'(A)')'! nb_snap = nombre de snapshots ' 125 write(num_rep_42,'(A)')'! time_depart_snaps = debut du forçage ' 126 write(num_rep_42,'(A)')'! bmelt_time = 0:fixe, 1:anomalies, 2:interp snapshots ' 127 write(num_rep_42,'(A)')'!_______________________________________________________________________' 128 129 file_bmelt_anom = trim(dirnameinp)//trim(file_bmelt_anom) 130 131 if ( bmelt_time == 1 ) then 132 call Read_Ncdf_var('abmb',file_bmelt_anom,tab2d) 133 bmelt_anom (:,:) = tab2d(:,:) 134 elseif (bmelt_time == 2) then ! fichier 3D de TF_anom : lecture des snapshots 135 ! allocation dynamique de time_snap 136 if (allocated(time_snap)) then 137 deallocate(time_snap,stat=err) 138 if (err/=0) then 139 print *,"Erreur à la desallocation de time_snap",err 140 stop 141 end if 142 end if 143 144 allocate(time_snap(nb_snap),stat=err) 145 if (err/=0) then 146 print *,"erreur a l'allocation du tableau time_snap ",err 147 print *,"nb_snap = ",nb_snap 148 stop 149 end if 150 ! allocation dynamique de TF_anom 151 if (allocated(TF_anom)) then 152 deallocate(TF_anom,stat=err) 153 if (err/=0) then 154 print *,"Erreur à la desallocation de TF_anom",err 155 stop 156 end if 157 end if 158 159 allocate(TF_anom(nx,ny,nzoc,nb_snap),stat=err) 160 if (err/=0) then 161 print *,"erreur a l'allocation du tableau TF_anom ",err 162 print *,"nx,ny,nb_snap = ",nx,',',ny,',',nb_snap 163 stop 164 end if 165 ! lecture de tann_snap 166 call Read_Ncdf_var('thermal_forcing',file_bmelt_anom,tab4D) 167 TF_anom(:,:,:,:) = tab4D(:,:,:,:) 168 169 ! lecture de time_snap 170 call Read_Ncdf_var('time',file_bmelt_anom,tab1D) 171 time_snap(:) = tab1D(:) 172 time_snap(:) = time_snap(:) + time_depart_snaps 173 endif 103 174 end subroutine init_bmelt 104 175 … … 115 186 real*8 :: bmloc 116 187 188 real :: coefanomtime ! pour initMIP abmb 189 117 190 allocate( mean_TF(Nbasin), IS_area(Nbasin) ) 191 192 if (bmelt_time == 0) then 193 coefanomtime = 0. 194 else if (bmelt_time == 1) then 195 coefanomtime = min ( real(time/40.) , 1. ) 196 else if (bmelt_time == 2) then 197 call TF_ISMIP_RCM 198 end if 118 199 119 200 mean_TF(:) = 0.d0 … … 176 257 if ( TF_draft(i,j) .gt. -5.d0 ) then !floating points 177 258 if ((mean_TF(basinNumber(i,j)+1).gt.-9999.d0).and.(H(i,j).gt.200.)) then !should use Hcoup 178 bmelt(i,j) = gamma0 * cste * ( TF_draft(i,j) + deltaT_basin(i,j) )* abs( mean_TF(basinNumber(i,j)+1) + deltaT_basin(i,j) ) 259 bmelt(i,j) = gamma0 * cste * ( TF_draft(i,j) + deltaT_basin(i,j) )* abs( mean_TF(basinNumber(i,j)+1) + deltaT_basin(i,j) ) 179 260 !if (bmelt(i,j).lt.-0.2) then 180 261 ! write(*,*) "Strong sub-shelf refreezing: ", bmelt(i,j), i,j,flot(i,j),ice_draft(i,j),TF_draft(i,j), mean_TF(basinNumber(i,j)+1), deltaT_basin(i,j) … … 183 264 bmelt(i,j) = gamma0 * cste * max( TF_draft(i,j) + deltaT_basin(i,j) , 0.d0 ) * max( TF_draft(i,j) + deltaT_basin(i,j) , 0.d0 ) 184 265 endif 266 if (bmelt_time.eq.1) bmelt(i,j) = bmelt(i,j) + (coefanomtime * bmelt_anom(i,j)) 185 267 endif 186 268 enddo … … 209 291 endif 210 292 bmelt(i,j)=(ngr/4.)*bmloc+(1-ngr/4.)*bmelt(i,j) 293 if (bmelt_time.eq.1) bmelt(i,j) = bmelt(i,j) + ((ngr/4.) * coefanomtime * bmelt_anom(i,j)) 211 294 endif 212 295 enddo … … 216 299 end subroutine bmeltshelf 217 300 301 subroutine TF_ISMIP_RCM ! calcule le thermal forcing a partir des snapshots d'anomalies 302 303 implicit none 304 integer :: k, k_snap ! pour calculer les indices de temps 305 real :: time_prec 306 real,dimension(nx,ny,nzoc) :: thermal_forcing_time ! pour calcul Thermal forcing 307 308 ! calcul TF a partir fichier snapshots TF_ISMIP_RCM 309 ! Calcule le mass balance d'apres un fichier de snapshots 310 311 ! calcule thermal_forcing_time par interpolation entre deux snapshots 312 ! avant prend la valeur de reference 313 ! apres prend la derniere valeur 314 ! en general les snapshots vont de 1995 a 2100 (time_snap de 0 à 105) 315 if(time.lt.time_snap(1)) then ! time avant le forcage 316 thermal_forcing_time(:,:,:) = TF_0(:,:,:) 317 k_snap = 1 318 ! S_ref(:,:) = S(:,:) ! du coup sera la surface de reference avant le forcage 319 time_prec = time 320 else if (time.ge.time_snap(nb_snap)) then ! time apres le forcage 321 thermal_forcing_time(:,:,:) = TF_0(:,:,:) + TF_anom(:,:,:,nb_snap) 322 if (abs(time-time_prec-1.).lt.dt) then ! 323 time_prec = time_prec + 1 324 endif 325 else ! cas general 326 do k = 1 , nb_snap-1 327 if((time.ge.time_snap(k)).and.(time.lt.time_snap(k+1))) then ! entre k et k+1 328 thermal_forcing_time(:,:,:) = TF_0(:,:,:) + TF_anom(:,:,:,k) + (TF_anom(:,:,:,k+1)-TF_anom(:,:,:,k)) * & 329 (time-time_snap(k))/(time_snap(k+1)-time_snap(k)) 330 ! exactement sur le snapshot et avec un ecart 1 an par rapport au precedent stockage 331 ! write(6,*) 'time,tests',k,time,time-time_snap(k),time-time_prec-1. 332 if ((abs(time-time_snap(k)).le.dt).and.(abs(time-time_prec-1.).lt.dt)) then 333 k_snap = k 334 time_prec = time_snap(k) ! time_prec est le temps du precedent 335 endif 336 exit 337 endif 338 end do 339 endif 340 341 thermal_forcing(:,:,:) = thermal_forcing_time(:,:,:) 342 ! print*,'TF_ISMIP_RCM time_snap TF', k, time_snap(k), time_snap(k+1), thermal_forcing_time(163,89,1), thermal_forcing_time(194,131,1),TF_0(163,89,1),TF_0(194,131,1) 343 344 end subroutine TF_ISMIP_RCM 345 218 346 219 347
Note: See TracChangeset
for help on using the changeset viewer.