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.
sbcflx_tam.F90 in branches/2010_and_older/TAM_V3_2_2/NEMOTAM/OPATAM_SRC/SBC – NEMO

source: branches/2010_and_older/TAM_V3_2_2/NEMOTAM/OPATAM_SRC/SBC/sbcflx_tam.F90 @ 7797

Last change on this file since 7797 was 2578, checked in by rblod, 13 years ago

first import of NEMOTAM 3.2.2

File size: 9.3 KB
Line 
1MODULE sbcflx_tam
2#if defined key_tam
3   !!======================================================================
4   !!                       ***  MODULE  sbcflx_tam  ***
5   !! Ocean forcing:  momentum, heat and freshwater flux formulation
6   !!                 Angent and Andjoint Module
7   !!=====================================================================
8   !! History of the direct module: 
9   !!      9.0   !  06-06  (G. Madec)  Original code
10   !! History of the T&A module: 
11   !!      9.0   !  08-11  (A. Vidard)  Original code
12   !!      9.0   !  10-04  (A. Vidard)  Original code
13   !!----------------------------------------------------------------------
14
15   !!----------------------------------------------------------------------
16   !!   namflx   : flux formulation namlist
17   !!   sbc_flx  : flux formulation as ocean surface boundary condition
18   !!              (forced mode, fluxes read in NetCDF files)
19   !!----------------------------------------------------------------------
20   !! question diverses
21   !!  *   ajouter un test sur la division entier de freqh et rdttra ???
22   !!  **  ajoute dans namelist: 1 year forcing files
23   !!                         or forcing file starts at the begining of the run
24   !!  *** we assume that the forcing file start and end with the previous
25   !!      year last record and the next year first record (useful for
26   !!      time interpolation, required even if no time interp???)
27   !!  *   ajouter un test sur la division de la frequence en pas de temps
28   !!  ==> daymod ajout de nsec_year = number of second since the begining of the year
29   !!      assumed to be 0 at 0h january the 1st (i.e. 24h december the 31)
30   !!
31   !!  *** regrouper dtatem et dtasal
32   !!----------------------------------------------------------------------
33   USE par_kind   , ONLY: & ! Precision variables
34      & wp
35   USE par_oce    , ONLY: & ! Ocean space and time domain variables
36      & jpi,              &
37      & jpj
38   USE sbc_oce_tam, ONLY: & ! Surface boundary condition: ocean fields
39      & utau_tl,          & ! sea surface i-stress (ocean referential) [N/m2]
40      & vtau_tl,          & ! sea surface j-stress (ocean referential) [N/m2]
41      & taum_tl,          &
42      & qns_tl ,          & ! sea heat flux: non solar                 [W/m2]
43      & qsr_tl ,          & ! sea heat flux:     solar                 [W/m2]
44      & emp_tl ,          & ! freshwater budget: volume flux           [Kg/m2/s]
45      & emps_tl,          & ! freshwater budget: concentr/dillution    [Kg/m2/s]
46      & wndm_tl,          & ! wind speed module at T-point(=|U10m-Uoce|)[m/s]
47      & utau_ad,          &
48      & vtau_ad,          &
49      & taum_ad,          &
50      & qns_ad ,          &
51      & qsr_ad ,          &
52      & emp_ad ,          &
53      & emps_ad,          &
54      & wndm_ad
55
56   IMPLICIT NONE
57   PRIVATE
58
59   PUBLIC sbc_flx_tan       ! routine called by sbcmod_tam.F90
60   PUBLIC sbc_flx_adj       ! routine called by sbcmod_tam.F90
61   PUBLIC sbc_flx_adj_tst   ! routine called by tst.F90
62
63   REAL(wp) ::   rhoa  = 1.22         ! Air density kg/m3
64   REAL(wp) ::   cdrag = 1.5e-3       ! drag coefficient
65
66   !! * Substitutions
67#  include "domzgr_substitute.h90"
68#  include "vectopt_loop_substitute.h90"
69   !!----------------------------------------------------------------------
70   !!   OPA 9.0 , LOCEAN-IPSL (2006)
71   !! $Id: sbcflx.F90 1200 2008-09-24 13:05:20Z rblod $
72   !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt)
73   !!----------------------------------------------------------------------
74
75CONTAINS
76
77   SUBROUTINE sbc_flx_tan( kt )
78      !!---------------------------------------------------------------------
79      !!                    ***  ROUTINE sbc_flx_tan  ***
80      !!                   
81      !! ** Purpose of the direct routine:
82      !!                provide at each time step the surface ocean fluxes
83      !!                (momentum, heat, freshwater and runoff)
84      !!
85      !! ** Method  : - READ each fluxes in NetCDF files:
86      !!                   i-component of the stress              utau  (N/m2)
87      !!                   j-component of the stress              vtau  (N/m2)
88      !!                   net downward heat flux                 qtot  (watt/m2)
89      !!                   net downward radiative flux            qsr   (watt/m2)
90      !!                   net upward freshwater (evapo - precip) emp   (kg/m2/s)
91      !!
92      !!      CAUTION :  - never mask the surface stress fields
93      !!                 - the stress is assumed to be in the mesh referential
94      !!                   i.e. the (i,j) referential
95      !!
96      !! ** Action  :   update at each time-step
97      !!              - utau, vtau  i- and j-component of the wind stress
98      !!              - taum        wind stress module at T-point
99      !!              - wndm        10m wind module at T-point
100      !!              - qns, qsr    non-slor and solar heat flux
101      !!              - emp, emps   evaporation minus precipitation
102      !!----------------------------------------------------------------------
103      INTEGER, INTENT(in) ::   kt   ! ocean time step
104      !!
105      INTEGER  ::   ji, jj          ! dummy indices
106     !!
107      !!---------------------------------------------------------------------
108      ! set the ocean fluxes from read fields
109!CDIR COLLAPSE
110      DO jj = 1, jpj
111         DO ji = 1, jpi
112            utau_tl(ji,jj) = 0.0_wp
113            vtau_tl(ji,jj) = 0.0_wp
114            qns_tl (ji,jj) = 0.0_wp
115            qsr_tl (ji,jj) = 0.0_wp 
116            emp_tl (ji,jj) = 0.0_wp
117         END DO
118      END DO
119
120      ! Initialization of emps (when no ice model)
121      emps_tl(:,:) = emp_tl (:,:) 
122
123      ! Estimation of wind speed as a function of wind stress ( |tau|=rhoa*Cd*|U|^2 )
124      ! WARNING !!! TANGENT NOT VALID if TAU is part of the state vector.
125      taum_tl(:,:) = 0.0_wp
126      wndm_tl(:,:) = 0.0_wp
127      !
128   END SUBROUTINE sbc_flx_tan
129   SUBROUTINE sbc_flx_adj( kt )
130      !!---------------------------------------------------------------------
131      !!                    ***  ROUTINE sbc_flx_adj  ***
132      !!                   
133      !! ** Purpose of the direct routine:
134      !!                provide at each time step the surface ocean fluxes
135      !!                (momentum, heat, freshwater and runoff)
136      !!
137      !! ** Method  : - READ each fluxes in NetCDF files:
138      !!                   i-component of the stress              utau  (N/m2)
139      !!                   j-component of the stress              vtau  (N/m2)
140      !!                   net downward heat flux                 qtot  (watt/m2)
141      !!                   net downward radiative flux            qsr   (watt/m2)
142      !!                   net upward freshwater (evapo - precip) emp   (kg/m2/s)
143      !!
144      !!      CAUTION :  - never mask the surface stress fields
145      !!                 - the stress is assumed to be in the mesh referential
146      !!                   i.e. the (i,j) referential
147      !!
148      !! ** Action  :   update at each time-step
149      !!              - utau, vtau  i- and j-component of the wind stress
150      !!              - taum        wind stress module at T-point
151      !!              - wndm        10m wind module at T-point
152      !!              - qns, qsr    non-slor and solar heat flux
153      !!              - emp, emps   evaporation minus precipitation
154      !!----------------------------------------------------------------------
155      INTEGER, INTENT(in) ::   kt   ! ocean time step
156      !!
157      INTEGER  ::   ji, jj   ! dummy indices
158      !!
159      !!---------------------------------------------------------------------
160      ! Estimation of wind speed as a function of wind stress ( |tau|=rhoa*Cd*|U|^2 )
161      ! WARNING !!! ADJGENT NOT VALID if TAU is par of the state vector.
162      taum_ad(:,:) = 0.0_wp
163      wndm_ad(:,:) = 0.0_wp
164      ! Initialization of emps (when no ice model)
165      emp_ad (:,:) =  emp_ad (:,:) + emps_ad(:,:)
166      emps_ad(:,:) = 0.0_wp
167       ! set the ocean fluxes from read fields
168!CDIR COLLAPSE
169      DO jj = 1, jpj
170         DO ji = 1, jpi
171            utau_ad(ji,jj) = 0.0_wp
172            vtau_ad(ji,jj) = 0.0_wp
173            qns_ad (ji,jj) = 0.0_wp
174            qsr_ad (ji,jj) = 0.0_wp 
175            emp_ad (ji,jj) = 0.0_wp
176         END DO
177      END DO
178     !
179   END SUBROUTINE sbc_flx_adj
180   SUBROUTINE sbc_flx_adj_tst( kumadt )
181      !!-----------------------------------------------------------------------
182      !!
183      !!                  ***  ROUTINE sbc_flx_adj_tst ***
184      !!
185      !! ** Purpose : Test the adjoint routine.
186      !!
187      !! ** Method  : Verify the scalar product
188      !!           
189      !!                 ( L dx )^T W dy  =  dx^T L^T W dy
190      !!
191      !!              where  L   = tangent routine
192      !!                     L^T = adjoint routine
193      !!                     W   = diagonal matrix of scale factors
194      !!                     dx  = input perturbation (random field)
195      !!                     dy  = L dx
196      !!
197      !!                   
198      !! History :
199      !!        ! 08-11 (A. Vidard)
200      !!-----------------------------------------------------------------------
201      !! * Modules used
202
203      !! * Arguments
204      INTEGER, INTENT(IN) :: &
205         & kumadt             ! Output unit
206
207      ! adjoint is obvious, no need to test...
208   END SUBROUTINE sbc_flx_adj_tst
209#endif
210   !!======================================================================
211END MODULE sbcflx_tam
Note: See TracBrowser for help on using the repository browser.