Changeset 378


Ignore:
Timestamp:
03/21/23 11:11:44 (13 months ago)
Author:
dumas
Message:

use only in module bilan_eau_mod

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/GRISLIv3/SOURCES/bilan_eau_mod.f90

    r255 r378  
    1919module bilan_eau_mod 
    2020 
     21  use param_phy_mod, only: ro,row 
     22  use runparam, only: nt 
     23  use module3D_phy, only: nx,ny,H,Bsoc,ice,sealevel_2d,gr_line,uxbar,uybar,flot_marais,dtt,& 
     24       bm,bmelt,dt,dx,dy,isynchro,time,dtmin,ablbord_dtt,water_bilan 
    2125 
    22 use module3D_phy 
    23 implicit none 
     26  implicit none 
    2427 
    25 real :: sum_H 
     28  real :: sum_H 
    2629 
     30  real,dimension(nx,ny) :: tot_water    !< bilan d'eau 
     31  real,dimension(nx,ny) :: H_beau_old, diff_H_2D, diff_H_water_bilan 
     32  real,dimension(nx,ny) :: Bm_dtt       !< mass balance on ice points accumulated during dtt 
     33  real,dimension(nx,ny) :: Bmelt_dtt    !< basal melting on ice points accumulated during dtt 
     34  real,dimension(nx,ny) :: calv_dtt     !< calving sur dtt (pour calcul bilan d'eau) 
     35  real,dimension(nx,ny) :: archimtab    ! point pose si > 0 
     36  real,dimension(nx,ny) :: grline_dtt   ! grounding line flux during dtt 
    2737 
    28 real,dimension(nx,ny) :: tot_water    !< bilan d'eau 
    29 real,dimension(nx,ny) :: H_beau_old, diff_H_2D, diff_H_water_bilan 
    30 real,dimension(nx,ny) :: Bm_dtt       !< mass balance on ice points accumulated during dtt 
    31 real,dimension(nx,ny) :: Bmelt_dtt    !< basal melting on ice points accumulated during dtt 
    32 real,dimension(nx,ny) :: calv_dtt     !< calving sur dtt (pour calcul bilan d'eau) 
    33 real,dimension(nx,ny) :: archimtab    ! point pose si > 0 
    34 real,dimension(nx,ny) :: grline_dtt   ! grounding line flux during dtt 
     38  real :: sum_H_old 
     39  real :: diff_H 
     40  real :: alpha_flot                      ! ro/row 
     41  real :: dtt_flux   ! 1 an si dtt<1an sinon dtt_loc=dtt  
    3542 
    36 real :: sum_H_old 
    37 real :: diff_H 
    38 real :: alpha_flot                      ! ro/row 
    39 real :: dtt_flux   ! 1 an si dtt<1an sinon dtt_loc=dtt  
    40  
    41 real,dimension(nx,ny) :: bm_dt,bmelt_dt 
     43  real,dimension(nx,ny) :: bm_dt,bmelt_dt 
    4244 
    4345 
    4446contains 
    4547 
    46 subroutine init_bilan_eau 
    47  ! initialisation des variables 
    48   diff_H=0. 
    49   sum_H_old = sum(H(2:nx-1,2:ny-1),mask=ice(2:nx-1,2:ny-1)==1) 
    50   H_beau_old(:,:)=H(:,:) 
    51   tot_water(:,:)=0. 
    52   bm_dt(:,:)=0. 
    53   bmelt_dt(:,:)=0. 
    54   alpha_flot=ro/row 
    55   archimtab(:,:) = Bsoc(:,:)+H(:,:)*alpha_flot - sealevel_2d(:,:) 
    56   gr_line(:,:)=0 
    57   do j=1,ny 
    58     do i=1,nx 
    59       !afq    if ((H(i,j).gt.0.).and.(archimtab(i,j).GE.0.).and.(Bsoc(i,j).LE.sealevel_2d(i,j))) then ! grounded with ice 
    60       if ((H(i,j).gt.0.).and.(archimtab(i,j).GE.0.)) then ! grounded with ice 
    61         if (archimtab(i-1,j).LT.0..and.Uxbar(i,j).LT.0..and..not.flot_marais(i-1,j)) gr_line(i,j)=1 
    62         if (archimtab(i+1,j).LT.0..and.Uxbar(i+1,j).GT.0..and..not.flot_marais(i+1,j)) gr_line(i,j)=1 
    63         if (archimtab(i,j-1).LT.0..and.Uybar(i,j).LT.0..and..not.flot_marais(i,j-1)) gr_line(i,j)=1 
    64         if (archimtab(i,j+1).LT.0..and.Uybar(i,j+1).GT.0..and..not.flot_marais(i,j+1)) gr_line(i,j)=1 
    65       endif 
     48  subroutine init_bilan_eau 
     49 
     50    integer :: i,j 
     51     
     52    ! initialisation des variables 
     53    diff_H=0. 
     54    sum_H_old = sum(H(2:nx-1,2:ny-1),mask=ice(2:nx-1,2:ny-1)==1) 
     55    H_beau_old(:,:)=H(:,:) 
     56    tot_water(:,:)=0. 
     57    bm_dt(:,:)=0. 
     58    bmelt_dt(:,:)=0. 
     59    alpha_flot=ro/row 
     60    archimtab(:,:) = Bsoc(:,:)+H(:,:)*alpha_flot - sealevel_2d(:,:) 
     61    gr_line(:,:)=0 
     62    do j=1,ny 
     63       do i=1,nx 
     64          !afq    if ((H(i,j).gt.0.).and.(archimtab(i,j).GE.0.).and.(Bsoc(i,j).LE.sealevel_2d(i,j))) then ! grounded with ice 
     65          if ((H(i,j).gt.0.).and.(archimtab(i,j).GE.0.)) then ! grounded with ice 
     66             if (archimtab(i-1,j).LT.0..and.Uxbar(i,j).LT.0..and..not.flot_marais(i-1,j)) gr_line(i,j)=1 
     67             if (archimtab(i+1,j).LT.0..and.Uxbar(i+1,j).GT.0..and..not.flot_marais(i+1,j)) gr_line(i,j)=1 
     68             if (archimtab(i,j-1).LT.0..and.Uybar(i,j).LT.0..and..not.flot_marais(i,j-1)) gr_line(i,j)=1 
     69             if (archimtab(i,j+1).LT.0..and.Uybar(i,j+1).GT.0..and..not.flot_marais(i,j+1)) gr_line(i,j)=1 
     70          endif 
     71       enddo 
    6672    enddo 
    67   enddo 
    68   if (dtt.ge.1.) then 
    69     dtt_flux=dtt 
    70   else 
    71     dtt_flux=1. 
    72   endif 
     73    if (dtt.ge.1.) then 
     74       dtt_flux=dtt 
     75    else 
     76       dtt_flux=1. 
     77    endif 
    7378 
    74 end subroutine init_bilan_eau 
     79  end subroutine init_bilan_eau 
    7580 
    7681 
    7782 
    7883 
    79 subroutine bilan_eau 
     84  subroutine bilan_eau 
    8085 
    81 tot_water(:,:)=0. 
     86    integer :: i,j 
    8287 
    83 bm_dt(:,:)=0. 
    84 bmelt_dt(:,:)=0. 
     88    tot_water(:,:)=0. 
    8589 
    86 bm_dt(2:nx-1,2:ny-1)=bm(2:nx-1,2:ny-1)*dt 
    87 bmelt_dt(2:nx-1,2:ny-1)=bmelt(2:nx-1,2:ny-1)*dt 
    88 !~ where (Bm(:,:).lt.0.) 
    89 !~      bm_dt(:,:)=max(Bm(:,:)*dt,-H(:,:)) 
    90 !~ elsewhere 
    91 !~      bm_dt(:,:)=bm(:,:)*dt 
    92 !~ endwhere 
     90    bm_dt(:,:)=0. 
     91    bmelt_dt(:,:)=0. 
    9392 
    94 !~ where (Bmelt(:,:).lt.0.) 
    95 !~      bmelt_dt(:,:)=max(Bmelt(:,:)*dt,-H(:,:)) 
    96 !~ elsewhere 
    97 !~      bmelt_dt(:,:)=bmelt(:,:)*dt 
    98 !~ endwhere 
     93    bm_dt(2:nx-1,2:ny-1)=bm(2:nx-1,2:ny-1)*dt 
     94    bmelt_dt(2:nx-1,2:ny-1)=bmelt(2:nx-1,2:ny-1)*dt 
     95    !~ where (Bm(:,:).lt.0.) 
     96    !~  bm_dt(:,:)=max(Bm(:,:)*dt,-H(:,:)) 
     97    !~ elsewhere 
     98    !~  bm_dt(:,:)=bm(:,:)*dt 
     99    !~ endwhere 
     100 
     101    !~ where (Bmelt(:,:).lt.0.) 
     102    !~  bmelt_dt(:,:)=max(Bmelt(:,:)*dt,-H(:,:)) 
     103    !~ elsewhere 
     104    !~  bmelt_dt(:,:)=bmelt(:,:)*dt 
     105    !~ endwhere 
    99106 
    100107 
    101 ! on fait la somme sur la grille en excluant les bords : 
     108    ! on fait la somme sur la grille en excluant les bords : 
    102109 
    103 sum_H = sum(H(2:nx-1,2:ny-1),mask=ice(2:nx-1,2:ny-1)==1) 
     110    sum_H = sum(H(2:nx-1,2:ny-1),mask=ice(2:nx-1,2:ny-1)==1) 
    104111 
    105 diff_H = diff_H + (sum_H - sum_H_old) ! on calcul la variation de volume a chaque dt 
     112    diff_H = diff_H + (sum_H - sum_H_old) ! on calcul la variation de volume a chaque dt 
    106113 
    107 diff_H_2D(2:nx-1,2:ny-1)=H(2:nx-1,2:ny-1)-H_beau_old(2:nx-1,2:ny-1) 
     114    diff_H_2D(2:nx-1,2:ny-1)=H(2:nx-1,2:ny-1)-H_beau_old(2:nx-1,2:ny-1) 
    108115 
    109 where (ice(2:nx-1,2:ny-1).eq.1) 
    110         Bm_dtt(2:nx-1,2:ny-1) = Bm_dtt(2:nx-1,2:ny-1) + Bm_dt(2:nx-1,2:ny-1) !* dt ! somme Bm sur dt 
    111         bmelt_dtt(2:nx-1,2:ny-1) = bmelt_dtt(2:nx-1,2:ny-1) + bmelt_dt(2:nx-1,2:ny-1) ! * dt ! somme bmelt sur dt 
    112 endwhere 
     116    where (ice(2:nx-1,2:ny-1).eq.1) 
     117       Bm_dtt(2:nx-1,2:ny-1) = Bm_dtt(2:nx-1,2:ny-1) + Bm_dt(2:nx-1,2:ny-1) !* dt ! somme Bm sur dt 
     118       bmelt_dtt(2:nx-1,2:ny-1) = bmelt_dtt(2:nx-1,2:ny-1) + bmelt_dt(2:nx-1,2:ny-1) ! * dt ! somme bmelt sur dt 
     119    endwhere 
    113120 
    114 archimtab(:,:) = Bsoc(:,:)+H(:,:)*alpha_flot - sealevel_2d(:,:) 
    115 gr_line(:,:)=0 
    116 do j=1,ny 
    117   do i=1,nx 
    118      !afq    if ((H(i,j).gt.0.).and.(archimtab(i,j).GE.0.).and.(Bsoc(i,j).LE.sealevel_2d(i,j))) then ! grounded with ice 
    119      if ((H(i,j).gt.0.).and.(archimtab(i,j).GE.0.)) then ! grounded with ice 
    120       if (archimtab(i-1,j).LT.0..and.Uxbar(i,j).LT.0..and..not.flot_marais(i-1,j)) gr_line(i,j)=1 
    121       if (archimtab(i+1,j).LT.0..and.Uxbar(i+1,j).GT.0..and..not.flot_marais(i+1,j)) gr_line(i,j)=1 
    122       if (archimtab(i,j-1).LT.0..and.Uybar(i,j).LT.0..and..not.flot_marais(i,j-1)) gr_line(i,j)=1 
    123       if (archimtab(i,j+1).LT.0..and.Uybar(i,j+1).GT.0..and..not.flot_marais(i,j+1)) gr_line(i,j)=1 
     121    archimtab(:,:) = Bsoc(:,:)+H(:,:)*alpha_flot - sealevel_2d(:,:) 
     122    gr_line(:,:)=0 
     123    do j=1,ny 
     124       do i=1,nx 
     125          !afq    if ((H(i,j).gt.0.).and.(archimtab(i,j).GE.0.).and.(Bsoc(i,j).LE.sealevel_2d(i,j))) then ! grounded with ice 
     126          if ((H(i,j).gt.0.).and.(archimtab(i,j).GE.0.)) then ! grounded with ice 
     127             if (archimtab(i-1,j).LT.0..and.Uxbar(i,j).LT.0..and..not.flot_marais(i-1,j)) gr_line(i,j)=1 
     128             if (archimtab(i+1,j).LT.0..and.Uxbar(i+1,j).GT.0..and..not.flot_marais(i+1,j)) gr_line(i,j)=1 
     129             if (archimtab(i,j-1).LT.0..and.Uybar(i,j).LT.0..and..not.flot_marais(i,j-1)) gr_line(i,j)=1 
     130             if (archimtab(i,j+1).LT.0..and.Uybar(i,j+1).GT.0..and..not.flot_marais(i,j+1)) gr_line(i,j)=1 
     131          endif 
     132       enddo 
     133    enddo 
     134 
     135    where (gr_line(:,:).eq.1) 
     136       !~   grline_dtt(:,:)= (((uxbar(:,:)+eoshift(uxbar(:,:),shift=1,boundary=0.,dim=1))**2+ & 
     137       !~                     (uybar(:,:)+eoshift(uybar(:,:),shift=1,boundary=0.,dim=2))**2)**0.5)*0.5 & 
     138       !~                     *H(:,:) + grline_dtt(:,:)  
     139       grline_dtt(:,:)= - sqrt(                                                                        & 
     140            ( (uxbar(:,:)+eoshift(uxbar(:,:),shift=1,boundary=0.,dim=1))*dy/2. )**2 +  & 
     141            ( (uybar(:,:)+eoshift(uybar(:,:),shift=1,boundary=0.,dim=2))*dx/2. )**2 )  & 
     142            * H(:,:) * dt + grline_dtt(:,:) 
     143    endwhere 
     144 
     145    if ((isynchro.eq.1.and.(mod(abs(TIME),1.).lt.dtmin)).or.(nt.eq.1)) then 
     146       ! on raisonne en bilan annuel pour simplifier : 
     147       !~       where (ice(2:nx-1,2:ny-1).eq.1) 
     148       !~               tot_water(2:nx-1,2:ny-1) = (Bm_dtt(2:nx-1,2:ny-1) - Bmelt_dtt(2:nx-1,2:ny-1) + calv_dtt(2:nx-1,2:ny-1) - ablbord_dtt(2:nx-1,2:ny-1)) / dtt  
     149       !~               elsewhere 
     150       !~               tot_water(2:nx-1,2:ny-1) = (calv_dtt(2:nx-1,2:ny-1) - ablbord_dtt(2:nx-1,2:ny-1)) / dtt 
     151       !~       endwhere 
     152       !cdc pas besoin du test sur ice ici, il a ete fait avant (et le masque ice varie a chaque dt)     
     153       tot_water(2:nx-1,2:ny-1) = (Bm_dtt(2:nx-1,2:ny-1) - Bmelt_dtt(2:nx-1,2:ny-1) + calv_dtt(2:nx-1,2:ny-1) - ablbord_dtt(2:nx-1,2:ny-1)) / dtt_flux 
     154 
     155       ! bilan d'eau sur la grille : 
     156       water_bilan=sum(tot_water(:,:)) 
     157       diff_H = diff_H/dtt_flux 
     158 
     159       !999 format(f0.2,1x,e15.8,1x,i10,8(1x,e15.8)) 
     160       !        write(6,999),time,sum_H,count(ice(:,:)==1),diff_H,water_bilan,sum(calv_dtt(:,:))/dtt,sum(ablbord_dtt(:,:))/dtt,sum(bmelt_dtt(:,:),mask=ice(:,:)==1)/dtt,sum(bm(:,:),mask=ice(:,:)==1),sum(Bm_dtt(:,:))/dtt,sum(bmelt_dtt(:,:))/dtt 
     161       diff_H_water_bilan(2:nx-1,2:ny-1)=tot_water(2:nx-1,2:ny-1)-diff_H_2D(2:nx-1,2:ny-1) 
     162 
    124163    endif 
    125   enddo 
    126 enddo 
     164    sum_H_old=sum_H 
    127165 
    128 where (gr_line(:,:).eq.1) 
    129 !~   grline_dtt(:,:)= (((uxbar(:,:)+eoshift(uxbar(:,:),shift=1,boundary=0.,dim=1))**2+ & 
    130 !~                     (uybar(:,:)+eoshift(uybar(:,:),shift=1,boundary=0.,dim=2))**2)**0.5)*0.5 & 
    131 !~                     *H(:,:) + grline_dtt(:,:)  
    132    grline_dtt(:,:)= - sqrt(                                                                        & 
    133                            ( (uxbar(:,:)+eoshift(uxbar(:,:),shift=1,boundary=0.,dim=1))*dy/2. )**2 +  & 
    134                            ( (uybar(:,:)+eoshift(uybar(:,:),shift=1,boundary=0.,dim=2))*dx/2. )**2 )  & 
    135                            * H(:,:) * dt + grline_dtt(:,:) 
    136 endwhere 
     166    H_beau_old(:,:)=H(:,:) 
    137167 
    138 if ((isynchro.eq.1.and.(mod(abs(TIME),1.).lt.dtmin)).or.(nt.eq.1)) then 
    139 ! on raisonne en bilan annuel pour simplifier : 
    140 !~      where (ice(2:nx-1,2:ny-1).eq.1) 
    141 !~              tot_water(2:nx-1,2:ny-1) = (Bm_dtt(2:nx-1,2:ny-1) - Bmelt_dtt(2:nx-1,2:ny-1) + calv_dtt(2:nx-1,2:ny-1) - ablbord_dtt(2:nx-1,2:ny-1)) / dtt  
    142 !~              elsewhere 
    143 !~              tot_water(2:nx-1,2:ny-1) = (calv_dtt(2:nx-1,2:ny-1) - ablbord_dtt(2:nx-1,2:ny-1)) / dtt 
    144 !~      endwhere 
    145 !cdc pas besoin du test sur ice ici, il a ete fait avant (et le masque ice varie a chaque dt)    
    146   tot_water(2:nx-1,2:ny-1) = (Bm_dtt(2:nx-1,2:ny-1) - Bmelt_dtt(2:nx-1,2:ny-1) + calv_dtt(2:nx-1,2:ny-1) - ablbord_dtt(2:nx-1,2:ny-1)) / dtt_flux 
    147     
    148 ! bilan d'eau sur la grille : 
    149   water_bilan=sum(tot_water(:,:)) 
    150   diff_H = diff_H/dtt_flux 
    151  
    152 !999 format(f0.2,1x,e15.8,1x,i10,8(1x,e15.8)) 
    153 !       write(6,999),time,sum_H,count(ice(:,:)==1),diff_H,water_bilan,sum(calv_dtt(:,:))/dtt,sum(ablbord_dtt(:,:))/dtt,sum(bmelt_dtt(:,:),mask=ice(:,:)==1)/dtt,sum(bm(:,:),mask=ice(:,:)==1),sum(Bm_dtt(:,:))/dtt,sum(bmelt_dtt(:,:))/dtt 
    154   diff_H_water_bilan(2:nx-1,2:ny-1)=tot_water(2:nx-1,2:ny-1)-diff_H_2D(2:nx-1,2:ny-1) 
    155  
    156 endif 
    157 sum_H_old=sum_H 
    158  
    159 H_beau_old(:,:)=H(:,:) 
    160  
    161 end subroutine bilan_eau 
     168  end subroutine bilan_eau 
    162169 
    163170end module bilan_eau_mod 
Note: See TracChangeset for help on using the changeset viewer.