1 | |
---|
2 | ! $Id: change_srf_frac_mod.F90 5112 2024-07-24 10:45:32Z abarral $ |
---|
3 | |
---|
4 | MODULE change_srf_frac_mod |
---|
5 | |
---|
6 | IMPLICIT NONE |
---|
7 | |
---|
8 | CONTAINS |
---|
9 | |
---|
10 | ! Change Surface Fractions |
---|
11 | ! Author J Ghattas 2008 |
---|
12 | |
---|
13 | SUBROUTINE change_srf_frac(itime, dtime, jour, & |
---|
14 | pctsrf, evap, z0m, z0h, agesno, & |
---|
15 | alb_dir, alb_dif, tsurf, ustar, u10m, v10m, pbl_tke) |
---|
16 | |
---|
17 | ! This SUBROUTINE is called from physiq.F at each timestep. |
---|
18 | ! 1- For each type of ocean (force, slab, couple) receive new fractions only if |
---|
19 | ! it's time to modify (is_modified=true). Otherwise nothing is done (is_modified=false). |
---|
20 | ! If received new fraction : |
---|
21 | ! 2- Tests and ajustements are done on the fractions |
---|
22 | ! 3- Initialize variables where a new fraction(new or melted ice) has appered, |
---|
23 | |
---|
24 | USE dimphy |
---|
25 | USE surface_data, ONLY: type_ocean,version_ocean |
---|
26 | USE limit_read_mod |
---|
27 | USE pbl_surface_mod, ONLY: pbl_surface_newfrac |
---|
28 | USE cpl_mod, ONLY: cpl_receive_frac |
---|
29 | USE ocean_slab_mod, ONLY: fsic, ocean_slab_frac |
---|
30 | USE indice_sol_mod |
---|
31 | USE lmdz_print_control, ONLY: lunout |
---|
32 | USE lmdz_abort_physic, ONLY: abort_physic |
---|
33 | |
---|
34 | INCLUDE "YOMCST.h" |
---|
35 | !albedo SB >>> |
---|
36 | include "clesphys.h" |
---|
37 | !albedo SB <<< |
---|
38 | |
---|
39 | |
---|
40 | |
---|
41 | ! Input arguments |
---|
42 | !**************************************************************************************** |
---|
43 | INTEGER, INTENT(IN) :: itime ! current time step |
---|
44 | INTEGER, INTENT(IN) :: jour ! day of the year |
---|
45 | REAL, INTENT(IN) :: dtime ! length of time step (s) |
---|
46 | |
---|
47 | ! In-Output arguments |
---|
48 | !**************************************************************************************** |
---|
49 | |
---|
50 | REAL, DIMENSION(klon,nbsrf), INTENT(INOUT) :: pctsrf ! sub-surface fraction |
---|
51 | REAL, DIMENSION(klon,nbsrf), INTENT(INOUT) :: evap, agesno ! sub-surface fraction |
---|
52 | REAL, DIMENSION(klon,nbsrf+1), INTENT(INOUT) :: z0m,z0h ! sub-surface fraction |
---|
53 | !albedo SB >>> |
---|
54 | REAL, DIMENSION(klon,nsw,nbsrf), INTENT(INOUT) :: alb_dir,alb_dif |
---|
55 | !albedo SB <<< |
---|
56 | |
---|
57 | REAL, DIMENSION(klon,nbsrf), INTENT(INOUT) :: tsurf |
---|
58 | REAL, DIMENSION(klon,nbsrf), INTENT(INOUT) :: ustar |
---|
59 | REAL, DIMENSION(klon,nbsrf), INTENT(INOUT) :: u10m |
---|
60 | REAL, DIMENSION(klon,nbsrf), INTENT(INOUT) :: v10m |
---|
61 | !jyg< |
---|
62 | !! REAL, DIMENSION(klon,klev+1,nbsrf), INTENT(INOUT) :: pbl_tke |
---|
63 | REAL, DIMENSION(klon,klev+1,nbsrf+1), INTENT(INOUT) :: pbl_tke |
---|
64 | !>jyg |
---|
65 | |
---|
66 | ! Loccal variables |
---|
67 | !**************************************************************************************** |
---|
68 | INTEGER :: i, nsrf |
---|
69 | LOGICAL :: is_modified ! true if pctsrf is modified at this time step |
---|
70 | LOGICAL :: test_sum=.FALSE. |
---|
71 | LOGICAL, DIMENSION(klon,nbsrf) :: new_surf |
---|
72 | REAL, DIMENSION(klon,nbsrf) :: pctsrf_old ! fraction from previous time-step |
---|
73 | REAL :: tmpsum |
---|
74 | |
---|
75 | pctsrf_old(:,:) = pctsrf(:,:) |
---|
76 | !**************************************************************************************** |
---|
77 | ! 1) |
---|
78 | ! For each type of ocean (force, slab, couple) receive new fractions only if it's time |
---|
79 | ! to modify (is_modified=true). Otherwise nothing is done (is_modified=false). |
---|
80 | !**************************************************************************************** |
---|
81 | SELECT CASE (type_ocean) |
---|
82 | CASE ('force') |
---|
83 | ! Read fraction from limit.nc |
---|
84 | CALL limit_read_frac(itime, dtime, jour, pctsrf, is_modified) |
---|
85 | CASE ('slab') |
---|
86 | IF (version_ocean == 'sicOBS'.OR. version_ocean == 'sicNO') THEN |
---|
87 | ! Read fraction from limit.nc |
---|
88 | CALL limit_read_frac(itime, dtime, jour, pctsrf, is_modified) |
---|
89 | ELSE |
---|
90 | ! Get fraction from slab module |
---|
91 | CALL ocean_slab_frac(itime, dtime, jour, pctsrf, is_modified) |
---|
92 | ENDIF |
---|
93 | CASE ('couple') |
---|
94 | ! Get fraction from the coupler |
---|
95 | CALL cpl_receive_frac(itime, dtime, pctsrf, is_modified) |
---|
96 | END SELECT |
---|
97 | |
---|
98 | |
---|
99 | !**************************************************************************************** |
---|
100 | ! 2) |
---|
101 | ! Tests and ajustements on the new fractions : |
---|
102 | ! - Put to zero fractions that are too small |
---|
103 | ! - Test total fraction sum is one for each grid point |
---|
104 | |
---|
105 | !**************************************************************************************** |
---|
106 | IF (is_modified) THEN |
---|
107 | |
---|
108 | ! Test and exit if a fraction is negative |
---|
109 | IF (MINVAL(pctsrf(:,:)) < 0.) THEN |
---|
110 | WRITE(lunout,*)'Warning! One or several fractions are negative, itime=',itime |
---|
111 | WRITE(lunout,*)'at point = ',MINLOC(pctsrf(:,:)) |
---|
112 | WRITE(lunout,*)'value = ',MINVAL(pctsrf(:,:)) |
---|
113 | CALL abort_physic('change_srf_frac','Negative fraction',1) |
---|
114 | END IF |
---|
115 | |
---|
116 | ! Optional test on the incoming fraction |
---|
117 | IF (test_sum) THEN |
---|
118 | DO i= 1, klon |
---|
119 | tmpsum = SUM(pctsrf(i,:)) |
---|
120 | IF (ABS(1. - tmpsum) > 0.05) CALL abort_physic('change_srf_frac','Total fraction not equal 1.',1) |
---|
121 | END DO |
---|
122 | END IF |
---|
123 | |
---|
124 | ! Test for too small fractions of the sum land+landice and ocean+sea-ice |
---|
125 | WHERE ((pctsrf(:,is_ter) + pctsrf(:,is_lic)) < 2*EPSFRA) |
---|
126 | pctsrf(:,is_ter) = 0. |
---|
127 | pctsrf(:,is_lic) = 0. |
---|
128 | END WHERE |
---|
129 | |
---|
130 | WHERE ((pctsrf(:,is_oce) + pctsrf(:,is_sic)) < 2*EPSFRA) |
---|
131 | pctsrf(:,is_oce) = 0. |
---|
132 | pctsrf(:,is_sic) = 0. |
---|
133 | END WHERE |
---|
134 | |
---|
135 | ! Normalize to force total fraction to be equal one |
---|
136 | DO i= 1, klon |
---|
137 | tmpsum = SUM(pctsrf(i,:)) |
---|
138 | DO nsrf = 1, nbsrf |
---|
139 | pctsrf(i,nsrf) = pctsrf(i,nsrf) / tmpsum |
---|
140 | END DO |
---|
141 | END DO |
---|
142 | |
---|
143 | ! Test for too small fractions at each sub-surface |
---|
144 | WHERE (pctsrf(:,is_ter) < EPSFRA) |
---|
145 | pctsrf(:,is_lic) = pctsrf(:,is_ter) + pctsrf(:,is_lic) |
---|
146 | pctsrf(:,is_ter) = 0. |
---|
147 | END WHERE |
---|
148 | |
---|
149 | WHERE (pctsrf(:,is_lic) < EPSFRA) |
---|
150 | pctsrf(:,is_ter) = pctsrf(:,is_ter) + pctsrf(:,is_lic) |
---|
151 | pctsrf(:,is_lic) = 0. |
---|
152 | END WHERE |
---|
153 | |
---|
154 | WHERE (pctsrf(:,is_oce) < EPSFRA) |
---|
155 | pctsrf(:,is_sic) = pctsrf(:,is_oce) + pctsrf(:,is_sic) |
---|
156 | pctsrf(:,is_oce) = 0. |
---|
157 | END WHERE |
---|
158 | |
---|
159 | WHERE (pctsrf(:,is_sic) < EPSFRA) |
---|
160 | pctsrf(:,is_oce) = pctsrf(:,is_oce) + pctsrf(:,is_sic) |
---|
161 | pctsrf(:,is_sic) = 0. |
---|
162 | END WHERE |
---|
163 | ! Send fractions back to slab ocean if needed |
---|
164 | IF (type_ocean == 'slab'.AND. version_ocean/='sicINT') THEN |
---|
165 | WHERE (1.-zmasq(:)>EPSFRA) |
---|
166 | fsic(:)=pctsrf(:,is_sic)/(1.-zmasq(:)) |
---|
167 | END WHERE |
---|
168 | END IF |
---|
169 | |
---|
170 | !**************************************************************************************** |
---|
171 | ! 3) |
---|
172 | ! Initialize variables where a new fraction has appered, |
---|
173 | ! i.e. where new sea ice has been formed |
---|
174 | ! or where ice free ocean has appread in a grid cell |
---|
175 | |
---|
176 | !**************************************************************************************** |
---|
177 | |
---|
178 | CALL pbl_surface_newfrac(itime, pctsrf, pctsrf_old, & |
---|
179 | evap, z0m, z0h, agesno, & |
---|
180 | tsurf, alb_dir,alb_dif, ustar, u10m, v10m, pbl_tke) |
---|
181 | |
---|
182 | ELSE |
---|
183 | ! No modifcation should be done |
---|
184 | pctsrf(:,:) = pctsrf_old(:,:) |
---|
185 | |
---|
186 | END IF ! is_modified |
---|
187 | |
---|
188 | END SUBROUTINE change_srf_frac |
---|
189 | |
---|
190 | |
---|
191 | END MODULE change_srf_frac_mod |
---|