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.
diawri_c1d.F90 in trunk/NEMO/C1D_SRC – NEMO

source: trunk/NEMO/C1D_SRC/diawri_c1d.F90 @ 899

Last change on this file since 899 was 899, checked in by rblod, 16 years ago

First set of modifications related to 1D update : cometic changes, see ticket #117

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