[3611] | 1 | MODULE 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 | !! 3.2 ! 10-04 (A. Vidard) Update to new reference |
---|
| 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 |
---|
| 34 | USE par_oce |
---|
| 35 | USE sbc_oce_tam |
---|
| 36 | |
---|
| 37 | IMPLICIT NONE |
---|
| 38 | PRIVATE |
---|
| 39 | |
---|
| 40 | PUBLIC sbc_flx_tan ! routine called by sbcmod_tam.F90 |
---|
| 41 | PUBLIC sbc_flx_adj ! routine called by sbcmod_tam.F90 |
---|
| 42 | PUBLIC sbc_flx_adj_tst ! routine called by tst.F90 |
---|
| 43 | |
---|
| 44 | REAL(wp) :: rhoa = 1.22 ! Air density kg/m3 |
---|
| 45 | REAL(wp) :: cdrag = 1.5e-3 ! drag coefficient |
---|
| 46 | |
---|
| 47 | !! * Substitutions |
---|
| 48 | # include "domzgr_substitute.h90" |
---|
| 49 | # include "vectopt_loop_substitute.h90" |
---|
| 50 | !!---------------------------------------------------------------------- |
---|
| 51 | !! OPA 9.0 , LOCEAN-IPSL (2006) |
---|
| 52 | !! $Id: sbcflx.F90 1200 2008-09-24 13:05:20Z rblod $ |
---|
| 53 | !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt) |
---|
| 54 | !!---------------------------------------------------------------------- |
---|
| 55 | |
---|
| 56 | CONTAINS |
---|
| 57 | |
---|
| 58 | SUBROUTINE sbc_flx_tan( kt ) |
---|
| 59 | !!--------------------------------------------------------------------- |
---|
| 60 | !! *** ROUTINE sbc_flx_tan *** |
---|
| 61 | !! |
---|
| 62 | !! ** Purpose of the direct routine: |
---|
| 63 | !! provide at each time step the surface ocean fluxes |
---|
| 64 | !! (momentum, heat, freshwater and runoff) |
---|
| 65 | !! |
---|
| 66 | !! ** Method : - READ each fluxes in NetCDF files: |
---|
| 67 | !! i-component of the stress utau (N/m2) |
---|
| 68 | !! j-component of the stress vtau (N/m2) |
---|
| 69 | !! net downward heat flux qtot (watt/m2) |
---|
| 70 | !! net downward radiative flux qsr (watt/m2) |
---|
| 71 | !! net upward freshwater (evapo - precip) emp (kg/m2/s) |
---|
| 72 | !! |
---|
| 73 | !! CAUTION : - never mask the surface stress fields |
---|
| 74 | !! - the stress is assumed to be in the mesh referential |
---|
| 75 | !! i.e. the (i,j) referential |
---|
| 76 | !! |
---|
| 77 | !! ** Action : update at each time-step |
---|
| 78 | !! - utau, vtau i- and j-component of the wind stress |
---|
| 79 | !! - taum wind stress module at T-point |
---|
| 80 | !! - wndm 10m wind module at T-point |
---|
| 81 | !! - qns, qsr non-slor and solar heat flux |
---|
| 82 | !! - emp, emps evaporation minus precipitation |
---|
| 83 | !!---------------------------------------------------------------------- |
---|
| 84 | INTEGER, INTENT(in) :: kt ! ocean time step |
---|
| 85 | !! |
---|
| 86 | INTEGER :: ji, jj ! dummy indices |
---|
| 87 | !! |
---|
| 88 | !!--------------------------------------------------------------------- |
---|
| 89 | ! set the ocean fluxes from read fields |
---|
| 90 | !CDIR COLLAPSE |
---|
| 91 | DO jj = 1, jpj |
---|
| 92 | DO ji = 1, jpi |
---|
| 93 | utau_tl(ji,jj) = 0.0_wp |
---|
| 94 | vtau_tl(ji,jj) = 0.0_wp |
---|
| 95 | qns_tl (ji,jj) = 0.0_wp |
---|
| 96 | qsr_tl (ji,jj) = 0.0_wp |
---|
| 97 | emp_tl (ji,jj) = 0.0_wp |
---|
| 98 | END DO |
---|
| 99 | END DO |
---|
| 100 | |
---|
| 101 | ! Initialization of emps (when no ice model) |
---|
| 102 | emps_tl(:,:) = emp_tl (:,:) |
---|
| 103 | |
---|
| 104 | ! Estimation of wind speed as a function of wind stress ( |tau|=rhoa*Cd*|U|^2 ) |
---|
| 105 | ! WARNING !!! TANGENT NOT VALID if TAU is part of the state vector. |
---|
| 106 | taum_tl(:,:) = 0.0_wp |
---|
| 107 | wndm_tl(:,:) = 0.0_wp |
---|
| 108 | ! |
---|
| 109 | END SUBROUTINE sbc_flx_tan |
---|
| 110 | SUBROUTINE sbc_flx_adj( kt ) |
---|
| 111 | !!--------------------------------------------------------------------- |
---|
| 112 | !! *** ROUTINE sbc_flx_adj *** |
---|
| 113 | !! |
---|
| 114 | !! ** Purpose of the direct routine: |
---|
| 115 | !! provide at each time step the surface ocean fluxes |
---|
| 116 | !! (momentum, heat, freshwater and runoff) |
---|
| 117 | !! |
---|
| 118 | !! ** Method : - READ each fluxes in NetCDF files: |
---|
| 119 | !! i-component of the stress utau (N/m2) |
---|
| 120 | !! j-component of the stress vtau (N/m2) |
---|
| 121 | !! net downward heat flux qtot (watt/m2) |
---|
| 122 | !! net downward radiative flux qsr (watt/m2) |
---|
| 123 | !! net upward freshwater (evapo - precip) emp (kg/m2/s) |
---|
| 124 | !! |
---|
| 125 | !! CAUTION : - never mask the surface stress fields |
---|
| 126 | !! - the stress is assumed to be in the mesh referential |
---|
| 127 | !! i.e. the (i,j) referential |
---|
| 128 | !! |
---|
| 129 | !! ** Action : update at each time-step |
---|
| 130 | !! - utau, vtau i- and j-component of the wind stress |
---|
| 131 | !! - taum wind stress module at T-point |
---|
| 132 | !! - wndm 10m wind module at T-point |
---|
| 133 | !! - qns, qsr non-slor and solar heat flux |
---|
| 134 | !! - emp, emps evaporation minus precipitation |
---|
| 135 | !!---------------------------------------------------------------------- |
---|
| 136 | INTEGER, INTENT(in) :: kt ! ocean time step |
---|
| 137 | !! |
---|
| 138 | INTEGER :: ji, jj ! dummy indices |
---|
| 139 | !! |
---|
| 140 | !!--------------------------------------------------------------------- |
---|
| 141 | ! Estimation of wind speed as a function of wind stress ( |tau|=rhoa*Cd*|U|^2 ) |
---|
| 142 | ! WARNING !!! ADJGENT NOT VALID if TAU is par of the state vector. |
---|
| 143 | taum_ad(:,:) = 0.0_wp |
---|
| 144 | wndm_ad(:,:) = 0.0_wp |
---|
| 145 | ! Initialization of emps (when no ice model) |
---|
| 146 | emp_ad (:,:) = emp_ad (:,:) + emps_ad(:,:) |
---|
| 147 | emps_ad(:,:) = 0.0_wp |
---|
| 148 | ! set the ocean fluxes from read fields |
---|
| 149 | !CDIR COLLAPSE |
---|
| 150 | DO jj = 1, jpj |
---|
| 151 | DO ji = 1, jpi |
---|
| 152 | utau_ad(ji,jj) = 0.0_wp |
---|
| 153 | vtau_ad(ji,jj) = 0.0_wp |
---|
| 154 | qns_ad (ji,jj) = 0.0_wp |
---|
| 155 | qsr_ad (ji,jj) = 0.0_wp |
---|
| 156 | emp_ad (ji,jj) = 0.0_wp |
---|
| 157 | END DO |
---|
| 158 | END DO |
---|
| 159 | ! |
---|
| 160 | END SUBROUTINE sbc_flx_adj |
---|
| 161 | SUBROUTINE sbc_flx_adj_tst( kumadt ) |
---|
| 162 | !!----------------------------------------------------------------------- |
---|
| 163 | !! |
---|
| 164 | !! *** ROUTINE sbc_flx_adj_tst *** |
---|
| 165 | !! |
---|
| 166 | !! ** Purpose : Test the adjoint routine. |
---|
| 167 | !! |
---|
| 168 | !! ** Method : Verify the scalar product |
---|
| 169 | !! |
---|
| 170 | !! ( L dx )^T W dy = dx^T L^T W dy |
---|
| 171 | !! |
---|
| 172 | !! where L = tangent routine |
---|
| 173 | !! L^T = adjoint routine |
---|
| 174 | !! W = diagonal matrix of scale factors |
---|
| 175 | !! dx = input perturbation (random field) |
---|
| 176 | !! dy = L dx |
---|
| 177 | !! |
---|
| 178 | !! |
---|
| 179 | !! History : |
---|
| 180 | !! ! 08-11 (A. Vidard) |
---|
| 181 | !!----------------------------------------------------------------------- |
---|
| 182 | !! * Modules used |
---|
| 183 | |
---|
| 184 | !! * Arguments |
---|
| 185 | INTEGER, INTENT(IN) :: & |
---|
| 186 | & kumadt ! Output unit |
---|
| 187 | |
---|
| 188 | ! adjoint is obvious, no need to test... |
---|
| 189 | END SUBROUTINE sbc_flx_adj_tst |
---|
| 190 | #endif |
---|
| 191 | !!====================================================================== |
---|
| 192 | END MODULE sbcflx_tam |
---|