1 | MODULE trdmxl_oce |
---|
2 | !!====================================================================== |
---|
3 | !! *** MODULE trdmxl_oce *** |
---|
4 | !! Ocean trends : set tracer and momentum trend variables |
---|
5 | !!====================================================================== |
---|
6 | !! History : 1.0 ! 2004-08 (C. Talandier) New trends organization |
---|
7 | !! 3.5 ! 2012-02 (G. Madec) suppress the trend keys + new trdmxl formulation |
---|
8 | !!---------------------------------------------------------------------- |
---|
9 | USE par_oce ! ocean parameters |
---|
10 | |
---|
11 | IMPLICIT NONE |
---|
12 | PRIVATE |
---|
13 | |
---|
14 | PUBLIC trdmxl_oce_alloc ! Called in trdmxl.F90 |
---|
15 | |
---|
16 | ! !* mixed layer trend indices |
---|
17 | INTEGER, PUBLIC, PARAMETER :: jpltrd = 12 !: number of mixed-layer trends arrays |
---|
18 | INTEGER, PUBLIC :: jpktrd !: max level for mixed-layer trends diag. |
---|
19 | ! |
---|
20 | INTEGER, PUBLIC, PARAMETER :: jpmxl_xad = 1 !: i-componant of advection |
---|
21 | INTEGER, PUBLIC, PARAMETER :: jpmxl_yad = 2 !: j-componant of advection |
---|
22 | INTEGER, PUBLIC, PARAMETER :: jpmxl_zad = 3 !: k-component of advection |
---|
23 | INTEGER, PUBLIC, PARAMETER :: jpmxl_ldf = 4 !: lateral diffusion (geopot. or iso-neutral) |
---|
24 | INTEGER, PUBLIC, PARAMETER :: jpmxl_zdf = 5 !: vertical diffusion |
---|
25 | INTEGER, PUBLIC, PARAMETER :: jpmxl_npc = 6 !: non penetrative convective adjustment |
---|
26 | INTEGER, PUBLIC, PARAMETER :: jpmxl_bbc = 7 !: geothermal flux |
---|
27 | INTEGER, PUBLIC, PARAMETER :: jpmxl_bbl = 8 !: bottom boundary layer (advective/diffusive) |
---|
28 | INTEGER, PUBLIC, PARAMETER :: jpmxl_for = 9 !: forcing |
---|
29 | INTEGER, PUBLIC, PARAMETER :: jpmxl_dmp = 10 !: internal restoring trend |
---|
30 | INTEGER, PUBLIC, PARAMETER :: jpmxl_zdfp = 11 !: ! iso-neutral diffusion:"pure" vertical diffusion |
---|
31 | INTEGER, PUBLIC, PARAMETER :: jpmxl_atf = 12 !: asselin trend (**MUST BE THE LAST ONE**) |
---|
32 | ! !!* Namelist namtrd_mxl: trend diagnostics in the mixed layer * |
---|
33 | INTEGER , PUBLIC :: nn_ctls = 0 !: control surface type for trends vertical integration |
---|
34 | REAL(wp) , PUBLIC :: rn_rho_c = 0.01 !: density criteria for MLD definition |
---|
35 | REAL(wp) , PUBLIC :: rn_ucf = 1. !: unit conversion factor (for netCDF trends outputs) |
---|
36 | ! =1. (=86400.) for degC/s (degC/day) and psu/s (psu/day) |
---|
37 | CHARACTER(len=32), PUBLIC :: cn_trdrst_in = "restart_mxl" !: suffix of ocean restart name (input) |
---|
38 | CHARACTER(len=32), PUBLIC :: cn_trdrst_out = "restart_mxl" !: suffix of ocean restart name (output) |
---|
39 | LOGICAL , PUBLIC :: ln_trdmxl_instant = .FALSE. !: flag to diagnose inst./mean ML T/S trends |
---|
40 | LOGICAL , PUBLIC :: ln_trdmxl_restart = .FALSE. !: flag to restart mixed-layer diagnostics |
---|
41 | |
---|
42 | |
---|
43 | !! Arrays used for diagnosing mixed-layer trends |
---|
44 | !!--------------------------------------------------------------------- |
---|
45 | CHARACTER(LEN=80) , PUBLIC :: clname, ctrd(jpltrd+1,2) |
---|
46 | |
---|
47 | INTEGER , PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) :: nmxl !: mixed layer depth indexes |
---|
48 | INTEGER , PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) :: nbol !: mixed-layer depth indexes when read from file |
---|
49 | |
---|
50 | REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) :: wkx !: |
---|
51 | |
---|
52 | REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) :: & |
---|
53 | hmxl , & !: mixed layer depth (m) corresponding to nmld |
---|
54 | tml , sml , & !: \ "now" mixed layer temperature/salinity |
---|
55 | tmlb , smlb , & !: / and associated "before" fields |
---|
56 | tmlbb , smlbb, & !: \ idem, but valid at the 1rst time step of the |
---|
57 | tmlbn , smlbn, & !: / current analysis window |
---|
58 | tmltrdm, smltrdm, & !: total cumulative trends over the analysis window |
---|
59 | tml_sum, & !: mixed layer T, summed over the current analysis period |
---|
60 | tml_sumb, & !: idem, but from the previous analysis period |
---|
61 | tmltrd_atf_sumb, & !: Asselin trends, summed over the previous analysis period |
---|
62 | sml_sum, & !: |
---|
63 | sml_sumb, & !: ( idem for salinity ) |
---|
64 | smltrd_atf_sumb, & !: |
---|
65 | hmxl_sum, hmxlbn !: needed to compute the leap-frog time mean of the ML depth |
---|
66 | |
---|
67 | REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) :: & |
---|
68 | tmlatfb, tmlatfn , & !: "before" Asselin contribution at begining of the averaging |
---|
69 | smlatfb, smlatfn, & !: period (i.e. last contrib. from previous such period) and |
---|
70 | !: "now" Asselin contribution to the ML temp. & salinity trends |
---|
71 | tmlatfm, smlatfm !: accumulator for Asselin trends (needed for storage only) |
---|
72 | |
---|
73 | REAL(wp), PUBLIC, ALLOCATABLE, DIMENSION(:,:,:) :: & |
---|
74 | tmltrd, & !: \ physical contributions to the total trend (for T/S), |
---|
75 | smltrd, & !: / cumulated over the current analysis window |
---|
76 | tmltrd_sum, & !: sum of these trends over the analysis period |
---|
77 | tmltrd_csum_ln, & !: now cumulated sum of the trends over the "lower triangle" |
---|
78 | tmltrd_csum_ub, & !: before (prev. analysis period) cumulated sum over the upper triangle |
---|
79 | smltrd_sum, & !: |
---|
80 | smltrd_csum_ln, & !: ( idem for salinity ) |
---|
81 | smltrd_csum_ub !: |
---|
82 | |
---|
83 | !!---------------------------------------------------------------------- |
---|
84 | !! NEMO/OCE 4.0 , NEMO Consortium (2018) |
---|
85 | !! $Id$ |
---|
86 | !! Software governed by the CeCILL license (see ./LICENSE) |
---|
87 | !!---------------------------------------------------------------------- |
---|
88 | CONTAINS |
---|
89 | |
---|
90 | INTEGER FUNCTION trdmxl_oce_alloc() |
---|
91 | !!---------------------------------------------------------------------- |
---|
92 | !! *** FUNCTION trdmxl_oce_alloc *** |
---|
93 | !!---------------------------------------------------------------------- |
---|
94 | USE lib_mpp |
---|
95 | INTEGER :: ierr(5) |
---|
96 | !!---------------------------------------------------------------------- |
---|
97 | |
---|
98 | ! Initialise jpktrd here as can no longer do it in MODULE body since |
---|
99 | ! jpk is now a variable. |
---|
100 | jpktrd = jpk !: max level for mixed-layer trends diag. |
---|
101 | |
---|
102 | ierr(:) = 0 |
---|
103 | |
---|
104 | ALLOCATE( nmxl (jpi,jpj) , nbol (jpi,jpj), & |
---|
105 | & wkx (jpi,jpj,jpk), hmxl (jpi,jpj), & |
---|
106 | & tml (jpi,jpj) , sml (jpi,jpj), & |
---|
107 | & tmlb (jpi,jpj) , smlb (jpi,jpj), & |
---|
108 | & tmlbb(jpi,jpj) , smlbb(jpi,jpj), STAT = ierr(1) ) |
---|
109 | |
---|
110 | ALLOCATE( tmlbn(jpi,jpj) , smlbn(jpi,jpj), & |
---|
111 | & tmltrdm(jpi,jpj), smltrdm(jpi,jpj), & |
---|
112 | & tml_sum(jpi,jpj), tml_sumb(jpi,jpj),& |
---|
113 | & tmltrd_atf_sumb(jpi,jpj) , STAT=ierr(2) ) |
---|
114 | |
---|
115 | ALLOCATE( sml_sum(jpi,jpj), sml_sumb(jpi,jpj), & |
---|
116 | & smltrd_atf_sumb(jpi,jpj), & |
---|
117 | & hmxl_sum(jpi,jpj), hmxlbn(jpi,jpj), & |
---|
118 | & tmlatfb(jpi,jpj), tmlatfn(jpi,jpj), STAT = ierr(3) ) |
---|
119 | |
---|
120 | ALLOCATE( smlatfb(jpi,jpj), smlatfn(jpi,jpj), & |
---|
121 | & tmlatfm(jpi,jpj), smlatfm(jpi,jpj), & |
---|
122 | & tmltrd(jpi,jpj,jpltrd), smltrd(jpi,jpj,jpltrd), STAT=ierr(4)) |
---|
123 | |
---|
124 | ALLOCATE( tmltrd_sum(jpi,jpj,jpltrd),tmltrd_csum_ln(jpi,jpj,jpltrd), & |
---|
125 | & tmltrd_csum_ub(jpi,jpj,jpltrd), smltrd_sum(jpi,jpj,jpltrd), & |
---|
126 | & smltrd_csum_ln(jpi,jpj,jpltrd), smltrd_csum_ub(jpi,jpj,jpltrd), STAT=ierr(5) ) |
---|
127 | ! |
---|
128 | trdmxl_oce_alloc = MAXVAL( ierr ) |
---|
129 | CALL mpp_sum ( 'trdmxl_oce', trdmxl_oce_alloc ) |
---|
130 | IF( trdmxl_oce_alloc /= 0 ) CALL ctl_stop( 'STOP', 'trdmxl_oce_alloc: failed to allocate arrays' ) |
---|
131 | ! |
---|
132 | END FUNCTION trdmxl_oce_alloc |
---|
133 | |
---|
134 | !!====================================================================== |
---|
135 | END MODULE trdmxl_oce |
---|