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