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.
diamlr.F90 in NEMO/branches/2019/dev_r11879_ENHANCE-05_SimonM-Harmonic_Analysis/src/OCE/DIA – NEMO

source: NEMO/branches/2019/dev_r11879_ENHANCE-05_SimonM-Harmonic_Analysis/src/OCE/DIA/diamlr.F90 @ 12122

Last change on this file since 12122 was 12122, checked in by smueller, 4 years ago

Modifications to make modules diadetide and diamlr compilable and compatible with module tide_mod (tickets #2175 and #2194)

File size: 23.0 KB
Line 
1MODULE diamlr
2   !!======================================================================
3   !!                       ***  MODULE  diamlr  ***
4   !! Management of the IOM context for multiple-linear-regression analysis
5   !!======================================================================
6   !! History :       !  2019  (S. Mueller)
7   !!----------------------------------------------------------------------
8
9   USE par_oce        , ONLY :   wp, jpi, jpj
10   USE phycst         , ONLY :   rpi
11   USE in_out_manager , ONLY :   lwp, numout, ln_timing
12   USE iom            , ONLY :   iom_put, iom_use, iom_update_file_name
13   USE dom_oce        , ONLY :   adatrj
14   USE timing         , ONLY :   timing_start, timing_stop
15   USE xios
16   USE tide_mod
17
18   IMPLICIT NONE
19   PRIVATE
20
21   LOGICAL, PUBLIC ::   lk_diamlr = .FALSE.
22
23   PUBLIC ::   dia_mlr_init, dia_mlr_iom_init, dia_mlr
24
25   !!----------------------------------------------------------------------
26   !! NEMO/OCE 4.0 , NEMO Consortium (2019)
27   !! $Id$
28   !! Software governed by the CeCILL license (see ./LICENSE)
29   !!----------------------------------------------------------------------
30CONTAINS
31   
32   SUBROUTINE dia_mlr_init
33      !!----------------------------------------------------------------------
34      !!                 ***  ROUTINE dia_mlr_init  ***
35      !!
36      !! ** Purpose : initialisation of IOM context management for
37      !!              multiple-linear-regression analysis
38      !!
39      !!----------------------------------------------------------------------
40
41      lk_diamlr = .TRUE.
42
43      IF(lwp) THEN
44         WRITE(numout, *)
45         WRITE(numout, *) 'dia_mlr_init : initialisation of IOM context management for'
46         WRITE(numout, *) '~~~~~~~~~~~~   multiple-linear-regression analysis'
47      END IF
48
49   END SUBROUTINE dia_mlr_init
50
51   SUBROUTINE dia_mlr_iom_init
52      !!----------------------------------------------------------------------
53      !!               ***  ROUTINE dia_mlr_iom_init  ***
54      !!
55      !! ** Purpose : IOM context setup for multiple-linear-regression
56      !!              analysis
57      !!
58      !!----------------------------------------------------------------------
59
60      TYPE(xios_fieldgroup)                       ::   slxhdl_fldgrp
61      TYPE(xios_filegroup)                        ::   slxhdl_filgrp
62      TYPE(xios_field), ALLOCATABLE, DIMENSION(:) ::   slxhdl_regs,    slxhdl_flds
63      TYPE(xios_field)                            ::   slxhdl_fld
64      TYPE(xios_file)                             ::   slxhdl_fil
65      LOGICAL                                     ::   llxatt_enabled, llxatt_comment
66      CHARACTER(LEN=256)                          ::   clxatt_expr,    clxatt_comment
67      CHARACTER(LEN=32)                           ::   clxatt_name1,   clxatt_name2
68      CHARACTER(LEN=32)                           ::   clxatt_gridref, clxatt_fieldref
69      INTEGER, PARAMETER                          ::   jpscanmax = 999
70      INTEGER                                     ::   ireg, ifld
71      CHARACTER(LEN=3)                            ::   cl3i
72      CHARACTER(LEN=6)                            ::   cl6a
73      CHARACTER(LEN=7)                            ::   cl7a
74      CHARACTER(LEN=1)                            ::   clgt
75      CHARACTER(LEN=2)                            ::   clgd
76      CHARACTER(LEN=25)                           ::   clfloat
77      CHARACTER(LEN=32)                           ::   clrepl
78      INTEGER                                     ::   jl, jm, jn
79      INTEGER                                     ::   itide                       ! Number of available tidal components
80      REAL(wp)                                    ::   ztide_phase                 ! Tidal-constituent phase at adatrj=0
81      CHARACTER (LEN=4), DIMENSION(jpmax_harmo)   ::   ctide_selected = ' n/a '
82      TYPE(tide_harmonic), DIMENSION(:), POINTER  ::   stideconst
83
84      IF(lwp) THEN
85         WRITE(numout, *)
86         WRITE(numout, *) 'dia_mlr_iom_init : IOM context setup for multiple-linear-regression'
87         WRITE(numout, *) '~~~~~~~~~~~~~~~~'
88      END IF
89
90      ! Get handles to multiple-linear-regression analysis configuration (field
91      ! group 'diamrl_fields' and file group 'diamlr_files'); if no suitable
92      ! configuration is found, disable diamlr
93      IF ( lk_diamlr .AND. xios_is_valid_fieldgroup( "diamlr_fields" ) .AND. xios_is_valid_field( "diamlr_time" ) .AND.   &
94         & xios_is_valid_filegroup( "diamlr_files" ) ) THEN
95         CALL xios_get_handle("diamlr_fields", slxhdl_fldgrp)
96         CALL xios_get_handle("diamlr_files",  slxhdl_filgrp)
97      ELSE
98         IF (lwp) THEN
99            WRITE(numout, *) "diamlr: configuration not found or icomplete (field group 'diamlr_fields'"
100            WRITE(numout, *) "        and/or file group 'diamlr_files' and/or field 'diamlr_time' missing);"
101            WRITE(numout, *) "        disabling output for multiple-linear-regression analysis."
102         END IF
103         lk_diamlr = .FALSE.
104      END IF
105
106      ! Set up IOM context for multiple-linear-regression analysis
107      IF ( lk_diamlr ) THEN
108
109         ! Set up output files for grid types scalar, grid_T, grid_U, grid_V,
110         ! and grid_W
111         DO jm = 1, 5
112            SELECT CASE( jm )
113            CASE( 1 )
114               cl6a = 'scalar'
115            CASE( 2 )
116               cl6a = 'grid_T'
117            CASE( 3 )
118               cl6a = 'grid_U'
119            CASE( 4 )
120               cl6a = 'grid_V'
121            CASE( 5 )
122               cl6a = 'grid_W'
123            END SELECT
124            CALL xios_add_child      ( slxhdl_filgrp, slxhdl_fil, "diamlr_file_"//cl6a )
125            CALL xios_set_attr       ( slxhdl_fil, name_suffix="_diamlr_"//cl6a,   &
126               &                       description="Intermediate output for multiple-linear-regression analysis - "//cl6a )
127            CALL iom_update_file_name( "diamlr_file_"//cl6a )
128         END DO
129
130         ! Compile lists of active regressors and of fields selected for
131         ! analysis (fields "diamlr_r<nnn>" and "diamlr_f<nnn>", where <nnn> is
132         ! a 3-digit integer); also carry out placeholder substitution of tidal
133         ! parameters in regressor expressions
134         !
135         ALLOCATE( slxhdl_regs( jpscanmax ), slxhdl_flds( jpscanmax ) )
136         ireg = 0
137         ifld = 0
138         !
139         IF ( ln_tide ) THEN
140            ! Retrieve information (frequency, phase, nodal correction) about all
141            ! available tidal constituents for placeholder substitution below
142            ctide_selected(1:34) = (/ 'Mf', 'Mm', 'Ssa', 'Mtm', 'Msf',    &
143               &                      'Msqm', 'Sa', 'K1', 'O1', 'P1',     &
144               &                      'Q1', 'J1', 'S1', 'M2', 'S2', 'N2', &
145               &                      'K2', 'nu2', 'mu2', '2N2', 'L2',    &
146               &                      'T2', 'eps2', 'lam2', 'R2', 'M3',   &
147               &                      'MKS2', 'MN4', 'MS4', 'M4', 'N4',   &
148               &                      'S4', 'M6', 'M8' /)
149            CALL tide_init_harmonics(ctide_selected, stideconst)
150            itide = size(stideconst)
151         ELSE
152            itide = 0
153         ENDIF
154         
155         DO jm = 1, jpscanmax
156            WRITE (cl3i, '(i3.3)') jm
157
158            ! Look for regressor
159            IF ( xios_is_valid_field( "diamlr_r"//cl3i ) ) THEN
160
161               CALL xios_get_handle( "diamlr_r"//cl3i, slxhdl_regs(ireg+1) )
162               ! Retrieve pre-configured value of "enabled" attribute and
163               ! regressor expression
164               CALL xios_get_attr  ( slxhdl_regs(ireg+1), enabled=llxatt_enabled, expr=clxatt_expr )
165               ! If enabled, keep handle in list of active regressors; also
166               ! substitute placeholders for tidal frequencies, phases, and
167               ! nodal corrections in regressor expressions
168               IF ( llxatt_enabled ) THEN
169
170                  ! Substitution of placeholders for tidal-constituent
171                  ! parameters (amplitudes, angular veloccities, nodal phase
172                  ! correction) with values that have been obtained from the
173                  ! tidal-forcing implementation (if enabled)
174                  DO jn = 1, itide
175                     ! Compute phase of tidal constituent (incl. current nodal
176                     ! correction) at the start of the model run (i.e. for
177                     ! adatrj=0)
178                     ztide_phase = MOD( stideconst(jn)%u +  stideconst(jn)%v0 - adatrj * 86400.0_wp * stideconst(jn)%omega, &
179                        & 2.0_wp * rpi )
180                     clrepl = "__TDE_"//TRIM( stideconst(jn)%cname_tide )//"_omega__"
181                     DO WHILE ( INDEX( clxatt_expr, TRIM( clrepl ) ) > 0 )
182                        WRITE (clfloat, '(e25.18)') stideconst(jn)%omega
183                        jl = INDEX( clxatt_expr, TRIM( clrepl ) )
184                        clxatt_expr = clxatt_expr(1:jl - 1)//clfloat//   &
185                           &          clxatt_expr(jl + LEN( TRIM( clrepl ) ):LEN( TRIM( clxatt_expr ) ))
186                     END DO
187                     clrepl = "__TDE_"//TRIM( stideconst(jn)%cname_tide )//"_phase__"
188                     DO WHILE ( INDEX( clxatt_expr, TRIM( clrepl ) ) > 0 )
189                        WRITE (clfloat, '(e25.18)') ztide_phase
190                        jl = INDEX( clxatt_expr, TRIM( clrepl ) )
191                        clxatt_expr = clxatt_expr(1:jl - 1)//clfloat//   &
192                           &          clxatt_expr(jl + LEN( TRIM( clrepl ) ):LEN( TRIM( clxatt_expr ) ))
193                     END DO
194                     clrepl = "__TDE_"//TRIM( stideconst(jn)%cname_tide )//"_amplitude__"
195                     DO WHILE (INDEX( clxatt_expr, TRIM( clrepl ) ) > 0 )
196                        WRITE (clfloat, '(e25.18)') stideconst(jn)%f
197                        jl = INDEX( clxatt_expr, TRIM( clrepl ) )
198                        clxatt_expr = clxatt_expr(1:jl - 1)//clfloat//   &
199                           &          clxatt_expr(jl + LEN( TRIM( clrepl ) ):LEN( TRIM( clxatt_expr ) ))
200                     END DO
201                  END DO
202
203                  ! Set standard value for comment attribute, including possible
204                  ! existing comment added in parantheses
205                  CALL xios_is_defined_attr( slxhdl_regs(ireg+1), comment=llxatt_comment )
206                  IF ( llxatt_comment ) THEN
207                     CALL xios_get_attr( slxhdl_regs(ireg+1), comment=clxatt_comment )
208                     clxatt_comment = "Regressor "//cl3i//" ("//TRIM( clxatt_comment )//") "
209                  ELSE
210                     clxatt_comment = "Regressor "//cl3i
211                  END IF
212
213                  ! Set name attribute (and overwrite possible pre-configured
214                  ! name) with field id to enable id string retrieval from
215                  ! stored handle below, re-set expression with possible
216                  ! substitutions, and set or re-set comment attribute
217                  CALL xios_set_attr  ( slxhdl_regs(ireg+1), name="diamlr_r"//cl3i, expr=TRIM( clxatt_expr ),   &
218                     &                  comment=TRIM( clxatt_comment ) )
219
220                  ireg = ireg + 1   ! Accept regressor in list of active regressors
221
222               END IF
223            END IF
224
225            ! Look for field
226            IF ( xios_is_valid_field( "diamlr_f"//cl3i ) ) THEN
227
228               CALL xios_get_handle( "diamlr_f"//cl3i, slxhdl_flds(ifld+1) )
229               ! Retrieve pre-configured value of "enabled" attribute
230               CALL xios_get_attr  ( slxhdl_flds(ifld+1), enabled=llxatt_enabled )
231               ! If enabled, keep handle in list of fields selected for analysis
232               IF ( llxatt_enabled ) THEN
233                 
234                  ! Set name attribute (and overwrite possible pre-configured name)
235                  ! with field id to enable id string retrieval from stored handle
236                  ! below
237                  CALL xios_set_attr  ( slxhdl_flds(ifld+1), name="diamlr_f"//cl3i )
238
239                  ifld = ifld + 1   ! Accept field in list of fields selected for analysis
240
241               END IF
242            END IF
243
244         END DO
245
246         ! Output number of active regressors and fields selected for analysis
247         IF ( lwp ) WRITE(numout,'(a,i3,a)' ) 'diamlr: ', ireg, ' active regressors found'
248         IF ( lwp ) WRITE(numout,'(a,i3,a)' ) 'diamlr: ', ifld, ' fields selected for analysis'
249
250         ! Set up output of minimum, maximum, and average values of the time
251         ! variable available for the computation of regressors (diamlr_time)
252         CALL xios_get_handle( "diamlr_file_scalar", slxhdl_fil )
253         CALL xios_add_child ( slxhdl_fil, slxhdl_fld, "diamlr_time_average" )
254!$AGRIF_DO_NOT_TREAT
255         CALL xios_set_attr  ( slxhdl_fld, standard_name="diamlr_time",                          &
256            &                  long_name="Elapsed model time at start of regression interval",   &
257            &                  unit="s", operation="average", field_ref="diamlr_time",           &
258            &                  grid_ref="diamlr_grid_2D_to_scalar" )
259!$AGRIF_END_DO_NOT_TREAT
260         CALL xios_add_child ( slxhdl_fil, slxhdl_fld, "diamlr_time_minimum" )
261!$AGRIF_DO_NOT_TREAT
262         CALL xios_set_attr  ( slxhdl_fld, standard_name="diamlr_time",                          &
263            &                  long_name="Elapsed model time at start of regression interval",   &
264            &                  unit="s", operation="minimum", field_ref="diamlr_time",           &
265            &                  grid_ref="diamlr_grid_2D_to_scalar" )
266!$AGRIF_END_DO_NOT_TREAT
267         CALL xios_add_child ( slxhdl_fil, slxhdl_fld, "diamlr_time_maximum" )
268!$AGRIF_DO_NOT_TREAT
269         CALL xios_set_attr  ( slxhdl_fld, standard_name="diamlr_time",                          &
270            &                  long_name="Elapsed model time at start of regression interval",   &
271            &                  unit="s", operation="maximum", field_ref="diamlr_time",           &
272            &                  grid_ref="diamlr_grid_2D_to_scalar" )
273!$AGRIF_END_DO_NOT_TREAT
274
275         ! For each active regressor:
276         DO jm = 1, ireg
277
278            !   i) set up 2-dimensional and 3-dimensional versions of the
279            !      regressors; explicitely set "enabled" attribute; note, while
280            !      the scalar versions of regressors are part of the
281            !      configuration, the respective 2-dimensional versions take
282            !      over the defining expression, while the scalar and
283            !      3-dimensional versions are simply obtained via grid
284            !      transformations from the 2-dimensional version.
285            CALL xios_get_attr  ( slxhdl_regs( jm ), name=clxatt_name1, expr=clxatt_expr,              &
286               &                  enabled=llxatt_enabled, comment=clxatt_comment )
287            CALL xios_add_child ( slxhdl_fldgrp, slxhdl_fld, TRIM( clxatt_name1 )//"_grid_T_2D" )
288            CALL xios_set_attr  ( slxhdl_fld, expr=TRIM( clxatt_expr ), grid_ref="diamlr_grid_T_2D",     &
289               &                  field_ref="diamlr_time", enabled=llxatt_enabled )
290            CALL xios_add_child ( slxhdl_fldgrp, slxhdl_fld, TRIM( clxatt_name1 )//"_grid_U_2D" )
291            CALL xios_set_attr  ( slxhdl_fld, expr=TRIM( clxatt_expr ), grid_ref="diamlr_grid_U_2D",     &
292               &                  field_ref="diamlr_time", enabled=llxatt_enabled )
293            CALL xios_add_child ( slxhdl_fldgrp, slxhdl_fld, TRIM( clxatt_name1 )//"_grid_V_2D" )
294            CALL xios_set_attr  ( slxhdl_fld, expr=TRIM( clxatt_expr ), grid_ref="diamlr_grid_V_2D",     &
295               &                  field_ref="diamlr_time", enabled=llxatt_enabled )
296            CALL xios_add_child ( slxhdl_fldgrp, slxhdl_fld, TRIM( clxatt_name1 )//"_grid_W_2D" )
297            CALL xios_set_attr  ( slxhdl_fld, expr=TRIM( clxatt_expr ), grid_ref="diamlr_grid_W_2D",     &
298               &                  field_ref="diamlr_time", enabled=llxatt_enabled )
299            CALL xios_add_child ( slxhdl_fldgrp, slxhdl_fld, TRIM( clxatt_name1 )//"_grid_T_3D")
300            CALL xios_set_attr  ( slxhdl_fld, expr="this", grid_ref="diamlr_grid_2D_to_grid_T_3D",            &
301               &                  field_ref=TRIM( clxatt_name1 )//"_grid_T_2D", enabled=llxatt_enabled)
302            CALL xios_add_child ( slxhdl_fldgrp, slxhdl_fld, TRIM( clxatt_name1 )//"_grid_U_3D")
303            CALL xios_set_attr  ( slxhdl_fld, expr="this", grid_ref="diamlr_grid_2D_to_grid_U_3D",            &
304               &                  field_ref=TRIM( clxatt_name1 )//"_grid_U_2D", enabled=llxatt_enabled)
305            CALL xios_add_child ( slxhdl_fldgrp, slxhdl_fld, TRIM( clxatt_name1 )//"_grid_V_3D")
306            CALL xios_set_attr  ( slxhdl_fld, expr="this", grid_ref="diamlr_grid_2D_to_grid_V_3D",            &
307               &                  field_ref=TRIM( clxatt_name1 )//"_grid_V_2D", enabled=llxatt_enabled)
308            CALL xios_add_child ( slxhdl_fldgrp, slxhdl_fld, TRIM( clxatt_name1 )//"_grid_W_3D")
309            CALL xios_set_attr  ( slxhdl_fld, expr="this", grid_ref="diamlr_grid_2D_to_grid_W_3D",            &
310               &                  field_ref=TRIM( clxatt_name1 )//"_grid_W_2D", enabled=llxatt_enabled)
311            CALL xios_set_attr  ( slxhdl_regs(jm), expr="this", grid_ref="diamlr_grid_2D_to_scalar",   &
312               &                  field_ref=TRIM( clxatt_name1 )//"_grid_T_2D", enabled=llxatt_enabled)
313
314            !  ii) set up output of active regressors, including metadata
315            CALL xios_get_handle( "diamlr_file_scalar", slxhdl_fil )
316            ! Add regressor to output file
317            CALL xios_add_child ( slxhdl_fil, slxhdl_fld, TRIM( clxatt_name1 ) )
318            CALL xios_set_attr  ( slxhdl_fld, standard_name=TRIM( clxatt_comment ), long_name=TRIM( clxatt_expr ),   &
319               &                  operation="average" )
320               
321            ! iii) set up the output of scalar products with itself and with
322            !      other active regressors
323            CALL xios_get_attr  ( slxhdl_regs(jm), name=clxatt_name1 )
324            DO jn = 1, jm
325               ! Field for product between regressors
326               CALL xios_get_attr  ( slxhdl_regs(jn), name=clxatt_name2 )
327               CALL xios_add_child ( slxhdl_fldgrp, slxhdl_fld, TRIM( clxatt_name1 )//"."//TRIM( clxatt_name2 ) )
328               ! Set appropriate name attribute to avoid the possibility of
329               ! using an inappropriate inherited name attribute as the variable
330               ! name in the output file
331               CALL xios_set_attr  ( slxhdl_fld,                                                        &
332                  &                  name=TRIM( clxatt_name1 )//"."//TRIM( clxatt_name2 ),              &
333                  &                  grid_ref="diamlr_grid_scalar",                                     &
334                  &                  expr="this * "//TRIM( clxatt_name2 ),                              &
335                  &                  field_ref=TRIM( clxatt_name1 ),                                    &
336                  &                  enabled=llxatt_enabled,                                            &
337                  &                  long_name="Scalar product of regressor "//TRIM( clxatt_name1 )//   &
338                  &                     " and regressor "//TRIM( clxatt_name2 ),                        &
339                  &                  standard_name=TRIM( clxatt_name1 )//"."//TRIM( clxatt_name2 ),     &
340                  &                  operation="accumulate")
341               ! Add regressor-product field to output file
342               CALL xios_add_child ( slxhdl_fil, slxhdl_fld, TRIM( clxatt_name1 )//"."//TRIM( clxatt_name2 ) )
343            END DO
344
345            !  iv) set up definitions for the output of scalar products with
346            !      fields selected for analysis
347            DO jn = 1, ifld
348               CALL xios_get_attr  ( slxhdl_flds(jn), name=clxatt_name2, field_ref=clxatt_fieldref )
349               CALL xios_get_handle( TRIM( clxatt_fieldref ), slxhdl_fld )
350               CALL xios_get_attr  ( slxhdl_fld, grid_ref=clxatt_gridref )
351               clgt="T"
352               IF ( INDEX( clxatt_gridref, "_U_" ) > 0 ) clgt="U"
353               IF ( INDEX( clxatt_gridref, "_V_" ) > 0 ) clgt="V"
354               IF ( INDEX( clxatt_gridref, "_W_" ) > 0 ) clgt="W"
355               clgd="2D"
356               cl7a=""
357               IF ( INDEX( clxatt_gridref, "_3D" ) > 0 ) THEN
358                  clgd="3D"
359               ELSE
360                  cl7a="diamlr_"
361               END IF
362               CALL xios_add_child ( slxhdl_fldgrp, slxhdl_fld, TRIM( clxatt_name2 )//"."//TRIM( clxatt_name1 ) )
363               ! Set appropriate name attribute to avoid the possibility of
364               ! using an inappropriate inherited name attribute as the variable
365               ! name in the output file; use metadata (standard_name and
366               ! long_name) to refer to the id of the analysed field
367               CALL xios_set_attr  ( slxhdl_fld,                                                         &
368                  &                  name=TRIM( clxatt_name2 )//"."//TRIM( clxatt_name1 ),               &
369                  &                  expr="this * "//TRIM( clxatt_fieldref ),                            &
370                  &                  grid_ref=cl7a//"grid_"//clgt//"_"//clgd,                                      &
371                  &                  field_ref=TRIM( clxatt_name1 )//"_grid_"//clgt//"_"//clgd,          &
372                  &                  enabled=llxatt_enabled,                                             &
373                  &                  long_name="Scalar product of "//TRIM( clxatt_fieldref )//           &
374                  &                     " and regressor "//TRIM( clxatt_name1 ),                         &
375                  &                  standard_name=TRIM( clxatt_fieldref )//"."//TRIM( clxatt_name1 ),   &
376                  &                  operation="accumulate" )
377               CALL xios_get_handle( "diamlr_file_grid_"//clgt, slxhdl_fil )
378               CALL xios_add_child ( slxhdl_fil, slxhdl_fld, TRIM( clxatt_name2 )//"."//TRIM( clxatt_name1 ) )
379            END DO
380
381         END DO
382
383         ! Release list of active regressors and fields selected for analysis
384         DEALLOCATE( slxhdl_regs, slxhdl_flds )
385
386      END IF
387
388   END SUBROUTINE dia_mlr_iom_init
389
390   SUBROUTINE dia_mlr
391      !!----------------------------------------------------------------------
392      !!                   ***  ROUTINE dia_mlr  ***
393      !!
394      !! ** Purpose : update time used in multiple-linear-regression analysis
395      !!
396      !!----------------------------------------------------------------------
397
398      REAL(wp), DIMENSION(jpi,jpj) ::   zadatrj2d
399
400      IF( ln_timing )   CALL timing_start('dia_mlr')
401
402      ! Update time to the continuous time since the start of the model run
403      ! (value of adatrj converted to time in units of seconds)
404      !
405      ! A 2-dimensional field of constant value is sent, and subsequently used
406      ! directly or transformed to a scalar or a constant 3-dimensional field as
407      ! required.
408      zadatrj2d(:,:) = adatrj*86400.0_wp
409      IF ( iom_use('diamlr_time') ) CALL iom_put('diamlr_time', zadatrj2d)
410     
411      IF( ln_timing )   CALL timing_stop('dia_mlr')
412
413   END SUBROUTINE dia_mlr
414
415END MODULE diamlr
Note: See TracBrowser for help on using the repository browser.