source: branches/iLoveclim/SOURCES/bmelt-ismip6-param_mod.f90 @ 254

Last change on this file since 254 was 254, checked in by aquiquet, 5 years ago

Grisli-iloveclim branch merged to trunk at revision 253 + some corrections for water conservation

File size: 7.8 KB
RevLine 
[252]1!> \file bmelt-ismip6-param.f90
2!! bmelt computed from the non-local formulation suggested in ismip6
3!<
4
5!> \namespace bmelt-ismip6-param
6!! Module for sub-shelf basal melting (grounded or ice shelves)
7!! \author aquiquet
8!! \date April 2019
9!! @note from ismip6 suggested parametrisation
10!! Should be chosen in the module_choix
11!! @note Used modules
12!! @note   - use module3D_phy
13!! @note   - use netcdf
14!! @note   - use io_netcdf_grisli
15!<
16
17module  bmelt_ismip6_param_mod
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
20  ! note: the geom. (nx,ny,dx,dy) come from module_geoplace
21  ! note: the densities come from param_phy_mod
22  use netcdf
23  use io_netcdf_grisli
24
25  implicit none
26
27  integer, parameter :: nzoc = 30 !< number of vertical levels in the ocean
28  real*8,parameter :: cpw    = 3974.d0 !Specific heat of sea water (J/kg/K)
29
30  real*8, dimension (nx,ny,nzoc) :: thermal_forcing !< thermal forcing            , input
31  real*8, dimension (nzoc)       :: zoc             !< depth of oceanic levels    , input
32  real*8, dimension (nx,ny)      :: basinNumber     !< IMBIE2 oc. basin identifier, input
33  real*8, dimension (nx,ny)      :: deltaT_basin    !< deltaT                     , input
34  real*8                         :: gamma0          !< gamma0                     , input
35 
36  real*8, dimension (nx,ny)      :: mesh_area       !< grid cell area
37  real*8, dimension (nx,ny)      :: ice_draft       !< ice draft (S-H)
38
39  real*8 :: cste !< a pre-computed constant
40  integer :: Nbasin                                 !< number of oceanic basin
41 
42contains
43
44
45 
46  subroutine init_bmelt
47   
48    ! this routine is used to initialise the sub-shelf basal melting rate
49
50
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
54   
55    character(len=100) :: file_inputs               !< files read
56    character(len=100) :: file_TF                   !< files read
57    character(len=100) :: file_basinNumbers         !< files read
58    character(len=100) :: file_coef                 !< files read
59
60    integer i,j !juste pour les verifs
61
62    namelist/bmelt_ismip6_param/file_TF,file_basinNumbers,file_coef,gamma0
63   
64    rewind(num_param)        ! loop back at the beginning of the param_list.dat file
65    read(num_param,bmelt_ismip6_param)
66    write(num_rep_42,'(A)') '!  module bmelt_ismip6_param'
67    write(num_rep_42,bmelt_ismip6_param)
68    write(num_rep_42,'(A)') '! file_TF: 3d thermal forcing'
69    write(num_rep_42,'(A)') '! file_basinNumbers: identifier for the Imbie2 basins'
70    write(num_rep_42,'(A)') '! file_coef: deltaT'
71    write(num_rep_42,'(A)') '! gamma0: value associated with the deltaT file'
72
73   
74    file_inputs=TRIM(DIRNAMEINP)//trim(file_TF)
75    call Read_Ncdf_var('z',file_inputs,tab1d)
76    zoc(:)  = tab1d(:)
77    call Read_Ncdf_var('thermal_forcing',file_inputs,tab3d)
78    thermal_forcing(:,:,:)  = tab3d(:,:,:)
79
80    file_inputs=TRIM(DIRNAMEINP)//trim(file_basinNumbers)
81    call Read_Ncdf_var('basinNumber',file_inputs,tab2d)
82    basinNumber(:,:)  = tab2d(:,:)
83
84    file_inputs=TRIM(DIRNAMEINP)//trim(file_coef)
85    call Read_Ncdf_var('deltaT_basin',file_inputs,tab2d)
86    deltaT_basin(:,:)  = tab2d(:,:)
87
88    if ( ubound(zoc,dim=1).ne.nzoc) then
89       write (*,*) "bmelt-ismip6-param: pb with the number of oceanic layers! abort..."
90       STOP
91    endif
92   
93    mesh_area(:,:) = dx*dy ! this could be corrected to account for projection deformation
94   
95    Nbasin=maxval(basinNumber)+1 ! number of basins
96   
97    cste = (row*cpw/(ro*cl))**2  ! in K^(-2)
98
99    where (thermal_forcing(:,:,:).lt.0.d0)
100       thermal_forcing(:,:,:) = 3.5
101    endwhere
102   
103  end subroutine init_bmelt
104
105
106
107  subroutine bmeltshelf
108
109    ! this routine is used to compute the sub-shelf basal melting rate
110
111    real*8, dimension(nx,ny) :: TF_draft
112    real*8,allocatable,dimension(:) :: mean_TF, IS_area
113
114    integer :: i,j,k,kinf,ksup,ngr
115    real*8  :: bmloc
116   
117    allocate( mean_TF(Nbasin), IS_area(Nbasin)  )
118
119    mean_TF(:) = 0.d0
120    IS_area(:) = 0.d0
121
122    ice_draft(:,:) = S(:,:)-H(:,:)-sealevel_2d(:,:)
123   
124    do j=1,ny
125       do i=1,nx
126
127          if (flot(i,j)) then
128
129             if (H(i,j).gt.200.d0) then !limit on the critical thickness of ice to define the ice shelf mask
130                                        ! we should use Hcalv
131
132                ! 1 -  Linear interpolation of the thermal forcing on the ice draft depth :
133                ksup=nzoc
134                do k=nzoc-1,2,-1
135                   if ( zoc(k) .le. ice_draft(i,j) ) ksup = k
136                enddo
137                kinf = ksup - 1
138                if     ( ice_draft(i,j) .gt. zoc(1) ) then
139                   TF_draft(i,j) = thermal_forcing(i,j,1)
140                elseif ( ice_draft(i,j) .lt. zoc(nzoc) ) then
141                   TF_draft(i,j) = thermal_forcing(i,j,nzoc)
142                else
143                   TF_draft(i,j) = (   (zoc(ksup)-ice_draft(i,j)) * thermal_forcing(i,j,kinf)   &
144                        &                   + (ice_draft(i,j)-zoc(kinf)) * thermal_forcing(i,j,ksup) ) / (zoc(ksup)-zoc(kinf))
145                endif
146
147                ! 2 -  Mean Thermal forcing in individual basins (NB: fortran norm while basins start at zero) :
148                mean_TF( basinNumber(i,j)+1 ) = mean_TF( basinNumber(i,j)+1 ) + mesh_area(i,j) * TF_draft(i,j)
149                IS_area( basinNumber(i,j)+1 ) = IS_area( basinNumber(i,j)+1 ) + mesh_area(i,j)
150
151             else
152                TF_draft(i,j) = thermal_forcing(i,j,1)
153             endif
154
155          else
156             
157             TF_draft(i,j) = -9999.9d0
158             
159          endif
160
161       enddo
162    enddo
163
164    where ( IS_area(:).gt.0.d0)     ! for all basins that have ice shelves
165       mean_TF(:) = mean_TF(:) / IS_area(:)
166    elsewhere                       ! we have no floating points over the whole basin
167       mean_TF(:) = -9999.d0
168    endwhere
169
170    ! 3  - Calculation of melting rate :
171
172    ! melt rate in m/yr (meters of pure water per year) :
173    ! [ * rhofw_SI / rhoi_SI to get it in meters of ice per year ]
174    do j=1,ny
175       do i=1,nx
176          if ( TF_draft(i,j) .gt. -5.d0 ) then !floating points
177             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) ) 
179                !if (bmelt(i,j).lt.-0.2) then
180                !   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)
181                !endif
182             else ! in case we have no floating points over a whole basin, we take the local expression
183                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             endif
185          endif
186       enddo
187    enddo
188   
189    do j=1,ny
190       do i=1,nx
191          if ( TF_draft(i,j) .le. -5.d0 ) then !grounded points
192             ngr=0
193             bmloc=0.d0
194             if (flot(i+1,j)) then
195                ngr=ngr+1
196                bmloc=bmloc+bmelt(i+1,j)
197             endif
198             if (flot(i-1,j)) then
199                ngr=ngr+1
200                bmloc=bmloc+bmelt(i-1,j)
201             endif
202             if (flot(i,j+1)) then
203                ngr=ngr+1
204                bmloc=bmloc+bmelt(i,j+1)
205             endif
206             if (flot(i,j-1)) then
207                ngr=ngr+1
208                bmloc=bmloc+bmelt(i,j-1)
209             endif
210             bmelt(i,j)=(ngr/4.)*bmloc+(1-ngr/4.)*bmelt(i,j)
211          endif
212       enddo
213    enddo
214
215
216  end subroutine bmeltshelf
217 
218
219 
220end module bmelt_ismip6_param_mod
Note: See TracBrowser for help on using the repository browser.