| 1 | MODULE evol_h2o_ice_s_mod |
|---|
| 2 | |
|---|
| 3 | implicit none |
|---|
| 4 | |
|---|
| 5 | !======================================================================= |
|---|
| 6 | contains |
|---|
| 7 | !======================================================================= |
|---|
| 8 | |
|---|
| 9 | SUBROUTINE evol_h2o_ice_s(ngrid,nslope,cell_area,delta_h2o_adsorbded,delta_h2o_icetablesublim,qsurf,tendencies_h2o_ice_phys,STOPPING) |
|---|
| 10 | |
|---|
| 11 | use time_evol_mod, only: dt_pem |
|---|
| 12 | use comslope_mod, only: subslope_dist, def_slope_mean |
|---|
| 13 | use 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 | |
|---|
| 21 | implicit none |
|---|
| 22 | |
|---|
| 23 | !======================================================================= |
|---|
| 24 | ! |
|---|
| 25 | ! Routine that compute the evolution of the water ice |
|---|
| 26 | ! |
|---|
| 27 | !======================================================================= |
|---|
| 28 | ! arguments: |
|---|
| 29 | ! ---------- |
|---|
| 30 | ! INPUT |
|---|
| 31 | integer, intent(in) :: ngrid ! # of grid points along longitude/latitude grid; |
|---|
| 32 | integer, intent(in) :: nslope ! # of subslope |
|---|
| 33 | real, dimension(ngrid), intent(in) :: cell_area ! Area of each mesh grid (m^2) |
|---|
| 34 | real, dimension(ngrid), intent(in) :: delta_h2o_adsorbded ! Mass of H2O adsorbded/desorbded in the soil (kg/m^2) |
|---|
| 35 | real, dimension(ngrid), intent(in) :: delta_h2o_icetablesublim ! Mass of H2O that have condensed/sublimated at the ice table (kg/m^2) |
|---|
| 36 | |
|---|
| 37 | ! OUTPUT |
|---|
| 38 | real, dimension(ngrid,nslope), intent(inout) :: qsurf ! physical point field: Previous and actual density of water ice (kg/m^2) |
|---|
| 39 | real, dimension(ngrid,nslope), intent(inout) :: tendencies_h2o_ice_phys ! physical point field: Evolution of perennial ice over one year (kg/m^2/year) |
|---|
| 40 | logical, intent(inout) :: STOPPING ! Stopping criterion |
|---|
| 41 | |
|---|
| 42 | ! local: |
|---|
| 43 | ! ------ |
|---|
| 44 | integer :: i,j,islope ! loop variable |
|---|
| 45 | real :: pos_tend, neg_tend, real_coefficient, negative_part ! Variable to conserve water |
|---|
| 46 | real :: 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. |
|---|
| 53 | if (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 |
|---|
| 139 | else ! ngrid==1; |
|---|
| 140 | do islope=1, nslope |
|---|
| 141 | qsurf(1,islope)=qsurf(1,islope)+tendencies_h2o_ice_phys(1,islope)*dt_pem |
|---|
| 142 | enddo |
|---|
| 143 | endif |
|---|
| 144 | |
|---|
| 145 | END SUBROUTINE evol_h2o_ice_s |
|---|
| 146 | |
|---|
| 147 | END MODULE evol_h2o_ice_s_mod |
|---|