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

Last change on this file since 3015 was 2980, checked in by romain.vande, 2 years ago

Mars PEM :

Adapt PEM to 1d runs.
Cleaning of names and unused variables.
Correct minor errors.
Adapt and correct reshape_xios_output utilitary for 1d diagfi output.

RV

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