[996] | 1 | ! |
---|
[2227] | 2 | ! $Id: change_srf_frac_mod.F90 2227 2015-03-12 11:07:43Z fhourdin $ |
---|
[996] | 3 | ! |
---|
| 4 | MODULE change_srf_frac_mod |
---|
| 5 | |
---|
| 6 | IMPLICIT NONE |
---|
| 7 | |
---|
| 8 | CONTAINS |
---|
| 9 | ! |
---|
| 10 | ! Change Surface Fractions |
---|
[1454] | 11 | ! Author J Ghattas 2008 |
---|
| 12 | |
---|
[996] | 13 | SUBROUTINE change_srf_frac(itime, dtime, jour, & |
---|
[2227] | 14 | !albedo SB >>> |
---|
| 15 | ! pctsrf, alb1, alb2, tsurf, ustar, u10m, v10m, pbl_tke) |
---|
| 16 | pctsrf, alb_dir, alb_dif, tsurf, ustar, u10m, v10m, pbl_tke) |
---|
| 17 | !albedo SB <<< |
---|
| 18 | |
---|
| 19 | |
---|
| 20 | |
---|
[996] | 21 | ! |
---|
| 22 | ! This subroutine is called from physiq.F at each timestep. |
---|
| 23 | ! 1- For each type of ocean (force, slab, couple) receive new fractions only if |
---|
| 24 | ! it's time to modify (is_modified=true). Otherwise nothing is done (is_modified=false). |
---|
| 25 | ! If received new fraction : |
---|
| 26 | ! 2- Tests and ajustements are done on the fractions |
---|
| 27 | ! 3- Initialize variables where a new fraction(new or melted ice) has appered, |
---|
| 28 | ! |
---|
| 29 | |
---|
| 30 | USE dimphy |
---|
[2209] | 31 | USE surface_data, ONLY : type_ocean,version_ocean |
---|
[996] | 32 | USE limit_read_mod |
---|
| 33 | USE pbl_surface_mod, ONLY : pbl_surface_newfrac |
---|
| 34 | USE cpl_mod, ONLY : cpl_receive_frac |
---|
[2209] | 35 | USE ocean_slab_mod, ONLY : fsic, ocean_slab_frac |
---|
[1785] | 36 | USE indice_sol_mod |
---|
[996] | 37 | |
---|
| 38 | INCLUDE "iniprint.h" |
---|
| 39 | INCLUDE "YOMCST.h" |
---|
[2227] | 40 | !albedo SB >>> |
---|
| 41 | include "clesphys.h" |
---|
| 42 | !albedo SB <<< |
---|
[996] | 43 | |
---|
[2227] | 44 | |
---|
| 45 | |
---|
[996] | 46 | ! Input arguments |
---|
| 47 | !**************************************************************************************** |
---|
| 48 | INTEGER, INTENT(IN) :: itime ! current time step |
---|
| 49 | INTEGER, INTENT(IN) :: jour ! day of the year |
---|
| 50 | REAL, INTENT(IN) :: dtime ! length of time step (s) |
---|
| 51 | |
---|
| 52 | ! In-Output arguments |
---|
| 53 | !**************************************************************************************** |
---|
| 54 | |
---|
| 55 | REAL, DIMENSION(klon,nbsrf), INTENT(INOUT) :: pctsrf ! sub-surface fraction |
---|
[2227] | 56 | !albedo SB >>> |
---|
| 57 | ! REAL, DIMENSION(klon,nbsrf), INTENT(INOUT) :: alb1 ! albedo first interval in SW spektrum |
---|
| 58 | ! REAL, DIMENSION(klon,nbsrf), INTENT(INOUT) :: alb2 ! albedo second interval in SW spektrum |
---|
| 59 | REAL, DIMENSION(klon,nsw,nbsrf), INTENT(INOUT) :: alb_dir,alb_dif |
---|
| 60 | !albedo SB <<< |
---|
| 61 | |
---|
[996] | 62 | REAL, DIMENSION(klon,nbsrf), INTENT(INOUT) :: tsurf |
---|
[1670] | 63 | REAL, DIMENSION(klon,nbsrf), INTENT(INOUT) :: ustar |
---|
[996] | 64 | REAL, DIMENSION(klon,nbsrf), INTENT(INOUT) :: u10m |
---|
| 65 | REAL, DIMENSION(klon,nbsrf), INTENT(INOUT) :: v10m |
---|
[2181] | 66 | !jyg< |
---|
| 67 | !! REAL, DIMENSION(klon,klev+1,nbsrf), INTENT(INOUT) :: pbl_tke |
---|
| 68 | REAL, DIMENSION(klon,klev+1,nbsrf+1), INTENT(INOUT) :: pbl_tke |
---|
| 69 | !>jyg |
---|
[996] | 70 | |
---|
| 71 | ! Loccal variables |
---|
| 72 | !**************************************************************************************** |
---|
| 73 | INTEGER :: i, nsrf |
---|
| 74 | LOGICAL :: is_modified ! true if pctsrf is modified at this time step |
---|
| 75 | LOGICAL :: test_sum=.FALSE. |
---|
| 76 | LOGICAL, DIMENSION(klon,nbsrf) :: new_surf |
---|
| 77 | REAL, DIMENSION(klon,nbsrf) :: pctsrf_old ! fraction from previous time-step |
---|
| 78 | REAL :: tmpsum |
---|
| 79 | |
---|
| 80 | pctsrf_old(:,:) = pctsrf(:,:) |
---|
| 81 | !**************************************************************************************** |
---|
| 82 | ! 1) |
---|
| 83 | ! For each type of ocean (force, slab, couple) receive new fractions only if it's time |
---|
| 84 | ! to modify (is_modified=true). Otherwise nothing is done (is_modified=false). |
---|
| 85 | !**************************************************************************************** |
---|
| 86 | SELECT CASE (type_ocean) |
---|
| 87 | CASE ('force') |
---|
| 88 | ! Read fraction from limit.nc |
---|
| 89 | CALL limit_read_frac(itime, dtime, jour, pctsrf, is_modified) |
---|
| 90 | CASE ('slab') |
---|
| 91 | ! Get fraction from slab module |
---|
| 92 | CALL ocean_slab_frac(itime, dtime, jour, pctsrf, is_modified) |
---|
| 93 | CASE ('couple') |
---|
| 94 | ! Get fraction from the coupler |
---|
| 95 | CALL cpl_receive_frac(itime, dtime, pctsrf, is_modified) |
---|
| 96 | END SELECT |
---|
| 97 | |
---|
[1454] | 98 | |
---|
[996] | 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 | !**************************************************************************************** |
---|
[1454] | 106 | IF (is_modified) THEN |
---|
[996] | 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_gcm('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_gcm('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 |
---|
[2209] | 163 | ! Send fractions back to slab ocean if needed |
---|
| 164 | IF (type_ocean == 'slab'.AND. version_ocean.NE.'sicINT') THEN |
---|
| 165 | WHERE (1.-zmasq(:)>EPSFRA) |
---|
| 166 | fsic(:)=pctsrf(:,is_sic)/(1.-zmasq(:)) |
---|
| 167 | END WHERE |
---|
| 168 | END IF |
---|
[996] | 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 | |
---|
[2227] | 178 | !albedo SB >>> |
---|
| 179 | ! CALL pbl_surface_newfrac(itime, pctsrf, pctsrf_old, tsurf, alb1, alb2, ustar, |
---|
| 180 | ! u10m, v10m, pbl_tke) |
---|
| 181 | CALL pbl_surface_newfrac(itime, pctsrf, pctsrf_old, tsurf, alb_dir,alb_dif, ustar, u10m, v10m, pbl_tke) |
---|
| 182 | !albedo SB <<< |
---|
| 183 | |
---|
| 184 | |
---|
| 185 | |
---|
[1454] | 186 | ELSE |
---|
| 187 | ! No modifcation should be done |
---|
| 188 | pctsrf(:,:) = pctsrf_old(:,:) |
---|
| 189 | |
---|
[996] | 190 | END IF ! is_modified |
---|
| 191 | |
---|
| 192 | END SUBROUTINE change_srf_frac |
---|
| 193 | |
---|
| 194 | |
---|
| 195 | END MODULE change_srf_frac_mod |
---|