source: trunk/LMDZ.COMMON/libf/evolution/evol_h2o_ice_s_mod.F90 @ 3136

Last change on this file since 3136 was 3130, checked in by jbclement, 2 years ago

PEM:
The perennial co2 ice is now taken into account with co2 frost (qsurf) to compute the tendency and to make the update + Rework of how co2 frost is converted to perennial co2 ice at the end of the PEM run + Correction of the value of 'threshold_co2_frost2perennial' to correspond to 10 m + Perennial co2 ice is now handled outside 'paleoclimate' in "phyetat0_mod.F90" of the Mars PCM + Some cleanings.

/!\ Commit for the PEM management of co2 ice before a rework of ice management in the PEM!
JBC

File size: 6.3 KB
Line 
1MODULE evol_h2o_ice_s_mod
2
3implicit none
4
5!=======================================================================
6contains
7!=======================================================================
8
9SUBROUTINE evol_h2o_ice_s(ngrid,nslope,cell_area,delta_h2o_adsorbded,delta_h2o_icetablesublim,qsurf,tendencies_h2o_ice_phys,STOPPING)
10
11use time_evol_mod,          only: dt_pem
12use comslope_mod,           only: subslope_dist, def_slope_mean
13use criterion_pem_stop_mod, only: criterion_waterice_stop
14
15#ifndef CPP_STD
16    use comcstfi_h,   only: pi
17#else
18    use comcstfi_mod, only: pi
19#endif
20
21implicit none
22
23!=======================================================================
24!
25!  Routine that compute the evolution of the water ice
26!
27!=======================================================================
28!   arguments:
29!   ----------
30!   INPUT
31integer,                intent(in) :: ngrid                    ! # of grid points along longitude/latitude grid;
32integer,                intent(in) :: nslope                   ! # of subslope
33real, dimension(ngrid), intent(in) :: cell_area                ! Area of each mesh grid (m^2)
34real, dimension(ngrid), intent(in) :: delta_h2o_adsorbded      ! Mass of H2O adsorbded/desorbded in the soil (kg/m^2)
35real, dimension(ngrid), intent(in) :: delta_h2o_icetablesublim ! Mass of H2O that have condensed/sublimated at the ice table (kg/m^2)
36
37!   OUTPUT
38real, dimension(ngrid,nslope), intent(inout) :: qsurf                   ! physical point field: Previous and actual density of water ice (kg/m^2)
39real, dimension(ngrid,nslope), intent(inout) :: tendencies_h2o_ice_phys ! physical point field: Evolution of perennial ice over one year (kg/m^2/year)
40logical,                       intent(inout) :: STOPPING                ! Stopping criterion
41
42!   local:
43!   ------
44integer :: i,j,islope                                          ! loop variable
45real    :: pos_tend, neg_tend, real_coefficient, negative_part ! Variable to conserve water
46real    ::  new_tendencies(ngrid,nslope)                       ! Tendencies computed in order to conserve water ice on the surface, only exchange between surface are done
47!=======================================================================
48
49  STOPPING=.false.
50
51  pos_tend=0.
52  neg_tend=0.
53if (ngrid.NE.1) then ! to make sure we are not in 1D
54  ! We compute the amount of water accumulating and sublimating
55  do i=1,ngrid
56     if(delta_h2o_adsorbded(i).GT.0) then
57        pos_tend=pos_tend+delta_h2o_adsorbded(i)*cell_area(i)
58     else
59        neg_tend=neg_tend+delta_h2o_adsorbded(i)*cell_area(i)
60     endif
61     if(delta_h2o_icetablesublim(i).GT.0) then
62        pos_tend=pos_tend+delta_h2o_icetablesublim(i)*cell_area(i)
63     else
64        neg_tend=neg_tend+delta_h2o_icetablesublim(i)*cell_area(i)
65     endif
66     do islope=1,nslope
67     if (qsurf(i,islope).GT.0) then
68         if (tendencies_h2o_ice_phys(i,islope).GT.0) then
69            pos_tend=pos_tend+tendencies_h2o_ice_phys(i,islope)*cell_area(i)*subslope_dist(i,islope)/cos(def_slope_mean(islope)*pi/180.)
70         else
71            neg_tend=neg_tend-tendencies_h2o_ice_phys(i,islope)*cell_area(i)*subslope_dist(i,islope)/cos(def_slope_mean(islope)*pi/180.)
72         endif
73     endif
74     enddo
75  enddo
76  ! We adapt the tendencies to conserve water and do only exchange between grid points
77   if(neg_tend.GT.pos_tend .and. pos_tend.GT.0) then ! We are sublimating more in the planet than condensing
78     do i=1,ngrid
79       do islope=1,nslope
80       if(tendencies_h2o_ice_phys(i,islope).LT.0) then ! We lower the sublimating rate by a coefficient
81          new_tendencies(i,islope)=tendencies_h2o_ice_phys(i,islope)*(pos_tend/neg_tend)
82       else                                            ! We dont't change the accumulating rate
83          new_tendencies(i,islope)=tendencies_h2o_ice_phys(i,islope)
84       endif
85       enddo
86     enddo
87   elseif(neg_tend.LT.pos_tend .and. neg_tend.GT.0) then ! We are condensing more in the planet than sublimating
88     do i=1,ngrid
89       do islope=1,nslope
90       if(tendencies_h2o_ice_phys(i,islope).LT.0) then ! We dont't change the sublimating rate
91          new_tendencies(i,islope)=tendencies_h2o_ice_phys(i,islope)
92       else                                            ! We lower the condensing rate by a coefficient
93          new_tendencies(i,islope)=tendencies_h2o_ice_phys(i,islope)*(neg_tend/pos_tend)
94       endif
95       enddo
96     enddo
97   elseif(pos_tend.EQ.0 .OR. neg_tend.EQ.0) then
98    write(*,*) "Reason of stopping : There is either no water ice sublimating or no water ice increasing !!"
99    write(*,*) "Tendencies on ice sublimating=", neg_tend
100    write(*,*) "Tendencies on ice increasing=", pos_tend
101    write(*,*) "This can be due to the absence of water ice in the PCM run!!"
102    call criterion_waterice_stop(cell_area,1.,qsurf(:,:)*0.,STOPPING,ngrid,qsurf(:,:)*0.)
103    do i=1,ngrid
104       do islope=1,nslope
105         new_tendencies(i,islope)=0
106       enddo
107    enddo
108   endif
109  negative_part = 0.
110
111! Evolution of the water ice for each physical point
112  do i=1,ngrid
113    do islope=1, nslope
114      qsurf(i,islope)=qsurf(i,islope)+new_tendencies(i,islope)*dt_pem
115      ! We compute the amount of water that is sublimated in excess
116      if (qsurf(i,islope).lt.0) then
117        negative_part=negative_part-qsurf(i,islope)*cell_area(i)*subslope_dist(i,islope)/cos(def_slope_mean(islope)*pi/180.)
118        qsurf(i,islope)=0.
119        tendencies_h2o_ice_phys(i,islope)=0.
120      endif
121    enddo
122  enddo
123
124
125  if(pos_tend.eq.0) then
126   real_coefficient = 0.
127  else
128   real_coefficient = negative_part/pos_tend ! We compute a coefficient by which we should remove the ice that has been added
129                                             ! to places even if this ice was contributing to an unphysical negative amount
130                                             ! of ice at other places
131  endif
132  do i=1,ngrid
133    do islope=1, nslope
134     if(new_tendencies(i,islope).GT.0) then  ! In the place of accumulation of ice, we remove a bit of ice in order to conserve water
135         qsurf(i,islope)=qsurf(i,islope)-new_tendencies(i,islope)*real_coefficient*dt_pem*cos(def_slope_mean(islope)*pi/180.)
136     endif
137    enddo
138  enddo
139else ! ngrid==1;
140  do islope=1, nslope
141    qsurf(1,islope)=qsurf(1,islope)+tendencies_h2o_ice_phys(1,islope)*dt_pem
142  enddo
143endif
144
145END SUBROUTINE evol_h2o_ice_s
146
147END MODULE evol_h2o_ice_s_mod
Note: See TracBrowser for help on using the repository browser.