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/2020/dev_r12512_HPC-04_mcastril_Mixed_Precision_implementation/src/OCE/DIA – NEMO

source: NEMO/branches/2020/dev_r12512_HPC-04_mcastril_Mixed_Precision_implementation/src/OCE/DIA/diamlr.F90 @ 13135

Last change on this file since 13135 was 13135, checked in by orioltp, 4 years ago

dev_r12512_HPC-04_mcastril_Mixed_Precision_implementation: merge with trunk@13134, see #2364

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