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 trunk/NEMO/C1D_SRC – NEMO

source: trunk/NEMO/C1D_SRC/diawri1d.F90 @ 708

Last change on this file since 708 was 708, checked in by smasson, 17 years ago

continue changeset:704, see ticket:5

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