Changeset 429 for branches/GRISLIv3
- Timestamp:
- 04/25/23 18:08:16 (15 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/GRISLIv3/SOURCES/spinup_mod.f90
r206 r429 19 19 module spinup_vitbil 20 20 21 use module3D_phy 22 use param_phy_mod 23 use deformation_mod_2lois 24 use interface_input 25 use io_netcdf_grisli 26 21 use geography, only: nx,ny,nz 22 27 23 implicit none 28 24 … … 36 32 real, dimension(nx,ny) :: init_coefmy !< rescalling coefficient before limitation 37 33 38 ! compatibilites avec remplimat34 ! compatibilites avec remplimat 39 35 logical :: corr_def = .False. !< for deformation correction (compatibility) 40 36 41 37 real, dimension(nx,ny) :: Vsl_x !< 42 38 real, dimension(nx,ny) :: Vsl_y !< 43 39 44 40 integer :: type_vitbil ! defini le type de fichier a lire : lect_vitbil ou lect_vitbil_Lebrocq 45 41 … … 51 47 !< 52 48 subroutine init_spinup 53 namelist/spinup/ispinup,type_vitbil 49 50 use module3D_phy, only: ispinup,num_param,num_rep_42 51 use runparam, only : itracebug 52 53 namelist/spinup/ispinup,type_vitbil 54 54 55 55 ! put here which type of spinup … … 63 63 ! ispinup = 3 ! fait le calcul des temperatures 64 64 ! ! avec les vitesses de bilan 65 66 67 68 69 ! lecture des parametres70 71 rewind(num_param) ! pour revenir au debut du fichier param_list.dat72 read(num_param,spinup)73 74 write(num_rep_42,*)'!___________________________________________________________'75 write(num_rep_42,*)'! spinup module spinup_vitbil '76 write(num_rep_42,spinup) ! pour ecrire les parametres lus77 write(num_rep_42,*)78 write(num_rep_42,*)79 write(num_rep_42,*)'! ispinup = 0 run standard voir no_spinup'80 write(num_rep_42,*)'! ispinup = 1 equilibre temperature avec vitesses grisli voir no_spinup'81 write(num_rep_42,*)82 write(num_rep_42,*)'! ispinup >1 use spinup_vitbil'83 write(num_rep_42,*)'! ispinup = 2 conservation de la masse avec vitesses bilan '84 write(num_rep_42,*)'! ispinup = 3 equilibre temperature avec vitesses bilan'85 write(num_rep_42,*)'! type_vitbil type de lecture des vitesses de bilan 1: lect_vitbil, 2 : lect_vitbil_Lebrocq'86 write(num_rep_42,*)87 88 89 if (ispinup.eq.0) then90 write(6,*)' ispinup = 0 et ispinup = 1 doivent etre appeles par no_spinup '91 write(6,*) 'et il faut rajouter un dragging'92 stop93 endif94 95 if (ispinup.eq.3) then96 select case (type_vitbil)97 case (1)98 !cdc Methode Cat lecture fichier selon x et y sur grille stag99 call lect_vitbil100 case(2)101 !cdc Methode Tof lecture fichier Lebrocq vitesse et direction102 call lect_vitbil_Lebrocq103 case default104 print*,'type_vitbil valeur invalide dans spinup_vitbil'105 stop106 end select107 endif65 66 67 68 69 ! lecture des parametres 70 71 rewind(num_param) ! pour revenir au debut du fichier param_list.dat 72 read(num_param,spinup) 73 74 write(num_rep_42,*)'!___________________________________________________________' 75 write(num_rep_42,*)'! spinup module spinup_vitbil ' 76 write(num_rep_42,spinup) ! pour ecrire les parametres lus 77 write(num_rep_42,*) 78 write(num_rep_42,*) 79 write(num_rep_42,*)'! ispinup = 0 run standard voir no_spinup' 80 write(num_rep_42,*)'! ispinup = 1 equilibre temperature avec vitesses grisli voir no_spinup' 81 write(num_rep_42,*) 82 write(num_rep_42,*)'! ispinup >1 use spinup_vitbil' 83 write(num_rep_42,*)'! ispinup = 2 conservation de la masse avec vitesses bilan ' 84 write(num_rep_42,*)'! ispinup = 3 equilibre temperature avec vitesses bilan' 85 write(num_rep_42,*)'! type_vitbil type de lecture des vitesses de bilan 1: lect_vitbil, 2 : lect_vitbil_Lebrocq' 86 write(num_rep_42,*) 87 88 89 if (ispinup.eq.0) then 90 write(6,*)' ispinup = 0 et ispinup = 1 doivent etre appeles par no_spinup ' 91 write(6,*) 'et il faut rajouter un dragging' 92 stop 93 endif 94 95 if (ispinup.eq.3) then 96 select case (type_vitbil) 97 case (1) 98 !cdc Methode Cat lecture fichier selon x et y sur grille stag 99 call lect_vitbil 100 case(2) 101 !cdc Methode Tof lecture fichier Lebrocq vitesse et direction 102 call lect_vitbil_Lebrocq 103 case default 104 print*,'type_vitbil valeur invalide dans spinup_vitbil' 105 stop 106 end select 107 endif 108 108 109 109 if (itracebug.eq.1) call tracebug(' fin routine init_spinup de spinup_vitbil') … … 111 111 112 112 subroutine lect_vitbil 113 113 114 use module3D_phy, only: debug_3D,num_rep_42,num_param 115 use io_netcdf_grisli, only: Read_Ncdf_var 116 use geography, only: dirnameinp 117 use runparam, only : itracebug 118 114 119 character(len=100) :: balance_Ux_file ! balance velocity file Ux 115 120 character(len=100) :: balance_Uy_file ! balance velocity file Uy 116 117 121 real*8, dimension(:,:), pointer :: tab !< tableau 2d real pointer 122 118 123 namelist/vitbil_upwind/balance_Ux_file, balance_Uy_file 119 124 … … 135 140 136 141 ! read balance velocities on staggered nodes 137 142 138 143 balance_Ux_file = trim(dirnameinp)//trim(balance_Ux_file) 139 144 balance_Uy_file = trim(dirnameinp)//trim(balance_Uy_file) 140 145 141 146 call Read_Ncdf_var('Vcol_x',balance_Ux_file,tab) 142 147 Vcol_x(:,:)=tab(:,:) … … 144 149 Vcol_y(:,:)=tab(:,:) 145 150 146 ! call lect_input(2,'Vcol',1,Vcol_x,balance_vel_file,trim(dirnameinp)//trim(runname)//'.nc') !read Vcol_x147 ! call lect_input(2,'Vcol',2,Vcol_y,balance_vel_file,trim(dirnameinp)//trim(runname)//'.nc') !read Vcol_y151 ! call lect_input(2,'Vcol',1,Vcol_x,balance_vel_file,trim(dirnameinp)//trim(runname)//'.nc') !read Vcol_x 152 ! call lect_input(2,'Vcol',2,Vcol_y,balance_vel_file,trim(dirnameinp)//trim(runname)//'.nc') !read Vcol_y 148 153 !call lect_datfile(nx,ny,Vcol_x,1,balance_vel_file) ! read Vcol_x 149 154 !call lect_datfile(nx,ny,Vcol_y,2,balance_vel_file) ! read Vcol_y … … 153 158 154 159 end subroutine lect_vitbil 155 160 156 161 subroutine lect_vitbil_Lebrocq 157 162 158 163 use module3D_phy, only: num_rep_42,mstream_mx,itracebug,num_param,pi 164 use io_netcdf_grisli, only: Read_Ncdf_var 165 use geography, only: dirnameinp 166 use runparam, only : itracebug 167 159 168 character(len=100) :: vit_balance_file ! balance velocity file 160 169 character(len=100) :: flowdir_balance_file ! balance flow direction file … … 164 173 real, dimension(nx,ny) :: Vx_Lebrocq, Vy_Lebrocq ! vitesses selon x et y 165 174 integer, dimension(nx,ny) :: v_good !points avec vitesse Lebrocq OK 166 175 integer :: i,j 176 167 177 namelist/vitbil_Lebrocq/vit_balance_file, flowdir_balance_file 168 178 … … 184 194 185 195 ! read balance velocities on staggered nodes 186 196 187 197 vit_balance_file = trim(dirnameinp)//trim(vit_balance_file) 188 198 flowdir_balance_file = trim(dirnameinp)//trim(flowdir_balance_file) 189 199 190 200 call Read_Ncdf_var('z',vit_balance_file,tab) 191 201 V_Lebrocq(:,:)=tab(:,:) … … 194 204 195 205 where (V_Lebrocq(:,:).ge.0.) 196 v_good(:,:)=1206 v_good(:,:)=1 197 207 elsewhere 198 v_good(:,:)=0208 v_good(:,:)=0 199 209 endwhere 200 210 201 211 do j=2,ny-1 202 do i=2,nx-1203 if (V_Lebrocq(i,j).lt.0.) then204 205 V_Lebrocq(i,j)= (V_Lebrocq(i-1,j)*v_good(i-1,j) + V_Lebrocq(i+1,j)*v_good(i+1,j) + &206 207 208 endif209 enddo212 do i=2,nx-1 213 if (V_Lebrocq(i,j).lt.0.) then 214 215 V_Lebrocq(i,j)= (V_Lebrocq(i-1,j)*v_good(i-1,j) + V_Lebrocq(i+1,j)*v_good(i+1,j) + & 216 V_Lebrocq(i,j-1)*v_good(i,j-1) + V_Lebrocq(i,j+1)*v_good(i,j+1)) / & 217 (v_good(i-1,j)+v_good(i+1,j)+v_good(i,j-1)+v_good(i,j-1)) 218 endif 219 enddo 210 220 enddo 211 221 212 222 213 223 where (V_Lebrocq(:,:).ge.100.) 214 V_Lebrocq(:,:)=100.224 V_Lebrocq(:,:)=100. 215 225 endwhere 216 226 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 end subroutine lect_vitbil_Lebrocq 227 ! calcul des vitesses selon x et selon y : 228 where (V_Lebrocq(:,:).ge.0.) 229 Vx_Lebrocq(:,:) = V_Lebrocq(:,:)*sin(flowdir_Lebrocq(:,:)) 230 Vy_Lebrocq(:,:) = V_Lebrocq(:,:)*cos(flowdir_Lebrocq(:,:)) 231 elsewhere 232 Vx_Lebrocq(:,:) = 0. 233 Vy_Lebrocq(:,:) = 0. 234 endwhere 235 236 237 ! calcul des vitesses sur les points staggered 238 239 do j=2,ny 240 do i=2,nx 241 Vcol_x(i,j) = (Vx_Lebrocq(i-1,j) + Vx_Lebrocq(i,j))/2. 242 Vcol_y(i,j) = (Vy_Lebrocq(i,j-1) + Vy_Lebrocq(i,j))/2. 243 enddo 244 enddo 245 246 end subroutine lect_vitbil_Lebrocq 237 247 !____________________________________________________________________________________ 238 248 … … 242 252 subroutine init_dragging ! Cette routine fait l'initialisation du dragging. 243 253 254 use module3D_phy, only: mstream_mx,mstream_my,drag_mx,drag_my,gzmx,gzmy,flgzmx,flgzmy,flotmx,flotmy 255 244 256 implicit none 245 257 … … 265 277 266 278 subroutine force_balance_vel 267 279 280 use module3D_phy, only: uxbar, uybar,debug_3D 281 use runparam, only : itracebug 268 282 if (itracebug.eq.1) call tracebug(' Subroutine force_balance_vel') 269 283 … … 281 295 !< 282 296 subroutine calc_coef_vitbil 283 297 298 use module3D_phy, only: ddbx,ddby,gzmx,gzmy,flgzmx,flgzmy,fleuvemx,fleuvemy,flot,flotmx,flotmy,& 299 coefmxbmelt,coefmybmelt,sdx,sdy,uxbar,uybar,uxdef,uydef,ubx,uby,debug_3D,iglen 300 use deformation_mod_2lois, only: n1poly,n2poly,sa_mx,sa_my,s2a_mx,s2a_my 301 use runparam, only : itracebug 302 303 integer :: i,j,k 304 284 305 ddbx(:,:)=0. 285 306 ddby(:,:)=0. … … 290 311 fleuvemx(:,:)=.false. 291 312 fleuvemy(:,:)=.false. 292 313 293 314 do j=2,ny 294 do i=2,nx315 do i=2,nx 295 316 if (flot(i,j).and.(flot(i-1,j))) then 296 flotmx(i,j)=.true.297 flgzmx(i,j)=.true.298 gzmx(i,j)=.false.317 flotmx(i,j)=.true. 318 flgzmx(i,j)=.true. 319 gzmx(i,j)=.false. 299 320 end if 300 321 if (flot(i,j).and.(flot(i,j-1))) then 301 flotmy(i,j)=.true.302 flgzmy(i,j)=.true.303 gzmy(i,j)=.false.322 flotmy(i,j)=.true. 323 flgzmy(i,j)=.true. 324 gzmy(i,j)=.false. 304 325 end if 305 end do306 end do 307 326 end do 327 end do 328 308 329 where (coefmxbmelt(:,:).le.0.) 309 gzmx(:,:)=.false.330 gzmx(:,:)=.false. 310 331 endwhere 311 332 where (coefmybmelt(:,:).le.0.) 312 gzmy(:,:)=.false.333 gzmy(:,:)=.false. 313 334 endwhere 314 335 flgzmx(:,:) = flgzmx(:,:) .or. gzmx(:,:) … … 316 337 fleuvemx(:,:)=gzmx(:,:) 317 338 fleuvemy(:,:)=gzmy(:,:) 318 339 319 340 if (itracebug.eq.1) call tracebug(' Subroutine calc_coef_vitbil') 320 341 call slope_surf … … 341 362 coef_defmx(i,j) = 1. 342 363 Uxbar(i,j) = Vcol_x(i,j) 343 ! dmr below is a cast from a real*4 to logical*4344 ! dmr cannot be implicit in gfortran345 ! dmr flgzmx(i,j) = Vcol_x(i,j)364 ! dmr below is a cast from a real*4 to logical*4 365 ! dmr cannot be implicit in gfortran 366 ! dmr flgzmx(i,j) = Vcol_x(i,j) 346 367 flgzmx(i,j) = (nint(Vcol_x(i,j)).ne.0) 347 368 uxdef(i,j) = 0. … … 365 386 coef_defmx(i,j)=Vcol_x(i,j)/Ux_deformation(i,j) 366 387 ddbx(i,j) = 0 367 388 Ubx(i,j) = 0. 368 389 else 369 390 coef_defmx(i,j)=1. ! no rescaling of deformation … … 385 406 coef_defmy(i,j) = 1. 386 407 Uybar(i,j) = Vcol_y(i,j) 387 ! dmr below is a cast from a real*4 to logical*4388 ! dmr cannot be implicit in gfortran389 ! dmr flgzmy(i,j) = Vcol_y(i,j)408 ! dmr below is a cast from a real*4 to logical*4 409 ! dmr cannot be implicit in gfortran 410 ! dmr flgzmy(i,j) = Vcol_y(i,j) 390 411 flgzmy(i,j) = (nint(Vcol_y(i,j)).ne.0) 391 412 … … 393 414 Uby(i,j) = Vcol_y(i,j) 394 415 395 if ((itracebug.eq.1).and.(i.eq.313).and.(j.eq.143)) call tracebug(' test0')416 if ((itracebug.eq.1).and.(i.eq.313).and.(j.eq.143)) call tracebug(' test0') 396 417 else 397 418 coldy: if ((coefmybmelt(i,j).le.0.).and.(.not.gzmy(i,j))) then !base froide … … 402 423 if (abs(Uy_deformation(i,j)).gt.0.01) then ! calcule par calc_ubar_def 403 424 coef_defmy(i,j)=Vcol_y(i,j)/Uy_deformation(i,j) 404 if ((itracebug.eq.1).and.(i.eq.313).and.(j.eq.143)) call tracebug(' test1')425 if ((itracebug.eq.1).and.(i.eq.313).and.(j.eq.143)) call tracebug(' test1') 405 426 else 406 if ((itracebug.eq.1).and.(i.eq.313).and.(j.eq.143)) call tracebug(' test2')427 if ((itracebug.eq.1).and.(i.eq.313).and.(j.eq.143)) call tracebug(' test2') 407 428 coef_defmy(i,j)=1. 408 429 end if … … 412 433 ddby(i,j) = 0. 413 434 Uby(i,j) = 0. 414 if ((itracebug.eq.1).and.(i.eq.313).and.(j.eq.143)) call tracebug(' test3')435 if ((itracebug.eq.1).and.(i.eq.313).and.(j.eq.143)) call tracebug(' test3') 415 436 else 416 437 coef_defmy(i,j)=1. ! pas de rescaling de la deformation 417 438 ddby(i,j)=-(Vcol_y(i,j)-Uy_deformation(i,j))/sdy(i,j) ! pb si directions opposees 418 439 Uby(i,j) = Vcol_y(i,j)-Uy_deformation(i,j) 419 if ((itracebug.eq.1).and.(i.eq.313).and.(j.eq.144)) call tracebug(' test4')440 if ((itracebug.eq.1).and.(i.eq.313).and.(j.eq.144)) call tracebug(' test4') 420 441 421 442 end if … … 426 447 end do 427 448 end do 428 if (itracebug.eq.1) call tracebug(' apres test floty')449 if (itracebug.eq.1) call tracebug(' apres test floty') 429 450 430 451 ! remarque coef peut être <1 a cause de la pente locale, mais il joue toujours son role … … 453 474 454 475 subroutine limit_coef_vitbil 455 476 477 use module3D_phy, only: sdx,sdy,flotmx,flotmy,coefmxbmelt,coefmybmelt,gzmx,gzmy,ddbx,ddby,debug_3D,& 478 iglen 479 use deformation_mod_2lois, only: n1poly,n2poly,sa_mx,sa_my,s2a_mx,s2a_my 480 use runparam, only : itracebug 481 482 integer :: i,j,k 483 456 484 call slope_surf 457 485 … … 583 611 subroutine calc_ubar_def ! calculate velocity due to deformation before calibration 584 612 613 use module3D_phy, only: iglen,flotmx,flotmy,hmx,hmy,sdx,sdy,slope2mx,slope2my 614 use deformation_mod_2lois, only: n1poly,n2poly,glen,s2a_mx,s2a_my,ddx,ddy 615 use geography, only: dx,dy 616 use param_phy_mod, only: rog 617 use runparam, only: itracebug 618 585 619 implicit none ! extrait de diffusiv pour calculer la partie deformation 586 620 … … 588 622 real :: inv_4dx ! inverse de dx pour eviter les divisions =1/(4*dx) 589 623 real :: inv_4dy ! inverse de dy pour eviter les divisions =1/(4*dy) 624 integer :: i,j 590 625 591 626 inv_4dx=1./(4*dx) … … 646 681 647 682 subroutine ajust_ghf 648 683 684 use module3D_phy, only: debug_3D,flot,ibase,ghf,ghf0,secyear 685 649 686 implicit none 687 650 688 real,dimension(nx,ny) :: coefdef_maj !< coefficient deformation 651 689 real :: increment_ghf 652 690 real :: ghf_min 691 integer :: i,j 692 653 693 increment_ghf=0.00001 !< exprime en W/m2 654 694 ghf_min=0.025
Note: See TracChangeset
for help on using the changeset viewer.