New URL for NEMO forge!   http://forge.nemo-ocean.eu

Since March 2022 along with NEMO 4.2 release, the code development moved to a self-hosted GitLab.
This present forge is now archived and remained online for history.
diawri1d.F90 in tags/nemo_v1_02/NEMO/C1D_SRC – NEMO

source: tags/nemo_v1_02/NEMO/C1D_SRC/diawri1d.F90 @ 7041

Last change on this file since 7041 was 255, checked in by opalod, 19 years ago

nemo_v1_update_002 : CT : Integration of the KPP turbulent closure scheme

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 26.4 KB
Line 
1MODULE diawri1d
2   !!======================================================================
3   !!                     ***  MODULE  diawri1d  ***
4   !! Ocean diagnostics :  write ocean output files
5   !!=====================================================================
6#if defined key_cfg_1d
7   !!----------------------------------------------------------------------
8   !!   'key_cfg_1d'               1D Configuration
9   !!---------------------------------------------------------------------- 
10   !!----------------------------------------------------------------------
11   !! * Modules used
12   USE oce             ! ocean dynamics and tracers
13   USE dom_oce         ! ocean space and time domain
14   USE zdf_oce         ! ocean vertical physics
15   USE zdftke          ! TKE vertical mixing
16   USE zdfkpp          ! KPP vertical mixing
17   USE sol_oce         ! solver variables
18   USE ice_oce         ! ice variables
19   USE phycst          ! physical constants
20   USE ocfzpt          ! ???
21   USE ocesbc          ! surface thermohaline fluxes
22   USE taumod          ! surface stress
23   USE flxrnf          ! ???
24   USE zdfmxl          ! mixed layer
25   USE daymod          ! calendar
26   USE dianam          ! build name of file (routine)
27   USE diawri
28   USE zdfddm          ! vertical  physics: double diffusion
29   USE diahth          ! thermocline diagnostics
30   USE lbclnk          ! ocean lateral boundary conditions (or mpp link)
31   USE in_out_manager  ! I/O manager
32
33   IMPLICIT NONE
34   PRIVATE
35
36   !! * Accessibility
37   PUBLIC dia_wri_1d                 ! routines called by step.F90
38   !! * Module variables
39   INTEGER ::   &
40      nid_T, nz_T, nh_T, ndim_T, ndim_hT,      &   ! grid_T file
41      ndex(1)                                      ! ???
42   INTEGER, DIMENSION(jpi*jpj) ::   &
43      ndex_hT
44   INTEGER, DIMENSION(jpi*jpj*jpk) ::   &
45      ndex_T
46
47   !! * Substitutions
48#  include "zdfddm_substitute.h90"
49   !!----------------------------------------------------------------------
50   !!   OPA 9.0 , LODYC-IPSL  (2003)
51   !!----------------------------------------------------------------------
52
53CONTAINS
54   !!----------------------------------------------------------------------
55   !!   Default option                                   NetCDF output file
56   !!----------------------------------------------------------------------
57   !!   dia_wri_1d       : create the standart NetCDF output files
58   !!   dia_wri_state_1d : create an output NetCDF file for a single
59   !!                      instantaeous ocean state and forcing fields
60   !!----------------------------------------------------------------------
61
62   SUBROUTINE dia_wri_1d( kt, kindic )
63      !!---------------------------------------------------------------------
64      !!                  ***  ROUTINE dia_wri_1d  ***
65      !!                   
66      !! ** Purpose :   Standard output of opa: dynamics and tracer fields
67      !!      NETCDF format is used by default
68      !!
69      !! ** Method  :   At the beginning of the first time step (nit000),
70      !!      define all the NETCDF files and fields
71      !!      At each time step call histdef to compute the mean if ncessary
72      !!      Each nwrite time step, output the instantaneous or mean fields
73      !!      IF kindic <0, output of fields before the model interruption.
74      !!      IF kindic =0, time step loop
75      !!      IF kindic >0, output of fields before the time step loop
76      !!
77      !! History :
78      !!        !  91-03  (M.-A. Foujols)  Original code
79      !!        !  91-11  (G. Madec)
80      !!        !  92-06  (M. Imbard)  correction restart file
81      !!        !  92-07  (M. Imbard)  split into diawri and rstwri
82      !!        !  93-03  (M. Imbard)  suppress writibm
83      !!        !  98-01  (C. Levy)  NETCDF format using ioipsl INTERFACE
84      !!        !  99-02  (E. Guilyardi)  name of netCDF files + variables
85      !!   8.5  !  02-09  (G. Madec)  F90: Free form and module
86      !!   9.0  !  04-10  (C. Ethe)   1D Configuration
87      !!----------------------------------------------------------------------
88      !! * Modules used
89      USE ioipsl
90
91      !! * Arguments
92      INTEGER, INTENT( in ) ::   kt      ! ocean time-step index
93      INTEGER, INTENT( in ) ::   kindic  !
94
95      !! * Local declarations
96      LOGICAL ::   ll_print = .FALSE.    ! =T print and flush numout
97      CHARACTER (len=40) ::           &
98         clhstnam, clop, clmx            ! temporary names
99      INTEGER ::   inum = 11             ! temporary logical unit
100      INTEGER ::   &
101         ji, jj, ik                      ! dummy loop indices
102      INTEGER ::   &
103         iimi, iima, ipk, it,         &  ! temporary integers
104         ijmi, ijma                      !    "          "
105      REAL(wp) ::   &
106         zsto, zout, zmax,            &  ! temporary scalars
107         zjulian, zdt                    !    "         "
108      REAL(wp), DIMENSION(jpi,jpj) :: &
109         zw2d                            ! temporary workspace
110      !!----------------------------------------------------------------------
111     
112      ! 0. Initialisation
113      ! -----------------
114     
115      ! local variable for debugging
116      ll_print = .FALSE.
117      ll_print = ll_print .AND. lwp
118
119      ! Define frequency of output and means
120      zdt = rdt
121      IF( nacc == 1 ) zdt = rdtmin
122#if defined key_diainstant
123      zsto = nwrite * zdt
124      clop = "inst(x)"           ! no use of the mask value (require less cpu time)
125      !!! clop="inst(only(x))"   ! put 1.e+20 on land (very expensive!!)
126#else
127      zsto=zdt
128      clop="ave(x)"              ! no use of the mask value (require less cpu time)
129      !!! clop="ave(only(x))"    ! put 1.e+20 on land (very expensive!!)
130#endif
131      zout = nwrite * zdt
132      zmax = ( nitend - nit000 + 1 ) * zdt
133
134      ! Define indices of the horizontal output zoom and vertical limit storage
135      iimi = 1      ;      iima = jpi
136      ijmi = 1      ;      ijma = jpj
137      ipk = jpk
138
139      ! define time axis
140      it = kt - nit000 + 1
141
142
143      ! 1. Define NETCDF files and fields at beginning of first time step
144      ! -----------------------------------------------------------------
145
146      IF(ll_print) WRITE(numout,*) 'dia_wri_1d kt = ', kt, ' kindic ', kindic
147
148      IF( kt == nit000 ) THEN
149
150         ! Define the NETCDF files (one per grid)
151         
152         ! Compute julian date from starting date of the run
153         CALL ymds2ju( nyear, nmonth, nday, 0.e0, zjulian )
154         IF(lwp)WRITE(numout,*)
155         IF(lwp)WRITE(numout,*) 'Date 0 used :', nit000, ' YEAR ', nyear,   &
156            &                    ' MONTH ', nmonth, ' DAY ', nday, 'Julian day : ', zjulian
157         IF(lwp)WRITE(numout,*) ' indexes of zoom = ', iimi, iima, ijmi, ijma,   &
158                                 ' limit storage in depth = ', ipk
159
160         ! WRITE root name in date.file for use by postpro
161         CALL dia_nam( clhstnam, nwrite,' ' )
162         CALL ctlopn( inum, 'date.file', 'UNKNOWN', 'FORMATTED', 'SEQUENTIAL', 1, numout, lwp, 1 )
163         WRITE(inum,*) clhstnam
164         CLOSE(inum)
165         
166         ! Define the T grid FILE ( nid_T )
167         
168         CALL dia_nam( clhstnam, nwrite, 'grid_T' )
169         IF(lwp) WRITE(numout,*) " Name of NETCDF file ", clhstnam    ! filename
170         CALL histbeg( clhstnam, jpi, glamt, jpj, gphit,           &  ! Horizontal grid: glamt and gphit
171            &          iimi, iima-iimi+1, ijmi, ijma-ijmi+1,       &
172            &          0, zjulian, zdt, nh_T, nid_T )
173         CALL histvert( nid_T, "deptht", "Vertical T levels",      &  ! Vertical grid: gdept
174            &           "m", ipk, gdept, nz_T )
175         !                                                            ! Index of ocean points
176         CALL wheneq( jpi*jpj*ipk, tmask, 1, 1., ndex_T , ndim_T  )      ! volume
177         CALL wheneq( jpi*jpj    , tmask, 1, 1., ndex_hT, ndim_hT )      ! surface
178
179
180         ! Declare all the output fields as NETCDF variables
181
182         !                                                                                      !!! nid_T : 3D
183         CALL histdef( nid_T, "votemper", "Temperature"                        , "C"      ,   &  ! tn
184            &          jpi, jpj, nh_T, ipk, 1, ipk, nz_T, 32, clop, zsto, zout )
185         CALL histdef( nid_T, "vosaline", "Salinity"                           , "PSU"    ,   &  ! sn
186            &          jpi, jpj, nh_T, ipk, 1, ipk, nz_T, 32, clop, zsto, zout )
187         !                                                                                      !!! nid_T : 2D
188         CALL histdef( nid_T, "sosstsst", "Sea Surface temperature"            , "C"      ,   &  ! sst
189            &          jpi, jpj, nh_T, 1  , 1, 1  , -99 , 32, clop, zsto, zout )
190         CALL histdef( nid_T, "sosaline", "Sea Surface Salinity"               , "PSU"    ,   &  ! sss
191            &          jpi, jpj, nh_T, 1  , 1, 1  , -99 , 32, clop, zsto, zout )
192
193#if defined key_dynspg_fsc && defined key_ice_lim
194         ! sowaflup = sowaflep + sorunoff + sowafldp + a term associated to
195         !    internal damping to Levitus that can be diagnosed from others
196         ! sowaflcd = sowaflep + sorunoff + sowafldp + iowaflup
197         CALL histdef( nid_T, "iowaflup", "Ice=>ocean net freshwater"          , "kg/m2/s",   &  ! fsalt
198            &          jpi, jpj, nh_T, 1  , 1, 1  , -99 , 32, clop, zsto, zout )
199         CALL histdef( nid_T, "sowaflep", "atmos=>ocean net freshwater"        , "kg/m2/s",   &  ! fmass
200            &          jpi, jpj, nh_T, 1  , 1, 1  , -99 , 32, clop, zsto, zout )
201#endif
202         CALL histdef( nid_T, "sowaflup", "Net Upward Water Flux"              , "Kg/m2/s",   &  ! emp
203            &          jpi, jpj, nh_T, 1  , 1, 1  , -99 , 32, clop, zsto, zout )
204         CALL histdef( nid_T, "sorunoff", "Runoffs"                            , "Kg/m2/s",   &  ! runoffs
205            &          jpi, jpj, nh_T, 1  , 1, 1  , -99 , 32, clop, zsto, zout )
206         CALL histdef( nid_T, "sowaflcd", "concentration/dilution water flux"  , "kg/m2/s",   &  ! emps
207            &          jpi, jpj, nh_T, 1  , 1, 1  , -99 , 32, clop, zsto, zout )
208         CALL histdef( nid_T, "sosalflx", "Surface Salt Flux"                  , "Kg/m2/s",   &  ! emps * sn
209            &          jpi, jpj, nh_T, 1  , 1, 1  , -99 , 32, clop, zsto, zout )
210         CALL histdef( nid_T, "sohefldo", "Net Downward Heat Flux"             , "W/m2"   ,   &  ! qt
211            &          jpi, jpj, nh_T, 1  , 1, 1  , -99 , 32, clop, zsto, zout )
212         CALL histdef( nid_T, "soshfldo", "Shortwave Radiation"                , "W/m2"   ,   &  ! qsr
213            &          jpi, jpj, nh_T, 1  , 1, 1  , -99 , 32, clop, zsto, zout )
214         CALL histdef( nid_T, "somxl010", "Mixed Layer Depth 0.01"             , "m"      ,   &  ! hmlp
215            &          jpi, jpj, nh_T, 1  , 1, 1  , -99 , 32, clop, zsto, zout )
216#if defined key_zdfkpp
217         CALL histdef( nid_T, "sokppekd", "Ekman depth                     "   , "m"      ,   &  ! sokppekd
218            &          jpi, jpj, nh_T, 1  , 1, 1  , -99 , 32, clop, zsto, zout )
219         CALL histdef( nid_T, "sokppbld", "Boundary Layer Depth            "   , "m"      ,   &  ! sokppbld
220            &          jpi, jpj, nh_T, 1  , 1, 1  , -99 , 32, clop, zsto, zout )
221#endif
222         CALL histdef( nid_T, "somxlavt", "AVT : bottom of the mixed layer    ", "m"      ,   &  ! avt_mxl
223            &          jpi, jpj, nh_T, 1  , 1, 1  , -99 , 32, clop, zsto, zout )
224         CALL histdef( nid_T, "somixhgt", "Turbocline Depth"                   , "m"      ,   &  ! hmld
225            &          jpi, jpj, nh_T, 1  , 1, 1  , -99 , 32, clop, zsto, zout )
226         CALL histdef( nid_T, "soicecov", "Ice Cover"                          , "[0,1]"  ,   &  ! freeze
227            &          jpi, jpj, nh_T, 1  , 1, 1  , -99 , 32, clop, zsto, zout )
228#if ! defined key_coupled
229         CALL histdef( nid_T, "sohefldp", "Surface Heat Flux: Damping"         , "W/m2"   ,   &  ! qrp
230            &          jpi, jpj, nh_T, 1  , 1, 1  , -99 , 32, clop, zsto, zout )
231         CALL histdef( nid_T, "sowafldp", "Surface Water Flux: Damping"        , "Kg/m2/s",   &  ! erp
232            &          jpi, jpj, nh_T, 1  , 1, 1  , -99 , 32, clop, zsto, zout )
233         CALL histdef( nid_T, "sosafldp", "Surface salt flux: damping"         , "Kg/m2/s",   &  ! erp * sn
234            &          jpi, jpj, nh_T, 1  , 1, 1  , -99 , 32, clop, zsto, zout )
235#endif
236
237#if ( defined key_coupled && ! defined key_ice_lim )
238         CALL histdef( nid_T, "sohefldp", "Surface Heat Flux: Damping"         , "W/m2"   ,   &  ! qrp
239            &          jpi, jpj, nh_T, 1  , 1, 1  , -99 , 32, clop, zsto, zout )
240         CALL histdef( nid_T, "sowafldp", "Surface Water Flux: Damping"        , "Kg/m2/s",   &  ! erp
241            &          jpi, jpj, nh_T, 1  , 1, 1  , -99 , 32, clop, zsto, zout )
242         CALL histdef( nid_T, "sosafldp", "Surface salt flux: Damping"         , "Kg/m2/s",   &  ! erp * sn
243            &          jpi, jpj, nh_T, 1  , 1, 1  , -99 , 32, clop, zsto, zout )
244#endif
245         clmx ="l_max(only(x))"    ! max index on a period
246         CALL histdef( nid_T, "sobowlin", "Bowl Index"                         , "W-point",   &  ! bowl INDEX
247            &          jpi, jpj, nh_T, 1  , 1, 1  , -99 , 32, clmx, zsto, zout )
248#if defined key_diahth
249         CALL histdef( nid_T, "sothedep", "Thermocline Depth"                  , "m"      ,   & ! hth
250            &          jpi, jpj, nh_T, 1  , 1, 1  , -99 , 32, clop, zsto, zout )
251         CALL histdef( nid_T, "so20chgt", "Depth of 20C isotherm"              , "m"      ,   & ! hd20
252            &          jpi, jpj, nh_T, 1  , 1, 1  , -99 , 32, clop, zsto, zout )
253         CALL histdef( nid_T, "so28chgt", "Depth of 28C isotherm"              , "m"      ,   & ! hd28
254            &          jpi, jpj, nh_T, 1  , 1, 1  , -99 , 32, clop, zsto, zout )
255         CALL histdef( nid_T, "sohtc300", "Heat content 300 m"                 , "W"      ,   & ! htc3
256            &          jpi, jpj, nh_T, 1  , 1, 1  , -99 , 32, clop, zsto, zout )
257#endif
258
259#if defined key_ice_lim && defined key_coupled
260         CALL histdef( nid_T,"soicetem" , "Ice Surface Temperature"            , "K"      ,   &  ! tn_ice
261            &          jpi, jpj, nh_T, 1  , 1, 1  , -99 , 32, clop, zsto, zout )
262         CALL histdef( nid_T,"soicealb" , "Ice Albedo"                         , "[0,1]"  ,   &  ! alb_ice
263            &          jpi, jpj, nh_T, 1  , 1, 1  , -99 , 32, clop, zsto, zout )
264#endif 
265
266         !                                                                                      !!! nid_U : 3D
267         CALL histdef( nid_T, "vozocrtx", "Zonal Current"                      , "m/s"    ,   &  ! un
268            &          jpi, jpj, nh_T, ipk, 1, ipk, nz_T, 32, clop, zsto, zout )
269#if defined key_diaeiv
270         CALL histdef( nid_T, "vozoeivu", "Zonal EIV Current"                  , "m/s"    ,   &  ! u_eiv
271            &          jpi, jpj, nh_T, ipk, 1, ipk, nz_T, 32, clop, zsto, zout )
272#endif
273         !                                                                                      !!! nid_U : 2D
274         CALL histdef( nid_T, "sozotaux", "Wind Stress along i-axis"           , "N/m2"   ,   &  ! taux
275            &          jpi, jpj, nh_T, 1  , 1, 1  , - 99, 32, clop, zsto, zout )
276
277         !                                                                                      !!! nid_V : 3D
278         CALL histdef( nid_T, "vomecrty", "Meridional Current"                 , "m/s"    ,   &  ! vn
279            &          jpi, jpj, nh_T, ipk, 1, ipk, nz_T, 32, clop, zsto, zout )
280#if defined key_diaeiv
281         CALL histdef( nid_T, "vomeeivv", "Meridional EIV Current"             , "m/s"    ,   &  ! v_eiv
282            &          jpi, jpj, nh_T, ipk, 1, ipk, nz_T, 32, clop, zsto, zout )
283#endif
284         !                                                                                      !!! nid_V : 2D
285         CALL histdef( nid_T, "sometauy", "Wind Stress along j-axis"           , "N/m2"   ,   &  ! tauy
286            &          jpi, jpj, nh_T, 1  , 1, 1  , - 99, 32, clop, zsto, zout )
287#if defined key_zdftke
288         !                                                                                      !!! nid_W : 3D
289         CALL histdef( nid_T, "votlsdis", " Dissipation Turbulent Lenght Scale", "m"      ,   &  ! e_dis
290            &          jpi, jpj, nh_T, ipk, 1, ipk, nz_T, 32, clop, zsto, zout )
291         !
292         CALL histdef( nid_T, "votlsmix", " Mixing Turbulent Lenght Scale"     , "m"      ,   &  ! e_mix
293            &          jpi, jpj, nh_T, ipk, 1, ipk, nz_T, 32, clop, zsto, zout )
294         !
295         CALL histdef( nid_T, "votlspdl", " Prandl Number",                      "-"       ,   &  ! e_pdl
296            &          jpi, jpj, nh_T, ipk, 1, ipk, nz_T, 32, clop, zsto, zout )
297         !
298         CALL histdef( nid_T, "votlsric", " Local Richardson Number",            "-"       ,   &  ! e_ric
299            &          jpi, jpj, nh_T, ipk, 1, ipk, nz_T, 32, clop, zsto, zout )
300         !
301         CALL histdef( nid_T, "votkeend", "TKE: Turbulent kinetic energy"       , "m2/s"   ,   &  ! TKE
302            &          jpi, jpj, nh_T, ipk, 1, ipk, nz_T, 32, clop, zsto, zout )
303#endif
304#if defined key_zdfkpp
305         !                                                                                      !!! nid_W : 3D
306         CALL histdef( nid_T, "vokpprig", " Gradient Richardson Number"        ,  "-"      ,   &  ! rig
307            &          jpi, jpj, nh_T, ipk, 1, ipk, nz_T, 32, clop, zsto, zout )
308         !
309         CALL histdef( nid_T, "vokpprib", " Bulk Richardson Number    "        ,  "-"      ,   &   ! rib
310            &          jpi, jpj, nh_T, ipk, 1, ipk, nz_T, 32, clop, zsto, zout )
311         !
312         CALL histdef( nid_T, "vokppbsf", " Buoyancy forcing          "        , "N/m2"    ,   &  ! sokppbsf
313            &          jpi, jpj, nh_T, ipk, 1, ipk, nz_T, 32, clop, zsto, zout )
314         !
315         CALL histdef( nid_T, "vokppmol", "Moning Obukhov length scale     "   , "m"       ,   &  ! sokppmol
316            &          jpi, jpj, nh_T, ipk, 1, ipk, nz_T, 32, clop, zsto, zout )
317#endif
318         !
319         CALL histdef( nid_T, "voeosbn2", "Brunt-Vaisala Frequency"             , "m2/s2"  ,   &  ! rn2
320            &          jpi, jpj, nh_T, ipk, 1, ipk, nz_T, 32, clop, zsto, zout )
321
322         CALL histdef( nid_T, "votkeavt", "Vertical Eddy Diffusivity"          , "m2/s"   ,   &  ! avt
323            &          jpi, jpj, nh_T, ipk, 1, ipk, nz_T, 32, clop, zsto, zout )
324
325         CALL histdef( nid_T, "votkeevd", "Enhanced Vertical Diffusivity",       "m2/s"   ,   &  ! avt_evd
326            &          jpi, jpj, nh_T, ipk, 1, ipk, nz_T, 32, clop, zsto, zout )
327
328         CALL histdef( nid_T, "votkeavm", "Vertical Eddy Viscosity",             "m2/s"   ,   &  ! avmu
329            &          jpi, jpj, nh_T, ipk, 1, ipk, nz_T, 32, clop, zsto, zout )
330         !
331         CALL histdef( nid_T, "votkeevm", "Enhanced Vertical Viscosity",         "m2/s"   ,   &  ! avmu_evd
332            &          jpi, jpj, nh_T, ipk, 1, ipk, nz_T, 32, clop, zsto, zout )
333
334         IF( lk_zdfddm ) THEN
335            CALL histdef( nid_T,"voddmavs","Salt Vertical Eddy Diffusivity"    , "m2/s"   ,   &  ! avs
336               &          jpi, jpj, nh_T, ipk, 1, ipk, nz_T, 32, clop, zsto, zout )
337         ENDIF
338
339         CALL histend( nid_T )
340
341         IF(lwp) WRITE(numout,*)
342         IF(lwp) WRITE(numout,*) 'End of NetCDF Initialization'
343         IF(ll_print) CALL FLUSH(numout )
344
345      ENDIF
346
347      ! 2. Start writing data
348      ! ---------------------
349
350      ! ndex(1) est utilise ssi l'avant dernier argument est diffferent de
351      ! la taille du tableau en sortie. Dans ce cas , l'avant dernier argument
352      ! donne le nombre d'elements, et ndex la liste des indices a sortir
353
354      IF( lwp .AND. MOD( kt, nwrite ) == 0 ) THEN
355         WRITE(numout,*) 'dia_wri : write model outputs in NetCDF files at ', kt, 'time-step'
356         WRITE(numout,*) '~~~~~~ '
357      ENDIF
358
359      ! Write fields on T grid
360      CALL histwrite( nid_T, "votemper", it, tn            , ndim_T , ndex_T  )   ! temperature
361      CALL histwrite( nid_T, "vosaline", it, sn            , ndim_T , ndex_T  )   ! salinity
362      CALL histwrite( nid_T, "sosstsst", it, tn(:,:,1)     , ndim_hT, ndex_hT )   ! sea surface temperature
363      CALL histwrite( nid_T, "sosaline", it, sn(:,:,1)     , ndim_hT, ndex_hT )   ! sea surface salinity
364#if defined key_dynspg_fsc && defined key_ice_lim
365      CALL histwrite( nid_T, "iowaflup", it, fsalt(:,:)    , ndim_hT, ndex_hT )   ! ice=>ocean water flux
366      CALL histwrite( nid_T, "sowaflep", it, fmass(:,:)    , ndim_hT, ndex_hT )   ! atmos=>ocean water flux
367#endif
368      CALL histwrite( nid_T, "sowaflup", it, emp           , ndim_hT, ndex_hT )   ! upward water flux
369      CALL histwrite( nid_T, "sorunoff", it, runoff        , ndim_hT, ndex_hT )   ! runoff
370      CALL histwrite( nid_T, "sowaflcd", it, emps          , ndim_hT, ndex_hT )   ! c/d water flux
371      zw2d(:,:) = emps(:,:) * sn(:,:,1) * tmask(:,:,1)
372      CALL histwrite( nid_T, "sosalflx", it, zw2d          , ndim_hT, ndex_hT )   ! c/d salt flux
373      CALL histwrite( nid_T, "sohefldo", it, qt            , ndim_hT, ndex_hT )   ! total heat flux
374      CALL histwrite( nid_T, "soshfldo", it, qsr           , ndim_hT, ndex_hT )   ! solar heat flux
375      CALL histwrite( nid_T, "somxl010", it, hmlp          , ndim_hT, ndex_hT )   ! mixed layer depth
376#if defined key_zdfkpp
377      CALL histwrite( nid_T, "sokppekd", it, ekdp          , ndim_hT, ndex_hT )   ! Ekman depht
378      CALL histwrite( nid_T, "sokppbld", it, hkpp          , ndim_hT, ndex_hT )   ! boundary layer depth
379#endif 
380      ! store the vertical eddy diffusivity coef. at the bottom of the mixed layer
381      DO jj = 1, jpj
382         DO ji = 1, jpi
383            ik = nmln(ji,jj)
384            zw2d(ji,jj) = avt(ji,jj,ik) * tmask(ji,jj,1)
385         END DO
386      END DO
387      CALL histwrite( nid_T, "somxlavt", it, zw2d          , ndim_hT, ndex_hT )   ! Kz at bottom of mixed layer
388      CALL histwrite( nid_T, "somixhgt", it, hmld          , ndim_hT, ndex_hT )   ! turbocline depth
389      CALL histwrite( nid_T, "soicecov", it, freeze        , ndim_hT, ndex_hT )   ! ice cover
390#if ! defined key_coupled
391      CALL histwrite( nid_T, "sohefldp", it, qrp           , ndim_hT, ndex_hT )   ! heat flux damping
392      CALL histwrite( nid_T, "sowafldp", it, erp           , ndim_hT, ndex_hT )   ! freshwater flux damping
393      zw2d(:,:) = erp(:,:) * sn(:,:,1) * tmask(:,:,1)
394      CALL histwrite( nid_T, "sosafldp", it, zw2d          , ndim_hT, ndex_hT )   ! salt flux damping
395#endif
396#if ( defined key_coupled && ! defined key_ice_lim )
397      CALL histwrite( nid_T, "sohefldp", it, qrp           , ndim_hT, ndex_hT )   ! heat flux damping
398      CALL histwrite( nid_T, "sowafldp", it, erp           , ndim_hT, ndex_hT )   ! freshwater flux damping
399         zw2d(:,:) = erp(:,:) * sn(:,:,1) * tmask(:,:,1)
400      CALL histwrite( nid_T, "sosafldp", it, zw2d          , ndim_hT, ndex_hT )   ! salt flux damping
401#endif
402         zw2d(:,:) = FLOAT( nmln(:,:) ) * tmask(:,:,1)
403      CALL histwrite( nid_T, "sobowlin", it, zw2d          , ndim_hT, ndex_hT )   ! ???
404
405#if defined key_diahth
406      CALL histwrite( nid_T, "sothedep", it, hth           , ndim_hT, ndex_hT )   ! depth of the thermocline
407      CALL histwrite( nid_T, "so20chgt", it, hd20          , ndim_hT, ndex_hT )   ! depth of the 20 isotherm
408      CALL histwrite( nid_T, "so28chgt", it, hd28          , ndim_hT, ndex_hT )   ! depth of the 28 isotherm
409      CALL histwrite( nid_T, "sohtc300", it, htc3          , ndim_hT, ndex_hT )   ! first 300m heaat content
410#endif
411#if defined key_ice_lim &&  defined key_coupled 
412      CALL histwrite( nid_T, "soicetem", it, tn_ice        , ndim_hT, ndex_hT )   ! surf. ice temperature
413      CALL histwrite( nid_T, "soicealb", it, alb_ice       , ndim_hT, ndex_hT )   ! ice albedo
414#endif
415
416      CALL histwrite( nid_T, "vozocrtx", it, un            , ndim_T , ndex_T )    ! i-current
417      CALL histwrite( nid_T, "sozotaux", it, taux          , ndim_hT, ndex_hT )   ! i-wind stress
418      CALL histwrite( nid_T, "vomecrty", it, vn            , ndim_T , ndex_T  )   ! j-current
419      CALL histwrite( nid_T, "sometauy", it, tauy          , ndim_hT, ndex_hT )   ! j-wind stress
420#if defined key_zdftke
421      CALL histwrite( nid_T, "votlsdis", it, e_dis         , ndim_T , ndex_T )    ! Diss. Turb. lenght scale
422      CALL histwrite( nid_T, "votlsmix", it, e_mix         , ndim_T , ndex_T )    ! Mixing Turb. lenght scale
423      CALL histwrite( nid_T, "votlspdl", it, e_pdl         , ndim_T , ndex_T )    ! Prandl number
424      CALL histwrite( nid_T, "votlsric", it, e_ric         , ndim_T , ndex_T )    ! local Richardson number
425      CALL histwrite( nid_T, "votkeend", it, en            , ndim_T , ndex_T )    ! TKE
426#endif
427#if defined key_zdfkpp
428      CALL histwrite( nid_T, "vokpprig", it, rig           , ndim_T , ndex_T )    ! gradient Richardson number
429      CALL histwrite( nid_T, "vokpprib", it, rib           , ndim_T , ndex_T )    ! bulk Richardson number
430      CALL histwrite( nid_T, "vokppbsf", it, buof          , ndim_T , ndex_T )    ! buoyancy forcing
431      CALL histwrite( nid_T, "vokppmol", it, mols          , ndim_T , ndex_T )    ! Moning-Obukov length scale
432#endif
433      CALL histwrite( nid_T, "voeosbn2", it, rn2           , ndim_T , ndex_T )    ! Brunt-Vaisala Frequency
434      CALL histwrite( nid_T, "votkeavt", it, avt           , ndim_T , ndex_T )    ! T vert. eddy diff. coef.
435      CALL histwrite( nid_T, "votkeevd", it, avt_evd       , ndim_T , ndex_T )    ! T enhan. vert. eddy diff. coef.
436      CALL histwrite( nid_T, "votkeavm", it, avmu          , ndim_T , ndex_T )    ! T vert. eddy visc. coef.
437      CALL histwrite( nid_T, "votkeevm", it, avmu_evd      , ndim_T , ndex_T )    ! T enhan. vert. eddy visc. coef.
438      IF( lk_zdfddm ) THEN
439         CALL histwrite( nid_T, "voddmavs", it, fsavs(:,:,:), ndim_T, ndex_T )    ! S vert. eddy diff. coef.
440      ENDIF
441
442      ! 3. Synchronise and close all files
443      ! ---------------------------------------
444      IF( MOD( kt, nwrite ) == 0 .OR. kindic < 0 ) THEN
445         CALL histsync( nid_T )
446      ENDIF
447
448      !  Create an output files (output.abort.nc) if S < 0 or u > 20 m/s
449      IF( kindic < 0 )   CALL dia_wri_state( 'output.abort' )
450
451      IF( kt == nitend .OR. kindic < 0 ) THEN
452         CALL histclo( nid_T )
453      ENDIF
454
455   END SUBROUTINE dia_wri_1d
456#else
457   !!----------------------------------------------------------------------
458   !!   Default key                                     NO 1D Config
459   !!----------------------------------------------------------------------
460CONTAINS
461   SUBROUTINE dia_wri_1d ( kt, kindic )
462      WRITE(*,*) 'dia_wri_1d: You should not have seen this print! error?', kt, kindic
463   END SUBROUTINE dia_wri_1d
464#endif
465
466   !!======================================================================
467END MODULE diawri1d
Note: See TracBrowser for help on using the repository browser.