1 | MODULE trc_oce_tam |
---|
2 | #if defined key_tam |
---|
3 | !!====================================================================== |
---|
4 | !! *** MODULE trc_oce_tam *** |
---|
5 | !! Ocean passive tracer : share SMS/Ocean variables |
---|
6 | !! Tangent and Adjoint Module |
---|
7 | !!====================================================================== |
---|
8 | !! History of the direct module: |
---|
9 | !! 9.0 ! 04-03 (C. Ethe) F90: Free form and module |
---|
10 | !! History of the T&A module: |
---|
11 | !! 9.0 ! 08-11 (A. Vidard) original version |
---|
12 | !!---------------------------------------------------------------------- |
---|
13 | # if defined key_top && defined key_pisces |
---|
14 | !!---------------------------------------------------------------------- |
---|
15 | !! OPA 9.0 , LOCEAN-IPSL (2005) |
---|
16 | !! $Id: trc_oce.F90 1152 2008-06-26 14:11:13Z rblod $ |
---|
17 | !! This software is governed by the CeCILL licence see modipsl/doc/NEMO_CeCILL.txt |
---|
18 | !!---------------------------------------------------------------------- |
---|
19 | USE sms_pisces_tam , ONLY : & |
---|
20 | etot3_tl => etot3_tl & !!: Biological fluxes for light |
---|
21 | etot3_ad => etot3_ad !!: Biological fluxes for light |
---|
22 | # else |
---|
23 | !!---------------------------------------------------------------------- |
---|
24 | !! Default option No Biological fluxes for light |
---|
25 | !!---------------------------------------------------------------------- |
---|
26 | USE par_kind, ONLY : & ! Precision variables |
---|
27 | & wp |
---|
28 | USE par_oce, ONLY: & |
---|
29 | & jpi, & |
---|
30 | & jpj, & |
---|
31 | & jpk |
---|
32 | !! * Module variables |
---|
33 | REAL(wp), DIMENSION(:,:,:), ALLOCATABLE :: & |
---|
34 | & etot3_tl, & |
---|
35 | & etot3_ad |
---|
36 | # endif |
---|
37 | PUBLIC & |
---|
38 | & trc_oce_tam_init, & !: Initialize the trend TAM fields |
---|
39 | & trc_oce_tam_deallocate, & !: Deallocate the trend TAM fields |
---|
40 | & etot3_tl, & |
---|
41 | & etot3_ad |
---|
42 | |
---|
43 | CONTAINS |
---|
44 | |
---|
45 | SUBROUTINE trc_oce_tam_init( kindic ) |
---|
46 | !!----------------------------------------------------------------------- |
---|
47 | !! |
---|
48 | !! *** ROUTINE trc_oce_tam_init *** |
---|
49 | !! |
---|
50 | !! ** Purpose : Allocate and initialize the tangent linear and |
---|
51 | !! adjoint arrays |
---|
52 | !! |
---|
53 | !! ** Method : kindic = 0 allocate/initialize both tl and ad variables |
---|
54 | !! kindic = 1 allocate/initialize only tl variables |
---|
55 | !! kindic = 2 allocate/initialize only ad variables |
---|
56 | !! |
---|
57 | !! ** Action : |
---|
58 | !! |
---|
59 | !! References : |
---|
60 | !! |
---|
61 | !! History : |
---|
62 | !! ! 09-05 (F. Vigilant) Initial version |
---|
63 | !!----------------------------------------------------------------------- |
---|
64 | !! * Arguments |
---|
65 | INTEGER, INTENT(IN) :: & |
---|
66 | & kindic ! indicate which variables to allocate/initialize |
---|
67 | |
---|
68 | !! * Local declarations |
---|
69 | ! Allocate tangent linear variable arrays |
---|
70 | ! --------------------------------------- |
---|
71 | |
---|
72 | IF ( kindic == 0 .OR. kindic == 1 ) THEN |
---|
73 | |
---|
74 | IF ( .NOT. ALLOCATED(etot3_tl) ) THEN |
---|
75 | |
---|
76 | ALLOCATE( etot3_tl(jpi,jpj,jpk) ) |
---|
77 | |
---|
78 | ENDIF |
---|
79 | |
---|
80 | ! Initialize tangent linear variable arrays to zero |
---|
81 | ! ------------------------------------------------- |
---|
82 | |
---|
83 | etot3_tl (:,:,:) = 0.0_wp |
---|
84 | |
---|
85 | END IF |
---|
86 | |
---|
87 | IF ( kindic == 0 .OR. kindic == 2 ) THEN |
---|
88 | |
---|
89 | ! Allocate adjoint variable arrays |
---|
90 | ! -------------------------------- |
---|
91 | |
---|
92 | IF ( .NOT. ALLOCATED(etot3_ad) ) THEN |
---|
93 | |
---|
94 | ALLOCATE( etot3_ad(jpi,jpj,jpk) ) |
---|
95 | |
---|
96 | ENDIF |
---|
97 | |
---|
98 | ! Initialize adjoint variable arrays to zero |
---|
99 | ! ------------------------------------------ |
---|
100 | |
---|
101 | etot3_ad (:,:,:) = 0.0_wp |
---|
102 | |
---|
103 | END IF |
---|
104 | |
---|
105 | END SUBROUTINE trc_oce_tam_init |
---|
106 | SUBROUTINE trc_oce_tam_deallocate( kindic ) |
---|
107 | !!----------------------------------------------------------------------- |
---|
108 | !! |
---|
109 | !! *** ROUTINE trc_oce_tam_deallocate *** |
---|
110 | !! |
---|
111 | !! ** Purpose : Deallocate the tangent linear and |
---|
112 | !! adjoint arrays |
---|
113 | !! |
---|
114 | !! ** Method : kindic = 0 deallocate both tl and ad variables |
---|
115 | !! kindic = 1 deallocate only tl variables |
---|
116 | !! kindic = 2 deallocate only ad variables |
---|
117 | !! |
---|
118 | !! ** Action : |
---|
119 | !! |
---|
120 | !! References : |
---|
121 | !! |
---|
122 | !! History : |
---|
123 | !! ! 2010-06 (A. Vidard) Initial version |
---|
124 | !!----------------------------------------------------------------------- |
---|
125 | !! * Arguments |
---|
126 | INTEGER, INTENT(IN) :: & |
---|
127 | & kindic ! indicate which variables to deallocate |
---|
128 | |
---|
129 | !! * Local declarations |
---|
130 | ! Deallocate tangent linear variable arrays |
---|
131 | ! --------------------------------------- |
---|
132 | |
---|
133 | IF ( kindic == 0 .OR. kindic == 1 ) THEN |
---|
134 | |
---|
135 | IF ( ALLOCATED(etot3_tl) ) DEALLOCATE( etot3_tl ) |
---|
136 | |
---|
137 | END IF |
---|
138 | |
---|
139 | IF ( kindic == 0 .OR. kindic == 2 ) THEN |
---|
140 | |
---|
141 | ! Deallocate adjoint variable arrays |
---|
142 | ! -------------------------------- |
---|
143 | |
---|
144 | IF ( ALLOCATED(etot3_ad) ) DEALLOCATE( etot3_ad ) |
---|
145 | |
---|
146 | END IF |
---|
147 | |
---|
148 | END SUBROUTINE trc_oce_tam_deallocate |
---|
149 | #endif |
---|
150 | END MODULE trc_oce_tam |
---|
151 | |
---|