SURFEX  V8_0
Surfex V8_0 release
 All Classes Files Functions Variables
seaice_gelato1dn.F90
Go to the documentation of this file.
1 !SFX_LIC Copyright 1994-2014 CNRS, Meteo-France and Universite Paul Sabatier
2 !SFX_LIC This is part of the SURFEX software governed by the CeCILL-C licence
3 !SFX_LIC version 1. See LICENSE, CeCILL-C_V1-en.txt and CeCILL-C_V1-fr.txt
4 !SFX_LIC for details. version 1.
5 ! #########
6  SUBROUTINE seaice_gelato1d_n (S, &
7  hprogram,ptimec, ptstep,tpglt, psst, psss, &
8  pfsic, pfsit, psic, ptice, pice_alb)
9 ! #######################################################################
10 !
11 !!**** *SEAICE_GELATO1D_n*
12 !!
13 !! PURPOSE
14 !! -------
15 ! Run Gelato Sea-ice model, which provides sea-ice cover, temperature
16 ! and albedo
17 !
18 !!** METHOD
19 !! ------
20 ! At relevant time steps :
21 ! i) Feed Gelato input interface structures with relevant variables
22 ! taken in XCPL_xxx fields from MODD_SEAFLUX_n
23 ! ii) call the minimal Gelato sequence , namely :
24 ! a) ingest and transform inputs regarding atm and sea state,
25 ! b) run Gelato ,
26 ! c) have it process its ouptuts for atm and oce,
27 ! iii) feed output arguments using content of Gelato output interface
28 ! structure
29 !
30 ! Note : for the time being, SST and SSS are not averaged over coupling
31 ! period
32 !
33 !! EXTERNAL :
34 !! ---------
35 !! - a number of glt<xxx> routines
36 !!
37 !! IMPLICIT ARGUMENTS :
38 !! -------------------
39 !! Variables XCPL_xxx in MODD_SEAFLUX_n, and also LINTERPOL_SIC and LINTERPOL_SIT
40 !!
41 !! REFERENCE :
42 !! ---------
43 !! Salas y Melia D (2002) A global coupled sea ice-ocean model.
44 !! Ocean Model 4:137-172
45 !!
46 !! AUTHOR
47 !! ------
48 !! S.Senesi *Meteo-France* CNRM - GAME
49 !!
50 !! MODIFICATIONS
51 !! -------------
52 !! Original 01/2014
53 !-------------------------------------------------------------------------------
54 !
55 !* 0. DECLARATIONS
56 ! ------------
57 !
58 !
59 USE modd_seaflux_n, ONLY : seaflux_t
60 !
61 USE modd_csts,ONLY : xtt
62 USE modd_surf_par, ONLY : xundef
63 USE modd_types_glt , ONLY : t_glt
64 USE modd_glt_param , ONLY : xtstep=>dtt, lwg, lp1, lp2, lp3, lp4, lp5, &
65  nprinto, gelato_dim=>nx
66 
67 USE modi_glt_gelato
68 USE modi_glt_sndatmf
69 USE modi_glt_sndmlrf
70 USE modi_glt_getmlrf
71 USE modi_glt_getatmf
72 USE modi_gltools_chkinp
73 USE modi_gltools_chkout
77 !
78 !
79 USE modi_get_luout
80 USE modi_abor1_sfx
81 USE yomhook ,ONLY : lhook, dr_hook
82 USE parkind1 ,ONLY : jprb
83 !
84 IMPLICIT NONE
85 !
86 !* 0.1 declarations of arguments
87 !
88 !
89 !
90 TYPE(seaflux_t), INTENT(INOUT) :: s
91 !
92  CHARACTER(LEN=6), INTENT(IN) :: hprogram ! program calling surf. schemes
93 REAL, INTENT(IN) :: ptimec ! current duration since start of the run (s)
94 REAL, INTENT(IN) :: ptstep ! surface time-step (s)
95 TYPE(t_glt) ,INTENT(INOUT) :: tpglt ! Gelato state variable
96 REAL, DIMENSION(:) ,INTENT(IN) :: psst ! sea surface temperature (K)
97 REAL, DIMENSION(:) ,INTENT(IN) :: psss ! sea surface salinity (psu)
98 REAL, DIMENSION(:) ,INTENT(IN) :: pfsic ! sea ice cover constraint ([0-1]).
99 REAL, DIMENSION(:) ,INTENT(IN) :: pfsit ! sea ice thickness constraint (m).
100 !
101 REAL, DIMENSION(:) ,INTENT(OUT) :: psic ! Sea-ice Cover ([0-1])
102 REAL, DIMENSION(:) ,INTENT(OUT) :: ptice ! Sea-ice temperature (K)
103 REAL, DIMENSION(:) ,INTENT(OUT) :: pice_alb ! Sea-ce albedo ([0-1])
104 !
105 !* 0.2 declarations of local variables
106 !
107 REAL, DIMENSION( SIZE(PSST)) :: zsst ! sea surface temperature with frozen sea set at freezing point
108 REAL, DIMENSION( SIZE(PSST)) :: zsic ! Will hold a forcing SIC field, even if PFSIC is missing
109 !
110 INTEGER :: it ! total number of Gelato timesteps in one atmospheric timestep
111 INTEGER :: jt ! Running index 1 -> IT
112 REAL :: zt ! total number of Gelato timesteps in one atmospheric timestep
113 REAL :: ztimeg ! Gelato simulation time (s)
114 
115 ! The time step for ice coupling could be a namelist parameter
116 ! for now, it will be set, here, as equal to the ice model time step
117 REAL :: zice_coupling_tstep
118 !
119 !
120 INTEGER :: iluout ! output listing logical unit
121 REAL(KIND=JPRB) :: zhook_handle
122 !
123 !-------------------------------------------------------------------------------
124 !
125 IF (lhook) CALL dr_hook('SEAICE_GELATO1D',0,zhook_handle)
126 !
127  CALL get_luout(hprogram,iluout)
128 !
129 ! Must restore Gelato problem size (nx) to the correct value for the NPROMA block
130 !
131 gelato_dim=SIZE(psss)
132 !
133 ! Time steps stuff : default Gelato time step equals surface time step
134 !
135 IF (s%XSEAICE_TSTEP == xundef) THEN
136  it=1
137  zt=1.
138  xtstep=ptstep
139 !
140 !* case of a Gelato time-step specified using NAM_SEAICE
141 ELSE
142  IF ( ptstep < s%XSEAICE_TSTEP ) THEN
143  CALL abor1_sfx("XSEAICE_TSTEP SHOULD BE EQUAL OR LESS THAN ATMOSPHERIC TIME STEP")
144  ELSE
145  it=nint(ptstep/s%XSEAICE_TSTEP)
146  zt=float(it)
147  xtstep=ptstep/zt
148  ENDIF
149 ENDIF
150 !
151 ! Initializations
152 !________________________________________________________________________
153 !
154 ! Ocean part
155 !----------------------------------------------------------------------------------
156 ! Surface salinity
157 tpglt%oce_all(:,1)%sml=psss(:)
158 
159 ! Ensure that SSS-dependant freezing point temperature is used on
160 ! locations where SIC (or SST) forcing value calls for it
161 
162 ! First init ZSST with freezing temperature (which depends on local salinity)
163 ! (Gelato uses Celsius scale for freezing temperatures)
164 zsst=reshape(glt_swfrzt2d(reshape(psss,(/SIZE(psss),1/))) + xtt,(/SIZE(psss)/))
165 
166 ! Then replace freezing temp with Surfex-provided SST (PSST) where
167 ! there is no (explicit or implicit) seaice and temperature is warmer
168 ! than freezing point. And inits ZSIC accordingly
169 IF (s%LINTERPOL_SIC) THEN
170  zsic=pfsic
171  WHERE ( zsic(:) < 1.e-10 .AND. psst(:) > zsst(:) )
172  zsst(:)=psst(:)
173  ENDWHERE
174 ELSE
175  ! Implicit sea-ice cover
176  WHERE (psst(:) - xtt > s%XFREEZING_SST + 0.1 )
177  zsst(:)= psst(:)
178  zsic(:)=0.
179  ELSEWHERE
180  zsic(:)=1.
181  ENDWHERE
182 ENDIF
183 !
184 ! Run Gelato for the length of the atmospheric time step
185 !________________________________________________________________________
186 !
187 ! Reset output accumulation/averaging fields
188 psic = 0.
189 ptice = 0.
190 pice_alb= 0.
191 lp1 = (lwg.AND.nprinto>=1)
192 lp2 = (lwg.AND.nprinto>=2)
193 lp3 = (lwg.AND.nprinto>=3)
194 lp4 = (lwg.AND.nprinto>=4)
195 lp5 = (lwg.AND.nprinto>=5)
196 
197 DO jt=1,it
198  IF (SIZE(psss) > 0) THEN
199  tpglt%oce_all(:,1)%tml=zsst(:)
200  IF (s%LINTERPOL_SIC) tpglt%sit_d(1,:,1)%fsi=zsic(:)
201  IF (s%LINTERPOL_SIT) tpglt%sit_d(1,:,1)%hsi=pfsit(:)
202  ! Gelato will compute heat flux from ocean by itself, thanks to
203  ! imposed namelist parameter nextqoc=0
204  tpglt%oce_all(:,1)%qoc=0.
205  ! Zero Frazil flux
206  tpglt%oce_all(:,1)%qml=0.
207  ! Don't bother for sea level variations
208  tpglt%oce_all(:,1)%ssh=0.
209  ! (velocity components are useless in Surfex 1D setting)
210  !
211  ! Atmosphere part
212  !----------------
213  ! Feed Gelato input structure with flux values from XCPL_xx
214  !
215  tpglt%atm_all(:,1)%lip=s%XCPL_SEA_RAIN(:) / ptstep
216  tpglt%atm_all(:,1)%sop=s%XCPL_SEA_SNOW(:) / ptstep
217  ! Fluxes over Sea water
218  tpglt%atm_wat(:,1)%eva=s%XCPL_SEA_EVAP(:) / ptstep
219  tpglt%atm_wat(:,1)%swa=s%XCPL_SEA_SNET(:) / ptstep
220  tpglt%atm_wat(:,1)%nsf=s%XCPL_SEA_HEAT(:) / ptstep
221  tpglt%atm_wat(:,1)%dfl=s%XSI_FLX_DRV ! W m-2 K-1
222  ! Fluxes over Sea ice
223  tpglt%atm_ice(1,:,1)%eva=s%XCPL_SEAICE_EVAP(:) / ptstep
224  tpglt%atm_ice(1,:,1)%swa=s%XCPL_SEAICE_SNET(:) / ptstep
225  tpglt%atm_ice(1,:,1)%nsf=s%XCPL_SEAICE_HEAT(:) / ptstep
226  tpglt%atm_ice(1,:,1)%dfl=s%XSI_FLX_DRV ! W m-2 K-1
227  ! (stress components are useless in Surfex 1D setting)
228  !
229  ! Let Gelato process its input data
230  !
231  CALL glt_getmlrf( tpglt%oce_all,tpglt%tml )
232  CALL glt_getatmf( tpglt )
233  CALL gltools_chkinp( 20010101,tpglt )
234  !
235  ! Compute gelato time index
236  !
237  tpglt%IND%CUR = ( ptimec + jt * xtstep ) / xtstep
238  !
239  ! Let Gelato thermodynamic scheme run
240  !
241  CALL glt_gelato( tpglt )
242  !
243  ! Have Gelato feed its coupling ouptut interface
244  !
245  CALL glt_sndatmf( tpglt )
246  CALL glt_sndmlrf( tpglt%bat,tpglt%dom,tpglt%atm_all,tpglt%tml, &
247  tpglt%dia,tpglt%sit,tpglt%tfl,tpglt%ust,tpglt%all_oce )
248  CALL wridia_ar5( tpglt )
249  CALL gltools_chkout( 20010101,tpglt ) ! Does not actually work with Arpege
250  ! Sum output fields over Gelato model time step duration
251  psic = psic + tpglt%ice_atm(1,:,1)%fsi * xtstep
252  ptice = ptice + tpglt%ice_atm(1,:,1)%tsf * xtstep
253  pice_alb = pice_alb + tpglt%ice_atm(1,:,1)%alb * xtstep
254  ENDIF
255 END DO
256 ! Average output fields over coupling time
257 psic = psic / (it * xtstep)
258 ptice = ptice / (it * xtstep)
259 pice_alb = pice_alb / (it * xtstep)
260 !
261 ! Resets input accumulation fields for next step
262 !
263 s%XCPL_SEA_RAIN=0.
264 s%XCPL_SEA_SNOW=0.
265 s%XCPL_SEA_EVAP=0.
266 s%XCPL_SEA_SNET=0.
267 s%XCPL_SEA_HEAT=0.
268 s%XCPL_SEAICE_EVAP=0.
269 s%XCPL_SEAICE_SNET=0.
270 s%XCPL_SEAICE_HEAT=0.
271 !
272 IF (lhook) CALL dr_hook('SEAICE_GELATO1D',1,zhook_handle)
273 !!-------------------------------------------------------------------------------
274 !!-----------------------------------------------------------------------------
275 END SUBROUTINE seaice_gelato1d_n
subroutine seaice_gelato1d_n(S, HPROGRAM, PTIMEC, PTSTEP, TPGLT, PSST, PSSS, PFSIC, PFSIT, PSIC, PTICE, PICE_ALB)
subroutine glt_gelato(tpglt)
subroutine glt_sndmlrf(pbathy, tpdom, tpatc, tpml, tpdia, tpsit, tptfl, pustar, tpall_oce)
subroutine glt_getatmf(tpglt)
subroutine gltools_chkout(kdate, tpglt)
subroutine abor1_sfx(YTEXT)
Definition: abor1_sfx.F90:6
subroutine wridia_ar5(tpglt)
subroutine get_luout(HPROGRAM, KLUOUT)
Definition: get_luout.F90:6
subroutine gltools_chkinp(kdate, tpglt)
subroutine glt_sndatmf(tpglt, xtmlf)
subroutine glt_getmlrf(tpoce_all, tpml)