source: trunk/LMDZ.COMMON/libf/evolution/glaciers.F90 @ 4074

Last change on this file since 4074 was 4074, checked in by jbclement, 11 days ago

PEM:

  • Correct management of H2O ice tendency in 1D when there is not enough ice anymore.
  • Clean initialization of allocatable module arrays (especially needed when no slope)
  • One more renaming for consistency + few small updates thoughout the code.

JBC

File size: 11.4 KB
Line 
1MODULE glaciers
2!-----------------------------------------------------------------------
3! NAME
4!     glaciers
5!
6! DESCRIPTION
7!     Compute flow and transfer of CO2 and H2O ice glaciers on slopes
8!     based on maximum ice thickness and basal drag conditions.
9!
10! AUTHORS & DATE
11!     L. Lange
12!     JB Clement, 2023-2025
13!
14! NOTES
15!
16!-----------------------------------------------------------------------
17
18! DEPENDENCIES
19! ------------
20use numerics, only: dp, di, k4, minieps
21
22! DECLARATION
23! -----------
24implicit none
25
26! PARAMETERS
27! ----------
28logical(k4), protected :: h2oice_flow ! Flag to compute H2O ice flow
29logical(k4), protected :: co2ice_flow ! Flag to compute CO2 ice flow
30
31contains
32!+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
33
34!=======================================================================
35SUBROUTINE set_glaciers_config(h2oice_flow_in,co2ice_flow_in)
36!-----------------------------------------------------------------------
37! NAME
38!     set_glaciers_config
39!
40! DESCRIPTION
41!     Setter for 'glaciers' configuration parameters.
42!
43! AUTHORS & DATE
44!     JB Clement, 02/2026
45!
46! NOTES
47!
48!-----------------------------------------------------------------------
49
50! DEPENDENCIES
51! ------------
52use utility,  only: bool2str
53use geometry, only: nslope
54use display,  only: print_msg
55
56! DECLARATION
57! -----------
58implicit none
59
60! ARGUMENTS
61! ---------
62logical(k4), intent(in) :: h2oice_flow_in, co2ice_flow_in
63
64! CODE
65! ----
66h2oice_flow = h2oice_flow_in
67co2ice_flow = co2ice_flow_in
68if (h2oice_flow .and. nslope == 1) then
69    call print_msg('Warning: h2oice_flow = .true. but nslope = 1. So there will be no flow!')
70    h2oice_flow = .false.
71end if
72if (co2ice_flow .and. nslope == 1) then
73    call print_msg('Warning: co2ice_flow = .true. but nslope = 1. So there will be no flow!')
74    co2ice_flow = .false.
75end if
76call print_msg('h2oice_flow = '//bool2str(h2oice_flow))
77call print_msg('co2ice_flow = '//bool2str(co2ice_flow))
78
79END SUBROUTINE set_glaciers_config
80!=======================================================================
81
82!=======================================================================
83SUBROUTINE flow_co2glaciers(vmr_co2_PEM,ps_PCM,ps_avg_glob_ini,ps_avg_global,co2ice,is_co2ice_flow)
84!-----------------------------------------------------------------------
85! NAME
86!     flow_co2glaciers
87!
88! DESCRIPTION
89!     Compute maximum thickness and transfer CO2 ice between subslopes.
90!
91! AUTHORS & DATE
92!     L. Lange
93!     JB Clement, 2023-2025
94!
95! NOTES
96!
97!-----------------------------------------------------------------------
98
99! DEPENDENCIES
100! ------------
101use geometry, only: ngrid, nslope
102use display,  only: print_msg
103
104! DECLARATION
105! -----------
106implicit none
107
108! ARGUMENTS
109! ---------
110real(dp),    dimension(:,:), intent(in)    :: vmr_co2_PEM     ! Grid points x Time field : VMR of CO2 in the first layer [mol/mol]
111real(dp),    dimension(:,:), intent(in)    :: ps_PCM          ! Grid points x Time field: surface pressure given by the PCM [Pa]
112real(dp),                    intent(in)    :: ps_avg_glob_ini ! Global averaged surface pressure at the beginning [Pa]
113real(dp),                    intent(in)    :: ps_avg_global   ! Global averaged surface pressure during the PEM iteration [Pa]
114real(dp),    dimension(:,:), intent(inout) :: co2ice          ! Grid points x Slope field: CO2 ice on the subgrid slopes [kg/m^2]
115logical(k4), dimension(:,:), intent(out)   :: is_co2ice_flow  ! Flag to see if there is flow on the subgrid slopes
116
117! LOCAL VARIABLES
118! ---------------
119real(dp), dimension(ngrid,nslope) :: Tcond ! CO2 condensation temperature [K]
120real(dp), dimension(ngrid,nslope) :: hmax  ! Maximum thickness before flow
121
122! CODE
123! ----
124call print_msg("> Flow of CO2 glaciers")
125call computeTcondCO2(vmr_co2_PEM,ps_PCM,ps_avg_glob_ini,ps_avg_global,Tcond)
126call compute_hmaxglaciers(Tcond,"CO2",hmax)
127call transfer_ice_duringflow(hmax,Tcond,co2ice,is_co2ice_flow)
128
129END SUBROUTINE flow_co2glaciers
130!=======================================================================
131
132!=======================================================================
133SUBROUTINE flow_h2oglaciers(Tice,h2oice,is_h2oice_flow)
134!-----------------------------------------------------------------------
135! NAME
136!     flow_h2oglaciers
137!
138! DESCRIPTION
139!     Compute maximum thickness and transfer H2O ice between subslopes.
140!
141! AUTHORS & DATE
142!     L. Lange
143!     JB Clement, 2023-2025
144!
145! NOTES
146!
147!-----------------------------------------------------------------------
148
149! DEPENDENCIES
150! ------------
151use geometry, only: ngrid, nslope
152use display,  only: print_msg
153
154! DECLARATION
155! -----------
156implicit none
157
158! ARGUMENTS
159! ---------
160real(dp),    dimension(:,:), intent(in)    ::  Tice           ! Ice Temperature [K]
161real(dp),    dimension(:,:), intent(inout) ::  h2oice         ! H2O ice on the subgrid slopes [kg/m^2]
162logical(k4), dimension(:,:), intent(out)   ::  is_h2oice_flow ! Flow flag on subgrid slopes
163
164! LOCAL VARIABLES
165! ---------------
166real(dp), dimension(ngrid,nslope) :: hmax ! Maximum thickness before flow
167
168! CODE
169! ----
170call print_msg("> Flow of H2O glaciers")
171call compute_hmaxglaciers(Tice,"H2O",hmax)
172call transfer_ice_duringflow(hmax,Tice,h2oice,is_h2oice_flow)
173
174END SUBROUTINE flow_h2oglaciers
175!=======================================================================
176
177!=======================================================================
178SUBROUTINE compute_hmaxglaciers(Tice,name_ice,hmax)
179!-----------------------------------------------------------------------
180! NAME
181!     compute_hmaxglaciers
182!
183! DESCRIPTION
184!     Compute the maximum thickness of CO2 and H2O glaciers given a
185!     slope angle before initiating flow.
186!
187! AUTHORS & DATE
188!     L. Lange
189!     JB Clement, 2023-2025
190!
191! NOTES
192!     Based on work by A.Grau Galofre (LPG) and Isaac Smith (JGR Planets 2022)
193!
194!-----------------------------------------------------------------------
195
196! DEPENDENCIES
197! ------------
198use geometry,  only: ngrid, nslope
199use slopes,    only: iflat, def_slope_mean
200use ice_table, only: rho_ice
201use stoppage,  only: stop_clean
202use maths,     only: pi
203use physics,   only: g
204
205! DECLARATION
206! -----------
207implicit none
208
209! ARGUMENTS
210! ---------
211real(dp), dimension(:,:), intent(in)  :: Tice     ! Ice temperature [K]
212character(3),             intent(in)  :: name_ice ! Nature of ice
213real(dp), dimension(:,:), intent(out) :: hmax     ! Maximum thickness before flow [m]
214
215! LOCAL VARIABLES
216! ---------------
217real(dp)    :: tau_d ! characteristic basal drag, understood as the stress that an ice mass flowing under its weight balanced by viscosity. Value obtained from I.Smith
218integer(di) :: ig, islope
219real(dp)    :: slo_angle
220
221! CODE
222! ----
223select case (trim(adjustl(name_ice)))
224    case('H2O')
225        tau_d = 1.e5_dp
226    case('CO2')
227        tau_d = 5.e3_dp
228    case default
229        call stop_clean(__FILE__,__LINE__,"type of ice unknown!",1)
230end select
231
232do ig = 1,ngrid
233    do islope = 1,nslope
234        if (islope == iflat) then
235            hmax(ig,islope) = 1.e8_dp
236        else
237            slo_angle = abs(def_slope_mean(islope)*pi/180._dp)
238            hmax(ig,islope) = tau_d/(rho_ice(Tice(ig,islope),name_ice)*g*slo_angle)
239        end if
240    end do
241end do
242
243END SUBROUTINE compute_hmaxglaciers
244!=======================================================================
245
246!=======================================================================
247SUBROUTINE transfer_ice_duringflow(hmax,Tice,qice,flag_flow)
248!-----------------------------------------------------------------------
249! NAME
250!     transfer_ice_duringflow
251!
252! DESCRIPTION
253!     Transfer the excess of ice from one subslope to another.
254!     No transfer between mesh at the time.
255!
256! AUTHORS & DATE
257!     L. Lange
258!     JB Clement, 2023-2025
259!
260! NOTES
261!
262!-----------------------------------------------------------------------
263
264! DEPENDENCIES
265! ------------
266use geometry,  only: ngrid, nslope
267use slopes,    only: iflat, subslope_dist, def_slope_mean
268use ice_table, only: rho_ice
269use stoppage,  only: stop_clean
270use maths,     only: pi
271
272! DECLARATION
273! -----------
274implicit none
275
276! ARGUMENTS
277! ---------
278real(dp),    dimension(:,:), intent(in)    :: hmax      ! Maximum height before initiating flow [m]
279real(dp),    dimension(:,:), intent(in)    :: Tice      ! Ice temperature [K]
280real(dp),    dimension(:,:), intent(inout) :: qice      ! Ice in the subslope [kg/m^2]
281logical(k4), dimension(:,:), intent(out)   :: flag_flow ! Flow flag on subgrid slopes
282
283! LOCAL VARIABLES
284! ---------------
285integer(di) :: ig, islope
286integer(di) :: iaval ! Index where ice is transferred
287
288! CODE
289! ----
290flag_flow = .false.
291
292do ig = 1,ngrid
293    do islope = 1,nslope
294        if (islope /= iflat) then ! ice can be infinite on flat ground
295! First: check that CO2 ice must flow (excess of ice on the slope), ice can accumulate infinitely  on flat ground
296            if (qice(ig,islope) >= rho_ice(Tice(ig,islope),'H2O')*hmax(ig,islope)*cos(pi*def_slope_mean(islope)/180._dp)) then
297! Second: determine the flatest slopes possible:
298                if (islope > iflat) then
299                    iaval = islope - 1
300                else
301                    iaval = islope + 1
302                end if
303                do while (iaval /= iflat .and. abs(subslope_dist(ig,iaval)) < minieps)
304                    if (iaval > iflat) then
305                        iaval = iaval - 1
306                    else
307                        iaval = iaval + 1
308                    end if
309                end do
310                qice(ig,iaval) = qice(ig,iaval) + (qice(ig,islope) - rho_ice(Tice(ig,islope),'H2O')*hmax(ig,islope)*cos(pi*def_slope_mean(islope)/180._dp)) &
311                               *subslope_dist(ig,islope)/subslope_dist(ig,iaval)*cos(pi*def_slope_mean(iaval)/180._dp)/cos(pi*def_slope_mean(islope)/180._dp)
312
313                qice(ig,islope) = rho_ice(Tice(ig,islope),'H2O')*hmax(ig,islope)*cos(pi*def_slope_mean(islope)/180._dp)
314                flag_flow(ig,islope) = .true.
315            end if ! co2ice > hmax
316        end if ! iflat
317    end do !islope
318end do !ig
319
320END SUBROUTINE
321
322!=======================================================================
323SUBROUTINE computeTcondCO2(vmr_co2_PEM,ps_PCM,ps_avg_glob_ini,ps_avg_global,Tcond)
324!-----------------------------------------------------------------------
325! NAME
326!     computeTcondCO2
327!
328! DESCRIPTION
329!     Compute CO2 condensation temperature.
330!
331! AUTHORS & DATE
332!     L. Lange
333!     JB Clement, 2023-2025
334!
335! NOTES
336!
337!-----------------------------------------------------------------------
338
339! DEPENDENCIES
340! ------------
341use geometry, only: ngrid, nday
342use planet,   only: alpha_clap_co2, beta_clap_co2
343
344! DECLARATION
345! -----------
346implicit none
347
348! ARGUMENTS
349! ---------
350real(dp), dimension(:,:), intent(in)  :: vmr_co2_PEM       ! VMR of CO2 in the first layer [mol/mol]
351real(dp), dimension(:,:), intent(in)  :: ps_PCM            ! Surface pressure in the PCM [Pa]
352real(dp),                 intent(in)  :: ps_avg_glob_ini ! Global averaged surfacepressure in the PCM [Pa]
353real(dp),                 intent(in)  :: ps_avg_global     ! Global averaged surface pressure computed during the PEM iteration
354real(dp), dimension(:,:), intent(out) :: Tcond             ! Condensation temperature of CO2, yearly averaged
355
356! LOCAL VARIABLES
357! ---------------
358integer(di) :: ig, it
359
360! CODE
361! ----
362do ig = 1,ngrid
363    Tcond(ig,:) = 0._dp
364    do it = 1,nday
365        Tcond(ig,:) = Tcond(ig,:) + beta_clap_co2/(alpha_clap_co2 - log(vmr_co2_PEM(ig,it)*ps_PCM(ig,it)*ps_avg_glob_ini/ps_avg_global/100._dp))
366    end do
367    Tcond(ig,:) = Tcond(ig,:)/nday
368end do
369
370END SUBROUTINE computeTcondCO2
371!=======================================================================
372
373END MODULE glaciers
Note: See TracBrowser for help on using the repository browser.