1 | ! |
---|
2 | ! $Id $ |
---|
3 | ! |
---|
4 | SUBROUTINE evol_h2o_ice_s_slope(qsurf,tendencies_h2o_ice_phys,& |
---|
5 | iim_input,jjm_input,ngrid,cell_area,STOPPING,nslope) |
---|
6 | |
---|
7 | USE temps_mod_evol, ONLY: dt_pem |
---|
8 | use comslope_mod, ONLY: subslope_dist |
---|
9 | |
---|
10 | IMPLICIT NONE |
---|
11 | |
---|
12 | !======================================================================= |
---|
13 | ! |
---|
14 | ! Routine that compute the evolution of the water ice |
---|
15 | ! |
---|
16 | !======================================================================= |
---|
17 | |
---|
18 | ! arguments: |
---|
19 | ! ---------- |
---|
20 | |
---|
21 | ! INPUT |
---|
22 | |
---|
23 | INTEGER, intent(in) :: iim_input,jjm_input, ngrid,nslope ! # of grid points along longitude/latitude/ total |
---|
24 | ! REAL, intent(in) :: tendencies_h2o_ice_phys(ngrid) ! physical point field : Evolution of perenial ice over one year |
---|
25 | REAL, intent(in) :: cell_area(ngrid) |
---|
26 | |
---|
27 | ! OUTPUT |
---|
28 | REAL, INTENT(INOUT) :: qsurf(ngrid,nslope) ! physical point field : Previous and actual density of water ice |
---|
29 | LOGICAL :: STOPPING |
---|
30 | REAL, intent(inout) :: tendencies_h2o_ice_phys(ngrid,nslope) ! physical point field : Evolution of perenial ice over one year |
---|
31 | |
---|
32 | |
---|
33 | ! local: |
---|
34 | ! ---- |
---|
35 | |
---|
36 | INTEGER :: i,j,ig0,islope ! loop variable |
---|
37 | ! REAL :: not_budget, budget |
---|
38 | REAL :: pos_tend, neg_tend, real_coefficient,negative_part |
---|
39 | REAL :: new_tendencies(ngrid,nslope) |
---|
40 | |
---|
41 | |
---|
42 | !======================================================================= |
---|
43 | |
---|
44 | ! budget=sum(qsurf(:)) |
---|
45 | |
---|
46 | pos_tend=0. |
---|
47 | neg_tend=0. |
---|
48 | |
---|
49 | do i=1,ngrid |
---|
50 | do islope=1,nslope |
---|
51 | if (qsurf(i,islope).GT.0) then |
---|
52 | if (tendencies_h2o_ice_phys(i,islope).GT.0) then |
---|
53 | pos_tend=pos_tend+tendencies_h2o_ice_phys(i,islope)*cell_area(i)*subslope_dist(i,islope) |
---|
54 | else |
---|
55 | neg_tend=neg_tend-tendencies_h2o_ice_phys(i,islope)*cell_area(i)*subslope_dist(i,islope) |
---|
56 | endif |
---|
57 | endif |
---|
58 | enddo |
---|
59 | enddo |
---|
60 | |
---|
61 | ! print *, "pos_tend", pos_tend |
---|
62 | ! print *, "neg_tend", neg_tend |
---|
63 | |
---|
64 | if(neg_tend.GT.pos_tend .and. pos_tend.GT.0) then |
---|
65 | do i=1,ngrid |
---|
66 | do islope=1,nslope |
---|
67 | if(tendencies_h2o_ice_phys(i,islope).LT.0) then |
---|
68 | ! print *, "pos_tend/neg_tend", pos_tend/neg_tend |
---|
69 | new_tendencies(i,islope)=tendencies_h2o_ice_phys(i,islope)*(pos_tend/neg_tend) |
---|
70 | else |
---|
71 | new_tendencies(i,islope)=tendencies_h2o_ice_phys(i,islope) |
---|
72 | endif |
---|
73 | enddo |
---|
74 | enddo |
---|
75 | elseif(neg_tend.LT.pos_tend .and. neg_tend.GT.0) then |
---|
76 | ! print *, "neg_tend/pos_tend", neg_tend/pos_tend |
---|
77 | do i=1,ngrid |
---|
78 | do islope=1,nslope |
---|
79 | if(tendencies_h2o_ice_phys(i,islope).LT.0) then |
---|
80 | new_tendencies(i,islope)=tendencies_h2o_ice_phys(i,islope) |
---|
81 | else |
---|
82 | new_tendencies(i,islope)=tendencies_h2o_ice_phys(i,islope)*(neg_tend/pos_tend) |
---|
83 | endif |
---|
84 | enddo |
---|
85 | enddo |
---|
86 | elseif(pos_tend.EQ.0 .OR. neg_tend.EQ.0) then |
---|
87 | |
---|
88 | ! call criterion_ice_stop(cell_area,1,qsurf*0.,STOPPING,ngrid,cell_area) |
---|
89 | call criterion_ice_stop_water_slope(cell_area,1,qsurf(:,:)*0.,STOPPING,ngrid,cell_area) |
---|
90 | do i=1,ngrid |
---|
91 | do islope=1,nslope |
---|
92 | new_tendencies(i,islope)=0 |
---|
93 | enddo |
---|
94 | enddo |
---|
95 | endif |
---|
96 | |
---|
97 | |
---|
98 | |
---|
99 | negative_part = 0. |
---|
100 | |
---|
101 | |
---|
102 | ! Evolution of the water ice for each physical point |
---|
103 | do i=1,ngrid |
---|
104 | do islope=1, nslope |
---|
105 | ! qsurf(i)=qsurf(i)+tendencies_h2o_ice_phys(i)*dt_pem |
---|
106 | qsurf(i,islope)=qsurf(i,islope)+new_tendencies(i,islope)*dt_pem |
---|
107 | ! budget=budget+tendencies_h2o_ice_phys(i)*dt_pem |
---|
108 | if (qsurf(i,islope).lt.0) then |
---|
109 | ! not_budget=not_budget+qsurf(i) |
---|
110 | ! print *, "NNqsurf(i,islope)", qsurf(i,islope) |
---|
111 | ! print *, "NNnew_tendencies(i,islope)", new_tendencies(i,islope) |
---|
112 | ! print *, "NNtendencies_h2o_ice_phys(i,islope)", tendencies_h2o_ice_phys(i,islope) |
---|
113 | negative_part=negative_part-qsurf(i,islope)*cell_area(i)*subslope_dist(i,islope) |
---|
114 | qsurf(i,islope)=0. |
---|
115 | tendencies_h2o_ice_phys(i,islope)=0. |
---|
116 | ! print *, "NNineg", i |
---|
117 | endif |
---|
118 | if(qsurf(i,islope).NE.qsurf(i,islope)) then |
---|
119 | ! print *, "qsurf(i,islope)",qsurf(i,islope) |
---|
120 | ! print *, "new_tendencies",new_tendencies(i,islope) |
---|
121 | ! print *, "tendencies_h2o_ice_phys",tendencies_h2o_ice_phys(i,islope) |
---|
122 | ! print *, "i", i |
---|
123 | ! print *,"islope",islope |
---|
124 | endif |
---|
125 | enddo |
---|
126 | enddo |
---|
127 | |
---|
128 | ! print *, "negative_part", negative_part |
---|
129 | real_coefficient=negative_part/pos_tend |
---|
130 | ! print *, "real_coefficient", real_coefficient |
---|
131 | |
---|
132 | do i=1,ngrid |
---|
133 | do islope=1, nslope |
---|
134 | if(new_tendencies(i,islope).GT.0) then |
---|
135 | qsurf(i,islope)=qsurf(i,islope)-new_tendencies(i,islope)*real_coefficient*dt_pem |
---|
136 | endif |
---|
137 | enddo |
---|
138 | enddo |
---|
139 | |
---|
140 | |
---|
141 | |
---|
142 | ! Conservation of water ice |
---|
143 | ! qsurf(:)=qsurf(:)*budget/sum(qsurf(:)) |
---|
144 | |
---|
145 | |
---|
146 | END SUBROUTINE evol_h2o_ice_s_slope |
---|