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 @ 11922

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

Addition of output of the elapsed model time for multiple-linear-regression analysis (ticket #2175)

File size: 3.9 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 in_out_manager , ONLY :   lwp, numout, ln_timing
11   USE iom            , ONLY :   iom_put, iom_use
12   USE dom_oce        , ONLY :   adatrj
13   USE timing         , ONLY :   timing_start, timing_stop
14   USE xios
15
16   IMPLICIT NONE
17   PRIVATE
18
19   LOGICAL, PUBLIC ::   lk_diamlr = .FALSE.
20
21   PUBLIC ::   dia_mlr_init, dia_mlr_iom_init, dia_mlr
22
23   !!----------------------------------------------------------------------
24   !! NEMO/OCE 4.0 , NEMO Consortium (2019)
25   !! $Id$
26   !! Software governed by the CeCILL license (see ./LICENSE)
27   !!----------------------------------------------------------------------
28CONTAINS
29   
30   SUBROUTINE dia_mlr_init
31      !!----------------------------------------------------------------------
32      !!                 ***  ROUTINE dia_mlr_init  ***
33      !!
34      !! ** Purpose : initialisation of IOM context management for
35      !!              multiple-linear-regression analysis
36      !!
37      !!----------------------------------------------------------------------
38
39      lk_diamlr = .TRUE.
40
41      IF(lwp) THEN
42         WRITE(numout, *)
43         WRITE(numout, *) 'dia_mlr_init : initialisation of IOM context management for'
44         WRITE(numout, *) '~~~~~~~~~~~~   multiple-linear-regression analysis'
45      END IF
46
47   END SUBROUTINE dia_mlr_init
48
49   SUBROUTINE dia_mlr_iom_init
50      !!----------------------------------------------------------------------
51      !!               ***  ROUTINE dia_mlr_iom_init  ***
52      !!
53      !! ** Purpose : IOM context setup for multiple-linear-regression
54      !!              analysis
55      !!
56      !!----------------------------------------------------------------------
57
58      TYPE(xios_fieldgroup)  ::   slxhdl_fldgrp
59
60      IF(lwp) THEN
61         WRITE(numout, *)
62         WRITE(numout, *) 'dia_mlr_iom_init : IOM context setup for multiple-linear-regression'
63         WRITE(numout, *) '~~~~~~~~~~~~~~~~'
64      END IF
65
66      ! Get handle to multiple-linear-regression analysis configuration; if no
67      ! configuration is found, disable diamlr
68      IF ( lk_diamlr .AND. xios_is_valid_fieldgroup( "diamlr_fields" ) .AND. xios_is_valid_field( "diamlr_time" ) ) THEN
69         CALL xios_get_handle("diamlr_fields",  slxhdl_fldgrp)
70      ELSE
71         IF (lwp) THEN
72            WRITE(numout, *) "diamlr: no configuration found (field group 'diamlr_fields' is missing);"
73            WRITE(numout, *) "        disabling output for multiple-linear-regression analysis."
74         END IF
75         lk_diamlr = .FALSE.
76      END IF
77
78   END SUBROUTINE dia_mlr_iom_init
79
80   SUBROUTINE dia_mlr
81      !!----------------------------------------------------------------------
82      !!                   ***  ROUTINE dia_mlr  ***
83      !!
84      !! ** Purpose : update time used in multiple-linear-regression analysis
85      !!
86      !!----------------------------------------------------------------------
87
88      REAL, DIMENSION(jpi,jpj) ::   zadatrj2d
89
90      IF( ln_timing )   CALL timing_start('dia_mlr')
91
92      ! Update time to the continuous time since the start of the model run
93      ! (value of adatrj converted to time in units of seconds)
94      !
95      ! A 2-dimensional field of constant value is sent, and subsequently used
96      ! directly or transformed to a scalar or a constant 3-dimensional field as
97      ! required.
98      zadatrj2d(:,:) = adatrj*86400.0_wp
99      IF ( iom_use('diamlr_time') ) CALL iom_put('diamlr_time', zadatrj2d)
100     
101      IF( ln_timing )   CALL timing_stop('dia_mlr')
102
103   END SUBROUTINE dia_mlr
104
105END MODULE diamlr
Note: See TracBrowser for help on using the repository browser.