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.
Changeset 2819 – NEMO

Changeset 2819


Ignore:
Timestamp:
2011-08-09T10:29:53+02:00 (13 years ago)
Author:
cetlod
Message:

Improvment of branch dev_r2787_LOCEAN3_TRA_TRP

Location:
branches/2011/dev_r2787_LOCEAN3_TRA_TRP/NEMOGCM
Files:
58 edited

Legend:

Unmodified
Added
Removed
  • branches/2011/dev_r2787_LOCEAN3_TRA_TRP/NEMOGCM/CONFIG/GYRE_LOBSTER/EXP00/namelist_lobster

    r2567 r2819  
    9898/ 
    9999!''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' 
    100 &namlobdia     !   additional 2D/3D tracers diagnostics ("key_trc_diaadd") 
     100&namlobdia     !   additional 2D/3D tracers diagnostics 
    101101!,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, 
    102    nn_writedia =  360  !  time step frequency for tracers diagnostics 
    103 ! 
    104102!              !    name   ! title of   ! units ! 
    105103!              !           ! the field  !       !   
     
    130128&namlobdbi     !   biological diagnostics trends      
    131129!,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, 
    132 !                !  3D bio diagnostics   units : mmole/m3/s   ("key_trc_diabio") 
    133130!                !  2D bio diagnostics   units : mmole/m2/s   ("key_trdmld_trc") 
    134  
    135    nwritebio    =   4320    !  time step frequency for biological outputs 
    136 ! 
    137131!                !  name    !       title of the field      !     units      ! 
    138132   lobdiabio(1)  = 'NO3PHY' , 'Flux from NO3 to PHY          ',  'mmole/m3/s' 
  • branches/2011/dev_r2787_LOCEAN3_TRA_TRP/NEMOGCM/CONFIG/GYRE_LOBSTER/EXP00/namelist_top

    r2528 r2819  
    11!!>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> 
    2 !! NEMO/TOP1 :  1 - tracer definition                     (namtrc    ) 
    3 !! namelists    2 - dynamical tracer trends               (namtrc_trd) 
    4 !!              3 - tracer advection                      (namtrc_adv) 
    5 !!              4 - tracer lateral diffusion              (namtrc_ldf) 
    6 !!              5 - tracer vertical physics               (namtrc_zdf) 
    7 !!              6 - tracer newtonian damping              (namtrc_dmp) 
     2!! NEMO/TOP2 namelits :  1 - tracer definition                     (namtrc    ) 
     3!!                       2 - tracer advection                      (namtrc_adv) 
     4!!                       3 - tracer lateral diffusion              (namtrc_ldf) 
     5!!                       4 - tracer vertical physics               (namtrc_zdf) 
     6!!                       5 - tracer newtonian damping              (namtrc_dmp) 
     7!!                       6 - dynamical tracer trends               (namtrc_trd) 
     8!!                       7 - tracer output                         (namtrc_wri) 
    89!>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> 
    910!''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' 
    1011&namtrc     !   tracers definition 
    1112!,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, 
     13! 
    1214   nn_dttrc      =  1        !  time step frequency for passive sn_tracers 
    13    nn_writetrc   =  360      !  time step frequency for sn_tracer outputs 
     15   nn_writetrc   =  60      !  time step frequency for sn_tracer outputs 
    1416   ln_rsttr      = .false.   !  start from a restart file (T) or not (F) 
    15    nn_rsttr      =   0       !  restart control = 0 initial time step is not compared to the restart file value 
     17   nn_rsttr      =   1       !  restart control = 0 initial time step is not compared to the restart file value 
    1618                           !                  = 1 do not use the value in the restart file 
    1719                           !                  = 2 calendar parameters read in the restart file 
    18    cn_trcrst_in  = "restart_trc"   !  suffix of pass. sn_tracer restart name (input) 
     20   cn_trcrst_in  = "restart_trc.nc"   !  suffix of pass. sn_tracer restart name (input) 
    1921   cn_trcrst_out = "restart_trc"   !  suffix of pass. sn_tracer restart name (output) 
     22   ln_trcdta     =   .false.    !  Initialisation from data input file (T) or not (F) 
    2023! 
    21 !              ! name  !     title of the field       !   units       ! initial data ! save   ! 
    22 !              !       !                              !               ! from file    ! or not !  
    23 !              !       !                              !               ! or not       !        ! 
    24    sn_tracer(1)   = 'DET' , 'Detritus                   ',  'mmole-N/m3' ,  .false.     ,  .true. 
    25    sn_tracer(2)   = 'ZOO' , 'Zooplankton concentration  ',  'mmole-N/m3' ,  .false.     ,  .true. 
    26    sn_tracer(3)   = 'PHY' , 'Phytoplankton concentration',  'mmole-N/m3' ,  .false.     ,  .true. 
    27    sn_tracer(4)   = 'NO3' , 'Nitrate concentration      ',  'mmole-N/m3' ,  .false.     ,  .true. 
    28    sn_tracer(5)   = 'NH4' , 'Ammonium concentration     ',  'mmole-N/m3' ,  .false.     ,  .true. 
    29    sn_tracer(6)   = 'DOM' , 'Dissolved organic matter   ',  'mmole-N/m3' ,  .false.     ,  .true. 
     24!                ! name  !     title of the field          !   units       ! initial data ! save   ! 
     25!                !       !                                 !               ! from file    ! or not !  
     26!                !       !                                 !               ! or not       !        ! 
     27   sn_tracer(1)   = 'DET'   , 'Detritus                   ',  'mmole-N/m3' ,  .false.     ,  .false. 
     28   sn_tracer(2)   = 'ZOO'   , 'Zooplankton concentration  ',  'mmole-N/m3' ,  .false.     ,  .false. 
     29   sn_tracer(3)   = 'PHY'   , 'Phytoplankton concentration',  'mmole-N/m3' ,  .false.     ,  .false. 
     30   sn_tracer(4)   = 'NO3'   , 'Nitrate concentration      ',  'mmole-N/m3' ,  .false.     ,  .true. 
     31   sn_tracer(5)   = 'NH4'   , 'Ammonium concentration     ',  'mmole-N/m3' ,  .false.     ,  .false. 
     32   sn_tracer(6)   = 'DOM'   , 'Dissolved organic matter   ',  'mmole-N/m3' ,  .false.     ,  .false. 
    3033/ 
    3134!----------------------------------------------------------------------- 
    32 &namtrc_adv    !   advection scheme for passive tracer 
     35&namtrc_dta      !    Initialisation from data input file (T) or not (F) 
    3336!----------------------------------------------------------------------- 
    34    ln_trcadv_cen2   =  .false.  !  2nd order centered scheme 
     37! 
     38!                !  file name  ! frequency (hours) ! variable   ! time interp. !  clim  ! 'yearly'/ ! weights  ! rotation ! 
     39!                !             !  (if <0  months)  !   name     !   (logical)  !  (T/F) ! 'monthly' ! filename ! pairing  ! 
     40   sn_trcdta(4)  = 'NO3_R1'    ,        -12        ,  'NO3'     ,    .false.   , .true. , 'yearly'  , ''       , '' 
     41 
     42   cn_dir        =     './'    !  root directory for the location of the runoff files 
     43   rn_trfac(4)   =    1.0      !   -       -       -       -      - 
     44/ 
     45!----------------------------------------------------------------------- 
     46&namtrc_adv    !   advection scheme for passive tracer  
     47!----------------------------------------------------------------------- 
     48   ln_trcadv_cen2   =  .false.  !  2nd order centered scheme    
    3549   ln_trcadv_tvd    =  .true.   !  TVD scheme 
    3650   ln_trcadv_muscl  =  .false.  !  MUSCL scheme 
     
    5165   ln_trcldf_iso    =  .true.   !     iso-neutral                       (require "key_ldfslp") 
    5266!                               !  Coefficient 
     67   rn_ahtrc_0       =  1000.    !  horizontal eddy diffusivity for tracers [m2/s] 
    5368   rn_ahtrb_0       =     0.    !     background eddy diffusivity for ldf_iso [m2/s] 
    5469/ 
     
    6075/ 
    6176!----------------------------------------------------------------------- 
    62 &namtrc_rad        !  treatment of negative concentrations 
     77&namtrc_rad        !  treatment of negative concentrations  
    6378!----------------------------------------------------------------------- 
    6479   ln_trcrad   =  .false.  !  artificially correct negative concentrations (T) or not (F) 
    6580/ 
    6681!----------------------------------------------------------------------- 
    67 &namtrc_dmp    !   passive tracer newtonian damping    ('key_tradmp && key_trcdmp') 
     82&namtrc_dmp    !   passive tracer newtonian damping   
    6883!----------------------------------------------------------------------- 
     84   ln_trcdmp   =  .false.  !  add a damping termn (T) or not (F) 
    6985   nn_hdmp_tr  =   -1      !  horizontal shape =-1, damping in Med and Red Seas only 
    7086                           !                   =XX, damping poleward of XX degrees (XX>0) 
     
    7995/ 
    8096!----------------------------------------------------------------------- 
    81 &namtrc_trd       !   diagnostics on tracer trends        ('key_trdtrc') 
    82 !                          or mixed-layer trends          ('key_trdmld_trc') 
     97&namtrc_trd                !   diagnostics on tracer trends        ('key_trdtrc') 
     98!                                   or mixed-layer trends          ('key_trdmld_trc') 
    8399!---------------------------------------------------------------------- 
    84    nn_trd_trc   =  360      !  time step frequency and tracers trends 
    85    nn_ctls_trc  =   0       !  control surface type in mixed-layer trends (0,1 or n<jpk) 
    86    rn_ucf_trc   =  86400    !  unit conversion factor (=1 -> /seconds ; =86400. -> /day) 
     100   nn_trd_trc  =  5475      !  time step frequency and tracers trends 
     101   nn_ctls_trc =   0        !  control surface type in mixed-layer trends (0,1 or n<jpk) 
     102   rn_ucf_trc  =   1        !  unit conversion factor (=1 -> /seconds ; =86400. -> /day) 
    87103   ln_trdmld_trc_restart = .false.  !  restart for ML diagnostics 
    88    ln_trdmld_trc_instant = .false.  !  flag to diagnose trends of instantantaneous or mean ML T/S 
     104   ln_trdmld_trc_instant = .true.  !  flag to diagnose trends of instantantaneous or mean ML T/S 
    89105   ln_trdtrc(1)  =   .true. 
    90    ln_trdtrc(2)  =   .true. 
    91    ln_trdtrc(3)  =   .true. 
    92    ln_trdtrc(4)  =   .true. 
    93    ln_trdtrc(5)  =   .true. 
    94    ln_trdtrc(6)  =   .true. 
    95106/ 
     107!----------------------------------------------------------------------- 
     108&namtrc_dia       !   parameters for passive tracer additional diagnostics 
     109!---------------------------------------------------------------------- 
     110   ln_diatrc     =  .true.   !  save additional diag. (T) or not (F) 
     111   nn_writedia   =  60     !  time step frequency for diagnostics 
     112/ 
  • branches/2011/dev_r2787_LOCEAN3_TRA_TRP/NEMOGCM/CONFIG/ORCA2_LIM/cpp_ORCA2_LIM.fcm

    r2670 r2819  
    1  bld::tool::fppkeys key_trabbl key_vectopt_loop key_orca_r2 key_lim2 key_dynspg_flt key_diaeiv key_ldfslp key_traldf_c2d key_traldf_eiv key_dynldf_c3d key_dtatem key_dtasal key_tradmp key_zdftke key_zdfddm key_zdftmx key_iomput  
     1 bld::tool::fppkeys key_trabbl key_vectopt_loop key_orca_r2 key_lim2 key_dynspg_flt key_diaeiv key_ldfslp key_traldf_c2d key_traldf_eiv key_dynldf_c3d key_zdftke key_zdfddm key_zdftmx key_iomput  
  • branches/2011/dev_r2787_LOCEAN3_TRA_TRP/NEMOGCM/CONFIG/ORCA2_LIM_PISCES/EXP00/namelist_pisces

    r2567 r2819  
    142142&nampisdia     !   additional 2D/3D tracers diagnostics ("key_trc_diaadd") 
    143143!,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, 
    144    nn_writedia  =  5475   !  time step frequency for tracers diagnostics 
    145 ! 
    146144!              !    name   !           title of the field          !     units      ! 
    147145!              !           !                                       !                !   
  • branches/2011/dev_r2787_LOCEAN3_TRA_TRP/NEMOGCM/CONFIG/ORCA2_LIM_PISCES/EXP00/namelist_top

    r2528 r2819  
    11!!>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> 
    22!! NEMO/TOP1 :  1 - tracer definition                     (namtrc    ) 
    3 !! namelists    2 - dynamical tracer trends               (namtrc_trd) 
     3!!              2 - tracer data initialisation            (namtrc_dta) 
    44!!              3 - tracer advection                      (namtrc_adv) 
    55!!              4 - tracer lateral diffusion              (namtrc_ldf) 
    66!!              5 - tracer vertical physics               (namtrc_zdf) 
    77!!              6 - tracer newtonian damping              (namtrc_dmp) 
     8!!              7 - dynamical tracer trends               (namtrc_trd) 
     9!!              8 - tracer output diagonstics             (namtrc_dia) 
    810!>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> 
    911!''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' 
     
    1820   cn_trcrst_in  = "restart_trc"   !  suffix of pass. sn_tracer restart name (input) 
    1921   cn_trcrst_out = "restart_trc"   !  suffix of pass. sn_tracer restart name (output) 
     22   ln_trcdta     =   .true. !  Initialisation from data input file (T) or not (F) 
    2023! 
    2124!              !    name   !           title of the field              !   units    ! initial data ! save   ! 
     
    4851/ 
    4952!----------------------------------------------------------------------- 
     53&namtrc_dta      !    Initialisation from data input file 
     54!----------------------------------------------------------------------- 
     55! 
     56!                !  file name               ! frequency (hours) ! variable   ! time interp. !  clim  ! 'yearly'/ ! weights  ! rotation ! 
     57!                !                          !  (if <0  months)  !   name     !   (logical)  !  (T/F) ! 'monthly' ! filename ! pairing  ! 
     58   sn_trcdta(1)  = 'data_DIC_nomask'        ,        -12        ,  'DIC'     ,    .false.   , .true. , 'yearly'  , ''       , '' 
     59   sn_trcdta(2)  = 'data_Alkalini_nomask'   ,        -12        ,  'Alkalini',    .false.   , .true. , 'yearly'  , ''       , '' 
     60   sn_trcdta(3)  = 'data_O2_nomask'         ,        -1         ,  'O2'      ,    .true.    , .true. , 'yearly'  , ''       , '' 
     61   sn_trcdta(5)  = 'data_PO4_nomask'        ,        -1         ,  'PO4'     ,    .true.    , .true. , 'yearly'  , ''       , '' 
     62   sn_trcdta(7)  = 'data_Si_nomask'         ,        -1         ,  'Si'      ,    .true.    , .true. , 'yearly'  , ''       , '' 
     63   sn_trcdta(10) = 'data_DOC_nomask'        ,        -12        ,  'DOC'     ,    .false.   , .true. , 'yearly'  , ''       , '' 
     64   sn_trcdta(14) = 'data_Fer_nomask'        ,        -12        ,  'Fer'     ,    .false.   , .true. , 'yearly'  , ''       , '' 
     65   sn_trcdta(23) = 'data_NO3_nomask'        ,        -1         ,  'NO3'     ,    .true.    , .true. , 'yearly'  , ''       , '' 
     66! 
     67   cn_dir        =  './'      !  root directory for the location of the data files 
     68   rn_trfac(1)   =   1.0e-06  !  multiplicative factor 
     69   rn_trfac(2)   =   1.0e-06  !  -      -      -     - 
     70   rn_trfac(3)   =  44.6e-06  !  -      -      -     - 
     71   rn_trfac(5)   = 122.0e-06  !  -      -      -     - 
     72   rn_trfac(7)   =   1.0e-06  !  -      -      -     - 
     73   rn_trfac(10)  =   1.0      !  -      -      -     - 
     74   rn_trfac(14)  =   1.0      !  -      -      -     - 
     75   rn_trfac(23)  =   7.6e-06  !  -      -      -     - 
     76/ 
     77!----------------------------------------------------------------------- 
    5078&namtrc_adv    !   advection scheme for passive tracer  
    5179!----------------------------------------------------------------------- 
     
    6997   ln_trcldf_iso    =  .true.   !     iso-neutral                       (require "key_ldfslp") 
    7098!                               !  Coefficient 
     99   rn_ahtrc_0       =  2000.    !  horizontal eddy diffusivity for tracers [m2/s] 
    71100   rn_ahtrb_0       =     0.    !     background eddy diffusivity for ldf_iso [m2/s] 
    72101/ 
     
    83112/ 
    84113!----------------------------------------------------------------------- 
    85 &namtrc_dmp    !   passive tracer newtonian damping    ('key_tradmp && key_trcdmp') 
     114&namtrc_dmp    !   passive tracer newtonian damping    
    86115!----------------------------------------------------------------------- 
     116   ln_trcdmp   =  .false.  !  add a damping termn (T) or not (F) 
    87117   nn_hdmp_tr  =   -1      !  horizontal shape =-1, damping in Med and Red Seas only 
    88118                           !                   =XX, damping poleward of XX degrees (XX>0) 
     
    107137   ln_trdtrc(1)  =   .true. 
    108138   ln_trdtrc(2)  =   .true. 
    109    ln_trdtrc(3)  =   .false. 
    110    ln_trdtrc(4)  =   .false. 
    111    ln_trdtrc(5)  =   .false. 
    112    ln_trdtrc(6)  =   .false. 
    113    ln_trdtrc(7)  =   .false. 
    114    ln_trdtrc(8)  =   .false. 
    115    ln_trdtrc(9)  =   .false. 
    116    ln_trdtrc(10) =   .false. 
    117    ln_trdtrc(11) =   .false. 
    118    ln_trdtrc(12) =   .false. 
    119    ln_trdtrc(13) =   .false. 
    120    ln_trdtrc(14) =   .false. 
    121    ln_trdtrc(15) =   .false. 
    122    ln_trdtrc(16) =   .false. 
    123    ln_trdtrc(17) =   .false. 
    124    ln_trdtrc(18) =   .false. 
    125    ln_trdtrc(19) =   .false. 
    126    ln_trdtrc(20) =   .false. 
    127    ln_trdtrc(21) =   .false. 
    128    ln_trdtrc(22) =   .false. 
    129139   ln_trdtrc(23) =   .true. 
    130    ln_trdtrc(24) =   .false. 
    131140/ 
     141!----------------------------------------------------------------------- 
     142&namtrc_dia       !   parameters for passive tracer additional diagnostics 
     143!---------------------------------------------------------------------- 
     144   ln_diatrc     =  .true.   !  save additional diag. (T) or not (F) 
     145   nn_writedia   =  5475     !  time step frequency for diagnostics 
     146/ 
  • branches/2011/dev_r2787_LOCEAN3_TRA_TRP/NEMOGCM/CONFIG/ORCA2_LIM_PISCES/cpp_ORCA2_LIM_PISCES.fcm

    r2670 r2819  
    1 bld::tool::fppkeys key_trabbl key_vectopt_loop key_orca_r2 key_lim2 key_dynspg_flt key_diaeiv key_ldfslp key_traldf_c2d key_traldf_eiv key_dynldf_c3d key_dtatem key_dtasal key_tradmp key_zdftke key_zdfddm key_top key_pisces key_dtatrc key_diatrc key_iomput  
     1bld::tool::fppkeys key_trabbl key_vectopt_loop key_orca_r2 key_lim2 key_dynspg_flt key_diaeiv key_ldfslp key_traldf_c2d key_traldf_eiv key_dynldf_c3d key_zdfddm key_top key_pisces key_iomput  
  • branches/2011/dev_r2787_LOCEAN3_TRA_TRP/NEMOGCM/CONFIG/ORCA2_OFF_PISCES/EXP00/namelist_top

    r2528 r2819  
    11!!>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> 
    22!! NEMO/TOP1 :  1 - tracer definition                     (namtrc    ) 
    3 !! namelists    2 - dynamical tracer trends               (namtrc_trd) 
     3!!              2 - tracer data initialisation            (namtrc_dta) 
    44!!              3 - tracer advection                      (namtrc_adv) 
    55!!              4 - tracer lateral diffusion              (namtrc_ldf) 
    66!!              5 - tracer vertical physics               (namtrc_zdf) 
    77!!              6 - tracer newtonian damping              (namtrc_dmp) 
     8!!              7 - dynamical tracer trends               (namtrc_trd) 
     9!!              8 - tracer output diagonstics             (namtrc_dia) 
    810!>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> 
    911!''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' 
     
    1820   cn_trcrst_in  = "restart_trc"   !  suffix of pass. sn_tracer restart name (input) 
    1921   cn_trcrst_out = "restart_trc"   !  suffix of pass. sn_tracer restart name (output) 
     22   ln_trcdta     =   .true. !  Initialisation from data input file (T) or not (F) 
    2023! 
    2124!              !    name   !           title of the field              !   units    ! initial data ! save   ! 
     
    4851/ 
    4952!----------------------------------------------------------------------- 
     53&namtrc_dta      !    Initialisation from data input file 
     54!----------------------------------------------------------------------- 
     55! 
     56!                !  file name               ! frequency (hours) ! variable   ! time interp. !  clim  ! 'yearly'/ ! weights  ! rotation ! 
     57!                !                          !  (if <0  months)  !   name     !   (logical)  !  (T/F) ! 'monthly' ! filename ! pairing  ! 
     58   sn_trcdta(1)  = 'data_DIC_nomask'        ,        -12        ,  'DIC'     ,    .false.   , .true. , 'yearly'  , ''       , '' 
     59   sn_trcdta(2)  = 'data_Alkalini_nomask'   ,        -12        ,  'Alkalini',    .false.   , .true. , 'yearly'  , ''       , '' 
     60   sn_trcdta(3)  = 'data_O2_nomask'         ,        -1         ,  'O2'      ,    .true.    , .true. , 'yearly'  , ''       , '' 
     61   sn_trcdta(5)  = 'data_PO4_nomask'        ,        -1         ,  'PO4'     ,    .true.    , .true. , 'yearly'  , ''       , '' 
     62   sn_trcdta(7)  = 'data_Si_nomask'         ,        -1         ,  'Si'      ,    .true.    , .true. , 'yearly'  , ''       , '' 
     63   sn_trcdta(10) = 'data_DOC_nomask'        ,        -12        ,  'DOC'     ,    .false.   , .true. , 'yearly'  , ''       , '' 
     64   sn_trcdta(14) = 'data_Fer_nomask'        ,        -12        ,  'Fer'     ,    .false.   , .true. , 'yearly'  , ''       , '' 
     65   sn_trcdta(23) = 'data_NO3_nomask'        ,        -1         ,  'NO3'     ,    .true.    , .true. , 'yearly'  , ''       , '' 
     66! 
     67   cn_dir        =  './'      !  root directory for the location of the data files 
     68   rn_trfac(1)   =   1.0e-06  !  multiplicative factor 
     69   rn_trfac(2)   =   1.0e-06  !  -      -      -     - 
     70   rn_trfac(3)   =  44.6e-06  !  -      -      -     - 
     71   rn_trfac(5)   = 122.0e-06  !  -      -      -     - 
     72   rn_trfac(7)   =   1.0e-06  !  -      -      -     - 
     73   rn_trfac(10)  =   1.0      !  -      -      -     - 
     74   rn_trfac(14)  =   1.0      !  -      -      -     - 
     75   rn_trfac(23)  =   7.6e-06  !  -      -      -     - 
     76/ 
     77!----------------------------------------------------------------------- 
    5078&namtrc_adv    !   advection scheme for passive tracer  
    5179!----------------------------------------------------------------------- 
     
    6997   ln_trcldf_iso    =  .true.   !     iso-neutral                       (require "key_ldfslp") 
    7098!                               !  Coefficient 
     99   rn_ahtrc_0       =  2000.    !  horizontal eddy diffusivity for tracers [m2/s] 
    71100   rn_ahtrb_0       =     0.    !     background eddy diffusivity for ldf_iso [m2/s] 
    72101/ 
     
    83112/ 
    84113!----------------------------------------------------------------------- 
    85 &namtrc_dmp    !   passive tracer newtonian damping    ('key_tradmp && key_trcdmp') 
     114&namtrc_dmp    !   passive tracer newtonian damping    
    86115!----------------------------------------------------------------------- 
     116   ln_trcdmp   =  .false.  !  add a damping termn (T) or not (F) 
    87117   nn_hdmp_tr  =   -1      !  horizontal shape =-1, damping in Med and Red Seas only 
    88118                           !                   =XX, damping poleward of XX degrees (XX>0) 
     
    107137   ln_trdtrc(1)  =   .true. 
    108138   ln_trdtrc(2)  =   .true. 
    109    ln_trdtrc(3)  =   .false. 
    110    ln_trdtrc(4)  =   .false. 
    111    ln_trdtrc(5)  =   .false. 
    112    ln_trdtrc(6)  =   .false. 
    113    ln_trdtrc(7)  =   .false. 
    114    ln_trdtrc(8)  =   .false. 
    115    ln_trdtrc(9)  =   .false. 
    116    ln_trdtrc(10) =   .false. 
    117    ln_trdtrc(11) =   .false. 
    118    ln_trdtrc(12) =   .false. 
    119    ln_trdtrc(13) =   .false. 
    120    ln_trdtrc(14) =   .false. 
    121    ln_trdtrc(15) =   .false. 
    122    ln_trdtrc(16) =   .false. 
    123    ln_trdtrc(17) =   .false. 
    124    ln_trdtrc(18) =   .false. 
    125    ln_trdtrc(19) =   .false. 
    126    ln_trdtrc(20) =   .false. 
    127    ln_trdtrc(21) =   .false. 
    128    ln_trdtrc(22) =   .false. 
    129139   ln_trdtrc(23) =   .true. 
    130    ln_trdtrc(24) =   .false. 
    131140/ 
     141!----------------------------------------------------------------------- 
     142&namtrc_dia       !   parameters for passive tracer additional diagnostics 
     143!---------------------------------------------------------------------- 
     144   ln_diatrc     =  .true.   !  save additional diag. (T) or not (F) 
     145   nn_writedia   =  1460     !  time step frequency for diagnostics 
     146/ 
  • branches/2011/dev_r2787_LOCEAN3_TRA_TRP/NEMOGCM/CONFIG/ORCA2_OFF_PISCES/cpp_ORCA2_OFF_PISCES.fcm

    r2787 r2819  
    1 bld::tool::fppkeys key_trabbl key_vectopt_loop key_orca_r2 key_ldfslp key_traldf_c2d key_traldf_eiv key_top key_offline key_pisces key_dtatrc key_diatrc key_iomput  
     1bld::tool::fppkeys key_trabbl key_vectopt_loop key_orca_r2 key_ldfslp key_traldf_c2d key_traldf_eiv key_top key_offline key_pisces key_iomput  
  • branches/2011/dev_r2787_LOCEAN3_TRA_TRP/NEMOGCM/NEMO/OPA_SRC/LDF/ldftra_oce.F90

    r2715 r2819  
    3434   LOGICAL , PUBLIC ::   l_triad_iso     = .FALSE.   !: calculate triads twice 
    3535   LOGICAL , PUBLIC ::   l_no_smooth     = .FALSE.   !: no Shapiro smoothing 
     36 
     37   REAL(wp), PUBLIC ::   rldf                        !: multiplicative factor of diffusive coefficient 
     38                                                     !: Needed to define the ratio between passive and active tracer diffusion coef.  
    3639 
    3740#if defined key_traldf_c3d 
  • branches/2011/dev_r2787_LOCEAN3_TRA_TRP/NEMOGCM/NEMO/OPA_SRC/LDF/ldftra_substitute.h90

    r2528 r2819  
    1212#if defined key_traldf_c3d 
    1313!   'key_traldf_c3d' :                 aht: 3D coefficient 
    14 #       define   fsahtt(i,j,k)   ahtt(i,j,k) 
    15 #       define   fsahtu(i,j,k)   ahtu(i,j,k) 
    16 #       define   fsahtv(i,j,k)   ahtv(i,j,k) 
    17 #       define   fsahtw(i,j,k)   ahtw(i,j,k) 
     14#       define   fsahtt(i,j,k)   rldf * ahtt(i,j,k) 
     15#       define   fsahtu(i,j,k)   rldf * ahtu(i,j,k) 
     16#       define   fsahtv(i,j,k)   rldf * ahtv(i,j,k) 
     17#       define   fsahtw(i,j,k)   rldf * ahtw(i,j,k) 
    1818#elif defined key_traldf_c2d 
    1919!   'key_traldf_c2d' :                 aht: 2D coefficient 
    20 #       define   fsahtt(i,j,k)   ahtt(i,j) 
    21 #       define   fsahtu(i,j,k)   ahtu(i,j) 
    22 #       define   fsahtv(i,j,k)   ahtv(i,j) 
    23 #       define   fsahtw(i,j,k)   ahtw(i,j) 
     20#       define   fsahtt(i,j,k)   rldf * ahtt(i,j) 
     21#       define   fsahtu(i,j,k)   rldf * ahtu(i,j) 
     22#       define   fsahtv(i,j,k)   rldf * ahtv(i,j) 
     23#       define   fsahtw(i,j,k)   rldf * ahtw(i,j) 
    2424#elif defined key_traldf_c1d 
    2525!   'key_traldf_c1d' :                aht: 1D coefficient 
    26 #       define   fsahtt(i,j,k)   ahtt(k) 
    27 #       define   fsahtu(i,j,k)   ahtu(k) 
    28 #       define   fsahtv(i,j,k)   ahtv(k) 
    29 #       define   fsahtw(i,j,k)   ahtw(k) 
     26#       define   fsahtt(i,j,k)   rldf * ahtt(k) 
     27#       define   fsahtu(i,j,k)   rldf * ahtu(k) 
     28#       define   fsahtv(i,j,k)   rldf * ahtv(k) 
     29#       define   fsahtw(i,j,k)   rldf * ahtw(k) 
    3030#else 
    3131!   Default option :             aht: Constant coefficient 
    32 #      define   fsahtt(i,j,k)   aht0 
    33 #      define   fsahtu(i,j,k)   aht0 
    34 #      define   fsahtv(i,j,k)   aht0 
    35 #      define   fsahtw(i,j,k)   aht0 
     32#      define   fsahtt(i,j,k)   rldf * aht0 
     33#      define   fsahtu(i,j,k)   rldf * aht0 
     34#      define   fsahtv(i,j,k)   rldf * aht0 
     35#      define   fsahtw(i,j,k)   rldf * aht0 
    3636#endif 
  • branches/2011/dev_r2787_LOCEAN3_TRA_TRP/NEMOGCM/NEMO/OPA_SRC/TRA/traldf.F90

    r2715 r2819  
    6161      REAL(wp), DIMENSION(:,:,:), ALLOCATABLE ::  ztrdt, ztrds 
    6262      !!---------------------------------------------------------------------- 
     63 
     64      rldf = 1     ! For active tracers the  
    6365 
    6466      IF( l_trdtra )   THEN                    !* Save ta and sa trends 
  • branches/2011/dev_r2787_LOCEAN3_TRA_TRP/NEMOGCM/NEMO/OPA_SRC/trc_oce.F90

    r2715 r2819  
    4848   !!---------------------------------------------------------------------- 
    4949   LOGICAL, PUBLIC, PARAMETER ::   lk_offline = .FALSE.   !: offline flag 
     50#endif 
     51#if defined key_degrad 
     52   !!---------------------------------------------------------------------- 
     53   !!   'key_degrad'                                     Degradation mode           
     54   !!---------------------------------------------------------------------- 
     55   LOGICAL, PUBLIC, PARAMETER ::   lk_degrad = .TRUE.   !: degradation flag 
     56#else 
     57   !!---------------------------------------------------------------------- 
     58   !!   Default option                                   NO  Degradation mode           
     59   !!---------------------------------------------------------------------- 
     60   LOGICAL, PUBLIC, PARAMETER ::   lk_degrad = .FALSE.   !: degradation flag 
    5061#endif 
    5162 
  • branches/2011/dev_r2787_LOCEAN3_TRA_TRP/NEMOGCM/NEMO/TOP_SRC/C14b/trcini_c14b.F90

    r2715 r2819  
    181181      IF( ctrcnm(jpc14) /= 'C14B' ) THEN 
    182182          ctrcnm(jpc14)  = 'C14B' 
    183           ctrcnl(jpc14)  = 'Bomb C14 concentration' 
     183          ctrcln(jpc14)  = 'Bomb C14 concentration' 
    184184      ENDIF 
    185185 
    186186      IF(lwp) THEN 
    187187         CALL ctl_warn( ' we force tracer names' ) 
    188          WRITE(numout,*) ' tracer nb: ',jpc14,' name = ',ctrcnm(jpc14), ctrcnl(jpc14) 
     188         WRITE(numout,*) ' tracer nb: ',jpc14,' name = ',ctrcnm(jpc14), ctrcln(jpc14) 
    189189         WRITE(numout,*) ' ' 
    190190      ENDIF 
  • branches/2011/dev_r2787_LOCEAN3_TRA_TRP/NEMOGCM/NEMO/TOP_SRC/C14b/trcnam_c14b.F90

    r2715 r2819  
    1616   USE trc             ! TOP variables 
    1717   USE trcsms_c14b     ! C14b specific variable 
     18   USE iom             ! I/O manager 
    1819 
    1920   IMPLICIT NONE 
     
    4344      INTEGER ::   numnatb 
    4445 
    45 #if defined key_diatrc && ! defined key_iomput 
    4646      ! definition of additional diagnostic as a structure 
    47       INTEGER ::   jl, jn 
    48       TYPE DIAG 
    49          CHARACTER(len = 20)  :: snamedia   !: short name 
    50          CHARACTER(len = 80 ) :: lnamedia   !: long name 
    51          CHARACTER(len = 20 ) :: unitdia    !: unit 
    52       END TYPE DIAG 
    53  
    54       TYPE(DIAG) , DIMENSION(jp_c14b_2d) :: c14dia2d 
    55       TYPE(DIAG) , DIMENSION(jp_c14b_3d) :: c14dia3d 
    56 #endif 
     47      INTEGER :: jl, jn 
     48      TYPE(DIAG), DIMENSION(jp_c14b_2d) :: c14dia2d 
     49      TYPE(DIAG), DIMENSION(jp_c14b_3d) :: c14dia3d 
    5750      !! 
    5851      NAMELIST/namc14date/ ndate_beg_b, nyear_res_b 
    59 #if defined key_diatrc && ! defined key_iomput 
    60       NAMELIST/namc14dia/nn_writedia, c14dia2d, c14dia3d     ! additional diagnostics 
    61 #endif 
     52      NAMELIST/namc14dia/  c14dia2d, c14dia3d     ! additional diagnostics 
    6253      !!------------------------------------------------------------------- 
    6354 
     
    8071      IF(lwp) WRITE(numout,*) '    initial year (aa)                  nyear_beg_b = ', nyear_beg_b 
    8172      ! 
    82 #if defined key_diatrc && ! defined key_iomput 
     73      IF( .NOT.lk_iomput .AND. ln_diatrc ) THEN 
     74         ! 
     75         ! Namelist namc14dia 
     76         ! ------------------- 
     77         DO jl = 1, jp_c14b_2d 
     78            WRITE(c14dia2d(jl)%sname,'("2D_",I1)') jl                      ! short name 
     79            WRITE(c14dia2d(jl)%lname,'("2D DIAGNOSTIC NUMBER ",I2)') jl    ! long name 
     80            c14dia2d(jl)%units = ' '                                       ! units 
     81         END DO 
     82         !                                 ! 3D output arrays 
     83         DO jl = 1, jp_c14b_3d 
     84            WRITE(c14dia3d(jl)%sname,'("3D_",I1)') jl                      ! short name 
     85            WRITE(c14dia3d(jl)%lname,'("3D DIAGNOSTIC NUMBER ",I2)') jl    ! long name 
     86            c14dia3d(jl)%units = ' '                                       ! units 
     87         END DO 
    8388 
    84       ! Namelist namc14dia 
    85       ! ------------------- 
    86       nn_writedia = 10                   ! default values 
    87  
    88       DO jl = 1, jp_c14b_2d 
    89          jn = jp_c14b0_2d + jl - 1 
    90          WRITE(ctrc2d(jn),'("2D_",I1)') jn                      ! short name 
    91          WRITE(ctrc2l(jn),'("2D DIAGNOSTIC NUMBER ",I2)') jn    ! long name 
    92          ctrc2u(jn) = ' '                                       ! units 
    93       END DO 
    94       !                                 ! 3D output arrays 
    95       DO jl = 1, jp_c14b_3d 
    96          jn = jp_c14b0_3d + jl - 1 
    97          WRITE(ctrc3d(jn),'("3D_",I1)') jn                      ! short name 
    98          WRITE(ctrc3l(jn),'("3D DIAGNOSTIC NUMBER ",I2)') jn    ! long name 
    99          ctrc3u(jn) = ' '                                       ! units 
    100       END DO 
    101  
    102       REWIND( numnatb )               ! read natrtd 
    103       READ  ( numnatb, namc14dia ) 
    104  
    105       DO jl = 1, jp_c14b_2d 
    106          jn = jp_c14b0_2d + jl - 1 
    107          ctrc2d(jn) = c14dia2d(jl)%snamedia 
    108          ctrc2l(jn) = c14dia2d(jl)%lnamedia 
    109          ctrc2u(jn) = c14dia2d(jl)%unitdia 
    110       END DO 
    111  
    112       DO jl = 1, jp_c14b_3d 
    113          jn = jp_c14b0_3d + jl - 1 
    114          ctrc3d(jn) = c14dia3d(jl)%snamedia 
    115          ctrc3l(jn) = c14dia3d(jl)%lnamedia 
    116          ctrc3u(jn) = c14dia3d(jl)%unitdia 
    117       END DO 
    118  
    119       IF(lwp) THEN                   ! control print 
    120          WRITE(numout,*) 
    121          WRITE(numout,*) ' Namelist : natadd' 
    122          WRITE(numout,*) '    frequency of outputs for additional arrays nn_writedia = ', nn_writedia 
    123          DO jl = 1, jp_c14b_3d 
    124             jn = jp_c14b0_3d + jl - 1 
    125             WRITE(numout,*) '   3d output field No : ',jn 
    126             WRITE(numout,*) '   short name         : ', TRIM(ctrc3d(jn)) 
    127             WRITE(numout,*) '   long name          : ', TRIM(ctrc3l(jn)) 
    128             WRITE(numout,*) '   unit               : ', TRIM(ctrc3u(jn)) 
    129             WRITE(numout,*) ' ' 
    130          END DO 
     89         REWIND( numnatb )               !  
     90         READ  ( numnatb, namc14dia ) 
    13191 
    13292         DO jl = 1, jp_c14b_2d 
    13393            jn = jp_c14b0_2d + jl - 1 
    134             WRITE(numout,*) '   2d output field No : ',jn 
    135             WRITE(numout,*) '   short name         : ', TRIM(ctrc2d(jn)) 
    136             WRITE(numout,*) '   long name          : ', TRIM(ctrc2l(jn)) 
    137             WRITE(numout,*) '   unit               : ', TRIM(ctrc2u(jn)) 
     94            ctrc2d(jn) = c14dia2d(jl)%sname 
     95            ctrc2l(jn) = c14dia2d(jl)%lname 
     96            ctrc2u(jn) = c14dia2d(jl)%units 
     97         END DO 
     98 
     99         DO jl = 1, jp_c14b_3d 
     100            jn = jp_c14b0_3d + jl - 1 
     101            ctrc3d(jn) = c14dia3d(jl)%sname 
     102            ctrc3l(jn) = c14dia3d(jl)%lname 
     103            ctrc3u(jn) = c14dia3d(jl)%units 
     104         END DO 
     105 
     106         IF(lwp) THEN                   ! control print 
     107            WRITE(numout,*) 
     108            WRITE(numout,*) ' Namelist : natadd' 
     109            DO jl = 1, jp_c14b_3d 
     110               jn = jp_c14b0_3d + jl - 1 
     111               WRITE(numout,*) '  3d diag nb : ', jn, '    short name : ', ctrc3d(jn), & 
     112                 &             '  long name  : ', ctrc3l(jn), '   unit : ', ctrc3u(jn) 
     113            END DO 
    138114            WRITE(numout,*) ' ' 
    139          END DO 
     115 
     116            DO jl = 1, jp_c14b_2d 
     117               jn = jp_c14b0_2d + jl - 1 
     118               WRITE(numout,*) '  2d diag nb : ', jn, '    short name : ', ctrc2d(jn), & 
     119                 &             '  long name  : ', ctrc2l(jn), '   unit : ', ctrc2u(jn) 
     120            END DO 
     121            WRITE(numout,*) ' ' 
     122         ENDIF 
     123         ! 
    140124      ENDIF 
    141  
    142 #endif 
    143125 
    144126   END SUBROUTINE trc_nam_c14b 
  • branches/2011/dev_r2787_LOCEAN3_TRA_TRP/NEMOGCM/NEMO/TOP_SRC/C14b/trcsms_c14b.F90

    r2715 r2819  
    246246#endif 
    247247                  &                      * tmask(ji,jj,1) * ( 1. - fr_i(ji,jj) ) / 2. 
    248  
    249248            ! Add the surface flux to the trend 
    250249            tra(ji,jj,1,jpc14) = tra(ji,jj,1,jpc14) + qtr_c14(ji,jj) / fse3t(ji,jj,1)  
     
    253252            qint_c14(ji,jj) = qint_c14(ji,jj) + qtr_c14(ji,jj) * rdt 
    254253 
    255 # if defined key_diatrc && ! defined key_iomput 
    256             ! Save 2D diagnostics 
    257             trc2d(ji,jj,jp_c14b0_2d    ) = qtr_c14 (ji,jj) 
    258             trc2d(ji,jj,jp_c14b0_2d + 1) = qint_c14(ji,jj) 
    259 # endif  
     254            !                                        ! Save 2D diagnostics 
     255            IF( .NOT.lk_iomput .AND. ln_diatrc ) THEN 
     256               trc2d(ji,jj,jp_c14b0_2d    ) = qtr_c14 (ji,jj) 
     257               trc2d(ji,jj,jp_c14b0_2d + 1) = qint_c14(ji,jj) 
     258            ENDIF  
     259            ! 
    260260         END DO 
    261261      END DO 
     
    265265         DO jj = 1, jpj 
    266266            DO ji = 1, jpi 
    267 #if ! defined key_degrad 
     267#if defined key_degrad 
     268               ztra = trn(ji,jj,jk,jpc14) * ( 1. - EXP( -xlambda * rdt * facvol(ji,jj,jk) ) ) 
     269#else 
    268270               ztra = trn(ji,jj,jk,jpc14) * xaccum 
    269 #else 
    270                ztra = trn(ji,jj,jk,jpc14) * ( 1. - EXP( -xlambda * rdt * facvol(ji,jj,jk) ) ) 
    271271#endif 
    272272               tra(ji,jj,jk,jpc14) = tra(ji,jj,jk,jpc14) - ztra / rdt 
    273 #if defined key_diatrc 
    274                ! Save 3D diagnostics 
    275 # if ! defined key_iomput 
    276                trc3d(ji,jj,jk,jp_c14b0_3d ) = ztra    !  radioactive decay 
    277 # else  
    278                zw3d(ji,jj,jk) = ztra    !  radioactive decay 
    279 # endif 
    280 #endif 
     273               !                                     ! save 3D diag : radioactive decay 
     274               IF( ln_diatrc ) THEN 
     275                  IF( lk_iomput ) THEN   ;   zw3d(ji,jj,jk)               = ztra 
     276                  ELSE                   ;   trc3d(ji,jj,jk,jp_c14b0_3d ) = ztra 
     277                  ENDIF 
     278               ENDIF 
     279               ! 
    281280            END DO 
    282281         END DO 
    283282      END DO 
    284283 
    285 #if defined key_diatrc  && defined key_iomput 
    286       CALL iom_put( "qtrC14b"  , qtr_c14  ) 
    287       CALL iom_put( "qintC14b" , qint_c14 ) 
    288 #endif 
    289 #if defined key_diatrc  && defined key_iomput 
    290       CALL iom_put( "fdecay" , zw3d ) 
    291 #endif 
    292       IF( l_trdtrc )   CALL trd_mod_trc( tra(:,:,:,jpc14), jpc14, jptra_trd_sms, kt )   ! save trends 
     284      IF( lk_iomput ) THEN 
     285         CALL iom_put( "qtrC14b"  , qtr_c14  ) 
     286         CALL iom_put( "qintC14b" , qint_c14 ) 
     287         CALL iom_put( "fdecay"   , zw3d     ) 
     288      ENDIF 
     289 
     290      IF( l_trdtrc )  CALL trd_mod_trc( tra(:,:,:,jpc14), jpc14, jptra_trd_sms, kt )   ! save trends 
    293291 
    294292      IF( wrk_not_released(2, 1) .OR.   & 
  • branches/2011/dev_r2787_LOCEAN3_TRA_TRP/NEMOGCM/NEMO/TOP_SRC/CFC/par_cfc.F90

    r2528 r2819  
    3232   !!--------------------------------------------------------------------- 
    3333   LOGICAL, PUBLIC, PARAMETER ::   lk_cfc     = .TRUE.      !: CFC flag  
    34    INTEGER, PUBLIC, PARAMETER ::   jp_cfc     =  2          !: number of passive tracers 
     34   INTEGER, PUBLIC, PARAMETER ::   jp_cfc     =  1          !: number of passive tracers 
    3535   INTEGER, PUBLIC, PARAMETER ::   jp_cfc_2d  =  2          !: additional 2d output arrays ('key_trc_diaadd') 
    3636   INTEGER, PUBLIC, PARAMETER ::   jp_cfc_3d  =  0          !: additional 3d output arrays ('key_trc_diaadd') 
  • branches/2011/dev_r2787_LOCEAN3_TRA_TRP/NEMOGCM/NEMO/TOP_SRC/CFC/trcini_cfc.F90

    r2715 r2819  
    44   !! TOP :   initialisation of the CFC tracers 
    55   !!====================================================================== 
    6    !! History :   2.0  !  2007-12  (C. Ethe, G. Madec) from trcini.cfc.h90 
     6   !! History :   2.0  !  2007-12  (C. Ethe, G. Madec)  
    77   !!---------------------------------------------------------------------- 
    88#if defined key_cfc 
     
    4343      !! ** Method  : - Read the namcfc namelist and check the parameter values 
    4444      !!---------------------------------------------------------------------- 
    45       INTEGER  ::  ji, jj, jn, jl, jm, js 
     45      INTEGER  ::  ji, jj, jn, jl, jm, js, io, ierr 
     46      INTEGER  ::  iskip = 6   ! number of 1st descriptor lines 
    4647      REAL(wp) ::  zyy, zyd 
    4748      !!---------------------------------------------------------------------- 
     
    5152      IF(lwp) WRITE(numout,*) ' ~~~~~~~~~~~' 
    5253 
     54 
     55      IF(lwp) WRITE(numout,*) 'read of formatted file cfc1112atm' 
     56       
     57      CALL ctl_opn( inum, clname, 'OLD', 'FORMATTED', 'SEQUENTIAL', -1, numout, .FALSE. ) 
     58      REWIND(inum) 
     59       
     60      ! compute the number of year in the file 
     61      ! file starts in 1931 do jn represent the year in the century 
     62      jn = 31  
     63      DO  
     64        READ(inum,'(1x)',END=100)  
     65        jn = jn + 1 
     66      END DO 
     67 100  jpyear = jn - 1 - iskip 
     68      IF ( lwp) WRITE(numout,*) '    ', jpyear ,' years read' 
    5369      !                                ! Allocate CFC arrays 
     70 
     71      ALLOCATE( p_cfc(jpyear,jphem,2), STAT=ierr ) 
     72      IF( ierr > 0 ) THEN 
     73         CALL ctl_stop( 'trc_ini_cfc: unable to allocate p_cfc array' )   ;   RETURN 
     74      ENDIF 
    5475      IF( trc_sms_cfc_alloc() /= 0 )   CALL ctl_stop( 'STOP', 'trc_ini_cfc: unable to allocate CFC arrays' ) 
    5576 
     
    7596      ENDIF 
    7697 
    77  
    78       !   READ CFC partial pressure atmospheric value : 
    79       !     p11(year,nt) = PCFC11  in northern (1) and southern (2) hemisphere  
    80       !     p12(year,nt) = PCFC12  in northern (1) and southern (2) hemisphere  
    81       !-------------------------------------------------------------------- 
    82  
    83       IF(lwp) WRITE(numout,*) 'read of formatted file cfc1112atm' 
    84        
    85       CALL ctl_opn( inum, clname, 'OLD', 'FORMATTED', 'SEQUENTIAL', -1, numout, .FALSE. ) 
    8698      REWIND(inum) 
    8799       
    88       DO jm = 1, 6        ! Skip over 1st six descriptor lines 
     100      DO jm = 1, iskip        ! Skip over 1st six descriptor lines 
    89101         READ(inum,'(1x)') 
    90102      END DO 
    91     
    92103      ! file starts in 1931 do jn represent the year in the century.jhh 
    93104      ! Read file till the end 
    94105      jn = 31 
    95       DO WHILE ( 1 /= 2 ) 
    96          READ(inum,*,END=100) zyy, p_cfc(jn,1,1), p_cfc(jn,1,2), p_cfc(jn,2,1), p_cfc(jn,2,2) 
    97          IF ( lwp) THEN 
    98            WRITE(numout,'(f7.2, 4f8.2)' ) & 
    99             &         zyy, p_cfc(jn,1,1), p_cfc(jn,1,2), p_cfc(jn,2,1), p_cfc(jn,2,2) 
    100          ENDIF 
    101          jn = jn + 1 
     106      DO  
     107        READ(inum,*, IOSTAT=io) zyy, p_cfc(jn,1,1), p_cfc(jn,1,2), p_cfc(jn,2,1), p_cfc(jn,2,2) 
     108        IF( io < 0 ) exit 
     109        jn = jn + 1 
    102110      END DO 
    103  100  npyear = jn - 1 
    104       IF ( lwp) WRITE(numout,*) '    ', npyear ,' years read' 
    105111 
    106112      p_cfc(32,1:2,1) = 5.e-4      ! modify the values of the first years 
     
    116122         WRITE(numout,*) 
    117123         WRITE(numout,*) ' Year   p11HN    p11HS    p12HN    p12HS ' 
    118          DO jn = 30, 100 
     124         DO jn = 30, jpyear 
    119125            WRITE(numout, '( 1I4, 4F9.2)') jn, p_cfc(jn,1,1), p_cfc(jn,2,1), p_cfc(jn,1,2), p_cfc(jn,2,2) 
    120126         END DO 
  • branches/2011/dev_r2787_LOCEAN3_TRA_TRP/NEMOGCM/NEMO/TOP_SRC/CFC/trcnam_cfc.F90

    r2715 r2819  
    1616   USE trc             ! TOP variables 
    1717   USE trcsms_cfc      ! CFC specific variable 
     18   USE iom             ! I/O manager 
    1819 
    1920   IMPLICIT NONE 
     
    4142      !! ** input   :   Namelist namcfc 
    4243      !!---------------------------------------------------------------------- 
    43       INTEGER ::   numnatc 
    44 #if defined key_diatrc && ! defined key_iomput 
    45       ! definition of additional diagnostic as a structure 
     44      INTEGER ::  numnatc 
    4645      INTEGER :: jl, jn 
    47       TYPE DIAG 
    48          CHARACTER(len = 20)  :: snamedia   !: short name 
    49          CHARACTER(len = 80 ) :: lnamedia   !: long name 
    50          CHARACTER(len = 20 ) :: unitdia    !: unit 
    51       END TYPE DIAG 
    52  
    53       TYPE(DIAG) , DIMENSION(jp_cfc_2d) :: cfcdia2d 
    54 #endif 
     46      TYPE(DIAG), DIMENSION(jp_cfc_2d) :: cfcdia2d 
    5547      !! 
    5648      NAMELIST/namcfcdate/ ndate_beg, nyear_res 
    57 #if defined key_diatrc && ! defined key_iomput 
    58       NAMELIST/namcfcdia/nn_writedia, cfcdia2d     ! additional diagnostics 
    59 #endif 
     49      NAMELIST/namcfcdia/  cfcdia2d     ! additional diagnostics 
    6050      !!------------------------------------------------------------------- 
    6151 
     
    7868      IF(lwp) WRITE(numout,*) '    initial year (aa)                       nyear_beg = ', nyear_beg 
    7969      ! 
    80 #if defined key_diatrc && ! defined key_iomput 
    8170 
    82       ! Namelist namcfcdia 
    83       ! ------------------- 
    84       nn_writedia = 10                   ! default values 
     71      IF( .NOT.lk_iomput .AND. ln_diatrc ) THEN 
     72         ! 
     73         ! Namelist namcfcdia 
     74         ! ------------------- 
     75         DO jl = 1, jp_cfc_2d 
     76            WRITE(cfcdia2d(jl)%sname,'("2D_",I1)') jl                      ! short name 
     77            WRITE(cfcdia2d(jl)%lname,'("2D DIAGNOSTIC NUMBER ",I2)') jl    ! long name 
     78            cfcdia2d(jl)%units = ' '                                       ! units 
     79         END DO 
    8580 
    86       DO jl = 1, jp_cfc_2d 
    87          jn = jp_cfc0_2d + jl - 1  
    88          WRITE(ctrc2d(jn),'("2D_",I1)') jn                      ! short name 
    89          WRITE(ctrc2l(jn),'("2D DIAGNOSTIC NUMBER ",I2)') jn    ! long name 
    90          ctrc2u(jn) = ' '                                       ! units 
    91       END DO 
     81         REWIND( numnatc )               ! read natrtd 
     82         READ  ( numnatc, namcfcdia ) 
    9283 
    93       REWIND( numnatc )               ! read natrtd 
    94       READ  ( numnatc, namcfcdia ) 
    95  
    96       DO jl = 1, jp_cfc_2d 
    97          jn = jp_cfc0_2d + jl - 1 
    98          ctrc2d(jn) = cfcdia2d(jl)%snamedia 
    99          ctrc2l(jn) = cfcdia2d(jl)%lnamedia 
    100          ctrc2u(jn) = cfcdia2d(jl)%unitdia 
    101       END DO 
    102  
    103  
    104       IF(lwp) THEN                   ! control print 
    105          WRITE(numout,*) 
    106          WRITE(numout,*) ' Namelist : natadd' 
    107          WRITE(numout,*) '    frequency of outputs for additional arrays nn_writedia = ', nn_writedia 
    10884         DO jl = 1, jp_cfc_2d 
    10985            jn = jp_cfc0_2d + jl - 1 
    110             WRITE(numout,*) '   2d output field No : ',jn 
    111             WRITE(numout,*) '   short name         : ', TRIM(ctrc2d(jn)) 
    112             WRITE(numout,*) '   long name          : ', TRIM(ctrc2l(jn)) 
    113             WRITE(numout,*) '   unit               : ', TRIM(ctrc2u(jn)) 
     86            ctrc2d(jn) = TRIM( cfcdia2d(jl)%sname ) 
     87            ctrc2l(jn) = TRIM( cfcdia2d(jl)%lname ) 
     88            ctrc2u(jn) = TRIM( cfcdia2d(jl)%units ) 
     89         END DO 
     90 
     91         IF(lwp) THEN                   ! control print 
     92            WRITE(numout,*) 
     93            WRITE(numout,*) ' Namelist : natadd' 
     94            DO jl = 1, jp_cfc_2d 
     95               jn = jp_cfc0_2d + jl - 1 
     96               WRITE(numout,*) '  2d diag nb : ', jn, '    short name : ', ctrc2d(jn), & 
     97                 &             '  long name  : ', ctrc2l(jn), '   unit : ', ctrc2u(jn) 
     98            END DO 
    11499            WRITE(numout,*) ' ' 
    115          END DO 
     100         ENDIF 
     101         ! 
    116102      ENDIF 
    117 #endif 
    118103 
    119104   END SUBROUTINE trc_nam_cfc 
  • branches/2011/dev_r2787_LOCEAN3_TRA_TRP/NEMOGCM/NEMO/TOP_SRC/CFC/trcsms_cfc.F90

    r2715 r2819  
    2828   PUBLIC   trc_sms_cfc_alloc   ! called in trcini_cfc.F90 
    2929 
    30    INTEGER , PUBLIC, PARAMETER ::   jpyear = 150   ! temporal parameter  
    3130   INTEGER , PUBLIC, PARAMETER ::   jphem  =   2   ! parameter for the 2 hemispheres 
    32    INTEGER , PUBLIC    ::   ndate_beg      ! initial calendar date (aammjj) for CFC 
    33    INTEGER , PUBLIC    ::   nyear_res      ! restoring time constant (year) 
    34    INTEGER , PUBLIC    ::   nyear_beg      ! initial year (aa)  
    35    INTEGER , PUBLIC    ::   npyear         ! Number of years read in CFC1112 file 
     31   INTEGER , PUBLIC            ::   jpyear         ! Number of years read in CFC1112 file 
     32   INTEGER , PUBLIC            ::   ndate_beg      ! initial calendar date (aammjj) for CFC 
     33   INTEGER , PUBLIC            ::   nyear_res      ! restoring time constant (year) 
     34   INTEGER , PUBLIC            ::   nyear_beg      ! initial year (aa)  
    3635    
    37    REAL(wp), PUBLIC, DIMENSION(jpyear,jphem, 2    )      ::   p_cfc    ! partial hemispheric pressure for CFC 
     36   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::   p_cfc    ! partial hemispheric pressure for CFC 
    3837   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:)   ::   xphem    ! spatial interpolation factor for patm 
    3938   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::   qtr_cfc  ! flux at surface 
    4039   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::   qint_cfc ! cumulative flux  
     40   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:)   ::   patm     ! atmospheric function 
    4141 
    4242   REAL(wp), DIMENSION(4,2) ::   soa   ! coefficient for solubility of CFC [mol/l/atm] 
     
    7575      !!                CFC concentration in pico-mol/m3 
    7676      !!---------------------------------------------------------------------- 
    77       USE wrk_nemo, ONLY:   wrk_in_use, wrk_not_released 
    78       USE wrk_nemo, ONLY:   ztrcfc => wrk_3d_1        ! use for CFC sms trend 
    7977      ! 
    8078      INTEGER, INTENT(in) ::   kt    ! ocean time-step index 
     
    8280      INTEGER  ::   ji, jj, jn, jl, jm, js 
    8381      INTEGER  ::   iyear_beg, iyear_end 
    84       INTEGER  ::   im1, im2 
     82      INTEGER  ::   im1, im2, ierr 
    8583      REAL(wp) ::   ztap, zdtap         
    8684      REAL(wp) ::   zt1, zt2, zt3, zv2 
     
    9088      REAL(wp) ::   zca_cfc   ! concentration at equilibrium 
    9189      REAL(wp) ::   zak_cfc   ! transfert coefficients 
    92       REAL(wp), DIMENSION(jphem,jp_cfc) ::   zpatm   ! atmospheric function 
    93       !!---------------------------------------------------------------------- 
    94       ! 
    95       IF( wrk_in_use(3, 1) ) THEN 
    96          CALL ctl_stop('trc_sms_cfc: requested workspace array unavailable')   ;   RETURN 
     90      REAL(wp), ALLOCATABLE, DIMENSION(:,:)  ::   zpatm     ! atmospheric function 
     91      !!---------------------------------------------------------------------- 
     92      ! 
     93      ALLOCATE( zpatm(jphem,jp_cfc), STAT=ierr ) 
     94      IF( ierr > 0 ) THEN 
     95         CALL ctl_stop( 'trc_sms_cfc: unable to allocate zpatm array' )   ;   RETURN 
    9796      ENDIF 
    9897 
     
    158157 
    159158               ! Input function  : speed *( conc. at equil - concen at surface ) 
    160                ! trn in pico-mol/l idem qtr; ak in en m/s 
     159               ! trn in pico-mol/l idem qtr; ak in en m/a 
    161160               qtr_cfc(ji,jj,jl) = -zak_cfc * ( trb(ji,jj,1,jn) - zca_cfc )   & 
    162161#if defined key_degrad 
     
    164163#endif 
    165164                  &                         * tmask(ji,jj,1) * ( 1. - fr_i(ji,jj) ) 
    166  
    167165               ! Add the surface flux to the trend 
    168166               tra(ji,jj,1,jn) = tra(ji,jj,1,jn) + qtr_cfc(ji,jj,jl) / fse3t(ji,jj,1)  
     
    176174      END DO                                                !  end CFC loop  ! 
    177175      !                                                     !----------------! 
    178  
    179 #if defined key_diatrc  
    180       ! Save diagnostics , just for CFC11 
    181 # if  defined key_iomput 
    182       CALL iom_put( "qtrCFC11"  , qtr_cfc (:,:,1) ) 
    183       CALL iom_put( "qintCFC11" , qint_cfc(:,:,1) ) 
    184 # else 
    185       trc2d(:,:,jp_cfc0_2d    ) = qtr_cfc (:,:,1) 
    186       trc2d(:,:,jp_cfc0_2d + 1) = qint_cfc(:,:,1) 
    187 # endif 
    188 #endif 
    189  
     176      IF( ln_diatrc ) THEN 
     177        ! 
     178        IF( lk_iomput ) THEN 
     179           CALL iom_put( "qtrCFC11"  , qtr_cfc (:,:,1) ) 
     180           CALL iom_put( "qintCFC11" , qint_cfc(:,:,1) ) 
     181        ELSE 
     182           trc2d(:,:,jp_cfc0_2d    ) = qtr_cfc (:,:,1) 
     183           trc2d(:,:,jp_cfc0_2d + 1) = qint_cfc(:,:,1) 
     184        END IF 
     185        ! 
     186      END IF 
     187  
    190188      IF( l_trdtrc ) THEN 
    191189          DO jn = jp_cfc0, jp_cfc1 
    192             ztrcfc(:,:,:) = tra(:,:,:,jn) 
    193             CALL trd_mod_trc( ztrcfc, jn, jptra_trd_sms, kt )   ! save trends 
     190            CALL trd_mod_trc( tra(:,:,:,jn), jn, jptra_trd_sms, kt )   ! save trends 
    194191          END DO 
    195192      END IF 
    196       ! 
    197       IF( wrk_not_released(3, 1) )   CALL ctl_stop('trc_sms_cfc: failed to release workspace array') 
    198193      ! 
    199194   END SUBROUTINE trc_sms_cfc 
  • branches/2011/dev_r2787_LOCEAN3_TRA_TRP/NEMOGCM/NEMO/TOP_SRC/LOBSTER/par_lobster.F90

    r2528 r2819  
    1919   LOGICAL, PUBLIC, PARAMETER ::   lk_lobster     = .TRUE.    !: LOBSTER flag  
    2020   INTEGER, PUBLIC, PARAMETER ::   jp_lobster     =  6        !: number of LOBSTER tracers 
    21    INTEGER, PUBLIC, PARAMETER ::   jp_lobster_2d  = 19        !: additional 2d output arrays ('key_diatrc') 
    22    INTEGER, PUBLIC, PARAMETER ::   jp_lobster_3d  =  3        !: additional 3d output arrays ('key_diatrc') 
     21   INTEGER, PUBLIC, PARAMETER ::   jp_lobster_2d  = 19        !: additional 2d output arrays  
     22   INTEGER, PUBLIC, PARAMETER ::   jp_lobster_3d  =  3        !: additional 3d output arrays  
    2323   INTEGER, PUBLIC, PARAMETER ::   jp_lobster_trd = 17       !: number of sms trends for LOBSTER 
    2424 
  • branches/2011/dev_r2787_LOCEAN3_TRA_TRP/NEMOGCM/NEMO/TOP_SRC/LOBSTER/trcbio.F90

    r2715 r2819  
    7474      REAL(wp) ::   zfilpz, zfildz, zphya, zzooa, zno3a 
    7575      REAL(wp) ::   znh4a, zdeta, zdoma, zzoobod, zboddet, zdomaju 
    76 #if defined key_diatrc 
    7776      REAL(wp) ::   ze3t 
    78 #endif 
    79 #if defined key_diatrc && defined key_iomput 
    8077      REAL(wp), POINTER,   DIMENSION(:,:,:) :: zw2d 
    8178      REAL(wp), POINTER, DIMENSION(:,:,:,:) :: zw3d 
    82 #endif 
    83       REAL(wp), DIMENSION(:,:,:,:), ALLOCATABLE ::   ztrbio 
    8479      CHARACTER (len=25) :: charout 
    8580      !!--------------------------------------------------------------------- 
    8681 
    87 #if defined key_diatrc && defined key_iomput 
    88       IF( ( wrk_in_use(3, 2) ) .OR. ( wrk_in_use(4, 1) ) ) THEN 
    89          CALL ctl_stop('trc_bio : requested workspace arrays unavailable.') 
    90          RETURN 
    91       END IF 
    92       ! Set-up pointers into sub-arrays of workspaces 
    93       zw2d => wrk_3d_2(:,:,1:17) 
    94       zw3d => wrk_4d_1(:,:,:,1:3) 
    95 #endif 
     82      IF( ln_diatrc .AND. lk_iomput ) THEN 
     83         IF( ( wrk_in_use(3, 2) ) .OR. ( wrk_in_use(4, 1) ) ) THEN 
     84            CALL ctl_stop('trc_bio : requested workspace arrays unavailable.')  ;  RETURN 
     85         END IF 
     86         ! Set-up pointers into sub-arrays of workspaces 
     87         zw2d => wrk_3d_2(:,:,1:17) 
     88         zw3d => wrk_4d_1(:,:,:,1:3) 
     89      ENDIF 
    9690 
    9791      IF( kt == nit000 ) THEN 
     
    10296 
    10397      fbod(:,:) = 0.e0 
    104 #if defined key_diatrc && ! defined key_iomput 
    105 #  if defined key_iomput 
    106       zw2d  (:,:,:) = 0.e0 
    107       zw3d(:,:,:,:) = 0.e0 
    108 #  else 
    109       DO jl = jp_lob0_2d, jp_lob1_2d 
    110          trc2d(:,:,jl) = 0.e0 
    111       END DO  
    112 #  endif 
    113 #endif 
    114  
    115       IF( l_trdtrc )THEN 
    116          ALLOCATE( ztrbio(jpi,jpj,jpk,jp_lobster_trd) ) 
    117          ztrbio(:,:,:,:) = 0. 
    118       ENDIF 
    119  
    120       !                                      ! -------------------------- ! 
    121       DO jk = 1, jpkbm1                      !  Upper ocean (bio-layers)  ! 
    122          !                                   ! -------------------------- ! 
     98      IF( ln_diatrc ) THEN 
     99         ! 
     100         IF( lk_iomput ) THEN 
     101            zw2d  (:,:,:) = 0.e0 
     102            zw3d(:,:,:,:) = 0.e0 
     103         ELSE 
     104            trc2d(:,:,  jp_lob0_2d:jp_lob1_2d) = 0.e0 
     105            trc3d(:,:,:,jp_lob0_3d:jp_lob1_3d) = 0.e0 
     106         ENDIF 
     107         ! 
     108      ENDIF 
     109 
     110      DO jk = 1, jpkm1                      
     111         !                              
    123112         DO jj = 2, jpjm1 
    124113            DO ji = fs_2, fs_jpim1  
     
    133122               znh4 = MAX( 0.e0, trn(ji,jj,jk,jp_lob_nh4) ) 
    134123               zdom = MAX( 0.e0, trn(ji,jj,jk,jp_lob_dom) ) 
    135  
    136                ! Limitations 
    137                zlt   = 1. 
    138                zle   = 1. - EXP( -xpar(ji,jj,jk) / aki / zlt ) 
    139                ! psinut,akno3,aknh4 added by asklod AS Kremeur 2005-03 
    140                zlno3 = zno3 * EXP( -psinut * znh4 ) / ( akno3 + zno3 ) 
    141                zlnh4 = znh4 / (znh4+aknh4)  
    142  
    143                ! sinks and sources 
    144                !    phytoplankton production and exsudation 
    145                zno3phy = tmumax * zle * zlt * zlno3 * zphy 
    146                znh4phy = tmumax * zle * zlt * zlnh4 * zphy 
    147  
    148                !    fphylab added by asklod AS Kremeur 2005-03 
    149                zphydom = rgamma * (1 - fphylab) * (zno3phy + znh4phy) 
    150                zphynh4 = rgamma * fphylab * (zno3phy + znh4phy) 
    151  
    152                ! zooplankton production 
    153                !    preferences 
    154                zppz = rppz 
    155                zpdz = 1. - rppz 
    156                zpppz = ( zppz * zphy ) / ( ( zppz * zphy + zpdz * zdet ) + 1.e-13 ) 
    157                zppdz = ( zpdz * zdet ) / ( ( zppz * zphy + zpdz * zdet ) + 1.e-13 ) 
    158                zfood = zpppz * zphy + zppdz * zdet 
    159                !    filtration 
    160                zfilpz = taus * zpppz / (aks + zfood) 
    161                zfildz = taus * zppdz / (aks + zfood) 
    162                !    grazing 
    163                zphyzoo = zfilpz * zphy * zzoo 
    164                zdetzoo = zfildz * zdet * zzoo 
    165  
    166                ! fecal pellets production 
    167                zzoodet = rpnaz * zphyzoo + rdnaz * zdetzoo 
     124               !                                      ! -------------------------- ! 
     125               IF( jk <= jpkbm1 ) THEN                !  Upper ocean (bio-layers)  !  
     126                  !                                   ! -------------------------- ! 
     127                  ! Limitations                      
     128                  zlt   = 1. 
     129                  zle   = 1. - EXP( -xpar(ji,jj,jk) / aki / zlt ) 
     130                  ! psinut,akno3,aknh4 added by asklod AS Kremeur 2005-03 
     131                  zlno3 = zno3 * EXP( -psinut * znh4 ) / ( akno3 + zno3 ) 
     132                  zlnh4 = znh4 / (znh4+aknh4)  
     133 
     134                  ! sinks and sources 
     135                  !    phytoplankton production and exsudation 
     136                  zno3phy = tmumax * zle * zlt * zlno3 * zphy 
     137                  znh4phy = tmumax * zle * zlt * zlnh4 * zphy 
     138 
     139                  !    fphylab added by asklod AS Kremeur 2005-03 
     140                  zphydom = rgamma * (1 - fphylab) * (zno3phy + znh4phy) 
     141                  zphynh4 = rgamma * fphylab * (zno3phy + znh4phy) 
     142    
     143                  ! zooplankton production 
     144                  !    preferences 
     145                  zppz = rppz 
     146                  zpdz = 1. - rppz 
     147                  zpppz = ( zppz * zphy ) / ( ( zppz * zphy + zpdz * zdet ) + 1.e-13 ) 
     148                  zppdz = ( zpdz * zdet ) / ( ( zppz * zphy + zpdz * zdet ) + 1.e-13 ) 
     149                  zfood = zpppz * zphy + zppdz * zdet 
     150                  !    filtration 
     151                  zfilpz = taus * zpppz / (aks + zfood) 
     152                  zfildz = taus * zppdz / (aks + zfood) 
     153                  !    grazing zphyzoo = zfilpz * zphy * zzoo 
     154                  zdetzoo = zfildz * zdet * zzoo 
     155 
     156                  ! fecal pellets production 
     157                  zzoodet = rpnaz * zphyzoo + rdnaz * zdetzoo 
    168158  
    169                ! zooplankton liquide excretion 
    170                zzoonh4 = tauzn * fzoolab * zzoo  
    171                zzoodom = tauzn * (1 - fzoolab) * zzoo 
    172  
    173                ! mortality 
    174                !    phytoplankton mortality  
    175                zphydet = tmminp * zphy 
    176  
    177                !    zooplankton mortality 
    178                !    closure : flux fbod is redistributed below level jpkbio 
    179                zzoobod = tmminz * zzoo * zzoo 
    180                fbod(ji,jj) = fbod(ji,jj) + (1-fdbod) * zzoobod * fse3t(ji,jj,jk) 
    181                zboddet = fdbod * zzoobod 
    182  
    183                ! detritus and dom breakdown 
    184                zdetnh4 = taudn * fdetlab * zdet 
    185                zdetdom = taudn * (1 - fdetlab) * zdet  
    186  
    187                zdomnh4 = taudomn * zdom 
    188  
    189                ! flux added to express how the excess of nitrogen from 
    190                ! PHY, ZOO and DET to DOM goes directly to NH4 (flux of ajustment) 
    191                zdomaju = (1 - redf/reddom) * (zphydom + zzoodom + zdetdom) 
    192  
    193                ! Nitrification 
    194                znh4no3 = taunn * znh4 
     159                  ! zooplankton liquide excretion 
     160                  zzoonh4 = tauzn * fzoolab * zzoo  
     161                  zzoodom = tauzn * (1 - fzoolab) * zzoo 
     162 
     163                  ! mortality 
     164                  !    phytoplankton mortality  
     165                  zphydet = tmminp * zphy 
     166 
     167                  !    zooplankton mortality 
     168                  !    closure : flux fbod is redistributed below level jpkbio 
     169                  zzoobod = tmminz * zzoo * zzoo 
     170                  fbod(ji,jj) = fbod(ji,jj) + (1-fdbod) * zzoobod * fse3t(ji,jj,jk) 
     171                  zboddet = fdbod * zzoobod 
     172 
     173                  ! detritus and dom breakdown 
     174                  zdetnh4 = taudn * fdetlab * zdet 
     175                  zdetdom = taudn * (1 - fdetlab) * zdet  
     176 
     177                  zdomnh4 = taudomn * zdom 
     178 
     179                  ! flux added to express how the excess of nitrogen from 
     180                  ! PHY, ZOO and DET to DOM goes directly to NH4 (flux of ajustment) 
     181                  zdomaju = (1 - redf/reddom) * (zphydom + zzoodom + zdetdom) 
     182 
     183                  ! Nitrification 
     184                  znh4no3 = taunn * znh4 
     185                  !                                   ! -------------------------- ! 
     186               ELSE                                   !  Lower ocean               !  
     187                  !                                   ! -------------------------- ! 
     188                  !    Limitations 
     189                  zlt   = 0.e0 
     190                  zle   = 0.e0 
     191                  zlno3 = 0.e0 
     192                  zlnh4 = 0.e0 
     193 
     194                  !    sinks and sources 
     195                  !       phytoplankton production and exsudation 
     196                  zno3phy = 0.e0 
     197                  znh4phy = 0.e0 
     198                  zphydom = 0.e0 
     199                  zphynh4 = 0.e0 
     200 
     201                  !    zooplankton production 
     202                  zphyzoo = 0.e0      ! grazing 
     203                  zdetzoo = 0.e0 
     204 
     205                  zzoodet = 0.e0      ! fecal pellets production 
     206 
     207                  zzoonh4 = tauzn * fzoolab * zzoo         ! zooplankton liquide excretion 
     208                  zzoodom = tauzn * (1 - fzoolab) * zzoo 
     209 
     210                  !    mortality 
     211                  zphydet = tmminp * zphy      ! phytoplankton mortality  
     212 
     213                  zzoobod = 0.e0               ! zooplankton mortality 
     214                  zboddet = 0.e0               ! closure : flux fbod is redistributed below level jpkbio 
     215 
     216                  !    detritus and dom breakdown 
     217                  zdetnh4 = taudn * fdetlab * zdet 
     218                  zdetdom = taudn * (1 - fdetlab) * zdet 
     219 
     220                  zdomnh4 = taudomn * zdom 
     221                  zdomaju = (1 - redf/reddom) * (zphydom + zzoodom + zdetdom) 
     222 
     223                  !    Nitrification 
     224                  znh4no3 = taunn * znh4 
     225                  ! 
     226               ENDIF 
    195227 
    196228               ! determination of trends 
     
    211243               tra(ji,jj,jk,jp_lob_dom) = tra(ji,jj,jk,jp_lob_dom) + zdoma 
    212244 
    213 #if defined key_diabio 
    214                trbio(ji,jj,jk,jp_lob0_trd     ) = zno3phy 
    215                trbio(ji,jj,jk,jp_lob0_trd +  1) = znh4phy 
    216                trbio(ji,jj,jk,jp_lob0_trd +  2) = zphynh4 
    217                trbio(ji,jj,jk,jp_lob0_trd +  3) = zphydom 
    218                trbio(ji,jj,jk,jp_lob0_trd +  4) = zphyzoo 
    219                trbio(ji,jj,jk,jp_lob0_trd +  5) = zphydet 
    220                trbio(ji,jj,jk,jp_lob0_trd +  6) = zdetzoo 
    221                trbio(ji,jj,jk,jp_lob0_trd +  8) = zzoodet 
    222                trbio(ji,jj,jk,jp_lob0_trd +  9) = zzoobod 
    223                trbio(ji,jj,jk,jp_lob0_trd + 10) = zzoonh4 
    224                trbio(ji,jj,jk,jp_lob0_trd + 11) = zzoodom 
    225                trbio(ji,jj,jk,jp_lob0_trd + 12) = znh4no3 
    226                trbio(ji,jj,jk,jp_lob0_trd + 13) = zdomnh4 
    227                trbio(ji,jj,jk,jp_lob0_trd + 14) = zdetnh4 
    228                trbio(ji,jj,jk,jp_lob0_trd + 15) = zdetdom 
    229 #endif 
    230                IF( l_trdtrc ) THEN 
    231                   ztrbio(ji,jj,jk,jp_lob0_trd     ) = zno3phy 
    232                   ztrbio(ji,jj,jk,jp_lob0_trd +  1) = znh4phy 
    233                   ztrbio(ji,jj,jk,jp_lob0_trd +  2) = zphynh4 
    234                   ztrbio(ji,jj,jk,jp_lob0_trd +  3) = zphydom 
    235                   ztrbio(ji,jj,jk,jp_lob0_trd +  4) = zphyzoo 
    236                   ztrbio(ji,jj,jk,jp_lob0_trd +  5) = zphydet 
    237                   ztrbio(ji,jj,jk,jp_lob0_trd +  6) = zdetzoo 
     245               IF( ( ln_diabio .AND. .NOT. lk_iomput ) .OR. l_trdtrc ) THEN 
     246                  trbio(ji,jj,jk,jp_lob0_trd     ) = zno3phy 
     247                  trbio(ji,jj,jk,jp_lob0_trd +  1) = znh4phy 
     248                  trbio(ji,jj,jk,jp_lob0_trd +  2) = zphynh4 
     249                  trbio(ji,jj,jk,jp_lob0_trd +  3) = zphydom 
     250                  trbio(ji,jj,jk,jp_lob0_trd +  4) = zphyzoo 
     251                  trbio(ji,jj,jk,jp_lob0_trd +  5) = zphydet 
     252                  trbio(ji,jj,jk,jp_lob0_trd +  6) = zdetzoo 
    238253                  !  trend number 8 in trcsed 
    239                   ztrbio(ji,jj,jk,jp_lob0_trd +  8) = zzoodet 
    240                   ztrbio(ji,jj,jk,jp_lob0_trd +  9) = zzoobod 
    241                   ztrbio(ji,jj,jk,jp_lob0_trd + 10) = zzoonh4 
    242                   ztrbio(ji,jj,jk,jp_lob0_trd + 11) = zzoodom 
    243                   ztrbio(ji,jj,jk,jp_lob0_trd + 12) = znh4no3 
    244                   ztrbio(ji,jj,jk,jp_lob0_trd + 13) = zdomnh4 
    245                   ztrbio(ji,jj,jk,jp_lob0_trd + 14) = zdetnh4 
    246                   ztrbio(ji,jj,jk,jp_lob0_trd + 15) = zdetdom 
     254                  trbio(ji,jj,jk,jp_lob0_trd +  8) = zzoodet 
     255                  trbio(ji,jj,jk,jp_lob0_trd +  9) = zzoobod 
     256                  trbio(ji,jj,jk,jp_lob0_trd + 10) = zzoonh4 
     257                  trbio(ji,jj,jk,jp_lob0_trd + 11) = zzoodom 
     258                  trbio(ji,jj,jk,jp_lob0_trd + 12) = znh4no3 
     259                  trbio(ji,jj,jk,jp_lob0_trd + 13) = zdomnh4 
     260                  trbio(ji,jj,jk,jp_lob0_trd + 14) = zdetnh4 
     261                  trbio(ji,jj,jk,jp_lob0_trd + 15) = zdetdom 
    247262                  !  trend number 17 in trcexp 
    248263                ENDIF 
    249264 
    250 #if defined key_diatrc 
    251                ! convert fluxes in per day 
    252                ze3t = fse3t(ji,jj,jk) * 86400. 
    253 #if ! defined key_iomput 
    254                trc2d(ji,jj,jp_lob0_2d    ) = trc2d(ji,jj, jp_lob0_2d    ) + zno3phy * ze3t  
    255                trc2d(ji,jj,jp_lob0_2d + 1) = trc2d(ji,jj, jp_lob0_2d + 1) + znh4phy * ze3t 
    256                trc2d(ji,jj,jp_lob0_2d + 2) = trc2d(ji,jj, jp_lob0_2d + 2) + zphydom * ze3t 
    257                trc2d(ji,jj,jp_lob0_2d + 3) = trc2d(ji,jj, jp_lob0_2d + 3) + zphynh4 * ze3t 
    258                trc2d(ji,jj,jp_lob0_2d + 4) = trc2d(ji,jj, jp_lob0_2d + 4) + zphyzoo * ze3t 
    259                trc2d(ji,jj,jp_lob0_2d + 5) = trc2d(ji,jj, jp_lob0_2d + 5) + zphydet * ze3t 
    260                trc2d(ji,jj,jp_lob0_2d + 6) = trc2d(ji,jj, jp_lob0_2d + 6) + zdetzoo * ze3t 
    261                ! trend number 8 is in trcsed.F             
    262                trc2d(ji,jj,jp_lob0_2d +  8) = trc2d(ji,jj,jp_lob0_2d +  8) + zzoodet * ze3t 
    263                trc2d(ji,jj,jp_lob0_2d +  9) = trc2d(ji,jj,jp_lob0_2d +  9) + zzoobod * ze3t 
    264                trc2d(ji,jj,jp_lob0_2d + 10) = trc2d(ji,jj,jp_lob0_2d + 10) + zzoonh4 * ze3t 
    265                trc2d(ji,jj,jp_lob0_2d + 11) = trc2d(ji,jj,jp_lob0_2d + 11) + zzoodom * ze3t 
    266                trc2d(ji,jj,jp_lob0_2d + 12) = trc2d(ji,jj,jp_lob0_2d + 12) + znh4no3 * ze3t 
    267                trc2d(ji,jj,jp_lob0_2d + 13) = trc2d(ji,jj,jp_lob0_2d + 13) + zdomnh4 * ze3t 
    268                trc2d(ji,jj,jp_lob0_2d + 14) = trc2d(ji,jj,jp_lob0_2d + 14) + zdetnh4 * ze3t              
    269                trc2d(ji,jj,jp_lob0_2d + 15) = trc2d(ji,jj,jp_lob0_2d + 15) + (  zno3phy + znh4phy - zphynh4   & 
    270                   &                                 - zphydom - zphyzoo - zphydet ) * ze3t 
    271                trc2d(ji,jj,jp_lob0_2d + 16) = trc2d(ji,jj,jp_lob0_2d + 16) + (  zphyzoo + zdetzoo - zzoodet   & 
    272                   &                                 - zzoobod - zzoonh4 - zzoodom ) * ze3t 
    273                trc2d(ji,jj,jp_lob0_2d + 17) = trc2d(ji,jj,jp_lob0_2d + 17) + zdetdom * ze3t 
    274                ! trend number 19 is in trcexp.F 
    275 #else 
    276                zw2d(ji,jj,1)  = zw2d(ji,jj,1)  + zno3phy * ze3t  
    277                zw2d(ji,jj,2)  = zw2d(ji,jj,2)  + znh4phy * ze3t 
    278                zw2d(ji,jj,3)  = zw2d(ji,jj,3)  + zphydom * ze3t 
    279                zw2d(ji,jj,4)  = zw2d(ji,jj,4)  + zphynh4 * ze3t 
    280                zw2d(ji,jj,5)  = zw2d(ji,jj,5)  + zphyzoo * ze3t 
    281                zw2d(ji,jj,6)  = zw2d(ji,jj,6)  + zphydet * ze3t 
    282                zw2d(ji,jj,7)  = zw2d(ji,jj,7)  + zdetzoo * ze3t 
    283                zw2d(ji,jj,8)  = zw2d(ji,jj,8)  + zzoodet * ze3t 
    284                zw2d(ji,jj,9)  = zw2d(ji,jj,9)  + zzoobod * ze3t 
    285                zw2d(ji,jj,10) = zw2d(ji,jj,10) + zzoonh4 * ze3t 
    286                zw2d(ji,jj,11) = zw2d(ji,jj,11) + zzoodom * ze3t 
    287                zw2d(ji,jj,12) = zw2d(ji,jj,12) + znh4no3 * ze3t 
    288                zw2d(ji,jj,13) = zw2d(ji,jj,13) + zdomnh4 * ze3t 
    289                zw2d(ji,jj,14) = zw2d(ji,jj,14) + zdetnh4 * ze3t              
    290                zw2d(ji,jj,15) = zw2d(ji,jj,15) + ( zno3phy + znh4phy - zphynh4 - zphydom - zphyzoo - zphydet ) * ze3t 
    291                zw2d(ji,jj,16) = zw2d(ji,jj,16) + ( zphyzoo + zdetzoo - zzoodet - zzoobod - zzoonh4 - zzoodom ) * ze3t 
    292                zw2d(ji,jj,17) = zw2d(ji,jj,17) + zdetdom * ze3t 
    293 #endif 
    294 #if defined key_diatrc  
    295 # if ! defined key_iomput 
    296                trc3d(ji,jj,jk,jp_lob0_3d    ) = zno3phy * 86400      
    297                trc3d(ji,jj,jk,jp_lob0_3d + 1) = znh4phy * 86400      
    298                trc3d(ji,jj,jk,jp_lob0_3d + 2) = znh4no3 * 86400    
    299 # else 
    300                zw3d(ji,jj,jk,1) = zno3phy * 86400      
    301                zw3d(ji,jj,jk,2) = znh4phy * 86400      
    302                zw3d(ji,jj,jk,3) = znh4no3 * 86400    
    303 # endif 
    304 #endif   
    305 #endif 
     265                IF( ln_diatrc ) THEN 
     266                  ! convert fluxes in per day 
     267                  ze3t = fse3t(ji,jj,jk) * 86400. 
     268                  IF( lk_iomput ) THEN 
     269                     zw2d(ji,jj,1)  = zw2d(ji,jj,1)  + zno3phy * ze3t  
     270                     zw2d(ji,jj,2)  = zw2d(ji,jj,2)  + znh4phy * ze3t 
     271                     zw2d(ji,jj,3)  = zw2d(ji,jj,3)  + zphydom * ze3t 
     272                     zw2d(ji,jj,4)  = zw2d(ji,jj,4)  + zphynh4 * ze3t 
     273                     zw2d(ji,jj,5)  = zw2d(ji,jj,5)  + zphyzoo * ze3t 
     274                     zw2d(ji,jj,6)  = zw2d(ji,jj,6)  + zphydet * ze3t 
     275                     zw2d(ji,jj,7)  = zw2d(ji,jj,7)  + zdetzoo * ze3t 
     276                     zw2d(ji,jj,8)  = zw2d(ji,jj,8)  + zzoodet * ze3t 
     277                     zw2d(ji,jj,9)  = zw2d(ji,jj,9)  + zzoobod * ze3t 
     278                     zw2d(ji,jj,10) = zw2d(ji,jj,10) + zzoonh4 * ze3t 
     279                     zw2d(ji,jj,11) = zw2d(ji,jj,11) + zzoodom * ze3t 
     280                     zw2d(ji,jj,12) = zw2d(ji,jj,12) + znh4no3 * ze3t 
     281                     zw2d(ji,jj,13) = zw2d(ji,jj,13) + zdomnh4 * ze3t 
     282                     zw2d(ji,jj,14) = zw2d(ji,jj,14) + zdetnh4 * ze3t              
     283                     zw2d(ji,jj,15) = zw2d(ji,jj,15) + ( zno3phy + znh4phy - zphynh4 - zphydom - zphyzoo - zphydet ) * ze3t 
     284                     zw2d(ji,jj,16) = zw2d(ji,jj,16) + ( zphyzoo + zdetzoo - zzoodet - zzoobod - zzoonh4 - zzoodom ) * ze3t 
     285                     zw2d(ji,jj,17) = zw2d(ji,jj,17) + zdetdom * ze3t 
     286                     ! 
     287                     zw3d(ji,jj,jk,1) = zno3phy * 86400      
     288                     zw3d(ji,jj,jk,2) = znh4phy * 86400      
     289                     zw3d(ji,jj,jk,3) = znh4no3 * 86400    
     290                  ELSE 
     291                     trc2d(ji,jj,jp_lob0_2d    ) = trc2d(ji,jj, jp_lob0_2d    ) + zno3phy * ze3t  
     292                     trc2d(ji,jj,jp_lob0_2d + 1) = trc2d(ji,jj, jp_lob0_2d + 1) + znh4phy * ze3t 
     293                     trc2d(ji,jj,jp_lob0_2d + 2) = trc2d(ji,jj, jp_lob0_2d + 2) + zphydom * ze3t 
     294                     trc2d(ji,jj,jp_lob0_2d + 3) = trc2d(ji,jj, jp_lob0_2d + 3) + zphynh4 * ze3t 
     295                     trc2d(ji,jj,jp_lob0_2d + 4) = trc2d(ji,jj, jp_lob0_2d + 4) + zphyzoo * ze3t 
     296                     trc2d(ji,jj,jp_lob0_2d + 5) = trc2d(ji,jj, jp_lob0_2d + 5) + zphydet * ze3t 
     297                     trc2d(ji,jj,jp_lob0_2d + 6) = trc2d(ji,jj, jp_lob0_2d + 6) + zdetzoo * ze3t 
     298                     ! trend number 8 is in trcsed.F             
     299                     trc2d(ji,jj,jp_lob0_2d +  8) = trc2d(ji,jj,jp_lob0_2d +  8) + zzoodet * ze3t 
     300                     trc2d(ji,jj,jp_lob0_2d +  9) = trc2d(ji,jj,jp_lob0_2d +  9) + zzoobod * ze3t 
     301                     trc2d(ji,jj,jp_lob0_2d + 10) = trc2d(ji,jj,jp_lob0_2d + 10) + zzoonh4 * ze3t 
     302                     trc2d(ji,jj,jp_lob0_2d + 11) = trc2d(ji,jj,jp_lob0_2d + 11) + zzoodom * ze3t 
     303                     trc2d(ji,jj,jp_lob0_2d + 12) = trc2d(ji,jj,jp_lob0_2d + 12) + znh4no3 * ze3t 
     304                     trc2d(ji,jj,jp_lob0_2d + 13) = trc2d(ji,jj,jp_lob0_2d + 13) + zdomnh4 * ze3t 
     305                     trc2d(ji,jj,jp_lob0_2d + 14) = trc2d(ji,jj,jp_lob0_2d + 14) + zdetnh4 * ze3t              
     306                     trc2d(ji,jj,jp_lob0_2d + 15) = trc2d(ji,jj,jp_lob0_2d + 15) + (  zno3phy + znh4phy - zphynh4   & 
     307                        &                                 - zphydom - zphyzoo - zphydet ) * ze3t 
     308                     trc2d(ji,jj,jp_lob0_2d + 16) = trc2d(ji,jj,jp_lob0_2d + 16) + (  zphyzoo + zdetzoo - zzoodet   & 
     309                        &                                 - zzoobod - zzoonh4 - zzoodom ) * ze3t 
     310                     trc2d(ji,jj,jp_lob0_2d + 17) = trc2d(ji,jj,jp_lob0_2d + 17) + zdetdom * ze3t 
     311                     ! trend number 19 is in trcexp.F 
     312                     trc3d(ji,jj,jk,jp_lob0_3d    ) = zno3phy * 86400      
     313                     trc3d(ji,jj,jk,jp_lob0_3d + 1) = znh4phy * 86400      
     314                     trc3d(ji,jj,jk,jp_lob0_3d + 2) = znh4no3 * 86400    
     315                     ! 
     316                  ENDIF 
     317                   ! 
     318                ENDIF 
    306319            END DO 
    307320         END DO 
    308321      END DO 
    309322 
    310       !                                      ! -------------------------- ! 
    311       DO jk = jpkb, jpkm1                    !  Upper ocean (bio-layers)  ! 
    312          !                                   ! -------------------------- ! 
    313          DO jj = 2, jpjm1 
    314             DO ji = fs_2, fs_jpim1  
    315                ! remineralisation of all quantities towards nitrate  
    316  
    317                !    trophic variables( det, zoo, phy, no3, nh4, dom) 
    318                !       negative trophic variables DO not contribute to the fluxes 
    319                zdet = MAX( 0.e0, trn(ji,jj,jk,jp_lob_det) ) 
    320                zzoo = MAX( 0.e0, trn(ji,jj,jk,jp_lob_zoo) ) 
    321                zphy = MAX( 0.e0, trn(ji,jj,jk,jp_lob_phy) ) 
    322                zno3 = MAX( 0.e0, trn(ji,jj,jk,jp_lob_no3) ) 
    323                znh4 = MAX( 0.e0, trn(ji,jj,jk,jp_lob_nh4) ) 
    324                zdom = MAX( 0.e0, trn(ji,jj,jk,jp_lob_dom) ) 
    325  
    326                !    Limitations 
    327                zlt   = 0.e0 
    328                zle   = 0.e0 
    329                zlno3 = 0.e0 
    330                zlnh4 = 0.e0 
    331  
    332                !    sinks and sources 
    333                !       phytoplankton production and exsudation 
    334                zno3phy = 0.e0 
    335                znh4phy = 0.e0 
    336                zphydom = 0.e0 
    337                zphynh4 = 0.e0 
    338  
    339                !    zooplankton production 
    340                zphyzoo = 0.e0      ! grazing 
    341                zdetzoo = 0.e0 
    342  
    343                zzoodet = 0.e0      ! fecal pellets production 
    344  
    345                zzoonh4 = tauzn * fzoolab * zzoo         ! zooplankton liquide excretion 
    346                zzoodom = tauzn * (1 - fzoolab) * zzoo 
    347  
    348                !    mortality 
    349                zphydet = tmminp * zphy      ! phytoplankton mortality  
    350  
    351                zzoobod = 0.e0               ! zooplankton mortality 
    352                zboddet = 0.e0               ! closure : flux fbod is redistributed below level jpkbio 
    353  
    354                !    detritus and dom breakdown 
    355                zdetnh4 = taudn * fdetlab * zdet 
    356                zdetdom = taudn * (1 - fdetlab) * zdet  
    357  
    358                zdomnh4 = taudomn * zdom 
    359                zdomaju = (1 - redf/reddom) * (zphydom + zzoodom + zdetdom) 
    360  
    361                !    Nitrification 
    362                znh4no3 = taunn * znh4 
    363  
    364  
    365                ! determination of trends 
    366                !     total trend for each biological tracer 
    367                zphya =   zno3phy + znh4phy - zphynh4 - zphydom - zphyzoo - zphydet 
    368                zzooa =   zphyzoo + zdetzoo - zzoodet - zzoodom - zzoonh4 - zzoobod 
    369                zno3a = - zno3phy + znh4no3 
    370                znh4a = - znh4phy - znh4no3 + zphynh4 + zzoonh4 + zdomnh4 + zdetnh4 + zdomaju 
    371                zdeta = zphydet + zzoodet  - zdetzoo - zdetnh4 - zdetdom + zboddet 
    372                zdoma = zphydom + zzoodom + zdetdom - zdomnh4 - zdomaju 
    373  
    374                ! tracer flux at totox-point added to the general trend 
    375                tra(ji,jj,jk,jp_lob_det) = tra(ji,jj,jk,jp_lob_det) + zdeta 
    376                tra(ji,jj,jk,jp_lob_zoo) = tra(ji,jj,jk,jp_lob_zoo) + zzooa 
    377                tra(ji,jj,jk,jp_lob_phy) = tra(ji,jj,jk,jp_lob_phy) + zphya 
    378                tra(ji,jj,jk,jp_lob_no3) = tra(ji,jj,jk,jp_lob_no3) + zno3a 
    379                tra(ji,jj,jk,jp_lob_nh4) = tra(ji,jj,jk,jp_lob_nh4) + znh4a 
    380                tra(ji,jj,jk,jp_lob_dom) = tra(ji,jj,jk,jp_lob_dom) + zdoma 
    381                ! 
    382 #if defined key_diabio 
    383                trbio(ji,jj,jk,jp_lob0_trd     ) = zno3phy 
    384                trbio(ji,jj,jk,jp_lob0_trd +  1) = znh4phy 
    385                trbio(ji,jj,jk,jp_lob0_trd +  2) = zphynh4 
    386                trbio(ji,jj,jk,jp_lob0_trd +  3) = zphydom 
    387                trbio(ji,jj,jk,jp_lob0_trd +  4) = zphyzoo 
    388                trbio(ji,jj,jk,jp_lob0_trd +  5) = zphydet 
    389                trbio(ji,jj,jk,jp_lob0_trd +  6) = zdetzoo 
    390                trbio(ji,jj,jk,jp_lob0_trd +  8) = zzoodet 
    391                trbio(ji,jj,jk,jp_lob0_trd +  9) = zzoobod 
    392                trbio(ji,jj,jk,jp_lob0_trd + 10) = zzoonh4 
    393                trbio(ji,jj,jk,jp_lob0_trd + 11) = zzoodom 
    394                trbio(ji,jj,jk,jp_lob0_trd + 12) = znh4no3 
    395                trbio(ji,jj,jk,jp_lob0_trd + 13) = zdomnh4 
    396                trbio(ji,jj,jk,jp_lob0_trd + 14) = zdetnh4 
    397                trbio(ji,jj,jk,jp_lob0_trd + 15) = zdetdom 
    398 #endif 
    399                IF( l_trdtrc ) THEN 
    400                   ztrbio(ji,jj,jk,jp_lob0_trd     ) = zno3phy 
    401                   ztrbio(ji,jj,jk,jp_lob0_trd +  1) = znh4phy 
    402                   ztrbio(ji,jj,jk,jp_lob0_trd +  2) = zphynh4 
    403                   ztrbio(ji,jj,jk,jp_lob0_trd +  3) = zphydom 
    404                   ztrbio(ji,jj,jk,jp_lob0_trd +  4) = zphyzoo 
    405                   ztrbio(ji,jj,jk,jp_lob0_trd +  5) = zphydet 
    406                   ztrbio(ji,jj,jk,jp_lob0_trd +  6) = zdetzoo 
    407                   !  trend number 8 in trcsed 
    408                   ztrbio(ji,jj,jk,jp_lob0_trd +  8) = zzoodet 
    409                   ztrbio(ji,jj,jk,jp_lob0_trd +  9) = zzoobod 
    410                   ztrbio(ji,jj,jk,jp_lob0_trd + 10) = zzoonh4 
    411                   ztrbio(ji,jj,jk,jp_lob0_trd + 11) = zzoodom 
    412                   ztrbio(ji,jj,jk,jp_lob0_trd + 12) = znh4no3 
    413                   ztrbio(ji,jj,jk,jp_lob0_trd + 13) = zdomnh4 
    414                   ztrbio(ji,jj,jk,jp_lob0_trd + 14) = zdetnh4 
    415                   ztrbio(ji,jj,jk,jp_lob0_trd + 15) = zdetdom 
    416                   !  trend number 17 in trcexp 
    417                 ENDIF 
    418 #if defined key_diatrc 
    419 # if ! defined key_iomput 
    420                trc3d(ji,jj,jk,jp_lob0_3d    ) =  zno3phy * 86400      
    421                trc3d(ji,jj,jk,jp_lob0_3d + 1) =  znh4phy * 86400      
    422                trc3d(ji,jj,jk,jp_lob0_3d + 2) =  znh4no3 * 86400      
    423 # else 
    424                zw3d(ji,jj,jk,1) = zno3phy * 86400      
    425                zw3d(ji,jj,jk,2) = znh4phy * 86400      
    426                zw3d(ji,jj,jk,3) = znh4no3 * 86400    
    427 # endif 
    428 #endif 
     323      IF( ln_diatrc ) THEN 
     324         ! 
     325         IF( lk_iomput ) THEN 
     326            DO jl = 1, 17  
     327               CALL lbc_lnk( zw2d(:,:,jl),'T', 1. ) 
    429328            END DO 
    430          END DO 
    431       END DO 
    432  
    433 #if defined key_diatrc 
    434       ! Lateral boundary conditions  
    435 # if ! defined key_iomput 
    436       DO jl = jp_lob0_2d, jp_lob1_2d 
    437           CALL lbc_lnk( trc2d(:,:,jl),'T', 1. ) 
    438       END DO  
    439 # else 
    440       DO jl = 1, 17  
    441           CALL lbc_lnk( zw2d(:,:,jl),'T', 1. ) 
    442       END DO 
    443       ! Save diagnostics 
    444       CALL iom_put( "TNO3PHY", zw2d(:,:,1) ) 
    445       CALL iom_put( "TNH4PHY", zw2d(:,:,2) ) 
    446       CALL iom_put( "TPHYDOM", zw2d(:,:,3) ) 
    447       CALL iom_put( "TPHYNH4", zw2d(:,:,4) ) 
    448       CALL iom_put( "TPHYZOO", zw2d(:,:,5) ) 
    449       CALL iom_put( "TPHYDET", zw2d(:,:,6) ) 
    450       CALL iom_put( "TDETZOO", zw2d(:,:,7) ) 
    451       CALL iom_put( "TZOODET", zw2d(:,:,8) ) 
    452       CALL iom_put( "TZOOBOD", zw2d(:,:,9) ) 
    453       CALL iom_put( "TZOONH4", zw2d(:,:,10) ) 
    454       CALL iom_put( "TZOODOM", zw2d(:,:,11) ) 
    455       CALL iom_put( "TNH4NO3", zw2d(:,:,12) ) 
    456       CALL iom_put( "TDOMNH4", zw2d(:,:,13) ) 
    457       CALL iom_put( "TDETNH4", zw2d(:,:,14) ) 
    458       CALL iom_put( "TPHYTOT", zw2d(:,:,15) ) 
    459       CALL iom_put( "TZOOTOT", zw2d(:,:,16) ) 
    460       CALL iom_put( "TDETDOM", zw2d(:,:,17) ) 
    461 # endif 
    462 #endif 
    463  
    464 #if defined key_diatrc 
    465       ! Lateral boundary conditions  
    466 # if ! defined key_iomput 
    467       DO jl = jp_lob0_3d, jp_lob1_3d 
    468           CALL lbc_lnk( trc3d(:,:,1,jl),'T', 1. ) 
    469       END DO  
    470 # else 
    471       DO jl = 1, 3 
    472           CALL lbc_lnk( zw3d(:,:,:,jl),'T', 1. ) 
    473       END DO 
    474       ! save diagnostics 
    475       CALL iom_put( "FNO3PHY", zw3d(:,:,:,1) ) 
    476       CALL iom_put( "FNH4PHY", zw3d(:,:,:,2) ) 
    477       CALL iom_put( "FNH4NO3", zw3d(:,:,:,3) ) 
    478 # endif  
    479 #endif 
    480  
    481 #if defined key_diabio 
    482       ! Lateral boundary conditions on trcbio 
    483       DO jl = jp_lob0_trd, jp_lob1_trd 
    484           CALL lbc_lnk( trbio(:,:,1,jl),'T', 1. ) 
    485       END DO  
    486 #endif 
     329            DO jl = 1, 3 
     330               CALL lbc_lnk( zw3d(:,:,:,jl),'T', 1. ) 
     331            END DO 
     332            ! Save diagnostics 
     333            CALL iom_put( "TNO3PHY", zw2d(:,:,1) ) 
     334            CALL iom_put( "TNH4PHY", zw2d(:,:,2) ) 
     335            CALL iom_put( "TPHYDOM", zw2d(:,:,3) ) 
     336            CALL iom_put( "TPHYNH4", zw2d(:,:,4) ) 
     337            CALL iom_put( "TPHYZOO", zw2d(:,:,5) ) 
     338            CALL iom_put( "TPHYDET", zw2d(:,:,6) ) 
     339            CALL iom_put( "TDETZOO", zw2d(:,:,7) ) 
     340            CALL iom_put( "TZOODET", zw2d(:,:,8) ) 
     341            CALL iom_put( "TZOOBOD", zw2d(:,:,9) ) 
     342            CALL iom_put( "TZOONH4", zw2d(:,:,10) ) 
     343            CALL iom_put( "TZOODOM", zw2d(:,:,11) ) 
     344            CALL iom_put( "TNH4NO3", zw2d(:,:,12) ) 
     345            CALL iom_put( "TDOMNH4", zw2d(:,:,13) ) 
     346            CALL iom_put( "TDETNH4", zw2d(:,:,14) ) 
     347            CALL iom_put( "TPHYTOT", zw2d(:,:,15) ) 
     348            CALL iom_put( "TZOOTOT", zw2d(:,:,16) ) 
     349            !  
     350            CALL iom_put( "FNO3PHY", zw3d(:,:,:,1) ) 
     351            CALL iom_put( "FNH4PHY", zw3d(:,:,:,2) ) 
     352            CALL iom_put( "FNH4NO3", zw3d(:,:,:,3) ) 
     353            ! 
     354         ELSE 
     355            ! 
     356           DO jl = jp_lob0_2d, jp_lob1_2d 
     357              CALL lbc_lnk( trc2d(:,:,jl),'T', 1. ) 
     358           END DO  
     359           ! 
     360           DO jl = jp_lob0_3d, jp_lob1_3d 
     361             CALL lbc_lnk( trc3d(:,:,1,jl),'T', 1. ) 
     362           END DO  
     363           ! 
     364        ENDIF 
     365        ! 
     366      ENDIF 
     367 
     368      IF( ln_diabio .AND. .NOT. lk_iomput )  THEN 
     369         DO jl = jp_lob0_trd, jp_lob1_trd 
     370            CALL lbc_lnk( trbio(:,:,1,jl),'T', 1. ) 
     371         END DO  
     372      ENDIF 
    487373      ! 
    488374      IF( l_trdtrc ) THEN 
    489375         DO jl = jp_lob0_trd, jp_lob1_trd 
    490             CALL trd_mod_trc( ztrbio(:,:,:,jl), jl, kt )   ! handle the trend 
     376            CALL trd_mod_trc( trbio(:,:,:,jl), jl, kt )   ! handle the trend 
    491377         END DO 
    492378      ENDIF 
    493  
    494       IF( l_trdtrc ) DEALLOCATE( ztrbio ) 
    495379 
    496380      IF(ln_ctl)   THEN  ! print mean trends (used for debugging) 
     
    500384      ENDIF 
    501385      ! 
    502 #if defined key_diatrc && defined key_iomput 
    503       IF( ( wrk_not_released(3, 2) ) .OR. ( wrk_not_released(4, 1) ) )  & 
    504         &   CALL ctl_stop('trc_bio : failed to release workspace arrays.') 
    505 #endif 
     386      IF( ln_diatrc .AND. lk_iomput ) THEN 
     387         IF( ( wrk_not_released(3, 2) ) .OR. ( wrk_not_released(4, 1) ) )  & 
     388           &   CALL ctl_stop('trc_bio : failed to release workspace arrays.') 
     389      ENDIF 
    506390      ! 
    507391   END SUBROUTINE trc_bio 
  • branches/2011/dev_r2787_LOCEAN3_TRA_TRP/NEMOGCM/NEMO/TOP_SRC/LOBSTER/trcexp.F90

    r2715 r2819  
    5353      !!              COLUMN BELOW THE SURFACE LAYER. 
    5454      !!--------------------------------------------------------------------- 
     55      !! 
    5556      INTEGER, INTENT( in ) ::   kt      ! ocean time-step index       
    5657      !! 
    57       INTEGER  ::   ji, jj, jk, jl, ikt 
     58      INTEGER  ::   ji, jj, jk, jl, ikt, ierr 
    5859      REAL(wp) ::   zgeolpoc, zfact, zwork, ze3t, zsedpocd 
    59       REAL(wp), DIMENSION(:,:,:), ALLOCATABLE ::   ztrbio 
     60      REAL(wp), DIMENSION(:,:,:), ALLOCATABLE ::  ztrbio 
    6061      CHARACTER (len=25) :: charout 
    6162      !!--------------------------------------------------------------------- 
     
    6768      ENDIF 
    6869 
     70      IF( l_trdtrc )  THEN 
     71         ALLOCATE( ztrbio(jpi,jpj,jpk) , STAT = ierr )   ! temporary save of trends 
     72         IF( ierr > 0 ) THEN 
     73            CALL ctl_stop( 'trc_exp: unable to allocate ztrbio array' )   ;   RETURN 
     74         ENDIF 
     75         ztrbio(:,:,:) = tra(:,:,:,jp_lob_no3) 
     76      ENDIF 
     77 
    6978      ! VERTICAL DISTRIBUTION OF NEWLY PRODUCED BIOGENIC 
    7079      ! POC IN THE WATER COLUMN 
     
    7281      ! LAYERS IS DETERMINED BY DMIN3 DEFINED IN sms_lobster.F90 
    7382      ! ---------------------------------------------------------------------- 
    74  
    75       IF( l_trdtrc )THEN 
    76          ALLOCATE( ztrbio(jpi,jpj,jpk) ) 
    77          ztrbio(:,:,:) = tra(:,:,:,jp_lob_no3) 
    78       ENDIF 
    79  
    8083      DO jk = 1, jpkm1 
    8184         DO jj = 2, jpjm1 
     
    114117  
    115118      ! Oa & Ek: diagnostics depending on jpdia2d !          left as example 
    116 #if defined key_diatrc 
    117 # if ! defined key_iomput 
    118       trc2d(:,:,jp_lob0_2d + 18) = sedpocn(:,:) 
    119 # else 
    120      CALL iom_put( "SEDPOC" , sedpocn ) 
    121 # endif 
    122 #endif 
     119      IF( ln_diatrc ) THEN 
     120         IF( lk_iomput ) THEN   ;   CALL iom_put( "SEDPOC" , sedpocn ) 
     121         ELSE                   ;   trc2d(:,:,jp_lob0_2d + 18) = sedpocn(:,:) 
     122         ENDIF 
     123      ENDIF 
    123124 
    124125       
     
    146147         jl = jp_lob0_trd + 16 
    147148         CALL trd_mod_trc( ztrbio, jl, kt )   ! handle the trend 
     149         DEALLOCATE( ztrbio )  
    148150      ENDIF 
    149  
    150       IF( l_trdtrc ) DEALLOCATE( ztrbio ) 
    151151 
    152152      IF(ln_ctl)   THEN  ! print mean trends (used for debugging) 
  • branches/2011/dev_r2787_LOCEAN3_TRA_TRP/NEMOGCM/NEMO/TOP_SRC/LOBSTER/trcnam_lobster.F90

    r2715 r2819  
    1212   !! trc_nam_lobster   : LOBSTER model namelist read 
    1313   !!---------------------------------------------------------------------- 
    14    USE oce_trc          ! Ocean variables 
    15    USE par_trc          ! TOP parameters 
    16    USE trc              ! TOP variables 
    17    USE sms_lobster      ! sms trends 
     14   USE oce_trc                                   ! Ocean variables 
     15   USE par_trc                                   ! TOP parameters 
     16   USE trc                                       ! TOP variables 
     17   USE trdmod_trc_oce , ONLY :  lk_trdmld_trc    !  tracers  trend flag 
     18   USE sms_lobster                               ! sms trends 
     19   USE iom                                       ! I/O manager 
    1820 
    1921   IMPLICIT NONE 
     
    4143      INTEGER ::   numnatl 
    4244      !! 
    43 #if defined key_diatrc && ! defined key_iomput 
    4445      INTEGER :: jl, jn 
    45       ! definition of additional diagnostic as a structure 
    46       TYPE DIAG 
    47          CHARACTER(len = 20)  :: snamedia   !: short name 
    48          CHARACTER(len = 80 ) :: lnamedia   !: long name 
    49          CHARACTER(len = 20 ) :: unitdia    !: unit 
    50       END TYPE DIAG 
    51  
    52       TYPE(DIAG) , DIMENSION(jp_lobster_2d) :: lobdia2d 
    53       TYPE(DIAG) , DIMENSION(jp_lobster_3d) :: lobdia3d 
    54 #endif 
    55 #if defined key_diabio || defined key_trdmld_trc 
    56       INTEGER :: js, jd 
    57       ! definition of additional diagnostic as a structure 
    58       TYPE DIABIO 
    59          CHARACTER(len = 20)  :: snamebio   !: short name 
    60          CHARACTER(len = 80 ) :: lnamebio   !: long name 
    61          CHARACTER(len = 20 ) :: unitbio    !: unit 
    62       END TYPE DIABIO 
    63  
    64       TYPE(DIABIO) , DIMENSION(jp_lobster_trd) :: lobdiabio 
    65 #endif 
     46      TYPE(DIAG), DIMENSION(jp_lobster_2d )  :: lobdia2d 
     47      TYPE(DIAG), DIMENSION(jp_lobster_3d )  :: lobdia3d 
     48      TYPE(DIAG), DIMENSION(jp_lobster_trd)  :: lobdiabio 
    6649 
    6750      NAMELIST/namlobphy/ apmin, tmumax, rgamma, fphylab, tmmaxp, tmminp, & 
     
    7760 
    7861      NAMELIST/namlobopt/ xkg0, xkr0, xkgp, xkrp, xlg, xlr, rpig 
    79 #if defined key_diatrc && ! defined key_iomput 
    80       NAMELIST/namlobdia/nn_writedia, lobdia3d, lobdia2d     ! additional diagnostics 
    81 #endif 
    82 #if defined key_diabio || defined key_trdmld_trc 
    83       NAMELIST/namlobdbi/nwritebio, lobdiabio 
    84 #endif 
     62      NAMELIST/namlobdia/ lobdia3d, lobdia2d     ! additional diagnostics 
     63      NAMELIST/namlobdbi/ lobdiabio 
    8564      !!---------------------------------------------------------------------- 
    8665 
     
    278257      ENDIF 
    279258 
    280 #if defined key_diatrc && ! defined key_iomput 
    281  
    282       ! Namelist namlobdia 
    283       ! ------------------- 
    284       nn_writedia = 10                   ! default values 
    285  
    286       DO jl = 1, jp_lobster_2d 
    287          jn = jp_lob0_2d + jl - 1 
    288          WRITE(ctrc2d(jn),'("2D_",I1)') jn                      ! short name 
    289          WRITE(ctrc2l(jn),'("2D DIAGNOSTIC NUMBER ",I2)') jn    ! long name 
    290          ctrc2u(jn) = ' '                                       ! units 
    291       END DO 
    292       !                                 ! 3D output arrays 
    293       DO jl = 1, jp_lobster_3d 
    294          jn = jp_lob0_3d + jl - 1 
    295          WRITE(ctrc3d(jn),'("3D_",I1)') jn                      ! short name 
    296          WRITE(ctrc3l(jn),'("3D DIAGNOSTIC NUMBER ",I2)') jn    ! long name 
    297          ctrc3u(jn) = ' '                                       ! units 
    298       END DO 
    299  
    300       REWIND( numnatl )               ! read natrtd 
    301       READ  ( numnatl, namlobdia ) 
    302  
    303       DO jl = 1, jp_lobster_2d 
    304          jn = jp_lob0_2d + jl - 1 
    305          ctrc2d(jn) = lobdia2d(jl)%snamedia 
    306          ctrc2l(jn) = lobdia2d(jl)%lnamedia 
    307          ctrc2u(jn) = lobdia2d(jl)%unitdia 
    308       END DO 
    309  
    310       DO jl = 1, jp_lobster_3d 
    311          jn = jp_lob0_3d + jl - 1 
    312          ctrc3d(jn) = lobdia3d(jl)%snamedia 
    313          ctrc3l(jn) = lobdia3d(jl)%lnamedia 
    314          ctrc3u(jn) = lobdia3d(jl)%unitdia 
    315       END DO 
    316  
    317       IF(lwp) THEN                   ! control print 
    318          WRITE(numout,*) 
    319          WRITE(numout,*) ' Namelist : natadd' 
    320          WRITE(numout,*) '    frequency of outputs for additional arrays nn_writedia = ', nn_writedia 
     259      ! 
     260      IF( .NOT.lk_iomput .AND. ln_diatrc ) THEN 
     261         ! 
     262         ! Namelist namlobdia 
     263         ! ------------------- 
     264         DO jl = 1, jp_lobster_2d 
     265            WRITE(lobdia2d(jl)%sname,'("2D_",I1)') jl                      ! short name 
     266            WRITE(lobdia2d(jl)%lname,'("2D DIAGNOSTIC NUMBER ",I2)') jl    ! long name 
     267            lobdia2d(jl)%units = ' '                                        ! units 
     268         END DO 
     269         !                                 ! 3D output arrays 
     270         DO jl = 1, jp_lobster_3d 
     271            WRITE(lobdia3d(jl)%sname,'("3D_",I1)') jl                      ! short name 
     272            WRITE(lobdia3d(jl)%lname,'("3D DIAGNOSTIC NUMBER ",I2)') jl    ! long name 
     273            lobdia3d(jl)%units = ' '                                        ! units 
     274         END DO 
     275 
     276         REWIND( numnatl )               ! read natrtd 
     277         READ  ( numnatl, namlobdia ) 
     278 
     279         DO jl = 1, jp_lobster_2d 
     280            jn = jp_lob0_2d + jl - 1 
     281            ctrc2d(jn) = lobdia2d(jl)%sname 
     282            ctrc2l(jn) = lobdia2d(jl)%lname 
     283            ctrc2u(jn) = lobdia2d(jl)%units 
     284         END DO 
     285 
    321286         DO jl = 1, jp_lobster_3d 
    322287            jn = jp_lob0_3d + jl - 1 
    323             WRITE(numout,*) '   3d output field No : ',jn 
    324             WRITE(numout,*) '   short name         : ', TRIM(ctrc3d(jn)) 
    325             WRITE(numout,*) '   long name          : ', TRIM(ctrc3l(jn)) 
    326             WRITE(numout,*) '   unit               : ', TRIM(ctrc3u(jn)) 
     288            ctrc3d(jn) = lobdia3d(jl)%sname 
     289            ctrc3l(jn) = lobdia3d(jl)%lname 
     290            ctrc3u(jn) = lobdia3d(jl)%units 
     291         END DO 
     292 
     293         IF(lwp) THEN                   ! control print 
     294            WRITE(numout,*) 
     295            WRITE(numout,*) ' Namelist : natadd' 
     296            DO jl = 1, jp_lobster_3d 
     297               jn = jp_lob0_3d + jl - 1 
     298               WRITE(numout,*) '  3d diag nb : ', jn, '    short name : ', ctrc3d(jn), & 
     299                 &             '  long name  : ', ctrc3l(jn), '   unit : ', ctrc3u(jn) 
     300            END DO 
    327301            WRITE(numout,*) ' ' 
    328          END DO 
    329  
    330          DO jl = 1, jp_lobster_2d 
    331             jn = jp_lob0_2d + jl - 1 
    332             WRITE(numout,*) '   2d output field No : ',jn 
    333             WRITE(numout,*) '   short name         : ', TRIM(ctrc2d(jn)) 
    334             WRITE(numout,*) '   long name          : ', TRIM(ctrc2l(jn)) 
    335             WRITE(numout,*) '   unit               : ', TRIM(ctrc2u(jn)) 
     302 
     303            DO jl = 1, jp_lobster_2d 
     304               jn = jp_lob0_2d + jl - 1 
     305               WRITE(numout,*) '  2d diag nb : ', jn, '    short name : ', ctrc2d(jn), & 
     306                 &             '  long name  : ', ctrc2l(jn), '   unit : ', ctrc2u(jn) 
     307            END DO 
    336308            WRITE(numout,*) ' ' 
    337          END DO 
    338       ENDIF 
    339 #endif 
    340  
    341 #if defined key_diabio || defined key_trdmld_trc 
    342       ! namlobdbi : bio diagnostics 
    343       nwritebio = 10                     ! default values 
    344  
    345       DO js = 1, jp_lobster_trd 
    346          jd = jp_lob0_trd + js - 1 
    347          IF(     jd <  10 ) THEN   ;   WRITE (ctrbio(jd),'("BIO_",I1)') jd      ! short name 
    348          ELSEIF (jd < 100 ) THEN   ;   WRITE (ctrbio(jd),'("BIO_",I2)') jd    
    349          ELSE                      ;   WRITE (ctrbio(jd),'("BIO_",I3)') jd 
    350309         ENDIF 
    351          WRITE(ctrbil(jd),'("BIOLOGICAL TREND NUMBER ",I2)') jd                 ! long name 
    352          ctrbiu(jd) = 'mmoleN/m3/s '                                            ! units 
    353       END DO 
    354  
    355       REWIND( numnatl ) 
    356       READ  ( numnatl, namlobdbi )  
     310         ! 
     311      ENDIF 
     312 
     313      IF( ( .NOT.lk_iomput .AND. ln_diabio ) .OR. lk_trdmld_trc ) THEN 
     314         ! 
     315         ! Namelist namlobdbi 
     316         ! ------------------- 
     317         DO jl = 1, jp_lobster_trd 
     318            IF(     jl <  10 ) THEN   ;   WRITE (lobdiabio(jl)%sname,'("BIO_",I1)') jl      ! short name 
     319            ELSEIF (jl < 100 ) THEN   ;   WRITE (lobdiabio(jl)%sname,'("BIO_",I2)') jl   
     320            ELSE                      ;   WRITE (lobdiabio(jl)%sname,'("BIO_",I3)') jl 
     321            ENDIF 
     322            WRITE(lobdiabio(jl)%lname,'("BIOLOGICAL TREND NUMBER ",I2)') jl                 ! long name 
     323            lobdiabio(jl)%units = 'mmoleN/m3/s '                                            ! units 
     324         END DO 
     325 
     326         REWIND( numnatl ) 
     327         READ  ( numnatl, namlobdbi )  
    357328  
    358       DO js = 1, jp_lobster_trd 
    359          jd = jp_lob0_trd + js - 1 
    360          ctrbio(jd) = lobdiabio(js)%snamebio 
    361          ctrbil(jd) = lobdiabio(js)%lnamebio 
    362          ctrbiu(jd) = lobdiabio(js)%unitbio 
    363       END DO 
    364  
    365       IF(lwp) THEN                   ! control print 
    366          WRITE(numout,*) 
    367          WRITE(numout,*) ' Namelist : namlobdbi' 
    368          WRITE(numout,*) '    frequency of outputs for biological trends nwritebio = ', nwritebio 
    369          DO js = 1, jp_lobster_trd 
    370             jd = jp_lob0_trd + js - 1 
    371             WRITE(numout,*) '   biological trend No : ',jd 
    372             WRITE(numout,*) '   short name         : ', TRIM(ctrbio(jd)) 
    373             WRITE(numout,*) '   long name          : ', TRIM(ctrbil(jd)) 
    374             WRITE(numout,*) '   unit               : ', TRIM(ctrbiu(jd)) 
     329         DO jl = 1, jp_lobster_trd 
     330            jn = jp_lob0_trd + jl - 1 
     331            ctrbio(jl) = lobdiabio(jl)%sname 
     332            ctrbil(jl) = lobdiabio(jl)%lname 
     333            ctrbiu(jl) = lobdiabio(jl)%units 
     334         END DO 
     335 
     336         IF(lwp) THEN                   ! control print 
     337            WRITE(numout,*) 
     338            WRITE(numout,*) ' Namelist : namlobdbi' 
     339            DO jl = 1, jp_lobster_trd 
     340               jn = jp_lob0_trd + jl - 1 
     341               WRITE(numout,*) '  biological trend No : ', jn, '    short name : ', ctrbio(jn), & 
     342                 &             '  long name  : ', ctrbio(jn), '   unit : ', ctrbio(jn) 
     343            END DO 
    375344            WRITE(numout,*) ' ' 
    376          END DO 
     345         END IF 
     346         ! 
    377347      END IF 
    378 #endif 
    379348      ! 
    380349   END SUBROUTINE trc_nam_lobster 
  • branches/2011/dev_r2787_LOCEAN3_TRA_TRP/NEMOGCM/NEMO/TOP_SRC/LOBSTER/trcsed.F90

    r2715 r2819  
    5757      !!--------------------------------------------------------------------- 
    5858      USE wrk_nemo, ONLY: wrk_in_use, wrk_not_released 
    59       USE wrk_nemo, ONLY: zwork => wrk_3d_2 
    60       USE wrk_nemo, ONLY: zw2d  => wrk_2d_1 ! only used (if defined  
    61                                             ! key_diatrc && defined key_iomput) 
     59      USE wrk_nemo, ONLY: zw2d  => wrk_2d_1, zwork => wrk_3d_2 
    6260      !! 
    6361      INTEGER, INTENT( in ) ::   kt      ! ocean time-step index       
    6462      !! 
    65       INTEGER  ::   ji, jj, jk, jl 
    66       REAL(wp) ::   ztra 
    67       REAL(wp), DIMENSION(:,:,:), ALLOCATABLE ::   ztrbio 
     63      INTEGER  ::   ji, jj, jk, jl, ierr 
     64      REAL(wp) ::   ztra, ze3t 
     65      REAL(wp), DIMENSION(:,:,:), ALLOCATABLE ::  ztrbio 
    6866      CHARACTER (len=25) :: charout 
    6967      !!--------------------------------------------------------------------- 
    70  
    71       IF( ( wrk_in_use(3,2)) .OR. ( wrk_in_use(2,1)) ) THEN 
    72          CALL ctl_stop('trc_sed : requested workspace arrays unavailable.') 
    73          RETURN 
    74       END IF 
    7568 
    7669      IF( kt == nit000 ) THEN 
     
    8073      ENDIF 
    8174 
     75      IF( wrk_in_use(2, 1) .OR. wrk_in_use(3, 2) ) THEN 
     76         CALL ctl_stop('trc_sed : requested workspace arrays unavailable.')  ;  RETURN 
     77      END IF 
     78 
     79      IF( l_trdtrc )  THEN 
     80         ALLOCATE( ztrbio(jpi,jpj,jpk) , STAT = ierr )   ! temporary save of trends 
     81         IF( ierr > 0 ) THEN 
     82            CALL ctl_stop( 'trc_sed: unable to allocate ztrbio array' )   ;   RETURN 
     83         ENDIF 
     84         ztrbio(:,:,:) = tra(:,:,:,jp_lob_det) 
     85      ENDIF 
     86 
     87      IF( ln_diatrc .AND. lk_iomput )  zw2d(:,:) = 0. 
     88 
    8289      ! sedimentation of detritus  : upstream scheme 
    8390      ! -------------------------------------------- 
     
    8693      zwork(:,:,1  ) = 0.e0      ! surface value set to zero 
    8794      zwork(:,:,jpk) = 0.e0      ! bottom value  set to zero 
    88  
    89 #if defined key_diatrc && defined key_iomput 
    90       zw2d(:,:) = 0. 
    91 # endif 
    92  
    93       IF( l_trdtrc )THEN 
    94          ALLOCATE( ztrbio(jpi,jpj,jpk) ) 
    95          ztrbio(:,:,:) = tra(:,:,:,jp_lob_det) 
    96       ENDIF 
    9795 
    9896      ! tracer flux at w-point: we use -vsed (downward flux)  with simplification : no e1*e2 
     
    104102      DO jk = 1, jpkm1 
    105103         DO jj = 1, jpj 
    106             DO ji = 1,jpi 
     104            DO ji = 1, jpi 
    107105               ztra  = - ( zwork(ji,jj,jk) - zwork(ji,jj,jk+1) ) / fse3t(ji,jj,jk) 
    108106               tra(ji,jj,jk,jp_lob_det) = tra(ji,jj,jk,jp_lob_det) + ztra 
    109 #if defined key_diabio 
    110                trbio(ji,jj,jk,jp_lob0_trd + 7) = ztra 
    111 #endif 
    112 #if defined key_diatrc 
    113 # if ! defined key_iomput 
    114                trc2d(ji,jj,jp_lob0_2d + 7) = trc2d(ji,jj,jp_lob0_2d + 7) + ztra * fse3t(ji,jj,jk) * 86400. 
    115 # else 
    116                zw2d(ji,jj) = zw2d(ji,jj) + ztra * fse3t(ji,jj,jk) * 86400. 
    117 # endif 
    118 #endif 
     107               ! 
     108               IF( ln_diabio )  trbio(ji,jj,jk,jp_lob0_trd + 7) = ztra 
     109               IF( ln_diatrc ) THEN 
     110                  ze3t = ztra * fse3t(ji,jj,jk) * 86400. 
     111                  IF( lk_iomput ) THEN   ;  zw2d(ji,jj) = zw2d(ji,jj) + ze3t  
     112                  ELSE                   ;  trc2d(ji,jj,jp_lob0_2d + 7) = trc2d(ji,jj,jp_lob0_2d + 7) + ze3t 
     113                  ENDIF 
     114               ENDIF 
     115               ! 
    119116            END DO 
    120117         END DO 
    121118      END DO 
    122119 
    123 #if defined key_diabio 
    124       jl = jp_lob0_trd + 7 
    125       CALL lbc_lnk (trbio(:,:,1,jl), 'T', 1. )    ! Lateral boundary conditions on trcbio 
    126 #endif 
    127 #if defined key_diatrc 
    128 # if ! defined key_iomput 
    129       jl = jp_lob0_2d + 7 
    130       CALL lbc_lnk( trc2d(:,:,jl), 'T', 1. )      ! Lateral boundary conditions on trc2d 
    131 # else 
    132       CALL lbc_lnk( zw2d(:,:), 'T', 1. )      ! Lateral boundary conditions on zw2d 
    133       CALL iom_put( "TDETSED", zw2d ) 
    134 # endif 
    135 #endif 
    136       ! 
     120      IF( ln_diatrc .AND. lk_iomput )  CALL iom_put( "TDETSED", zw2d ) 
    137121 
    138122      IF( l_trdtrc ) THEN 
     
    140124         jl = jp_lob0_trd + 7 
    141125         CALL trd_mod_trc( ztrbio, jl, kt )   ! handle the trend 
     126         DEALLOCATE( ztrbio )  
    142127      ENDIF 
    143  
    144       IF( l_trdtrc ) DEALLOCATE( ztrbio ) 
    145128 
    146129      IF(ln_ctl)   THEN  ! print mean trends (used for debugging) 
     
    150133      ENDIF 
    151134 
    152       IF( ( wrk_not_released(3, 2) ) .OR. ( wrk_not_released(2, 1) ) )  & 
     135      IF( ( wrk_not_released(2, 1) ) .OR. ( wrk_not_released(3, 2) ) )  & 
    153136       &         CALL ctl_stop('trc_sed : failed to release workspace arrays.') 
    154137 
  • branches/2011/dev_r2787_LOCEAN3_TRA_TRP/NEMOGCM/NEMO/TOP_SRC/LOBSTER/trcsms_lobster.F90

    r2715 r2819  
    4545      !! ** Method  : - ??? 
    4646      !! -------------------------------------------------------------------- 
    47       USE wrk_nemo, ONLY: wrk_in_use, wrk_not_released 
    48       USE wrk_nemo, ONLY: ztrlob => wrk_3d_1   ! used for lobster sms trends 
    4947      !! 
    5048      INTEGER, INTENT( in ) ::   kt      ! ocean time-step index       
     49      ! 
    5150      INTEGER :: jn 
    5251      !! -------------------------------------------------------------------- 
    53  
    54       IF( wrk_in_use(3, 1) ) THEN 
    55          CALL ctl_stop('trc_sms_lobster : requested workspace array unavailable')   ;   RETURN 
    56       ENDIF 
    5752 
    5853      CALL trc_opt( kt )      ! optical model 
     
    6257 
    6358      IF( l_trdtrc ) THEN 
    64           DO jn = jp_lob0, jp_lob1 
    65             ztrlob(:,:,:) = tra(:,:,:,jn) 
    66             CALL trd_mod_trc( ztrlob, jn, jptra_trd_sms, kt )   ! save trends 
    67           END DO 
     59         DO jn = jp_lob0, jp_lob1 
     60           CALL trd_mod_trc( tra(:,:,:,jn), jn, jptra_trd_sms, kt )   ! save trends 
     61         END DO 
    6862      END IF 
    6963 
    7064      IF( lk_trdmld_trc )  CALL trd_mld_bio( kt )   ! trends: Mixed-layer 
    71  
    72       IF( wrk_not_released(3, 1) )   CALL ctl_stop('trc_sms_lobster : failed to release workspace array.') 
    7365      ! 
    7466   END SUBROUTINE trc_sms_lobster 
  • branches/2011/dev_r2787_LOCEAN3_TRA_TRP/NEMOGCM/NEMO/TOP_SRC/PISCES/p4zbio.F90

    r2715 r2819  
    1414   !!                      compartments of PISCES 
    1515   !!---------------------------------------------------------------------- 
    16    USE oce_trc         ! 
    17    USE trc         !  
    18    USE sms_pisces      !  
    19    USE p4zsink         !  
    20    USE p4zopt          !  
    21    USE p4zlim          !  
    22    USE p4zprod         ! 
    23    USE p4zmort         ! 
    24    USE p4zmicro        !  
    25    USE p4zmeso         !  
    26    USE p4zrem          !  
    27    USE prtctl_trc 
    28    USE iom 
     16   USE oce_trc         !  shared variables between ocean and passive tracers 
     17   USE trc             !  passive tracers common variables  
     18   USE sms_pisces      !  PISCES Source Minus Sink variables 
     19   USE p4zsink         !  vertical flux of particulate matter due to sinking 
     20   USE p4zopt          !  optical model 
     21   USE p4zlim          !  Co-limitations of differents nutrients 
     22   USE p4zprod         !  Growth rate of the 2 phyto groups 
     23   USE p4zmort         !  Mortality terms for phytoplankton 
     24   USE p4zmicro        !  Sources and sinks of microzooplankton 
     25   USE p4zmeso         !  Sources and sinks of mesozooplankton 
     26   USE p4zrem          !  Remineralisation of organic matter 
     27   USE prtctl_trc      !  print control for debugging 
     28   USE iom             !  I/O manager 
    2929   
    3030   IMPLICIT NONE 
  • branches/2011/dev_r2787_LOCEAN3_TRA_TRP/NEMOGCM/NEMO/TOP_SRC/PISCES/p4zche.F90

    r2715 r2819  
    1717   !!   p4z_che      :  Sea water chemistry computed following OCMIP protocol 
    1818   !!---------------------------------------------------------------------- 
    19    USE oce_trc       ! 
    20    USE trc           ! 
    21    USE sms_pisces    !  
    22    USE lib_mpp       ! MPP library 
     19   USE oce_trc       !  shared variables between ocean and passive tracers 
     20   USE trc           !  passive tracers common variables 
     21   USE sms_pisces    !  PISCES Source Minus Sink variables 
     22   USE lib_mpp       !  MPP library 
    2323 
    2424   IMPLICIT NONE 
  • branches/2011/dev_r2787_LOCEAN3_TRA_TRP/NEMOGCM/NEMO/TOP_SRC/PISCES/p4zflx.F90

    r2715 r2819  
    1717   !!   p4z_flx_init  :   Read the namelist 
    1818   !!---------------------------------------------------------------------- 
    19    USE trc 
    20    USE oce_trc         ! 
    21    USE trc 
    22    USE sms_pisces 
    23    USE prtctl_trc 
    24    USE p4zche 
    25    USE iom 
     19   USE oce_trc                      !  shared variables between ocean and passive tracers  
     20   USE trc                          !  passive tracers common variables 
     21   USE sms_pisces                   !  PISCES Source Minus Sink variables 
     22   USE p4zche                       !  Chemical model 
     23   USE prtctl_trc                   !  print control for debugging 
     24   USE iom                          !  I/O manager 
    2625#if defined key_cpl_carbon_cycle 
    27    USE sbc_oce , ONLY :  atm_co2 
     26   USE sbc_oce, ONLY :  atm_co2     !  atmospheric pCO2                
    2827#endif 
    2928 
     
    137136            ! Compute the piston velocity for O2 and CO2 
    138137            zkgwan = 0.3 * zws  + 2.5 * ( 0.5246 + 0.016256 * ztc + 0.00049946  * ztc2 ) 
     138            zkgwan = zkgwan * xconv * ( 1.- fr_i(ji,jj) ) * tmask(ji,jj,1) 
    139139# if defined key_degrad 
    140             zkgwan = zkgwan * xconv * ( 1.- fr_i(ji,jj) ) * tmask(ji,jj,1) * facvol(ji,jj,1) 
    141 #else 
    142             zkgwan = zkgwan * xconv * ( 1.- fr_i(ji,jj) ) * tmask(ji,jj,1) 
     140            zkgwan = zkgwan * facvol(ji,jj,1) 
    143141#endif  
    144142            ! compute gas exchange for CO2 and O2 
     
    161159            zflu16 = trn(ji,jj,1,jpoxy) * tmask(ji,jj,1) * zkgo2(ji,jj) 
    162160            tra(ji,jj,1,jpoxy) = tra(ji,jj,1,jpoxy) + ( zfld16 - zflu16 ) / fse3t(ji,jj,1) 
    163  
    164 #if defined key_diatrc  
    165             ! Save diagnostics 
    166 #  if ! defined key_iomput 
     161#if defined key_iomput 
     162            zoflx(ji,jj) = ( zfld16 - zflu16 ) * 1000. * tmask(ji,jj,1) 
     163            zkg  (ji,jj) = zkgco2(ji,jj) * tmask(ji,jj,1) 
     164            zdpco2(ji,jj) = ( satmco2(ji,jj) - zh2co3(ji,jj) / ( chemc(ji,jj,1) + rtrn ) ) * tmask(ji,jj,1) 
     165            zdpo2 (ji,jj) = ( atcox  - trn(ji,jj,1,jpoxy)    / ( chemc(ji,jj,2) + rtrn ) ) * tmask(ji,jj,1) 
     166# else 
    167167            zfact = 1. / e1e2t(ji,jj) / rfact 
    168168            trc2d(ji,jj,jp_pcs0_2d    ) = oce_co2(ji,jj) * zfact 
    169169            trc2d(ji,jj,jp_pcs0_2d + 1) = ( zfld16 - zflu16 ) * 1000. * tmask(ji,jj,1) 
    170170            trc2d(ji,jj,jp_pcs0_2d + 2) = zkgco2(ji,jj) * tmask(ji,jj,1) 
    171             trc2d(ji,jj,jp_pcs0_2d + 3) = ( satmco2(ji,jj) - zh2co3(ji,jj) / ( chemc(ji,jj,1) + rtrn ) ) & 
    172                &                            * tmask(ji,jj,1) 
    173 #  else 
    174             zoflx(ji,jj) = ( zfld16 - zflu16 ) * 1000. * tmask(ji,jj,1) 
    175             zkg  (ji,jj) = zkgco2(ji,jj) * tmask(ji,jj,1) 
    176             zdpco2(ji,jj) = ( satmco2(ji,jj) - zh2co3(ji,jj) / ( chemc(ji,jj,1) + rtrn ) ) * tmask(ji,jj,1) 
    177             zdpo2 (ji,jj) = ( atcox  - trn(ji,jj,1,jpoxy) / ( chemc(ji,jj,2) + rtrn ) ) * tmask(ji,jj,1) 
    178 #  endif 
    179 #endif 
     171            trc2d(ji,jj,jp_pcs0_2d + 3) = ( satmco2(ji,jj) - zh2co3(ji,jj) / ( chemc(ji,jj,1) + rtrn ) ) * tmask(ji,jj,1) 
     172# endif 
    180173         END DO 
    181174      END DO 
    182175 
    183       t_oce_co2_flx = t_oce_co2_flx + glob_sum( oce_co2(:,:) )                     ! Cumulative Total Flux of Carbon 
     176      t_oce_co2_flx = t_oce_co2_flx + glob_sum( oce_co2(:,:) )            ! Cumulative Total Flux of Carbon 
    184177      IF( kt == nitend ) THEN 
    185178         t_atm_co2_flx = glob_sum( satmco2(:,:) * e1e2t(:,:) )            ! Total atmospheric pCO2 
    186179         ! 
    187          t_oce_co2_flx = (-1.) * t_oce_co2_flx  * 12. / 1.e15                      ! Conversion in PgC ; negative for out of the ocean 
    188          t_atm_co2_flx = t_atm_co2_flx  / area                                     ! global mean of atmospheric pCO2 
     180         t_oce_co2_flx = (-1.) * t_oce_co2_flx  * 12. / 1.e15             ! Conversion in PgC ; negative for out of the ocean 
     181         t_atm_co2_flx = t_atm_co2_flx  / area                            ! global mean of atmospheric pCO2 
    189182         ! 
    190183         IF( lwp) THEN 
     
    205198      ENDIF 
    206199 
    207 # if defined key_diatrc && defined key_iomput 
    208       CALL iom_put( "Cflx" , oce_co2(:,:) / e1e2t(:,:) / rfact )  
    209       CALL iom_put( "Oflx" , zoflx  ) 
    210       CALL iom_put( "Kg"   , zkg    ) 
    211       CALL iom_put( "Dpco2", zdpco2 ) 
    212       CALL iom_put( "Dpo2" , zdpo2  ) 
    213 #endif 
     200      IF( ln_diatrc ) THEN 
     201         CALL iom_put( "Cflx" , oce_co2(:,:) / e1e2t(:,:) / rfact )  
     202         CALL iom_put( "Oflx" , zoflx  ) 
     203         CALL iom_put( "Kg"   , zkg    ) 
     204         CALL iom_put( "Dpco2", zdpco2 ) 
     205         CALL iom_put( "Dpo2" , zdpo2  ) 
     206      ENDIF 
    214207      ! 
    215208      IF( wrk_not_released(2, 1,2,3,4,5,6,7) )   CALL ctl_stop('p4z_flx: failed to release workspace arrays') 
     
    231224      !!---------------------------------------------------------------------- 
    232225      ! 
    233       REWIND( numnat )                     ! read numnat 
    234       READ  ( numnat, nampisext ) 
     226      REWIND( numnatp )                     ! read numnatp 
     227      READ  ( numnatp, nampisext ) 
    235228      ! 
    236229      IF(lwp) THEN                         ! control print 
  • branches/2011/dev_r2787_LOCEAN3_TRA_TRP/NEMOGCM/NEMO/TOP_SRC/PISCES/p4zint.F90

    r2715 r2819  
    1313   !!   p4z_int        :  interpolation and computation of various accessory fields 
    1414   !!---------------------------------------------------------------------- 
    15    USE oce_trc         ! 
    16    USE trc 
    17    USE sms_pisces 
     15   USE oce_trc         !  shared variables between ocean and passive tracers 
     16   USE trc             !  passive tracers common variables  
     17   USE sms_pisces      !  PISCES Source Minus Sink variables 
    1818 
    1919   IMPLICIT NONE 
     
    2121 
    2222   PUBLIC   p4z_int   
    23    PUBLIC   p4z_int_alloc 
    24  
    25    REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::   tgfunc    !: Temp. dependancy of various biological rates 
    26    REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::   tgfunc2   !: Temp. dependancy of mesozooplankton rates 
    27  
    2823   REAL(wp) ::   xksilim = 16.5e-6_wp   ! Half-saturation constant for the Si half-saturation constant computation 
    2924 
     
    4136      !! ** Purpose :   interpolation and computation of various accessory fields 
    4237      !! 
    43       !! ** Method  : - ??? 
    4438      !!--------------------------------------------------------------------- 
    45       INTEGER  ::   ji, jj 
    46       REAL(wp) ::   zdum 
     39      INTEGER  ::   ji, jj                 ! dummy loop indices 
     40      REAL(wp) ::   zvar                   ! local variable 
    4741      !!--------------------------------------------------------------------- 
    4842 
     
    5751      DO ji = 1, jpi 
    5852         DO jj = 1, jpj 
    59             zdum = trn(ji,jj,1,jpsil) * trn(ji,jj,1,jpsil) 
    60             xksimax(ji,jj) = MAX( xksimax(ji,jj), ( 1.+ 7.* zdum / ( xksilim * xksilim + zdum ) ) * 1e-6 ) 
     53            zvar = trn(ji,jj,1,jpsil) * trn(ji,jj,1,jpsil) 
     54            xksimax(ji,jj) = MAX( xksimax(ji,jj), ( 1.+ 7.* zvar / ( xksilim * xksilim + zvar ) ) * 1e-6 ) 
    6155         END DO 
    6256      END DO 
     
    6862      ! 
    6963   END SUBROUTINE p4z_int 
    70  
    71  
    72    INTEGER FUNCTION p4z_int_alloc() 
    73       !!---------------------------------------------------------------------- 
    74       !!                     ***  ROUTINE p4z_int_alloc  *** 
    75       !!---------------------------------------------------------------------- 
    76       ALLOCATE( tgfunc(jpi,jpj,jpk), tgfunc2(jpi,jpj,jpk), STAT=p4z_int_alloc ) 
    77       ! 
    78       IF( p4z_int_alloc /= 0 )   CALL ctl_warn('p4z_int_alloc : failed to allocate arrays.') 
    79       ! 
    80    END FUNCTION p4z_int_alloc 
    8164 
    8265#else 
  • branches/2011/dev_r2787_LOCEAN3_TRA_TRP/NEMOGCM/NEMO/TOP_SRC/PISCES/p4zlim.F90

    r2528 r2819  
    1414   !!   p4z_lim_init   :   Read the namelist  
    1515   !!---------------------------------------------------------------------- 
    16    USE trc 
    17    USE oce_trc         ! 
    18    USE trc         !  
    19    USE sms_pisces      !  
     16   USE oce_trc         !  shared variables between ocean and passive tracers 
     17   USE trc             !  passive tracers common variables  
     18   USE sms_pisces      !  PISCES Source Minus Sink variables 
    2019 
    2120   IMPLICIT NONE 
     
    184183         &             concnnh4, concdnh4, xksi1, xksi2, xkdoc, caco3r 
    185184 
    186       REWIND( numnat )                     ! read numnat 
    187       READ  ( numnat, nampislim ) 
     185      REWIND( numnatp )                     ! read numnat 
     186      READ  ( numnatp, nampislim ) 
    188187 
    189188      IF(lwp) THEN                         ! control print 
  • branches/2011/dev_r2787_LOCEAN3_TRA_TRP/NEMOGCM/NEMO/TOP_SRC/PISCES/p4zlys.F90

    r2715 r2819  
    1717   !!   p4z_lys_init   :   Read the namelist parameters 
    1818   !!---------------------------------------------------------------------- 
    19    USE trc 
    20    USE oce_trc         ! 
    21    USE trc 
    22    USE sms_pisces 
    23    USE prtctl_trc 
    24    USE iom 
     19   USE oce_trc         !  shared variables between ocean and passive tracers 
     20   USE trc             !  passive tracers common variables  
     21   USE sms_pisces      !  PISCES Source Minus Sink variables 
     22   USE prtctl_trc      !  print control for debugging 
     23   USE iom             !  I/O manager 
    2524 
    2625   IMPLICIT NONE 
     
    6261      INTEGER, INTENT(in) ::   kt ! ocean time step 
    6362      INTEGER  ::   ji, jj, jk, jn 
    64       REAL(wp) ::   zbot, zalk, zdic, zph, zremco3, zah2 
     63      REAL(wp) ::   zbot, zalk, zdic, zph, zah2 
    6564      REAL(wp) ::   zdispot, zfact, zalka 
    6665      REAL(wp) ::   zomegaca, zexcess, zexcess0 
    67 #if defined key_diatrc && defined key_iomput 
    6866      REAL(wp) ::   zrfact2 
    69 #endif 
    7067      CHARACTER (len=25) :: charout 
    7168      !!--------------------------------------------------------------------- 
     
    7572      END IF 
    7673 
    77       zco3(:,:,:) = 0. 
    78 # if defined key_diatrc && defined key_iomput 
     74      zco3    (:,:,:) = 0. 
    7975      zcaldiss(:,:,:) = 0. 
    80 # endif 
    8176      !     ------------------------------------------- 
    8277      !     COMPUTE [CO3--] and [H+] CONCENTRATIONS 
     
    9186!CDIR NOVERRCHK 
    9287               DO ji = 1, jpi 
    93  
    9488                  ! SET DUMMY VARIABLE FOR TOTAL BORATE 
    95                   zbot  = borat(ji,jj,jk) 
    96  
    97                   ! SET DUMMY VARIABLE FOR TOTAL BORATE 
    98                   zbot  = borat(ji,jj,jk) 
     89                  zbot  = borat(ji,jj,jk)     
    9990                  zfact = rhop (ji,jj,jk) / 1000. + rtrn 
    100  
    10191                  ! SET DUMMY VARIABLE FOR [H+] 
    10292                  zph   = hi(ji,jj,jk) * tmask(ji,jj,jk) / zfact + ( 1.-tmask(ji,jj,jk) ) * 1.e-9 
    103  
    10493                  ! SET DUMMY VARIABLE FOR [SUM(CO2)]GIVEN  
    10594                  zdic  = trn(ji,jj,jk,jpdic) / zfact 
    10695                  zalka = trn(ji,jj,jk,jptal) / zfact 
    107  
    10896                  ! CALCULATE [ALK]([CO3--], [HCO3-]) 
    10997                  zalk  = zalka - (  akw3(ji,jj,jk) / zph - zph   & 
    11098                     &             + zbot / (1.+ zph / akb3(ji,jj,jk) )  ) 
    111  
    11299                  ! CALCULATE [H+] and [CO3--] 
    113100                  zah2 = SQRT( (zdic-zalk)*(zdic-zalk)+   & 
     
    146133               !       (ACCORDING TO THIS FORMULATION ALSO SOME PARTICULATE 
    147134               !       CACO3 GETS DISSOLVED EVEN IN THE CASE OF OVERSATURATION) 
     135               zdispot = kdca * zexcess * trn(ji,jj,jk,jpcal) 
    148136# if defined key_degrad 
    149               zdispot = kdca * zexcess * trn(ji,jj,jk,jpcal) * facvol(ji,jj,jk) 
    150 # else 
    151               zdispot = kdca * zexcess * trn(ji,jj,jk,jpcal) 
     137               zdispot = zdispot * facvol(ji,jj,jk) 
    152138# endif 
    153  
    154139              !  CHANGE OF [CO3--] , [ALK], PARTICULATE [CACO3], 
    155140              !       AND [SUM(CO2)] DUE TO CACO3 DISSOLUTION/PRECIPITATION 
    156               zremco3 = zdispot / rmtss 
    157               zco3(ji,jj,jk) = zco3(ji,jj,jk) + zremco3 * rfact 
    158               tra(ji,jj,jk,jptal) = tra(ji,jj,jk,jptal) + 2. * zremco3 
    159               tra(ji,jj,jk,jpcal) = tra(ji,jj,jk,jpcal) -      zremco3 
    160               tra(ji,jj,jk,jpdic) = tra(ji,jj,jk,jpdic) +      zremco3 
    161  
    162 # if defined key_diatrc && defined key_iomput 
    163               zcaldiss(ji,jj,jk) = zremco3  ! calcite dissolution 
    164 # endif 
     141              zcaldiss(ji,jj,jk)  = zdispot / rmtss  ! calcite dissolution 
     142              zco3(ji,jj,jk)      = zco3(ji,jj,jk) + zcaldiss(ji,jj,jk) * rfact 
     143              ! 
     144              tra(ji,jj,jk,jptal) = tra(ji,jj,jk,jptal) + 2. * zcaldiss(ji,jj,jk) 
     145              tra(ji,jj,jk,jpcal) = tra(ji,jj,jk,jpcal) -      zcaldiss(ji,jj,jk) 
     146              tra(ji,jj,jk,jpdic) = tra(ji,jj,jk,jpdic) +      zcaldiss(ji,jj,jk) 
    165147            END DO 
    166148         END DO 
    167149      END DO 
    168150 
    169 # if defined key_diatrc 
    170 #  if ! defined key_iomput 
    171       trc3d(:,:,:,jp_pcs0_3d    ) = hi  (:,:,:)          * tmask(:,:,:) 
    172       trc3d(:,:,:,jp_pcs0_3d + 1) = zco3(:,:,:)          * tmask(:,:,:) 
    173       trc3d(:,:,:,jp_pcs0_3d + 2) = aksp(:,:,:) / calcon * tmask(:,:,:) 
    174 #  else 
    175       zrfact2 = 1.e3 * rfact2r 
    176       CALL iom_put( "PH"    , hi      (:,:,:)           * tmask(:,:,:) ) 
    177       CALL iom_put( "CO3"   , zco3    (:,:,:)           * tmask(:,:,:) ) 
    178       CALL iom_put( "CO3sat", aksp    (:,:,:) / calcon  * tmask(:,:,:) ) 
    179       CALL iom_put( "DCAL"  , zcaldiss(:,:,:) * zrfact2 * tmask(:,:,:) ) 
    180 #  endif 
     151      IF( ln_diatrc )  THEN 
     152         zrfact2 = 1.e3 * rfact2r 
     153         CALL iom_put( "PH"    , hi      (:,:,:)           * tmask(:,:,:) ) 
     154         CALL iom_put( "CO3"   , zco3    (:,:,:)           * tmask(:,:,:) ) 
     155         CALL iom_put( "CO3sat", aksp    (:,:,:) / calcon  * tmask(:,:,:) ) 
     156         CALL iom_put( "DCAL"  , zcaldiss(:,:,:) * zrfact2 * tmask(:,:,:) ) 
     157# if ! defined key_iomput 
     158         trc3d(:,:,:,jp_pcs0_3d    ) = hi  (:,:,:)          * tmask(:,:,:) 
     159         trc3d(:,:,:,jp_pcs0_3d + 1) = zco3(:,:,:)          * tmask(:,:,:) 
     160         trc3d(:,:,:,jp_pcs0_3d + 2) = aksp(:,:,:) / calcon * tmask(:,:,:) 
    181161# endif 
     162      ENDIF 
    182163      ! 
    183164       IF(ln_ctl)   THEN  ! print mean trends (used for debugging) 
     
    207188      NAMELIST/nampiscal/ kdca, nca 
    208189 
    209       REWIND( numnat )                     ! read numnat 
    210       READ  ( numnat, nampiscal ) 
     190      REWIND( numnatp )                     ! read numnatp 
     191      READ  ( numnatp, nampiscal ) 
    211192 
    212193      IF(lwp) THEN                         ! control print 
  • branches/2011/dev_r2787_LOCEAN3_TRA_TRP/NEMOGCM/NEMO/TOP_SRC/PISCES/p4zmeso.F90

    r2528 r2819  
    1414   !!   p4z_meso_init  :   Initialization of the parameters for mesozooplankton 
    1515   !!---------------------------------------------------------------------- 
    16    USE trc 
    17    USE oce_trc         ! 
    18    USE trc         !  
    19    USE sms_pisces      !  
    20    USE prtctl_trc 
    21    USE p4zint 
    22    USE p4zsink 
    23    USE iom 
     16   USE oce_trc         !  shared variables between ocean and passive tracers 
     17   USE trc             !  passive tracers common variables  
     18   USE sms_pisces      !  PISCES Source Minus Sink variables 
     19   USE p4zsink         !  vertical flux of particulate matter due to sinking 
     20   USE prtctl_trc      !  print control for debugging 
     21   USE iom             !  I/O manager 
     22 
    2423 
    2524   IMPLICIT NONE 
     
    7574      REAL(wp) :: zgrazfff,zgrazffe 
    7675      CHARACTER (len=25) :: charout 
    77 #if defined key_diatrc && defined key_iomput 
    7876      REAL(wp) :: zrfact2 
    79 #endif 
    8077 
    8178      !!--------------------------------------------------------------------- 
     
    8481         DO jj = 1, jpj 
    8582            DO ji = 1, jpi 
    86  
    8783               zcompam = MAX( ( trn(ji,jj,jk,jpmes) - 1.e-9 ), 0.e0 ) 
     84               zstep   = xstep 
    8885# if defined key_degrad 
    89                zstep   = xstep * facvol(ji,jj,jk) 
    90 # else 
    91                zstep   = xstep 
    92 # endif 
    93                zfact   = zstep * tgfunc(ji,jj,jk) * zcompam 
     86               zstep = zstep * facvol(ji,jj,jk) 
     87# endif 
     88               zfact = zstep * tgfunc(ji,jj,jk) * zcompam 
    9489 
    9590               !  Respiration rates of both zooplankton 
     
    132127               zgrazffe = grazflux * zstep * wsbio4(ji,jj,jk)          & 
    133128                  &                 * tgfunc2(ji,jj,jk) * trn(ji,jj,jk,jpgoc) * trn(ji,jj,jk,jpmes) 
     129# if defined key_degrad 
     130               zgrazffe = zgrazffe  * facvol(ji,jj,jk) 
     131# endif 
    134132               zgrazfff = zgrazffe * trn(ji,jj,jk,jpbfe) / (trn(ji,jj,jk,jpgoc) + rtrn) 
    135133# else 
     
    143141               !!--------------------------- KRIEST3 ------------------------------------------- 
    144142 
    145               zgrazffe = grazflux * zstep * wsbio3(ji,jj,jk)     & 
     143               zgrazffe = grazflux * zstep * wsbio3(ji,jj,jk)     & 
    146144                  &                * tgfunc2(ji,jj,jk) * trn(ji,jj,jk,jppoc) * trn(ji,jj,jk,jpmes) 
    147               zgrazfff = zgrazffe * trn(ji,jj,jk,jpsfe) / (trn(ji,jj,jk,jppoc) + rtrn) 
     145# if defined key_degrad 
     146               zgrazffe = zgrazffe  * facvol(ji,jj,jk) 
     147# endif 
     148               zgrazfff = zgrazffe * trn(ji,jj,jk,jpsfe) / (trn(ji,jj,jk,jppoc) + rtrn) 
    148149# endif 
    149150       
    150 #if defined key_diatrc 
    151               ! Total grazing ( grazing by microzoo is already computed in p4zmicro )  
     151              ! Total grazing ( grazing by microzoo is already computed in p4zmicro ) 
    152152              grazing(ji,jj,jk) = grazing(ji,jj,jk) + (  zgrazd + zgrazz + zgrazn + zgrazpoc + zgrazffe ) 
    153 #endif 
    154153 
    155154              !    Mesozooplankton efficiency 
     
    200199 
    201200               zprcaca = xfracal(ji,jj,jk) * unass2 * zgrazn 
    202 #if defined key_diatrc 
     201               ! calcite production 
    203202               prodcal(ji,jj,jk) = prodcal(ji,jj,jk) + zprcaca  ! prodcal=prodcal(nanophy)+prodcal(microzoo)+prodcal(mesozoo) 
    204 #endif 
     203               ! 
    205204               zprcaca = part * zprcaca 
    206205               tra(ji,jj,jk,jpdic) = tra(ji,jj,jk,jpdic) - zprcaca 
     
    226225      END DO 
    227226      ! 
    228 #if defined key_diatrc && defined key_iomput 
    229       zrfact2 = 1.e3 * rfact2r 
    230       ! Total grazing of phyto by zoo 
    231       grazing(:,:,:) = grazing(:,:,:) * zrfact2 * tmask(:,:,:) 
    232       ! Calcite production 
    233       prodcal(:,:,:) = prodcal(:,:,:) * zrfact2 * tmask(:,:,:) 
    234       IF( jnt == nrdttrc ) then  
    235          CALL iom_put( "GRAZ" , grazing  )  ! Total grazing of phyto by zooplankton 
    236          CALL iom_put( "PCAL" , prodcal  )  ! Calcite production 
     227      IF( ln_diatrc ) THEN 
     228         zrfact2 = 1.e3 * rfact2r 
     229         grazing(:,:,:) = grazing(:,:,:) * zrfact2 * tmask(:,:,:)   ! Total grazing of phyto by zoo 
     230         prodcal(:,:,:) = prodcal(:,:,:) * zrfact2 * tmask(:,:,:)   ! Calcite production 
     231         IF( jnt == nrdttrc ) THEN 
     232            CALL iom_put( "GRAZ" , grazing  )  ! Total grazing of phyto by zooplankton 
     233            CALL iom_put( "PCAL" , prodcal  )  ! Calcite production 
     234         ENDIF 
    237235      ENDIF 
    238 #endif 
    239236 
    240237       IF(ln_ctl)   THEN  ! print mean trends (used for debugging) 
     
    263260         &             xprefz, xprefpoc, xkgraz2, epsher2, sigma2, unass2, grazflux 
    264261 
    265       REWIND( numnat )                     ! read numnat 
    266       READ  ( numnat, nampismes ) 
     262      REWIND( numnatp )                     ! read numnatp 
     263      READ  ( numnatp, nampismes ) 
    267264 
    268265 
  • branches/2011/dev_r2787_LOCEAN3_TRA_TRP/NEMOGCM/NEMO/TOP_SRC/PISCES/p4zmicro.F90

    r2528 r2819  
    1414   !!   p4z_micro_init  :   Initialize and read the appropriate namelist 
    1515   !!---------------------------------------------------------------------- 
    16    USE trc 
    17    USE oce_trc         ! 
    18    USE trc         !  
    19    USE sms_pisces      !  
    20    USE prtctl_trc 
    21    USE p4zint 
    22    USE p4zsink 
    23    USE iom 
     16   USE oce_trc         !  shared variables between ocean and passive tracers 
     17   USE trc             !  passive tracers common variables  
     18   USE sms_pisces      !  PISCES Source Minus Sink variables 
     19   USE p4zsink         !  vertical flux of particulate matter due to sinking 
     20   USE prtctl_trc      !  print control for debugging 
    2421 
    2522   IMPLICIT NONE 
     
    2825   PUBLIC   p4z_micro         ! called in p4zbio.F90 
    2926   PUBLIC   p4z_micro_init    ! called in trcsms_pisces.F90 
     27   PUBLIC   p4z_micro_alloc    ! called in trcsms_pisces.F90 
    3028 
    3129   !! * Shared module variables 
     
    7472      !!--------------------------------------------------------------------- 
    7573 
    76  
    77 #if defined key_diatrc 
    78       grazing(:,:,:) = 0.  !: Initialisation of  grazing 
    79 #endif 
    80  
     74      grazing(:,:,:) = 0.  !: grazing set to zero 
    8175      zstep = rfact2 / rday      ! Time step duration for biology 
    8276 
     
    8579            DO ji = 1, jpi 
    8680               zcompaz = MAX( ( trn(ji,jj,jk,jpzoo) - 1.e-9 ), 0.e0 ) 
     81               zstep   = xstep 
    8782# if defined key_degrad 
    88                zstep   = xstep * facvol(ji,jj,jk) 
    89 # else 
    90                zstep   = xstep 
     83               zstep = zstep * facvol(ji,jj,jk) 
    9184# endif 
    9285               zfact   = zstep * tgfunc(ji,jj,jk) * zcompaz 
     
    126119               zgrazmf = zgrazm  * trn(ji,jj,jk,jpsfe) / (trn(ji,jj,jk,jppoc) + rtrn) 
    127120               zgrazsf = zgrazsd * trn(ji,jj,jk,jpdfe) / (trn(ji,jj,jk,jpdia) + rtrn) 
    128 #if defined key_diatrc 
     121 
    129122               ! Grazing by microzooplankton 
    130                grazing(ji,jj,jk) = grazing(ji,jj,jk) + zgrazp + zgrazm + zgrazsd  
    131 #endif 
     123               grazing(ji,jj,jk) = grazing(ji,jj,jk) + zgrazp + zgrazm + zgrazsd 
    132124 
    133125               !    Various remineralization and excretion terms 
     
    172164               tra(ji,jj,jk,jpsfe) = tra(ji,jj,jk,jpsfe) + ferat3 * zmortz + unass * ( zgrazpf + zgrazsf ) - (1.-unass) * zgrazmf 
    173165               zprcaca = xfracal(ji,jj,jk) * unass * zgrazp 
    174 #if defined key_diatrc 
     166               ! 
    175167               prodcal(ji,jj,jk) = prodcal(ji,jj,jk) + zprcaca  ! prodcal=prodcal(nanophy)+prodcal(microzoo)+prodcal(mesozoo) 
    176 #endif 
     168               ! 
    177169               zprcaca = part * zprcaca 
    178170               tra(ji,jj,jk,jpdic) = tra(ji,jj,jk,jpdic) - zprcaca 
     
    212204         &             xpref2d, xkgraz, epsher, sigma1, unass 
    213205 
    214       REWIND( numnat )                     ! read numnat 
    215       READ  ( numnat, nampiszoo ) 
     206      REWIND( numnatp )                     ! read numnatp 
     207      READ  ( numnatp, nampiszoo ) 
    216208 
    217209      IF(lwp) THEN                         ! control print 
     
    233225   END SUBROUTINE p4z_micro_init 
    234226 
     227   INTEGER FUNCTION p4z_micro_alloc() 
     228      !!---------------------------------------------------------------------- 
     229      !!                     ***  ROUTINE p4z_micro_alloc  *** 
     230      !!---------------------------------------------------------------------- 
     231      ALLOCATE( grazing(jpi,jpj,jpk), STAT=p4z_micro_alloc ) 
     232      IF( p4z_micro_alloc /= 0 ) CALL ctl_warn('p4z_micro_alloc : failed to allocate arrays.') 
     233 
     234   END FUNCTION p4z_micro_alloc 
     235 
    235236#else 
    236237   !!====================================================================== 
  • branches/2011/dev_r2787_LOCEAN3_TRA_TRP/NEMOGCM/NEMO/TOP_SRC/PISCES/p4zmort.F90

    r2528 r2819  
    1414   !!   p4z_mort_init  :   Initialize the mortality params for phytoplankton 
    1515   !!---------------------------------------------------------------------- 
    16    USE trc 
    17    USE oce_trc         ! 
    18    USE trc         !  
    19    USE sms_pisces      !  
    20    USE p4zsink 
    21    USE prtctl_trc 
     16   USE oce_trc         !  shared variables between ocean and passive tracers 
     17   USE trc             !  passive tracers common variables  
     18   USE sms_pisces      !  PISCES Source Minus Sink variables 
     19   USE p4zsink         !  vertical flux of particulate matter due to sinking 
     20   USE prtctl_trc      !  print control for debugging 
    2221 
    2322   IMPLICIT NONE 
     
    2625   PUBLIC   p4z_mort     
    2726   PUBLIC   p4z_mort_init     
    28  
     27   PUBLIC   p4z_mort_alloc     
    2928 
    3029   !! * Shared module variables 
     
    8180      !!--------------------------------------------------------------------- 
    8281 
    83  
    84 #if defined key_diatrc 
    85      prodcal(:,:,:) = 0.  !: Initialisation of calcite production variable 
    86 #endif 
    87  
     82      prodcal(:,:,:) = 0.  !: calcite production variable set to zero 
    8883      DO jk = 1, jpkm1 
    8984         DO jj = 1, jpj 
    9085            DO ji = 1, jpi 
    91  
    9286               zcompaph = MAX( ( trn(ji,jj,jk,jpphy) - 1e-8 ), 0.e0 ) 
    93  
     87               zstep   = xstep 
    9488# if defined key_degrad 
    95                zstep =  xstep * facvol(ji,jj,jk)   
    96 # else 
    97                zstep =  xstep   
     89               zstep = zstep * facvol(ji,jj,jk) 
    9890# endif 
    9991               !     Squared mortality of Phyto similar to a sedimentation term during 
     
    117109               tra(ji,jj,jk,jpnfe) = tra(ji,jj,jk,jpnfe) - zmortp * zfactfe 
    118110               zprcaca = xfracal(ji,jj,jk) * zmortp 
    119 #if defined key_diatrc 
     111 
     112               ! calcite production 
    120113               prodcal(ji,jj,jk) = prodcal(ji,jj,jk) + zprcaca  ! prodcal=prodcal(nanophy)+prodcal(microzoo)+prodcal(mesozoo) 
    121 #endif 
     114               ! 
    122115               zfracal = 0.5 * xfracal(ji,jj,jk) 
    123116               tra(ji,jj,jk,jpdic) = tra(ji,jj,jk,jpdic) - zprcaca 
     
    177170               !    sticky and coagulate to sink quickly out of the euphotic zone 
    178171               !     ------------------------------------------------------------ 
    179  
     172               zstep   = xstep 
    180173# if defined key_degrad 
    181                zstep =  xstep * facvol(ji,jj,jk)   
    182 # else 
    183                zstep =  xstep   
     174               zstep = zstep * facvol(ji,jj,jk) 
    184175# endif 
    185176               !  Phytoplankton respiration  
     
    243234      NAMELIST/nampismort/ wchl, wchld, mprat, mprat2, mpratm 
    244235 
    245       REWIND( numnat )                     ! read numnat 
    246       READ  ( numnat, nampismort ) 
     236      REWIND( numnatp )                     ! read numnatp 
     237      READ  ( numnatp, nampismort ) 
    247238 
    248239      IF(lwp) THEN                         ! control print 
     
    259250   END SUBROUTINE p4z_mort_init 
    260251 
     252   INTEGER FUNCTION p4z_mort_alloc() 
     253      !!---------------------------------------------------------------------- 
     254      !!                     ***  ROUTINE p4z_mort_alloc  *** 
     255      !!---------------------------------------------------------------------- 
     256      ALLOCATE( prodcal(jpi,jpj,jpk), STAT=p4z_mort_alloc ) 
     257      IF( p4z_mort_alloc /= 0 ) CALL ctl_warn('p4z_mort_alloc : failed to allocate arrays.') 
     258 
     259   END FUNCTION p4z_mort_alloc 
     260 
    261261#else 
    262262   !!====================================================================== 
  • branches/2011/dev_r2787_LOCEAN3_TRA_TRP/NEMOGCM/NEMO/TOP_SRC/PISCES/p4zopt.F90

    r2715 r2819  
    215215      END DO 
    216216 
    217 #if defined key_diatrc 
    218 # if ! defined key_iomput 
    219       ! save for outputs 
    220       trc2d(:,:,  jp_pcs0_2d + 10) = heup(:,:  ) * tmask(:,:,1)   
    221       trc3d(:,:,:,jp_pcs0_3d + 3)  = etot(:,:,:) * tmask(:,:,:) 
    222 # else 
    223       ! write diagnostics  
    224       IF( jnt == nrdttrc ) then  
    225          CALL iom_put( "Heup", heup(:,:  ) * tmask(:,:,1) )  ! euphotic layer deptht 
    226          CALL iom_put( "PAR" , etot(:,:,:) * tmask(:,:,:) )  ! Photosynthetically Available Radiation 
     217      IF( ln_diatrc ) THEN        ! save output diagnostics 
     218        ! 
     219        IF( lk_iomput ) THEN 
     220           IF( jnt == nrdttrc ) THEN 
     221              CALL iom_put( "Heup", heup(:,:  ) * tmask(:,:,1) )  ! euphotic layer deptht 
     222              CALL iom_put( "PAR" , etot(:,:,:) * tmask(:,:,:) )  ! Photosynthetically Available Radiation 
     223           ENDIF 
     224        ELSE 
     225           trc2d(:,:,  jp_pcs0_2d + 10) = heup(:,:  ) * tmask(:,:,1)   
     226           trc3d(:,:,:,jp_pcs0_3d + 3)  = etot(:,:,:) * tmask(:,:,:) 
     227        ENDIF 
     228        ! 
    227229      ENDIF 
    228 # endif 
    229 #endif 
    230230      ! 
    231231      IF(  wrk_not_released(2, 1,2)           .OR.   & 
  • branches/2011/dev_r2787_LOCEAN3_TRA_TRP/NEMOGCM/NEMO/TOP_SRC/PISCES/p4zprod.F90

    r2730 r2819  
    22   !!====================================================================== 
    33   !!                         ***  MODULE p4zprod  *** 
    4    !! TOP :   PISCES  
     4   !! TOP :  Growth Rate of the two phytoplanktons groups  
    55   !!====================================================================== 
    66   !! History :   1.0  !  2004     (O. Aumont) Original code 
     
    1111   !!   'key_pisces'                                       PISCES bio-model 
    1212   !!---------------------------------------------------------------------- 
    13    !!   p4z_prod       :   
    14    !!---------------------------------------------------------------------- 
    15    USE trc 
    16    USE oce_trc         ! 
    17    USE sms_pisces      !  
    18    USE prtctl_trc 
    19    USE p4zopt 
    20    USE p4zint 
    21    USE p4zlim 
    22    USE iom 
     13   !!   p4z_prod       :   Compute the growth Rate of the two phytoplanktons groups 
     14   !!   p4z_prod_init  :   Initialization of the parameters for growth 
     15   !!   p4z_prod_alloc :   Allocate variables for growth 
     16   !!---------------------------------------------------------------------- 
     17   USE oce_trc         !  shared variables between ocean and passive tracers 
     18   USE trc             !  passive tracers common variables  
     19   USE sms_pisces      !  PISCES Source Minus Sink variables 
     20   USE p4zopt          !  optical model 
     21   USE p4zlim          !  Co-limitations of differents nutrients 
     22   USE prtctl_trc      !  print control for debugging 
     23   USE iom             !  I/O manager 
    2324 
    2425   IMPLICIT NONE 
     
    8485      REAL(wp) ::   zpislopen  , zpislope2n 
    8586      REAL(wp) ::   zrum, zcodel, zargu, zval, zvol 
    86 #if defined key_diatrc 
    8787      REAL(wp) ::   zrfact2 
    88 #endif 
    8988      CHARACTER (len=25) :: charout 
    9089      !!--------------------------------------------------------------------- 
     
    108107 
    109108      ! Computation of the optimal production 
    110 # if defined key_degrad 
    111       prmax(:,:,:) = rday1 * tgfunc(:,:,:) * facvol(:,:,:) 
    112 # else 
    113       prmax(:,:,:) = rday1 * tgfunc(:,:,:) 
    114 # endif 
     109      prmax(:,:,:) = rday1 * tgfunc(:,:,:)  
     110      IF( lk_degrad )  prmax(:,:,:) = prmax(:,:,:) * facvol(:,:,:)  
    115111 
    116112      ! compute the day length depending on latitude and the day 
     
    321317     ! Total primary production per year 
    322318 
    323 #if defined key_degrad 
    324      tpp = tpp + glob_sum( ( zprorca(:,:,:) + zprorcad(:,:,:) ) * cvol(:,:,:) * facvol(:,:,:) ) 
    325 #else 
    326      tpp = tpp + glob_sum( ( zprorca(:,:,:) + zprorcad(:,:,:) ) * cvol(:,:,:) ) 
    327 #endif 
    328  
    329      IF( kt == nitend .AND. jnt == nrdttrc .AND. lwp ) THEN 
     319     IF( lk_degrad )  THEN 
     320        tpp = tpp + glob_sum( ( zprorca(:,:,:) + zprorcad(:,:,:) ) * cvol(:,:,:) * facvol(:,:,:) ) 
     321     ELSE 
     322        tpp = tpp + glob_sum( ( zprorca(:,:,:) + zprorcad(:,:,:) ) * cvol(:,:,:) ) 
     323     ENDIF 
     324 
     325     IF( kt == nitend .AND. jnt == nrdttrc ) THEN 
    330326        WRITE(numout,*) 'Total PP (Gtc) :' 
    331327        WRITE(numout,*) '-------------------- : ',tpp * 12. / 1.E12 
     
    333329      ENDIF 
    334330 
    335 #if defined key_diatrc && ! defined key_iomput 
    336       !   Supplementary diagnostics 
    337       zrfact2 = 1.e3 * rfact2r 
    338       trc3d(:,:,:,jp_pcs0_3d + 4)  = zprorca (:,:,:) * zrfact2 * tmask(:,:,:) 
    339       trc3d(:,:,:,jp_pcs0_3d + 5)  = zprorcad(:,:,:) * zrfact2 * tmask(:,:,:) 
    340       trc3d(:,:,:,jp_pcs0_3d + 6)  = zpronew (:,:,:) * zrfact2 * tmask(:,:,:) 
    341       trc3d(:,:,:,jp_pcs0_3d + 7)  = zpronewd(:,:,:) * zrfact2 * tmask(:,:,:) 
    342       trc3d(:,:,:,jp_pcs0_3d + 8)  = zprorcad(:,:,:) * zrfact2 * tmask(:,:,:) * zysopt(:,:,:) 
    343       trc3d(:,:,:,jp_pcs0_3d + 9)  = zprofed (:,:,:) * zrfact2 * tmask(:,:,:) 
     331      IF( ln_diatrc ) THEN 
     332         ! 
     333         zrfact2 = 1.e3 * rfact2r 
     334         IF( jnt == nrdttrc ) THEN 
     335            CALL iom_put( "PPPHY" , zprorca (:,:,:) * zrfact2 * tmask(:,:,:) )  ! primary production by nanophyto 
     336            CALL iom_put( "PPPHY2", zprorcad(:,:,:) * zrfact2 * tmask(:,:,:) )  ! primary production by diatom 
     337            CALL iom_put( "PPNEWN", zpronew (:,:,:) * zrfact2 * tmask(:,:,:) )  ! new primary production by nanophyto 
     338            CALL iom_put( "PPNEWD", zpronewd(:,:,:) * zrfact2 * tmask(:,:,:) )  ! new primary production by diatom 
     339            CALL iom_put( "PBSi"  , zprorcad(:,:,:) * zrfact2 * tmask(:,:,:) * zysopt(:,:,:) ) ! biogenic silica production 
     340            CALL iom_put( "PFeD"  , zprofed (:,:,:) * zrfact2 * tmask(:,:,:) )  ! biogenic iron production by diatom 
     341            CALL iom_put( "PFeN"  , zprofen (:,:,:) * zrfact2 * tmask(:,:,:) )  ! biogenic iron production by nanophyto 
     342         ENDIF 
     343#if ! defined key_iomput 
     344         trc3d(:,:,:,jp_pcs0_3d + 4)  = zprorca (:,:,:) * zrfact2 * tmask(:,:,:) 
     345         trc3d(:,:,:,jp_pcs0_3d + 5)  = zprorcad(:,:,:) * zrfact2 * tmask(:,:,:) 
     346         trc3d(:,:,:,jp_pcs0_3d + 6)  = zpronew (:,:,:) * zrfact2 * tmask(:,:,:) 
     347         trc3d(:,:,:,jp_pcs0_3d + 7)  = zpronewd(:,:,:) * zrfact2 * tmask(:,:,:) 
     348         trc3d(:,:,:,jp_pcs0_3d + 8)  = zprorcad(:,:,:) * zrfact2 * tmask(:,:,:) * zysopt(:,:,:) 
     349         trc3d(:,:,:,jp_pcs0_3d + 9)  = zprofed (:,:,:) * zrfact2 * tmask(:,:,:) 
    344350#  if ! defined key_kriest 
    345       trc3d(:,:,:,jp_pcs0_3d + 10) = zprofen (:,:,:) * zrfact2 * tmask(:,:,:) 
     351         trc3d(:,:,:,jp_pcs0_3d + 10) = zprofen (:,:,:) * zrfact2 * tmask(:,:,:) 
    346352#  endif 
    347353#endif 
    348  
    349 #if defined key_diatrc && defined key_iomput 
    350       zrfact2 = 1.e3 * rfact2r 
    351       IF ( jnt == nrdttrc ) then 
    352          CALL iom_put( "PPPHY" , zprorca (:,:,:) * zrfact2 * tmask(:,:,:) )  ! primary production by nanophyto 
    353          CALL iom_put( "PPPHY2", zprorcad(:,:,:) * zrfact2 * tmask(:,:,:) )  ! primary production by diatom 
    354          CALL iom_put( "PPNEWN", zpronew (:,:,:) * zrfact2 * tmask(:,:,:) )  ! new primary production by nanophyto 
    355          CALL iom_put( "PPNEWD", zpronewd(:,:,:) * zrfact2 * tmask(:,:,:) )  ! new primary production by diatom 
    356          CALL iom_put( "PBSi"  , zprorcad(:,:,:) * zrfact2 * tmask(:,:,:) * zysopt(:,:,:) ) ! biogenic silica production 
    357          CALL iom_put( "PFeD"  , zprofed (:,:,:) * zrfact2 * tmask(:,:,:) )  ! biogenic iron production by diatom 
    358          CALL iom_put( "PFeN"  , zprofen (:,:,:) * zrfact2 * tmask(:,:,:) )  ! biogenic iron production by nanophyto 
     354         ! 
    359355      ENDIF 
    360 #endif 
    361356 
    362357      IF(ln_ctl)   THEN  ! print mean trends (used for debugging) 
     
    388383      !!---------------------------------------------------------------------- 
    389384 
    390       REWIND( numnat )                     ! read numnat 
    391       READ  ( numnat, nampisprod ) 
     385      REWIND( numnatp )                     ! read numnatp 
     386      READ  ( numnatp, nampisprod ) 
    392387 
    393388      IF(lwp) THEN                         ! control print 
  • branches/2011/dev_r2787_LOCEAN3_TRA_TRP/NEMOGCM/NEMO/TOP_SRC/PISCES/p4zrem.F90

    r2773 r2819  
    1212   !!   'key_pisces'                                       PISCES bio-model 
    1313   !!---------------------------------------------------------------------- 
    14    !!   p4z_rem       :   Compute remineralization/scavenging of organic compounds 
    15    !!---------------------------------------------------------------------- 
    16    USE trc 
    17    USE oce_trc         ! 
    18    USE sms_pisces      !  
    19    USE prtctl_trc 
    20    USE p4zint 
    21    USE p4zopt 
    22    USE p4zmeso 
    23    USE p4zprod 
    24    USE p4zche 
     14   !!   p4z_rem       :  Compute remineralization/scavenging of organic compounds 
     15   !!   p4z_rem_init  :  Initialisation of parameters for remineralisation 
     16   !!   p4z_rem_alloc :  Allocate remineralisation variables 
     17   !!---------------------------------------------------------------------- 
     18   USE oce_trc         !  shared variables between ocean and passive tracers 
     19   USE trc             !  passive tracers common variables  
     20   USE sms_pisces      !  PISCES Source Minus Sink variables 
     21   USE p4zopt          !  optical model 
     22   USE p4zche          !  chemical model 
     23   USE p4zprod         !  Growth rate of the 2 phyto groups 
     24   USE p4zmeso         !  Sources and sinks of mesozooplankton 
     25   USE prtctl_trc      !  print control for debugging 
    2526 
    2627   IMPLICIT NONE 
     
    6162      USE wrk_nemo, ONLY:   wrk_in_use, wrk_not_released 
    6263      USE wrk_nemo, ONLY:   ztempbac => wrk_2d_1 
    63       USE wrk_nemo, ONLY:   zdepbac  => wrk_3d_2 , zolimi => wrk_3d_3 
     64      USE wrk_nemo, ONLY:   zdepbac  => wrk_3d_2, zolimi => wrk_3d_3 
    6465      ! 
    6566      INTEGER, INTENT(in) ::   kt ! ocean time step 
     
    117118         DO jj = 1, jpj 
    118119            DO ji = 1, jpi 
     120               zstep   = xstep 
    119121# if defined key_degrad 
    120                zstep = xstep * facvol(ji,jj,jk) 
    121 # else 
    122                zstep = xstep 
     122               zstep = zstep * facvol(ji,jj,jk) 
    123123# endif 
    124124               ! DOC ammonification. Depends on depth, phytoplankton biomass 
     
    153153         DO jj = 1, jpj 
    154154            DO ji = 1, jpi 
     155               zstep   = xstep 
    155156# if defined key_degrad 
    156                zstep = xstep * facvol(ji,jj,jk) 
    157 # else 
    158                zstep = xstep 
     157               zstep = zstep * facvol(ji,jj,jk) 
    159158# endif 
    160159               !    NH4 nitrification to NO3. Ceased for oxygen concentrations 
     
    214213         DO jj = 1, jpj 
    215214            DO ji = 1, jpi 
     215               zstep   = xstep 
    216216# if defined key_degrad 
    217                zstep = xstep * facvol(ji,jj,jk) 
    218 # else 
    219                zstep = xstep 
     217               zstep = zstep * facvol(ji,jj,jk) 
    220218# endif 
    221219               !    POC disaggregation by turbulence and bacterial activity.  
     
    266264         DO jj = 1, jpj 
    267265            DO ji = 1, jpi 
     266               zstep   = xstep 
    268267# if defined key_degrad 
    269                zstep = xstep * facvol(ji,jj,jk) 
    270 # else 
    271                zstep = xstep 
     268               zstep = zstep * facvol(ji,jj,jk) 
    272269# endif 
    273270               !     Remineralization rate of BSi depedant on T and saturation 
     
    300297!CDIR NOVERRCHK 
    301298            DO ji = 1, jpi 
     299               zstep   = xstep 
    302300# if defined key_degrad 
    303                zstep = xstep * facvol(ji,jj,jk) 
    304 # else 
    305                zstep = xstep 
     301               zstep = zstep * facvol(ji,jj,jk) 
    306302# endif 
    307303               !  Compute de different ratios for scavenging of iron 
     
    414410      !!---------------------------------------------------------------------- 
    415411 
    416       REWIND( numnat )                     ! read numnat 
    417       READ  ( numnat, nampisrem ) 
     412      REWIND( numnatp )                     ! read numnatp 
     413      READ  ( numnatp, nampisrem ) 
    418414 
    419415      IF(lwp) THEN                         ! control print 
  • branches/2011/dev_r2787_LOCEAN3_TRA_TRP/NEMOGCM/NEMO/TOP_SRC/PISCES/p4zsed.F90

    r2774 r2819  
    1515   !!   p4z_sed_init   :  Initialization of p4z_sed 
    1616   !!---------------------------------------------------------------------- 
    17    USE trc 
    18    USE oce_trc         ! 
    19    USE sms_pisces 
    20    USE prtctl_trc 
    21    USE p4zbio 
    22    USE p4zint 
    23    USE p4zopt 
    24    USE p4zsink 
    25    USE p4zrem 
    26    USE p4zlim 
    27    USE iom 
    28  
     17   USE oce_trc         !  shared variables between ocean and passive tracers 
     18   USE trc             !  passive tracers common variables  
     19   USE sms_pisces      !  PISCES Source Minus Sink variables 
     20   USE p4zsink         !  vertical flux of particulate matter due to sinking 
     21   USE p4zopt          !  optical model 
     22   USE p4zlim          !  Co-limitations of differents nutrients 
     23   USE p4zrem          !  Remineralisation of organic matter 
     24   USE prtctl_trc      !  print control for debugging 
     25   USE iom             !  I/O manager 
    2926 
    3027   IMPLICIT NONE 
     
    247244               IF( zlim <= 0.2 )   zlim = 0.01 
    248245               znitrpot(ji,jj,jk) = MAX( 0.e0, ( 0.6 * tgfunc(ji,jj,jk) - 2.15 ) * rday1 )   & 
     246                  &                  * zlim * rfact2 * trn(ji,jj,jk,jpfer)   & 
    249247# if defined key_degrad 
    250                &                  * facvol(ji,jj,jk)   & 
     248                  &                  * facvol(ji,jj,jk) 
    251249# endif 
    252                &                  * zlim * rfact2 * trn(ji,jj,jk,jpfer)   & 
    253                &                  / ( conc3 + trn(ji,jj,jk,jpfer) ) * ( 1.- EXP( -etot(ji,jj,jk) / 50.) ) 
     250                  &                  / ( conc3 + trn(ji,jj,jk,jpfer) ) * ( 1.- EXP( -etot(ji,jj,jk) / 50.) ) 
    254251            END DO 
    255252         END DO  
     
    272269      END DO 
    273270 
    274 #if defined key_diatrc 
    275       zfact = 1.e+3 * rfact2r 
    276 #  if  ! defined key_iomput 
    277       trc2d(:,:,jp_pcs0_2d + 11) = zirondep(:,:,1)         * zfact * fse3t(:,:,1) * tmask(:,:,1) 
    278       trc2d(:,:,jp_pcs0_2d + 12) = znitrpot(:,:,1) * 1.e-7 * zfact * fse3t(:,:,1) * tmask(:,:,1) 
    279 #  else 
    280       zwork (:,:)  =  ( zirondep(:,:,1) + ironsed(:,:,1) * rfact2 ) * zfact * fse3t(:,:,1) * tmask(:,:,1)  
    281       zwork1(:,:)  =  znitrpot(:,:,1) * 1.e-7                       * zfact * fse3t(:,:,1) * tmask(:,:,1) 
    282       IF( jnt == nrdttrc ) THEN 
    283          CALL iom_put( "Irondep", zwork  )  ! surface downward net flux of iron 
    284          CALL iom_put( "Nfix"   , zwork1 )  ! nitrogen fixation at surface 
     271      IF( ln_diatrc ) THEN 
     272         ! 
     273         zfact = 1.e+3 * rfact2r 
     274         zwork (:,:)  =  ( zirondep(:,:,1) + ironsed(:,:,1) * rfact2 ) * zfact * fse3t(:,:,1) * tmask(:,:,1)  
     275         zwork1(:,:)  =    znitrpot(:,:,1) * 1.e-7                     * zfact * fse3t(:,:,1) * tmask(:,:,1) 
     276         IF( jnt == nrdttrc ) THEN 
     277            CALL iom_put( "Irondep", zwork  )  ! surface downward net flux of iron 
     278            CALL iom_put( "Nfix"   , zwork1 )  ! nitrogen fixation at surface 
     279         ENDIF 
     280# if ! defined key_iomput 
     281         trc2d(:,:,jp_pcs0_2d + 11) = zirondep(:,:,1)         * zfact * fse3t(:,:,1) * tmask(:,:,1) 
     282         trc2d(:,:,jp_pcs0_2d + 12) = znitrpot(:,:,1) * 1.e-7 * zfact * fse3t(:,:,1) * tmask(:,:,1) 
     283# endif 
     284         ! 
    285285      ENDIF 
    286 #  endif 
    287 #endif 
    288286      ! 
    289287       IF(ln_ctl)   THEN  ! print mean trends (used for debugging) 
     
    355353 
    356354   END SUBROUTINE p4z_sbc 
    357  
    358355 
    359356   SUBROUTINE p4z_sed_init 
     
    385382         CALL ctl_stop('p4z_sed_init: requested workspace arrays unavailable')  ;  RETURN 
    386383      END IF 
    387       ! 
    388       REWIND( numnat )                     ! read numnat 
    389       READ  ( numnat, nampissed ) 
     384 
     385      REWIND( numnatp )                     ! read numnatp 
     386      READ  ( numnatp, nampissed ) 
    390387 
    391388      IF(lwp) THEN 
  • branches/2011/dev_r2787_LOCEAN3_TRA_TRP/NEMOGCM/NEMO/TOP_SRC/PISCES/p4zsink.F90

    r2715 r2819  
    22   !!====================================================================== 
    33   !!                         ***  MODULE p4zsink  *** 
    4    !! TOP :   PISCES Compute vertical flux of particulate matter due to gravitational sinking 
     4   !! TOP :  PISCES vertical flux of particulate matter due to gravitational sinking 
    55   !!====================================================================== 
    66   !! History :   1.0  !  2004     (O. Aumont) Original code 
     
    99   !!---------------------------------------------------------------------- 
    1010   !!   p4z_sink       :  Compute vertical flux of particulate matter due to gravitational sinking 
     11   !!   p4z_sink_init  :  Unitialisation of sinking speed parameters 
     12   !!   p4z_sink_alloc :  Allocate sinking speed variables 
    1113   !!---------------------------------------------------------------------- 
    12    USE trc 
    13    USE oce_trc         ! 
    14    USE sms_pisces 
    15    USE prtctl_trc 
    16    USE iom 
     14   USE oce_trc         !  shared variables between ocean and passive tracers 
     15   USE trc             !  passive tracers common variables  
     16   USE sms_pisces      !  PISCES Source Minus Sink variables 
     17   USE prtctl_trc      !  print control for debugging 
     18   USE iom             !  I/O manager 
    1719 
    1820   IMPLICIT NONE 
     
    9193      REAL(wp) :: zdiv , zdiv1, zdiv2, zdiv3, zdiv4, zdiv5 
    9294      REAL(wp) :: zval1, zval2, zval3, zval4 
    93 #if defined key_diatrc 
    9495      REAL(wp) :: zrfact2 
    9596      INTEGER  :: ik1 
    96 #endif 
    9797      CHARACTER (len=25) :: charout 
    9898      !!--------------------------------------------------------------------- 
     
    193193                     &            * (zeps-1)/zdiv1 + 3.*(zfm*xkr_mass_max-xkr_mass_min)    & 
    194194                     &            * (zfm*xkr_mass_max**2-xkr_mass_min**2)                  & 
    195                      &            * (zeps-1.)**2/(zdiv2*zdiv3))            & 
    196 # if defined key_degrad 
    197                      &                 *facvol(ji,jj,jk)       & 
    198 # endif 
    199                      &    ) 
     195                     &            * (zeps-1.)**2/(zdiv2*zdiv3))           )  
    200196 
    201197                  zagg2 = (  2*0.163*trn(ji,jj,jk,jpnum)**2*zfm*                       & 
     
    205201                     &                    +xkr_mass_min**3*(zeps-1)/zdiv1)                  & 
    206202                     &                    -zfm*xkr_mass_max**3*(1.+3.*((zeps-1.)/           & 
    207                      &                    (zeps-2.)+(zeps-1.)/zdiv3)+(zeps-1.)/zdiv1))      & 
    208 #    if defined key_degrad 
    209                      &                 *facvol(ji,jj,jk)             & 
    210 #    endif 
    211                      &    ) 
    212  
    213                   zagg3 = (  0.163*trn(ji,jj,jk,jpnum)**2*zfm**2*8. * xkr_mass_max**3   & 
    214 #    if defined key_degrad 
    215                      &                 *facvol(ji,jj,jk)             & 
    216 #    endif 
    217                      &    ) 
    218  
     203                     &                    (zeps-2.)+(zeps-1.)/zdiv3)+(zeps-1.)/zdiv1))  )  
     204 
     205                  zagg3 = (  0.163*trn(ji,jj,jk,jpnum)**2*zfm**2*8. * xkr_mass_max**3 )  
     206 
     207                  IF( lk_degrad ) THEN 
     208                     zagg1 = zagg1 * facvol(ji,jj,jk) 
     209                     zagg2 = zagg2 * facvol(ji,jj,jk) 
     210                     zagg3 = zagg3 * facvol(ji,jj,jk) 
     211                  ENDIF 
    219212                  zaggsh = ( zagg1 + zagg2 + zagg3 ) * rfact2 * xdiss(ji,jj,jk) / 1000. 
    220213 
     
    228221                     &                 -(1.-zfm)/(zdiv*(zeps-1.)))-                       & 
    229222                     &                 ((zfm*zfm*xkr_mass_max**2*zsm-xkr_mass_min**2)     & 
    230                      &                 *xkr_eta)/(zdiv*zdiv3*zdiv5) )                     & 
    231 # if defined key_degrad 
    232                      &                 *facvol(ji,jj,jk)        & 
    233 # endif 
    234                      &    ) 
     223                     &                 *xkr_eta)/(zdiv*zdiv3*zdiv5) )  )  
    235224 
    236225                  zagg5 = (  2.*3.141*0.125*trn(ji,jj,jk,jpnum)**2                         & 
     
    238227                     &                 *(zsm*(xkr_mass_min**2-zfm*xkr_mass_max**2)         & 
    239228                     &                 /zdiv3-(xkr_mass_min**2-zfm*zsm*xkr_mass_max**2)    & 
    240                      &                 /zdiv)                   & 
     229                     &                 /zdiv)    )  
    241230# if defined key_degrad 
    242                      &                 *facvol(ji,jj,jk)        & 
     231                  zagg4 = zagg4 * facvol(ji,jj,jk) 
     232                  zagg5 = zagg5 * facvol(ji,jj,jk) 
    243233# endif 
    244                      &    ) 
    245  
    246234                  zaggsi = ( zagg4 + zagg5 ) * xstep / 10. 
    247235 
     
    254242                     &        + 1018.  * trn(ji,jj,jk,jppoc)  ) * xstep    & 
    255243# if defined key_degrad 
    256                      &        * facvol(ji,jj,jk)                              & 
     244                     &        * facvol(ji,jj,jk) 
    257245# endif 
    258246                     &        * xdiss(ji,jj,jk) * trn(ji,jj,jk,jpdoc) 
     
    268256      END DO 
    269257 
    270 #if defined key_diatrc 
    271       zrfact2 = 1.e3 * rfact2r 
    272       ik1 = iksed + 1 
    273 #  if ! defined key_iomput 
    274       trc2d(:,:  ,jp_pcs0_2d + 4)  = sinking (:,:,ik1) * zrfact2 * tmask(:,:,1) 
    275       trc2d(:,:  ,jp_pcs0_2d + 5)  = sinking2(:,:,ik1) * zrfact2 * tmask(:,:,1) 
    276       trc2d(:,:  ,jp_pcs0_2d + 6)  = sinkfer (:,:,ik1) * zrfact2 * tmask(:,:,1) 
    277       trc2d(:,:  ,jp_pcs0_2d + 7)  = sinksil (:,:,ik1) * zrfact2 * tmask(:,:,1) 
    278       trc2d(:,:  ,jp_pcs0_2d + 8)  = sinkcal (:,:,ik1) * zrfact2 * tmask(:,:,1) 
    279       trc3d(:,:,:,jp_pcs0_3d + 11) = sinking (:,:,:)      * zrfact2 * tmask(:,:,:) 
    280       trc3d(:,:,:,jp_pcs0_3d + 12) = sinking2(:,:,:)      * zrfact2 * tmask(:,:,:) 
    281       trc3d(:,:,:,jp_pcs0_3d + 13) = sinksil (:,:,:)      * zrfact2 * tmask(:,:,:) 
    282       trc3d(:,:,:,jp_pcs0_3d + 14) = sinkcal (:,:,:)      * zrfact2 * tmask(:,:,:) 
    283       trc3d(:,:,:,jp_pcs0_3d + 15) = znum3d  (:,:,:)                * tmask(:,:,:) 
    284       trc3d(:,:,:,jp_pcs0_3d + 16) = wsbio3  (:,:,:)                * tmask(:,:,:) 
    285       trc3d(:,:,:,jp_pcs0_3d + 17) = wsbio4  (:,:,:)                * tmask(:,:,:) 
    286 #else 
    287       IF( jnt == nrdttrc ) then 
    288         CALL iom_put( "POCFlx"  , sinking (:,:,:)      * zrfact2 * tmask(:,:,:) )  ! POC export 
    289         CALL iom_put( "NumFlx"  , sinking2 (:,:,:)     * zrfact2 * tmask(:,:,:) )  ! Num export 
    290         CALL iom_put( "SiFlx"   , sinksil (:,:,:)      * zrfact2 * tmask(:,:,:) )  ! Silica export 
    291         CALL iom_put( "CaCO3Flx", sinkcal (:,:,:)      * zrfact2 * tmask(:,:,:) )  ! Calcite export 
    292         CALL iom_put( "xnum"    , znum3d  (:,:,:)                * tmask(:,:,:) )  ! Number of particles in aggregats 
    293         CALL iom_put( "W1"      , wsbio3  (:,:,:)                * tmask(:,:,:) )  ! sinking speed of POC 
    294         CALL iom_put( "W2"      , wsbio4  (:,:,:)                * tmask(:,:,:) )  ! sinking speed of aggregats 
    295         CALL iom_put( "PMO"     , sinking (:,:,ik1) * zrfact2 * tmask(:,:,1) )  ! POC export at 100m 
    296         CALL iom_put( "PMO2"    , sinking2(:,:,ik1) * zrfact2 * tmask(:,:,1) )  ! Num export at 100m 
    297         CALL iom_put( "ExpFe1"  , sinkfer (:,:,ik1) * zrfact2 * tmask(:,:,1) )  ! Export of iron at 100m 
    298         CALL iom_put( "ExpSi"   , sinksil (:,:,ik1) * zrfact2 * tmask(:,:,1) )  ! export of silica at 100m 
    299         CALL iom_put( "ExpCaCO3", sinkcal (:,:,ik1) * zrfact2 * tmask(:,:,1) )  ! export of calcite at 100m 
    300      ENDIF 
    301 #  endif 
    302  
    303 #endif 
     258      IF( ln_diatrc ) THEN 
     259         ! 
     260         ik1 = iksed + 1 
     261         zrfact2 = 1.e3 * rfact2r 
     262         IF( jnt == nrdttrc ) THEN 
     263           CALL iom_put( "POCFlx"  , sinking (:,:,:)      * zrfact2 * tmask(:,:,:) )  ! POC export 
     264           CALL iom_put( "NumFlx"  , sinking2 (:,:,:)     * zrfact2 * tmask(:,:,:) )  ! Num export 
     265           CALL iom_put( "SiFlx"   , sinksil (:,:,:)      * zrfact2 * tmask(:,:,:) )  ! Silica export 
     266           CALL iom_put( "CaCO3Flx", sinkcal (:,:,:)      * zrfact2 * tmask(:,:,:) )  ! Calcite export 
     267           CALL iom_put( "xnum"    , znum3d  (:,:,:)                * tmask(:,:,:) )  ! Number of particles in aggregats 
     268           CALL iom_put( "W1"      , wsbio3  (:,:,:)                * tmask(:,:,:) )  ! sinking speed of POC 
     269           CALL iom_put( "W2"      , wsbio4  (:,:,:)                * tmask(:,:,:) )  ! sinking speed of aggregats 
     270           CALL iom_put( "PMO"     , sinking (:,:,ik1)    * zrfact2 * tmask(:,:,1) )  ! POC export at 100m 
     271           CALL iom_put( "PMO2"    , sinking2(:,:,ik1)    * zrfact2 * tmask(:,:,1) )  ! Num export at 100m 
     272           CALL iom_put( "ExpFe1"  , sinkfer (:,:,ik1)    * zrfact2 * tmask(:,:,1) )  ! Export of iron at 100m 
     273           CALL iom_put( "ExpSi"   , sinksil (:,:,ik1)    * zrfact2 * tmask(:,:,1) )  ! export of silica at 100m 
     274           CALL iom_put( "ExpCaCO3", sinkcal (:,:,ik1)    * zrfact2 * tmask(:,:,1) )  ! export of calcite at 100m 
     275         ENDIF 
     276# if ! defined key_iomput 
     277         trc2d(:,:  ,jp_pcs0_2d + 4)  = sinking (:,:,ik1)    * zrfact2 * tmask(:,:,1) 
     278         trc2d(:,:  ,jp_pcs0_2d + 5)  = sinking2(:,:,ik1)    * zrfact2 * tmask(:,:,1) 
     279         trc2d(:,:  ,jp_pcs0_2d + 6)  = sinkfer (:,:,ik1)    * zrfact2 * tmask(:,:,1) 
     280         trc2d(:,:  ,jp_pcs0_2d + 7)  = sinksil (:,:,ik1)    * zrfact2 * tmask(:,:,1) 
     281         trc2d(:,:  ,jp_pcs0_2d + 8)  = sinkcal (:,:,ik1)    * zrfact2 * tmask(:,:,1) 
     282         trc3d(:,:,:,jp_pcs0_3d + 11) = sinking (:,:,:)      * zrfact2 * tmask(:,:,:) 
     283         trc3d(:,:,:,jp_pcs0_3d + 12) = sinking2(:,:,:)      * zrfact2 * tmask(:,:,:) 
     284         trc3d(:,:,:,jp_pcs0_3d + 13) = sinksil (:,:,:)      * zrfact2 * tmask(:,:,:) 
     285         trc3d(:,:,:,jp_pcs0_3d + 14) = sinkcal (:,:,:)      * zrfact2 * tmask(:,:,:) 
     286         trc3d(:,:,:,jp_pcs0_3d + 15) = znum3d  (:,:,:)                * tmask(:,:,:) 
     287         trc3d(:,:,:,jp_pcs0_3d + 16) = wsbio3  (:,:,:)                * tmask(:,:,:) 
     288         trc3d(:,:,:,jp_pcs0_3d + 17) = wsbio4  (:,:,:)                * tmask(:,:,:) 
     289# endif 
     290        ! 
     291      ENDIF 
    304292      ! 
    305293      IF(ln_ctl)   THEN  ! print mean trends (used for debugging) 
     
    335323      !!---------------------------------------------------------------------- 
    336324      ! 
    337       REWIND( numnat )                     ! read nampiskrs 
    338       READ  ( numnat, nampiskrs ) 
     325      REWIND( numnatp )                     ! read nampiskrs 
     326      READ  ( numnatp, nampiskrs ) 
    339327 
    340328      IF(lwp) THEN 
     
    459447      REAL(wp) ::   zagg , zaggfe, zaggdoc, zaggdoc2 
    460448      REAL(wp) ::   zfact, zwsmax, zstep 
    461 #if defined key_diatrc 
    462449      REAL(wp) ::   zrfact2 
    463450      INTEGER  ::   ik1 
    464 #endif 
    465451      CHARACTER (len=25) :: charout 
    466452      !!--------------------------------------------------------------------- 
     
    526512         DO jj = 1, jpj 
    527513            DO ji = 1, jpi 
     514               ! 
     515               zstep = xstep  
    528516# if defined key_degrad 
    529                zstep = xstep * facvol(ji,jj,jk) 
    530 # else 
    531                zstep = xstep  
     517               zstep = zstep * facvol(ji,jj,jk) 
    532518# endif 
    533519               zfact = zstep * xdiss(ji,jj,jk) 
     
    560546      END DO 
    561547 
    562 #if defined key_diatrc 
    563       zrfact2 = 1.e3 * rfact2r 
    564       ik1  = iksed + 1 
    565 #  if ! defined key_iomput 
    566       trc2d(:,:,jp_pcs0_2d + 4) = sinking (:,:,ik1) * zrfact2 * tmask(:,:,1) 
    567       trc2d(:,:,jp_pcs0_2d + 5) = sinking2(:,:,ik1) * zrfact2 * tmask(:,:,1) 
    568       trc2d(:,:,jp_pcs0_2d + 6) = sinkfer (:,:,ik1) * zrfact2 * tmask(:,:,1) 
    569       trc2d(:,:,jp_pcs0_2d + 7) = sinkfer2(:,:,ik1) * zrfact2 * tmask(:,:,1) 
    570       trc2d(:,:,jp_pcs0_2d + 8) = sinksil (:,:,ik1) * zrfact2 * tmask(:,:,1) 
    571       trc2d(:,:,jp_pcs0_2d + 9) = sinkcal (:,:,ik1) * zrfact2 * tmask(:,:,1) 
    572 #  else 
    573       IF( jnt == nrdttrc )  then 
    574          CALL iom_put( "EPC100"  , ( sinking(:,:,ik1) + sinking2(:,:,ik1) ) * zrfact2 * tmask(:,:,1) ) ! Export of carbon at 100m 
    575          CALL iom_put( "EPFE100" , ( sinkfer(:,:,ik1) + sinkfer2(:,:,ik1) ) * zrfact2 * tmask(:,:,1) ) ! Export of iron at 100m 
    576          CALL iom_put( "EPCAL100",   sinkcal(:,:,ik1)                       * zrfact2 * tmask(:,:,1) ) ! Export of calcite  at 100m 
    577          CALL iom_put( "EPSI100" ,   sinksil(:,:,ik1)                       * zrfact2 * tmask(:,:,1) ) ! Export of biogenic silica at 100m 
     548      IF( ln_diatrc ) THEN 
     549         ! 
     550         zrfact2 = 1.e3 * rfact2r 
     551         ik1  = iksed + 1 
     552         IF( jnt == nrdttrc ) THEN 
     553            CALL iom_put( "EPC100"  , ( sinking(:,:,ik1) + sinking2(:,:,ik1) ) * zrfact2 * tmask(:,:,1) ) ! Export of carbon at 100m 
     554            CALL iom_put( "EPFE100" , ( sinkfer(:,:,ik1) + sinkfer2(:,:,ik1) ) * zrfact2 * tmask(:,:,1) ) ! Export of iron at 100m 
     555            CALL iom_put( "EPCAL100",   sinkcal(:,:,ik1)                       * zrfact2 * tmask(:,:,1) ) ! Export of calcite  at 100m 
     556            CALL iom_put( "EPSI100" ,   sinksil(:,:,ik1)                       * zrfact2 * tmask(:,:,1) ) ! Export of biogenic silica at 100m 
     557         ENDIF 
     558# if ! defined key_iomput 
     559         trc2d(:,:,jp_pcs0_2d + 4) = sinking (:,:,ik1) * zrfact2 * tmask(:,:,1) 
     560         trc2d(:,:,jp_pcs0_2d + 5) = sinking2(:,:,ik1) * zrfact2 * tmask(:,:,1) 
     561         trc2d(:,:,jp_pcs0_2d + 6) = sinkfer (:,:,ik1) * zrfact2 * tmask(:,:,1) 
     562         trc2d(:,:,jp_pcs0_2d + 7) = sinkfer2(:,:,ik1) * zrfact2 * tmask(:,:,1) 
     563         trc2d(:,:,jp_pcs0_2d + 8) = sinksil (:,:,ik1) * zrfact2 * tmask(:,:,1) 
     564         trc2d(:,:,jp_pcs0_2d + 9) = sinkcal (:,:,ik1) * zrfact2 * tmask(:,:,1) 
     565# endif 
     566         ! 
    578567      ENDIF 
    579 #endif 
    580 #endif 
    581568      ! 
    582569      IF(ln_ctl)   THEN  ! print mean trends (used for debugging) 
     
    630617 
    631618      DO jk = 1, jpkm1 
    632 # if defined key_degrad 
    633          zwsink2(:,:,jk+1) = -pwsink(:,:,jk) / rday * tmask(:,:,jk+1) * facvol(:,:,jk) 
    634 # else 
    635          zwsink2(:,:,jk+1) = -pwsink(:,:,jk) / rday * tmask(:,:,jk+1) 
    636 # endif 
     619         zwsink2(:,:,jk+1) = -pwsink(:,:,jk) / rday * tmask(:,:,jk+1)  
    637620      END DO 
    638621      zwsink2(:,:,1) = 0.e0 
     622      IF( lk_degrad ) THEN 
     623         zwsink2(:,:,:) = zwsink2(:,:,:) * facvol(:,:,:) 
     624      ENDIF 
    639625 
    640626 
  • branches/2011/dev_r2787_LOCEAN3_TRA_TRP/NEMOGCM/NEMO/TOP_SRC/PISCES/par_pisces.F90

    r2528 r2819  
    2929   LOGICAL, PUBLIC, PARAMETER ::   lk_kriest     = .TRUE.  !: Kriest flag  
    3030   INTEGER, PUBLIC, PARAMETER ::   jp_pisces     =  23     !: number of passive tracers 
    31    INTEGER, PUBLIC, PARAMETER ::   jp_pisces_2d  =  13     !: additional 2d output ('key_diatrc') 
    32    INTEGER, PUBLIC, PARAMETER ::   jp_pisces_3d  =  18     !: additional 3d output ('key_diatrc') 
     31   INTEGER, PUBLIC, PARAMETER ::   jp_pisces_2d  =  13     !: additional 2d output  
     32   INTEGER, PUBLIC, PARAMETER ::   jp_pisces_3d  =  18     !: additional 3d output  
    3333   INTEGER, PUBLIC, PARAMETER ::   jp_pisces_trd =   1     !: number of sms trends for PISCES 
    3434 
     
    6767   LOGICAL, PUBLIC, PARAMETER ::   lk_kriest     = .FALSE. !: Kriest flag  
    6868   INTEGER, PUBLIC, PARAMETER ::   jp_pisces     = 24      !: number of PISCES passive tracers 
    69    INTEGER, PUBLIC, PARAMETER ::   jp_pisces_2d  = 13      !: additional 2d output ('key_diatrc') 
    70    INTEGER, PUBLIC, PARAMETER ::   jp_pisces_3d  = 11      !: additional 3d output ('key_diatrc') 
     69   INTEGER, PUBLIC, PARAMETER ::   jp_pisces_2d  = 13      !: additional 2d output  
     70   INTEGER, PUBLIC, PARAMETER ::   jp_pisces_3d  = 11      !: additional 3d output  
    7171   INTEGER, PUBLIC, PARAMETER ::   jp_pisces_trd =  1      !: number of sms trends for PISCES 
    7272 
  • branches/2011/dev_r2787_LOCEAN3_TRA_TRP/NEMOGCM/NEMO/TOP_SRC/PISCES/sms_pisces.F90

    r2715 r2819  
    1616   IMPLICIT NONE 
    1717   PUBLIC 
     18 
     19   INTEGER ::   numnatp 
    1820 
    1921   !!*  Time variables 
     
    6163   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::   xlimbac    !: ?? 
    6264   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::   xdiss      !: ?? 
    63 #if defined key_diatrc 
    6465   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::   prodcal    !: Calcite production 
    6566   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::   grazing    !: Total zooplankton grazing 
    66 #endif 
    6767 
    6868   !!* Variable for chemistry of the CO2 cycle 
     
    7474   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::   borat      !: ??? 
    7575   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::   hi         !: ??? 
     76 
     77   !!* Temperature dependancy of SMS terms 
     78   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::   tgfunc    !: Temp. dependancy of various biological rates 
     79   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::   tgfunc2   !: Temp. dependancy of mesozooplankton rates 
    7680 
    7781   !!* Array used to indicate negative tracer values 
     
    98102      !!---------------------------------------------------------------------- 
    99103      USE lib_mpp , ONLY: ctl_warn 
    100       INTEGER ::   ierr(5)        ! Local variables 
     104      INTEGER ::   ierr(6)        ! Local variables 
    101105      !!---------------------------------------------------------------------- 
    102106      ierr(:) = 0 
    103107      ! 
    104108      !*  Biological fluxes for light 
    105       ALLOCATE( neln(jpi,jpj), heup(jpi,jpj),                           STAT=ierr(1) ) 
     109      ALLOCATE( neln(jpi,jpj), heup(jpi,jpj),                   STAT=ierr(1) ) 
    106110      ! 
    107111      !*  Biological fluxes for primary production 
    108       ALLOCATE( xksimax(jpi,jpj)     , xksi(jpi,jpj)        ,               & 
    109          &      xnanono3(jpi,jpj,jpk), xdiatno3(jpi,jpj,jpk),               & 
    110          &      xnanonh4(jpi,jpj,jpk), xdiatnh4(jpi,jpj,jpk),               & 
    111          &      xlimphy (jpi,jpj,jpk), xlimdia (jpi,jpj,jpk),               & 
    112          &      concdfe (jpi,jpj,jpk), concnfe (jpi,jpj,jpk),           STAT=ierr(2) )  
     112      ALLOCATE( xksimax(jpi,jpj)     , xksi(jpi,jpj)        ,       & 
     113         &      xnanono3(jpi,jpj,jpk), xdiatno3(jpi,jpj,jpk),       & 
     114         &      xnanonh4(jpi,jpj,jpk), xdiatnh4(jpi,jpj,jpk),       & 
     115         &      xlimphy (jpi,jpj,jpk), xlimdia (jpi,jpj,jpk),       & 
     116         &      concdfe (jpi,jpj,jpk), concnfe (jpi,jpj,jpk),   STAT=ierr(2) )  
    113117         ! 
    114118      !*  SMS for the organic matter 
    115       ALLOCATE( xfracal (jpi,jpj,jpk), nitrfac (jpi,jpj,jpk),               & 
    116 #if defined key_diatrc 
    117          &      prodcal(jpi,jpj,jpk) , grazing(jpi,jpj,jpk) ,               & 
    118 #endif  
    119          &      xlimbac (jpi,jpj,jpk), xdiss(jpi,jpj,jpk)   ,           STAT=ierr(3) )   
     119      ALLOCATE( xfracal (jpi,jpj,jpk), nitrfac (jpi,jpj,jpk),       & 
     120         &      xlimbac (jpi,jpj,jpk), xdiss(jpi,jpj,jpk)   ,   STAT=ierr(3) )   
    120121         ! 
    121122      !* Variable for chemistry of the CO2 cycle 
    122       ALLOCATE( akb3(jpi,jpj,jpk), ak13(jpi,jpj,jpk) ,                      & 
    123          &      ak23(jpi,jpj,jpk), aksp(jpi,jpj,jpk) ,                      & 
    124          &      akw3(jpi,jpj,jpk), borat(jpi,jpj,jpk), hi(jpi,jpj,jpk), STAT=ierr(4) ) 
     123      ALLOCATE( akb3(jpi,jpj,jpk)    , ak13(jpi,jpj,jpk)    ,       & 
     124         &      ak23(jpi,jpj,jpk)    , aksp(jpi,jpj,jpk)    ,       & 
     125         &      akw3(jpi,jpj,jpk)    , borat(jpi,jpj,jpk)   ,       & 
     126         &      hi  (jpi,jpj,jpk)    ,                          STAT=ierr(4) ) 
     127         ! 
     128      !* Temperature dependancy of SMS terms 
     129      ALLOCATE( tgfunc(jpi,jpj,jpk)  , tgfunc2(jpi,jpj,jpk) ,   STAT=ierr(5) ) 
    125130         ! 
    126131      !* Array used to indicate negative tracer values   
    127       ALLOCATE( xnegtr(jpi,jpj,jpk),                                    STAT=ierr(5) ) 
     132      ALLOCATE( xnegtr(jpi,jpj,jpk)  ,                          STAT=ierr(6) ) 
    128133      ! 
    129134      sms_pisces_alloc = MAXVAL( ierr ) 
  • branches/2011/dev_r2787_LOCEAN3_TRA_TRP/NEMOGCM/NEMO/TOP_SRC/PISCES/trcini_pisces.F90

    r2715 r2819  
    1717   !!---------------------------------------------------------------------- 
    1818   USE par_trc         ! TOP parameters 
    19    USE sms_pisces      ! Source Minus Sink variables 
    20    USE trc 
    21    USE oce_trc         ! ocean variables 
    22    USE p4zche  
    23    USE p4zche          !  
    24    USE p4zsink         !  
    25    USE p4zopt          !  
    26    USE p4zprod         ! 
    27    USE p4zrem          !  
    28    USE p4zsed          !  
    29    USE p4zflx          !  
     19   USE oce_trc         !  shared variables between ocean and passive tracers 
     20   USE trc             !  passive tracers common variables  
     21   USE sms_pisces      !  PISCES Source Minus Sink variables 
     22   USE p4zche          !  Chemical model 
     23   USE p4zsink         !  vertical flux of particulate matter due to sinking 
     24   USE p4zopt          !  optical model 
     25   USE p4zrem          !  Remineralisation of organic matter 
     26   USE p4zflx          !  Gas exchange 
     27   USE p4zsed          !  Sedimentation 
    3028 
    3129   IMPLICIT NONE 
     
    136134      !! ** Purpose :   Allocate all the dynamic arrays of PISCES  
    137135      !!---------------------------------------------------------------------- 
    138       USE p4zint , ONLY : p4z_int_alloc       
    139       USE p4zsink, ONLY : p4z_sink_alloc       
    140       USE p4zopt , ONLY : p4z_opt_alloc            
    141       USE p4zprod, ONLY : p4z_prod_alloc          
    142       USE p4zrem , ONLY : p4z_rem_alloc            
    143       USE p4zsed , ONLY : p4z_sed_alloc           
    144       USE p4zflx , ONLY : p4z_flx_alloc 
     136      USE p4zsink , ONLY : p4z_sink_alloc       
     137      USE p4zopt  , ONLY : p4z_opt_alloc            
     138      USE p4zprod , ONLY : p4z_prod_alloc          
     139      USE p4zmort , ONLY : p4z_mort_alloc          
     140      USE p4zmicro, ONLY : p4z_micro_alloc          
     141      USE p4zrem  , ONLY : p4z_rem_alloc            
     142      USE p4zsed  , ONLY : p4z_sed_alloc           
     143      USE p4zflx  , ONLY : p4z_flx_alloc 
    145144      ! 
    146145      INTEGER :: ierr 
     
    148147      ! 
    149148      ierr =         sms_pisces_alloc()          ! Start of PISCES-related alloc routines... 
    150       ierr = ierr +     p4z_che_alloc() 
    151       ierr = ierr +     p4z_int_alloc() 
    152       ierr = ierr +    p4z_sink_alloc() 
    153       ierr = ierr +     p4z_opt_alloc() 
    154       ierr = ierr +    p4z_prod_alloc() 
    155       ierr = ierr +     p4z_rem_alloc() 
    156       ierr = ierr +     p4z_sed_alloc() 
    157       ierr = ierr +     p4z_flx_alloc() 
     149      ierr = ierr +  p4z_che_alloc() 
     150      ierr = ierr +  p4z_sink_alloc() 
     151      ierr = ierr +  p4z_opt_alloc() 
     152      ierr = ierr +  p4z_prod_alloc() 
     153      ierr = ierr +  p4z_mort_alloc() 
     154      ierr = ierr +  p4z_micro_alloc() 
     155      ierr = ierr +  p4z_rem_alloc() 
     156      ierr = ierr +  p4z_sed_alloc() 
     157      ierr = ierr +  p4z_flx_alloc() 
    158158      ! 
    159159      IF( lk_mpp    )   CALL mpp_sum( ierr ) 
  • branches/2011/dev_r2787_LOCEAN3_TRA_TRP/NEMOGCM/NEMO/TOP_SRC/PISCES/trcnam_pisces.F90

    r2715 r2819  
    1919   USE trc             ! TOP variables 
    2020   USE sms_pisces      ! sms trends 
     21   USE iom             ! I/O manager 
    2122 
    2223 
     
    4647      !!---------------------------------------------------------------------- 
    4748      !! 
    48 #if defined key_diatrc && ! defined key_iomput 
    49       INTEGER ::  jl, jn 
    50       ! definition of additional diagnostic as a structure 
    51       TYPE DIAG 
    52          CHARACTER(len = 20)  :: snamedia   !: short name 
    53          CHARACTER(len = 80 ) :: lnamedia   !: long name 
    54          CHARACTER(len = 20 ) :: unitdia    !: unit 
    55       END TYPE DIAG 
    56  
    57       TYPE(DIAG) , DIMENSION(jp_pisces_2d) :: pisdia2d 
    58       TYPE(DIAG) , DIMENSION(jp_pisces_3d) :: pisdia3d 
    59 #endif 
    60  
     49      INTEGER :: jl, jn 
     50      TYPE(DIAG), DIMENSION(jp_pisces_2d) :: pisdia2d 
     51      TYPE(DIAG), DIMENSION(jp_pisces_3d) :: pisdia3d 
     52      !! 
    6153      NAMELIST/nampisbio/ part, nrdttrc, wsbio, xkmort, ferat3, wsbio2 
    6254#if defined key_kriest 
    6355      NAMELIST/nampiskrp/ xkr_eta, xkr_zeta, xkr_mass_min, xkr_mass_max 
    6456#endif 
    65 #if defined key_diatrc && ! defined key_iomput 
    66       NAMELIST/nampisdia/ nn_writedia, pisdia3d, pisdia2d     ! additional diagnostics 
    67 #endif 
     57      NAMELIST/nampisdia/ pisdia3d, pisdia2d     ! additional diagnostics 
    6858      NAMELIST/nampisdmp/ ln_pisdmp, ln_pisclo 
    6959 
     
    7767      !                               ! Open the namelist file 
    7868      !                               ! ---------------------- 
    79       CALL ctl_opn( numnat, 'namelist_pisces', 'OLD', 'FORMATTED', 'SEQUENTIAL', -1, numout, .FALSE. ) 
     69      CALL ctl_opn( numnatp, 'namelist_pisces', 'OLD', 'FORMATTED', 'SEQUENTIAL', -1, numout, .FALSE. ) 
    8070 
    81       REWIND( numnat )                     
    82       READ  ( numnat, nampisbio ) 
     71      REWIND( numnatp )                     
     72      READ  ( numnatp, nampisbio ) 
    8373 
    8474      IF(lwp) THEN                         ! control print 
     
    10191      xkr_mass_max = 1.       
    10292 
    103       REWIND( numnat )                     ! read natkriest 
    104       READ  ( numnat, nampiskrp ) 
     93      REWIND( numnatp )                     ! read natkriest 
     94      READ  ( numnatp, nampiskrp ) 
    10595 
    10696      IF(lwp) THEN 
     
    120110#endif 
    121111      ! 
    122 #if defined key_diatrc && ! defined key_iomput 
     112      IF( .NOT.lk_iomput .AND. ln_diatrc ) THEN 
     113         ! 
     114         ! Namelist nampisdia 
     115         ! ------------------- 
     116         DO jl = 1, jp_pisces_2d 
     117            WRITE(pisdia2d(jl)%sname,'("2D_",I1)') jl                      ! short name 
     118            WRITE(pisdia2d(jl)%lname,'("2D DIAGNOSTIC NUMBER ",I2)') jl    ! long name 
     119            pisdia2d(jl)%units = ' '                                       ! units 
     120         END DO 
     121         !                                 ! 3D output arrays 
     122         DO jl = 1, jp_pisces_3d 
     123            WRITE(pisdia3d(jl)%sname,'("3D_",I1)') jl                      ! short name 
     124            WRITE(pisdia3d(jl)%lname,'("3D DIAGNOSTIC NUMBER ",I2)') jl    ! long name 
     125            pisdia3d(jl)%units = ' '                                       ! units 
     126         END DO 
    123127 
    124       ! Namelist namlobdia 
    125       ! ------------------- 
    126       nn_writedia = 10                   ! default values 
    127  
    128       DO jl = 1, jp_pisces_2d 
    129          jn = jp_pcs0_2d + jl - 1 
    130          WRITE(ctrc2d(jn),'("2D_",I1)') jn                      ! short name 
    131          WRITE(ctrc2l(jn),'("2D DIAGNOSTIC NUMBER ",I2)') jn    ! long name 
    132          ctrc2u(jn) = ' '                                       ! units 
    133       END DO 
    134       !                                 ! 3D output arrays 
    135       DO jl = 1, jp_pisces_3d 
    136          jn = jp_pcs0_3d + jl - 1 
    137          WRITE(ctrc3d(jn),'("3D_",I1)') jn                      ! short name 
    138          WRITE(ctrc3l(jn),'("3D DIAGNOSTIC NUMBER ",I2)') jn    ! long name 
    139          ctrc3u(jn) = ' '                                       ! units 
    140       END DO 
    141  
    142       REWIND( numnat )               ! read natrtd 
    143       READ  ( numnat, nampisdia ) 
    144  
    145       DO jl = 1, jp_pisces_2d 
    146          jn = jp_pcs0_2d + jl - 1 
    147          ctrc2d(jn) = pisdia2d(jl)%snamedia 
    148          ctrc2l(jn) = pisdia2d(jl)%lnamedia 
    149          ctrc2u(jn) = pisdia2d(jl)%unitdia 
    150       END DO 
    151  
    152       DO jl = 1, jp_pisces_3d 
    153          jn = jp_pcs0_3d + jl - 1 
    154          ctrc3d(jn) = pisdia3d(jl)%snamedia 
    155          ctrc3l(jn) = pisdia3d(jl)%lnamedia 
    156          ctrc3u(jn) = pisdia3d(jl)%unitdia 
    157       END DO 
    158  
    159       IF(lwp) THEN                   ! control print 
    160          WRITE(numout,*) 
    161          WRITE(numout,*) ' Namelist : natadd' 
    162          WRITE(numout,*) '    frequency of outputs for additional arrays nn_writedia = ', nn_writedia 
    163          DO jl = 1, jp_pisces_3d 
    164             jn = jp_pcs0_3d + jl - 1 
    165             WRITE(numout,*) '   3d output field No : ',jn 
    166             WRITE(numout,*) '   short name         : ', TRIM(ctrc3d(jn)) 
    167             WRITE(numout,*) '   long name          : ', TRIM(ctrc3l(jn)) 
    168             WRITE(numout,*) '   unit               : ', TRIM(ctrc3u(jn)) 
    169             WRITE(numout,*) ' ' 
    170          END DO 
     128         REWIND( numnatp )               !  
     129         READ  ( numnatp, nampisdia ) 
    171130 
    172131         DO jl = 1, jp_pisces_2d 
    173132            jn = jp_pcs0_2d + jl - 1 
    174             WRITE(numout,*) '   2d output field No : ',jn 
    175             WRITE(numout,*) '   short name         : ', TRIM(ctrc2d(jn)) 
    176             WRITE(numout,*) '   long name          : ', TRIM(ctrc2l(jn)) 
    177             WRITE(numout,*) '   unit               : ', TRIM(ctrc2u(jn)) 
     133            ctrc2d(jn) = pisdia2d(jl)%sname 
     134            ctrc2l(jn) = pisdia2d(jl)%lname 
     135            ctrc2u(jn) = pisdia2d(jl)%units 
     136         END DO 
     137 
     138         DO jl = 1, jp_pisces_3d 
     139            jn = jp_pcs0_3d + jl - 1 
     140            ctrc3d(jn) = pisdia3d(jl)%sname 
     141            ctrc3l(jn) = pisdia3d(jl)%lname 
     142            ctrc3u(jn) = pisdia3d(jl)%units 
     143         END DO 
     144 
     145         IF(lwp) THEN                   ! control print 
     146            WRITE(numout,*) 
     147            WRITE(numout,*) ' Namelist : natadd' 
     148            DO jl = 1, jp_pisces_3d 
     149               jn = jp_pcs0_3d + jl - 1 
     150               WRITE(numout,*) '  3d diag nb : ', jn, '    short name : ', ctrc3d(jn), & 
     151                 &             '  long name  : ', ctrc3l(jn), '   unit : ', ctrc3u(jn) 
     152            END DO 
    178153            WRITE(numout,*) ' ' 
    179          END DO 
     154 
     155            DO jl = 1, jp_pisces_2d 
     156               jn = jp_pcs0_2d + jl - 1 
     157               WRITE(numout,*) '  2d diag nb : ', jn, '    short name : ', ctrc2d(jn), & 
     158                 &             '  long name  : ', ctrc2l(jn), '   unit : ', ctrc2u(jn) 
     159            END DO 
     160            WRITE(numout,*) ' ' 
     161         ENDIF 
     162         ! 
    180163      ENDIF 
    181 #endif 
    182164 
    183       REWIND( numnat ) 
    184       READ  ( numnat, nampisdmp ) 
     165      REWIND( numnatp ) 
     166      READ  ( numnatp, nampisdmp ) 
    185167 
    186168      IF(lwp) THEN                         ! control print 
  • branches/2011/dev_r2787_LOCEAN3_TRA_TRP/NEMOGCM/NEMO/TOP_SRC/PISCES/trcrst_pisces.F90

    r2715 r2819  
    4343 
    4444      ! 
    45       IF( lk_dtatrc .AND. ln_pisclo ) CALL pis_dmp_clo  ! restoring of nutrients on close seas 
     45      IF( ln_trcdta .AND. ln_pisclo ) CALL pis_dmp_clo  ! restoring of nutrients on close seas 
    4646      IF( ln_pisdmp )                 CALL pis_dmp_ini  ! relaxation of some tracers 
    4747      ! 
     
    5353         CALL iom_get( knum, jpdom_autoglo, 'PH' , hi(:,:,:)  ) 
    5454      ELSE 
     55         hi(:,:,:) = 1.e-9  
    5556         ! Set PH from  total alkalinity, borat (???), akb3 (???) and ak23 (???) 
    5657         ! -------------------------------------------------------- 
    57          DO jk = 1, jpk 
    58             DO jj = 1, jpj 
    59                DO ji = 1, jpi 
    60                   ztmas   = tmask(ji,jj,jk) 
    61                   ztmas1  = 1. - tmask(ji,jj,jk) 
    62                   zcaralk = trn(ji,jj,jk,jptal) - borat(ji,jj,jk) / (  1. + 1.E-8 / ( rtrn + akb3(ji,jj,jk) )  ) 
    63                   zco3    = ( zcaralk - trn(ji,jj,jk,jpdic) ) * ztmas + 0.5e-3 * ztmas1 
    64                   zbicarb = ( 2. * trn(ji,jj,jk,jpdic) - zcaralk ) 
    65                   hi(ji,jj,jk) = ( ak23(ji,jj,jk) * zbicarb / zco3 ) * ztmas + 1.e-9 * ztmas1 
    66                END DO 
    67             END DO 
    68          END DO 
     58      !   DO jk = 1, jpk 
     59      !      DO jj = 1, jpj 
     60      !         DO ji = 1, jpi 
     61      !            ztmas   = tmask(ji,jj,jk) 
     62      !            ztmas1  = 1. - tmask(ji,jj,jk) 
     63      !            zcaralk = trn(ji,jj,jk,jptal) - borat(ji,jj,jk) / (  1. + 1.E-8 / ( rtrn + akb3(ji,jj,jk) )  ) 
     64      !            zco3    = ( zcaralk - trn(ji,jj,jk,jpdic) ) * ztmas + 0.5e-3 * ztmas1 
     65      !            zbicarb = ( 2. * trn(ji,jj,jk,jpdic) - zcaralk ) 
     66      !           hi(ji,jj,jk) = ( ak23(ji,jj,jk) * zbicarb / zco3 ) * ztmas + 1.e-9 * ztmas1 
     67      !         END DO 
     68      !      END DO 
     69      !   END DO 
    6970      ENDIF 
    7071      CALL iom_get( knum, jpdom_autoglo, 'Silicalim', xksi(:,:) )  
     
    120121 
    121122         zarea   = 1. / areatot * 1.e6 
    122 # if defined key_degrad 
    123          zalksum = glob_sum( trn(:,:,:,jptal) * cvol(:,:,:) * facvol(:,:,:) ) * zarea 
    124          zpo4sum = glob_sum( trn(:,:,:,jppo4) * cvol(:,:,:) * facvol(:,:,:) ) * zarea / 122. 
    125          zno3sum = glob_sum( trn(:,:,:,jpno3) * cvol(:,:,:) * facvol(:,:,:) ) * zarea / 7.6 
    126          zsilsum = glob_sum( trn(:,:,:,jpsil) * cvol(:,:,:) * facvol(:,:,:) ) * zarea 
    127 # else 
    128          zalksum = glob_sum( trn(:,:,:,jptal) * cvol(:,:,:)  ) * zarea 
    129          zpo4sum = glob_sum( trn(:,:,:,jppo4) * cvol(:,:,:)  ) * zarea / 122. 
    130          zno3sum = glob_sum( trn(:,:,:,jpno3) * cvol(:,:,:)  ) * zarea / 7.6 
    131          zsilsum = glob_sum( trn(:,:,:,jpsil) * cvol(:,:,:)  ) * zarea 
    132 # endif 
     123         IF( lk_degrad ) THEN 
     124            zalksum = glob_sum( trn(:,:,:,jptal) * cvol(:,:,:) * facvol(:,:,:) ) * zarea 
     125            zpo4sum = glob_sum( trn(:,:,:,jppo4) * cvol(:,:,:) * facvol(:,:,:) ) * zarea / 122. 
     126            zno3sum = glob_sum( trn(:,:,:,jpno3) * cvol(:,:,:) * facvol(:,:,:) ) * zarea / 7.6 
     127            zsilsum = glob_sum( trn(:,:,:,jpsil) * cvol(:,:,:) * facvol(:,:,:) ) * zarea 
     128         ELSE 
     129            zalksum = glob_sum( trn(:,:,:,jptal) * cvol(:,:,:)  ) * zarea 
     130            zpo4sum = glob_sum( trn(:,:,:,jppo4) * cvol(:,:,:)  ) * zarea / 122. 
     131            zno3sum = glob_sum( trn(:,:,:,jpno3) * cvol(:,:,:)  ) * zarea / 7.6 
     132            zsilsum = glob_sum( trn(:,:,:,jpsil) * cvol(:,:,:)  ) * zarea 
     133         ENDIF 
    133134 
    134135         IF(lwp) WRITE(numout,*) '       TALK mean : ', zalksum 
     
    168169      !!                ictsi2(), ictsj2() : north-east Closed sea limits (i,j) 
    169170      !!---------------------------------------------------------------------- 
    170       INTEGER, PARAMETER           ::   npicts   = 4       !: number of closed sea 
    171       INTEGER, DIMENSION(npicts)   ::   ictsi1, ictsj1     !: south-west closed sea limits (i,j) 
    172       INTEGER, DIMENSION(npicts)   ::   ictsi2, ictsj2     !: north-east closed sea limits (i,j) 
    173       INTEGER :: ji, jj, jk, jn, jc            ! dummy loop indices 
     171      INTEGER, PARAMETER           ::   npicts   = 4        ! number of closed sea 
     172      INTEGER, DIMENSION(npicts)   ::   ictsi1, ictsj1      ! south-west closed sea limits (i,j) 
     173      INTEGER, DIMENSION(npicts)   ::   ictsi2, ictsj2      ! north-east closed sea limits (i,j) 
     174      INTEGER :: ji, jj, jk, jn, jl, jc                     ! dummy loop indices 
     175      INTEGER :: ierr                                       ! local integer 
     176      REAL(wp), ALLOCATABLE, DIMENSION(:,:,:,:) ::  ztrcdta ! 4D  workspace 
    174177      !!---------------------------------------------------------------------- 
    175178 
     
    243246      END DO 
    244247 
    245 #if defined key_dtatrc 
    246248      ! Restore close seas values to initial data 
    247       CALL trc_dta( nit000 )  
    248       DO jn = 1, jptra 
    249          IF( lutini(jn) ) THEN 
    250             DO jc = 1, npicts 
    251                DO jk = 1, jpkm1 
    252                   DO jj = ictsj1(jc), ictsj2(jc) 
    253                      DO ji = ictsi1(jc), ictsi2(jc) 
    254                         trn(ji,jj,jk,jn) = trdta(ji,jj,jk,jn) * tmask(ji,jj,jk)  
    255                         trb(ji,jj,jk,jn) = trn(ji,jj,jk,jn) 
    256                      ENDDO 
    257                   ENDDO 
    258                ENDDO 
    259             ENDDO 
    260          ENDIF 
    261       ENDDO 
    262 #endif 
    263    ! 
     249      IF( nb_trcdta > 0 ) THEN  ! Initialisation of tracer from a file that may also be used for damping 
     250        ALLOCATE( ztrcdta(jpi,jpj,jpk,nb_trcdta), STAT=ierr ) 
     251        IF( ierr > 0 ) THEN 
     252           CALL ctl_stop( 'trc_ini: unable to allocate ztrcdta array' )   ;   RETURN 
     253        ENDIF 
     254        ! 
     255        CALL trc_dta( nit000, ztrcdta )   ! read tracer data at nit000 
     256        ! 
     257        DO jn = 1, jptra 
     258           IF( ln_trc_ini(jn) ) THEN      ! update passive tracers arrays with input data read from file 
     259              jl = n_trc_index(jn) 
     260              DO jc = 1, npicts 
     261                 DO jk = 1, jpkm1 
     262                    DO jj = ictsj1(jc), ictsj2(jc) 
     263                       DO ji = ictsi1(jc), ictsi2(jc) 
     264                          trn(ji,jj,jk,jn) = ztrcdta(ji,jj,jk,jl) * tmask(ji,jj,jk)  
     265                          trb(ji,jj,jk,jn) = trn(ji,jj,jk,jn) 
     266                       ENDDO 
     267                    ENDDO 
     268                 ENDDO 
     269              ENDDO 
     270           ENDIF 
     271        ENDDO 
     272        DEALLOCATE( ztrcdta ) 
     273      ENDIF 
     274      ! 
    264275   END SUBROUTINE pis_dmp_clo 
    265276 
  • branches/2011/dev_r2787_LOCEAN3_TRA_TRP/NEMOGCM/NEMO/TOP_SRC/PISCES/trcsms_pisces.F90

    r2715 r2819  
    1313   !!   trcsms_pisces        :  Time loop of passive tracers sms 
    1414   !!---------------------------------------------------------------------- 
    15    USE oce_trc         ! 
    16    USE trc 
    17    USE sms_pisces 
    18     
    19    USE p4zint          !  
    20    USE p4zche          !  
    21    USE p4zbio          !  
    22    USE p4zsink         !  
    23    USE p4zopt          !  
    24    USE p4zlim          !  
    25    USE p4zprod         ! 
    26    USE p4zmort         ! 
    27    USE p4zmicro        !  
    28    USE p4zmeso         !  
    29    USE p4zrem          !  
    30    USE p4zsed          !  
    31    USE p4zlys          !  
    32    USE p4zflx          !  
    33  
    34    USE prtctl_trc 
    35  
    36    USE trdmod_oce 
    37    USE trdmod_trc 
    38  
    39    USE sedmodel 
     15   USE oce_trc         !  shared variables between ocean and passive tracers 
     16   USE trc             !  passive tracers common variables  
     17   USE sms_pisces      !  PISCES Source Minus Sink variables 
     18   USE p4zbio          !  Biological model 
     19   USE p4zche          !  Chemical model 
     20   USE p4zsink         !  vertical flux of particulate matter due to sinking 
     21   USE p4zopt          !  optical model 
     22   USE p4zlim          !  Co-limitations of differents nutrients 
     23   USE p4zprod         !  Growth rate of the 2 phyto groups 
     24   USE p4zmort         !  Mortality terms for phytoplankton 
     25   USE p4zmicro        !  Sources and sinks of microzooplankton 
     26   USE p4zmeso         !  Sources and sinks of mesozooplankton 
     27   USE p4zrem          !  Remineralisation of organic matter 
     28   USE p4zlys          !  Calcite saturation 
     29   USE p4zflx          !  Gas exchange 
     30   USE p4zsed          !  Sedimentation 
     31   USE p4zint          !  time interpolation 
     32   USE trdmod_oce      !  Ocean trends variables 
     33   USE trdmod_trc      !  TOP trends variables 
     34   USE sedmodel        !  Sediment model 
     35   USE prtctl_trc      !  print control for debugging 
    4036 
    4137   IMPLICIT NONE 
     
    6460      !!--------------------------------------------------------------------- 
    6561      USE wrk_nemo, ONLY: wrk_in_use, wrk_not_released 
    66       USE wrk_nemo, ONLY: ztrpis => wrk_3d_1   ! used for pisces sms trends 
    6762      ! 
    6863      INTEGER, INTENT( in ) ::   kt      ! ocean time-step index       
     
    7469      IF( kt == nit000 )   CALL trc_sms_pisces_init    ! Initialization (first time-step only) 
    7570 
    76       IF( wrk_in_use(3,1) )  THEN 
    77         CALL ctl_stop('trc_sms_pisces : requested workspace array unavailable.')  ;  RETURN 
    78       ENDIF 
    79  
    8071      IF( ndayflxtr /= nday_year ) THEN      ! New days 
    8172         ! 
     
    8677         IF(lwp) write(numout,*) '~~~~~~' 
    8778 
    88          CALL p4z_che          ! computation of chemical constants 
    89          CALL p4z_int          ! computation of various rates for biogeochemistry 
     79         CALL p4z_che              ! computation of chemical constants 
     80         CALL p4z_int              ! computation of various rates for biogeochemistry 
    9081         ! 
    9182      ENDIF 
     
    112103      IF( l_trdtrc ) THEN 
    113104          DO jn = jp_pcs0, jp_pcs1 
    114             ztrpis(:,:,:) = tra(:,:,:,jn) 
    115             CALL trd_mod_trc( ztrpis, jn, jptra_trd_sms, kt )   ! save trends 
     105            CALL trd_mod_trc( tra(:,:,:,jn), jn, jptra_trd_sms, kt )   ! save trends 
    116106          END DO 
    117           DEALLOCATE( ztrpis ) 
    118107      END IF 
    119108 
     
    127116         ! 
    128117      ENDIF 
    129  
    130       IF( wrk_not_released(3,1) ) CALL ctl_stop('trc_sms_pisces : failed to release workspace array.')  
    131  
     118      ! 
    132119   END SUBROUTINE trc_sms_pisces 
    133120 
     
    164151      xstep = rfact2 / rday 
    165152 
    166       CALL p4z_sink_init      ! vertical flux of particulate organic matter 
    167       CALL p4z_opt_init       ! Optic: PAR in the water column 
    168       CALL p4z_lim_init       ! co-limitations by the various nutrients 
    169       CALL p4z_prod_init      ! phytoplankton growth rate over the global ocean.  
    170       CALL p4z_rem_init       ! remineralisation 
    171       CALL p4z_mort_init      ! phytoplankton mortality 
    172       CALL p4z_micro_init     ! microzooplankton 
    173       CALL p4z_meso_init      ! mesozooplankton 
    174       CALL p4z_sed_init       ! sedimentation 
    175       CALL p4z_lys_init       ! calcite saturation 
    176       CALL p4z_flx_init       ! gas exchange 
     153      CALL p4z_sink_init      !  vertical flux of particulate organic matter 
     154      CALL p4z_opt_init       !  Optic: PAR in the water column 
     155      CALL p4z_lim_init       !  co-limitations by the various nutrients 
     156      CALL p4z_prod_init      !  phytoplankton growth rate over the global ocean.  
     157      CALL p4z_rem_init       !  remineralisation 
     158      CALL p4z_mort_init      !  phytoplankton mortality 
     159      CALL p4z_micro_init     !  microzooplankton 
     160      CALL p4z_meso_init      !  mesozooplankton 
     161      CALL p4z_sed_init       !  sedimentation 
     162      CALL p4z_lys_init       !  calcite saturation 
     163      CALL p4z_flx_init       !  gas exchange 
    177164 
    178165      ndayflxtr = 0 
  • branches/2011/dev_r2787_LOCEAN3_TRA_TRP/NEMOGCM/NEMO/TOP_SRC/TRP/trcldf.F90

    r2715 r2819  
    1818   USE trc             ! ocean passive tracers variables 
    1919   USE trcnam_trp      ! passive tracers transport namelist variables 
    20    USE ldftra_oce      ! lateral diffusion coefficient on tracers 
    2120   USE ldfslp          ! ??? 
    2221   USE traldf_bilapg   ! lateral mixing            (tra_ldf_bilapg routine) 
     
    3332   PUBLIC   trc_ldf    ! called by step.F90  
    3433   !                                                 !!: ** lateral mixing namelist (nam_trcldf) ** 
    35    INTEGER ::   nldf = 0   ! type of lateral diffusion used defined from ln_trcldf_... namlist logicals) 
     34   REAL(wp) ::  rldf_rat    ! ratio between active and passive tracers diffusive coefficient 
     35   INTEGER  ::  nldf = 0   ! type of lateral diffusion used defined from ln_trcldf_... namlist logicals) 
    3636   !! * Substitutions 
    3737#  include "domzgr_substitute.h90" 
     
    6161      IF( kt == nit000 )   CALL ldf_ctl          ! initialisation & control of options 
    6262 
     63      rldf = rldf_rat 
     64 
    6365      IF( l_trdtrc )  THEN  
    6466         ALLOCATE( ztrtrd(jpi,jpj,jpk,jptra) )  ! temporary save of trends 
     
    6769 
    6870      SELECT CASE ( nldf )                       ! compute lateral mixing trend and add it to the general trend 
    69       CASE ( 0 )   ;   CALL tra_ldf_lap   ( kt, 'TRC', gtru, gtrv, trb, tra, jptra            )  ! iso-level laplacian 
    70       CASE ( 1 )   ;   CALL tra_ldf_iso   ( kt, 'TRC', gtru, gtrv, trb, tra, jptra, rn_ahtb_0 )  ! rotated laplacian  
    71       CASE ( 2 )   ;   CALL tra_ldf_bilap ( kt, 'TRC', gtru, gtrv, trb, tra, jptra            )  ! iso-level bilaplacian 
    72       CASE ( 3 )   ;   CALL tra_ldf_bilapg( kt, 'TRC',             trb, tra, jptra            )  ! s-coord. horizontal bilaplacian 
     71      CASE ( 0 )   ;   CALL tra_ldf_lap   ( kt, 'TRC', gtru, gtrv, trb, tra, jptra             )  ! iso-level laplacian 
     72      CASE ( 1 )   ;   CALL tra_ldf_iso   ( kt, 'TRC', gtru, gtrv, trb, tra, jptra, rn_ahtrb_0 )  ! rotated laplacian  
     73      CASE ( 2 )   ;   CALL tra_ldf_bilap ( kt, 'TRC', gtru, gtrv, trb, tra, jptra             )  ! iso-level bilaplacian 
     74      CASE ( 3 )   ;   CALL tra_ldf_bilapg( kt, 'TRC',             trb, tra, jptra             )  ! s-coord. horizontal bilaplacian 
    7375         ! 
    7476      CASE ( -1 )                                     ! esopa: test all possibility with control print 
    75          CALL tra_ldf_lap   ( kt, 'TRC', gtru, gtrv, trb, tra, jptra            ) 
     77         CALL tra_ldf_lap   ( kt, 'TRC', gtru, gtrv, trb, tra, jptra             ) 
    7678         WRITE(charout, FMT="('ldf0 ')") ;  CALL prt_ctl_trc_info(charout) 
    7779                                            CALL prt_ctl_trc( tab4d=tra, mask=tmask, clinfo=ctrcnm, clinfo2='trd' ) 
    78          CALL tra_ldf_iso   ( kt, 'TRC', gtru, gtrv, trb, tra, jptra, rn_ahtb_0 ) 
     80         CALL tra_ldf_iso   ( kt, 'TRC', gtru, gtrv, trb, tra, jptra, rn_ahtrb_0 ) 
    7981         WRITE(charout, FMT="('ldf1 ')") ;  CALL prt_ctl_trc_info(charout) 
    8082                                            CALL prt_ctl_trc( tab4d=tra, mask=tmask, clinfo=ctrcnm, clinfo2='trd' ) 
    81          CALL tra_ldf_bilap ( kt, 'TRC', gtru, gtrv, trb, tra, jptra            ) 
     83         CALL tra_ldf_bilap ( kt, 'TRC', gtru, gtrv, trb, tra, jptra             ) 
    8284         WRITE(charout, FMT="('ldf2 ')") ;  CALL prt_ctl_trc_info(charout) 
    8385                                            CALL prt_ctl_trc( tab4d=tra, mask=tmask, clinfo=ctrcnm, clinfo2='trd' ) 
    84          CALL tra_ldf_bilapg( kt, 'TRC',             trb, tra, jptra            ) 
     86         CALL tra_ldf_bilapg( kt, 'TRC',             trb, tra, jptra             ) 
    8587         WRITE(charout, FMT="('ldf3 ')") ;  CALL prt_ctl_trc_info(charout) 
    8688                                            CALL prt_ctl_trc( tab4d=tra, mask=tmask, clinfo=ctrcnm, clinfo2='trd' ) 
     
    119121      INTEGER ::   ioptio, ierr         ! temporary integers  
    120122      !!---------------------------------------------------------------------- 
     123 
     124      rldf_rat = rn_ahtrc_0 / rn_aht_0 
    121125 
    122126      !  Define the lateral mixing oparator for tracers 
     
    206210      ENDIF 
    207211 
     212      IF( ln_trcldf_bilap ) THEN 
     213         IF(lwp) WRITE(numout,*) '          biharmonic tracer diffusion' 
     214         IF( rn_ahtrc_0 > 0 .AND. .NOT. lk_esopa )   CALL ctl_stop( 'The horizontal diffusivity coef. rn_ahtrc_0 must be negative' ) 
     215      ELSE 
     216         IF(lwp) WRITE(numout,*) '          harmonic tracer diffusion (default)' 
     217         IF( rn_ahtrc_0 < 0 .AND. .NOT. lk_esopa )   CALL ctl_stop('The horizontal diffusivity coef. rn_ahtrc_0 must be positive' ) 
     218      ENDIF 
     219 
     220      ! ratio between active and passive tracers diffusive coef. 
     221      rldf_rat = rn_ahtrc_0 / rn_aht_0 
     222      IF( rldf_rat < 0 ) THEN 
     223         IF( .NOT.lk_offline ) THEN  
     224            CALL ctl_stop( 'Choose the same type of diffusive scheme both for active & passive tracers' ) 
     225         ELSE 
     226            CALL ctl_stop( 'Change the sign of rn_aht_0 in namelist to -/+1' ) 
     227         ENDIF  
     228      ENDIF 
    208229      ! 
    209230   END SUBROUTINE ldf_ctl 
  • branches/2011/dev_r2787_LOCEAN3_TRA_TRP/NEMOGCM/NEMO/TOP_SRC/TRP/trcnam_trp.F90

    r2528 r2819  
    3636   LOGICAL , PUBLIC ::   ln_trcldf_hor   = .FALSE.    !: horizontal (geopotential) direction 
    3737   LOGICAL , PUBLIC ::   ln_trcldf_iso   = .TRUE.     !: iso-neutral direction 
     38   REAL(wp), PUBLIC ::   rn_ahtrc_0                   !: diffusivity coefficient for passive tracer (m2/s) 
    3839   REAL(wp), PUBLIC ::   rn_ahtrb_0                   !: background diffusivity coefficient for passive tracer (m2/s) 
    3940 
     
    7677      NAMELIST/namtrc_ldf/ ln_trcldf_diff , ln_trcldf_lap  ,     & 
    7778         &                 ln_trcldf_bilap, ln_trcldf_level,     & 
    78          &                 ln_trcldf_hor  , ln_trcldf_iso  , rn_ahtrb_0 
     79         &                 ln_trcldf_hor  , ln_trcldf_iso  , rn_ahtrc_0, rn_ahtrb_0 
    7980      NAMELIST/namtrc_zdf/ ln_trczdf_exp  , nn_trczdf_exp 
    8081      NAMELIST/namtrc_rad/ ln_trcrad 
     
    119120         WRITE(numout,*) '      horizontal (geopotential)                          ln_trcldf_hor   = ', ln_trcldf_hor 
    120121         WRITE(numout,*) '      iso-neutral                                        ln_trcldf_iso   = ', ln_trcldf_iso 
     122         WRITE(numout,*) '      diffusivity coefficient                                 rn_ahtrc_0 = ', rn_ahtrc_0 
    121123         WRITE(numout,*) '      background hor. diffusivity                             rn_ahtrb_0 = ', rn_ahtrb_0 
    122124      ENDIF 
  • branches/2011/dev_r2787_LOCEAN3_TRA_TRP/NEMOGCM/NEMO/TOP_SRC/oce_trc.F90

    r2789 r2819  
    196196   USE oce , ONLY :   gru     =>    gru     !: 
    197197   USE oce , ONLY :   grv     =>    grv     !:  
    198 # if defined key_degrad 
    199    USE dommsk , ONLY :   facvol     =>   facvol     !: volume factor for degradation 
    200 # endif 
    201  
    202198#endif 
    203199 
     
    224220 
    225221   !* lateral diffusivity (tracers) * 
    226    USE ldftra_oce , ONLY :   aht0    =>   aht0     !: horizontal eddy diffusivity for tracers (m2/s) 
    227    USE ldftra_oce , ONLY :   ahtb0   =>   ahtb0    !: background eddy diffusivity for isopycnal diff. (m2/s) 
    228    USE ldftra_oce , ONLY :   ahtu    =>   ahtu     !: lateral diffusivity coef. at u-points  
    229    USE ldftra_oce , ONLY :   ahtv    =>   ahtv     !: lateral diffusivity coef. at v-points  
    230    USE ldftra_oce , ONLY :   ahtw    =>   ahtw     !: lateral diffusivity coef. at w-points  
    231    USE ldftra_oce , ONLY :   ahtt    =>   ahtt     !: lateral diffusivity coef. at t-points 
    232    USE ldftra_oce , ONLY :   aeiv0   =>   aeiv0    !: eddy induced velocity coefficient (m2/s)  
    233    USE ldftra_oce , ONLY :   aeiu    =>   aeiu     !: eddy induced velocity coef. at u-points (m2/s)    
    234    USE ldftra_oce , ONLY :   aeiv    =>   aeiv     !: eddy induced velocity coef. at v-points (m2/s)  
    235    USE ldftra_oce , ONLY :   aeiw    =>   aeiw     !: eddy induced velocity coef. at w-points (m2/s)  
     222   USE ldftra_oce , ONLY :  rldf     =>   rldf        !: multiplicative coef. for lateral diffusivity 
     223   USE ldftra_oce , ONLY :  rn_aht_0 =>   rn_aht_0    !: horizontal eddy diffusivity for tracers (m2/s) 
     224   USE ldftra_oce , ONLY :  aht0     =>   aht0        !: horizontal eddy diffusivity for tracers (m2/s) 
     225   USE ldftra_oce , ONLY :  ahtb0    =>   ahtb0       !: background eddy diffusivity for isopycnal diff. (m2/s) 
     226   USE ldftra_oce , ONLY :  ahtu     =>   ahtu        !: lateral diffusivity coef. at u-points  
     227   USE ldftra_oce , ONLY :  ahtv     =>   ahtv        !: lateral diffusivity coef. at v-points  
     228   USE ldftra_oce , ONLY :  ahtw     =>   ahtw        !: lateral diffusivity coef. at w-points  
     229   USE ldftra_oce , ONLY :  ahtt     =>   ahtt        !: lateral diffusivity coef. at t-points 
     230   USE ldftra_oce , ONLY :  aeiv0    =>   aeiv0       !: eddy induced velocity coefficient (m2/s)  
     231   USE ldftra_oce , ONLY :  aeiu     =>   aeiu        !: eddy induced velocity coef. at u-points (m2/s)    
     232   USE ldftra_oce , ONLY :  aeiv     =>   aeiv        !: eddy induced velocity coef. at v-points (m2/s)  
     233   USE ldftra_oce , ONLY :  aeiw     =>   aeiw        !: eddy induced velocity coef. at w-points (m2/s)  
     234   USE ldftra_oce , ONLY :  lk_traldf_eiv  =>  lk_traldf_eiv     !: eddy induced velocity flag 
    236235 
    237236   !* vertical diffusion * 
    238237   USE zdf_oce , ONLY :   avt        =>   avt         !: vert. diffusivity coef. at w-point for temp   
    239238# if defined key_zdfddm 
    240    USE zdfddm  , ONLY :   avs        =>   avs        !: salinity vertical diffusivity coeff. at w-point 
     239   USE zdfddm  , ONLY :   avs        =>   avs         !: salinity vertical diffusivity coeff. at w-point 
    241240# endif 
    242241 
  • branches/2011/dev_r2787_LOCEAN3_TRA_TRP/NEMOGCM/NEMO/TOP_SRC/trc.F90

    r2715 r2819  
    2121   PUBLIC   trc_alloc   ! called by nemogcm.F90 
    2222 
    23    !! passive tracers names and units (read in namelist) 
    24    !! -------------------------------------------------- 
    25    CHARACTER(len=12), PUBLIC, DIMENSION(jptra) ::   ctrcnm     !: tracer name  
    26    CHARACTER(len=12), PUBLIC, DIMENSION(jptra) ::   ctrcun     !: tracer unit 
    27    CHARACTER(len=80), PUBLIC, DIMENSION(jptra) ::   ctrcnl     !: tracer long name  
    28     
    29     
    3023   !! parameters for the control of passive tracers 
    3124   !! -------------------------------------------------- 
    32    INTEGER, PUBLIC                   ::   numnat   !: the number of the passive tracer NAMELIST 
    33    LOGICAL, PUBLIC, DIMENSION(jptra) ::   lutini   !:  initialisation from FILE or not (NAMELIST) 
    34    LOGICAL, PUBLIC, DIMENSION(jptra) ::   lutsav   !:  save the tracer or not 
     25   INTEGER, PUBLIC                                                 ::   numnat        !: the number of the passive tracer NAMELIST 
    3526 
    3627   !! passive tracers fields (before,now,after) 
    3728   !! -------------------------------------------------- 
    38    REAL(wp), PUBLIC ::   trai                          !: initial total tracer 
    39    REAL(wp), PUBLIC ::   areatot                       !: total volume  
    40    REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION (:,:,:)   ::   cvol   !: volume correction -degrad option-  
    41    REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION (:,:,:,:) ::   trn    !: traceur concentration for now time step 
    42    REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION (:,:,:,:) ::   tra    !: traceur concentration for next time step 
    43    REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION (:,:,:,:) ::   trb    !: traceur concentration for before time step 
     29   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:)               ::  trai           !: initial total tracer 
     30   REAL(wp), PUBLIC                                                ::  areatot        !: total volume  
     31   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:  )         ::  cvol           !: volume correction -degrad option-  
     32   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:,:)         ::  trn            !: traceur concentration for now time step 
     33   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:,:)         ::  tra            !: traceur concentration for next time step 
     34   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:,:)         ::  trb            !: traceur concentration for before time step 
    4435 
    4536   !! interpolated gradient 
    4637   !!--------------------------------------------------   
    47    REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION (:,:,:) ::   gtru   !: hor. gradient at u-points at bottom ocean level 
    48    REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION (:,:,:) ::   gtrv   !: hor. gradient at v-points at bottom ocean level 
     38   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:)           ::  gtru           !: hor. gradient at u-points at bottom ocean level 
     39   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:)           ::  gtrv           !: hor. gradient at v-points at bottom ocean level 
    4940    
    50    !! passive tracers restart (input and output) 
     41   !! passive tracers (input and output) 
    5142   !! ------------------------------------------   
    52    LOGICAL          , PUBLIC ::  ln_rsttr        !: boolean term for restart i/o for passive tracers (namelist) 
    53    LOGICAL          , PUBLIC ::  lrst_trc        !: logical to control the trc restart write 
    54    INTEGER          , PUBLIC ::  nn_dttrc        !: frequency of step on passive tracers 
    55    INTEGER          , PUBLIC ::  nutwrs          !: output FILE for passive tracers restart 
    56    INTEGER          , PUBLIC ::  nutrst          !: logical unit for restart FILE for passive tracers 
    57    INTEGER          , PUBLIC ::  nn_rsttr        !: control of the time step ( 0 or 1 ) for pass. tr. 
    58    CHARACTER(len=50), PUBLIC ::  cn_trcrst_in    !: suffix of pass. tracer restart name (input) 
    59    CHARACTER(len=50), PUBLIC ::  cn_trcrst_out   !: suffix of pass. tracer restart name (output) 
    60     
     43   LOGICAL             , PUBLIC                                    ::  ln_rsttr       !: boolean term for restart i/o for passive tracers (namelist) 
     44   LOGICAL             , PUBLIC                                    ::  lrst_trc       !: logical to control the trc restart write 
     45   INTEGER             , PUBLIC                                    ::  nn_dttrc       !: frequency of step on passive tracers 
     46   INTEGER             , PUBLIC                                    ::  nn_writetrc    !: time step frequency for concentration outputs (namelist) 
     47   INTEGER             , PUBLIC                                    ::  nutwrs         !: output FILE for passive tracers restart 
     48   INTEGER             , PUBLIC                                    ::  nutrst         !: logical unit for restart FILE for passive tracers 
     49   INTEGER             , PUBLIC                                    ::  nn_rsttr       !: control of the time step ( 0 or 1 ) for pass. tr. 
     50   CHARACTER(len = 80) , PUBLIC                                    ::  cn_trcrst_in   !: suffix of pass. tracer restart name (input) 
     51   CHARACTER(len = 80) , PUBLIC                                    ::  cn_trcrst_out  !: suffix of pass. tracer restart name (output) 
     52   REAL(wp)            , PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:)   ::  rdttrc         !: vertical profile of passive tracer time step 
     53   LOGICAL             , PUBLIC                                    ::  ln_trcdta      !: Read inputs data from files 
     54   LOGICAL             , PUBLIC                                    ::  ln_trcdmp      !: internal damping flag 
     55 
    6156   !! information for outputs 
    6257   !! -------------------------------------------------- 
    63    INTEGER , PUBLIC ::   nn_writetrc   !: time step frequency for concentration outputs (namelist) 
    64    REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:) ::   rdttrc        !: vertical profile of passive tracer time step 
    65     
    66 # if defined key_diatrc && ! defined key_iomput 
     58   TYPE, PUBLIC :: PTRACER                                                            !: Passive tracer type 
     59       CHARACTER(len = 20)  :: clsname  !: short name 
     60       CHARACTER(len = 80)  :: cllname  !: long name 
     61       CHARACTER(len = 20)  :: clunit   !: unit 
     62       LOGICAL              :: llinit   !: read in a file or not 
     63       LOGICAL              :: llsave   !: save the tracer or not 
     64   END TYPE PTRACER 
     65   CHARACTER(len = 20), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:)    ::  ctrcnm         !: tracer name  
     66   CHARACTER(len = 80), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:)    ::  ctrcln         !: trccer field long name 
     67   CHARACTER(len = 20), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:)    ::  ctrcun         !: tracer unit 
     68   LOGICAL            , PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:)    ::  ln_trc_ini     !: Initialisation from data input file 
     69   LOGICAL            , PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:)    ::  ln_trc_wri     !: save the tracer or not 
     70 
     71   TYPE, PUBLIC :: DIAG                                                               !: passive trcacer ddditional diagnostic type 
     72      CHARACTER(len = 20)  :: sname    !: short name 
     73      CHARACTER(len = 80)  :: lname    !: long name 
     74      CHARACTER(len = 20)  :: units    !: unit 
     75   END TYPE DIAG 
     76 
    6777   !! additional 2D/3D outputs namelist 
    6878   !! -------------------------------------------------- 
    69    INTEGER         , PUBLIC                      ::   nn_writedia   !: frequency of additional arrays outputs(namelist) 
    70    CHARACTER(len= 8), PUBLIC, DIMENSION(jpdia2d) ::   ctrc2d      !: 2d output field name 
    71    CHARACTER(len= 8), PUBLIC, DIMENSION(jpdia2d) ::   ctrc2u      !: 2d output field unit    
    72    CHARACTER(len= 8), PUBLIC, DIMENSION(jpdia3d) ::   ctrc3d      !: 3d output field name 
    73    CHARACTER(len= 8), PUBLIC, DIMENSION(jpdia3d) ::   ctrc3u      !: 3d output field unit 
    74    CHARACTER(len=80), PUBLIC, DIMENSION(jpdia2d) ::   ctrc2l      !: 2d output field long name 
    75    CHARACTER(len=80), PUBLIC, DIMENSION(jpdia3d) ::   ctrc3l      !: 3d output field long name 
     79   REAL(wp)           , PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,  :) ::   trc2d         !: additional 2d outputs array  
     80   REAL(wp)           , PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:,:) ::   trc3d         !: additional 3d outputs array  
     81   CHARACTER(len = 20), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:)       ::   ctrc2d        !: 2d field short name 
     82   CHARACTER(len = 80), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:)       ::   ctrc2l        !: 2d field long name 
     83   CHARACTER(len = 20), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:)       ::   ctrc2u        !: 2d field unit 
     84   CHARACTER(len = 20), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:)       ::   ctrc3d        !: 3d field short name 
     85   CHARACTER(len = 80), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:)       ::   ctrc3l        !: 3d field long name 
     86   CHARACTER(len = 20), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:)       ::   ctrc3u        !: 3d field unit 
     87   LOGICAL            , PUBLIC                                        ::  ln_diatrc      !: boolean term for additional diagnostic 
     88   INTEGER            , PUBLIC                                        ::  nn_writedia    !: frequency of additional outputs 
    7689 
    77    REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,  :) ::   trc2d    !:  additional 2d outputs   
    78    REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:,:) ::   trc3d    !:  additional 3d outputs   
    79 # endif 
    80  
    81 # if defined key_diabio || defined key_trdmld_trc 
    82    !                                                              !!*  namtop_XXX namelist * 
    83    INTEGER , PUBLIC                               ::   nn_writebio   !: time step frequency for biological outputs  
    84    CHARACTER(len=8 ), PUBLIC, DIMENSION(jpdiabio) ::   ctrbio      !: biological trends name       
    85    CHARACTER(len=20), PUBLIC, DIMENSION(jpdiabio) ::   ctrbiu      !: biological trends unit    
    86    CHARACTER(len=80), PUBLIC, DIMENSION(jpdiabio) ::   ctrbil      !: biological trends long name 
    87 # endif 
    88 # if defined key_diabio 
    8990   !! Biological trends 
    9091   !! ----------------- 
    91    REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:,:) ::   trbio   !: biological trends 
    92 # endif 
    93  
    94     
    95    !! passive tracers data read and at given time_step 
    96    !! -------------------------------------------------- 
    97 # if defined key_dtatrc 
    98    INTEGER , PUBLIC, DIMENSION(jptra) ::   numtr   !: logical unit for passive tracers data 
    99 # endif 
     92   LOGICAL            , PUBLIC                                        ::  ln_diabio      !: boolean term for biological diagnostic 
     93   INTEGER            , PUBLIC                                        ::  nn_writebio    !: frequency of biological outputs 
     94   REAL(wp)           , PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:,:) ::  trbio          !: biological trends 
     95   CHARACTER(len = 20), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:)       ::  ctrbio         !: bio field short name 
     96   CHARACTER(len = 80), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:)       ::  ctrbil         !: bio field long name 
     97   CHARACTER(len = 20), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:)       ::  ctrbiu         !: bio field unit 
    10098 
    10199   !!---------------------------------------------------------------------- 
     
    113111      !!------------------------------------------------------------------- 
    114112      ! 
    115       ALLOCATE( cvol(jpi,jpj,jpk      ) ,                           & 
    116          &      trn (jpi,jpj,jpk,jptra) ,                           & 
    117          &      tra (jpi,jpj,jpk,jptra) ,                           & 
    118          &      trb (jpi,jpj,jpk,jptra) ,                           & 
    119          &      gtru(jpi,jpj    ,jptra) , gtrv(jpi,jpj,jptra) ,     & 
    120 # if defined key_diatrc && ! defined key_iomput 
    121          &      trc2d(jpi,jpj,jpdia2d), trc3d(jpi,jpj,jpk,jpdia3d), & 
    122 # endif 
    123 # if defined key_diabio 
    124          &      trbio(jpi,jpj,jpk,jpdiabio),                        & 
    125 #endif 
    126                rdttrc(jpk) ,  STAT=trc_alloc )       
     113      ALLOCATE( trn(jpi,jpj,jpk,jptra), trb(jpi,jpj,jpk,jptra), tra(jpi,jpj,jpk,jptra),       &   
     114         &      gtru(jpi,jpj,jpk)     , gtrv(jpi,jpj,jpk)                             ,       & 
     115         &      cvol(jpi,jpj,jpk)     , rdttrc(jpk)           , trai(jptra)           ,       & 
     116         &      ctrcnm(jptra)         , ctrcln(jptra)         , ctrcun(jptra)         ,       &  
     117         &      ln_trc_ini(jptra)     , ln_trc_wri(jptra)                             ,  STAT = trc_alloc  )   
    127118 
    128119      IF( trc_alloc /= 0 )   CALL ctl_warn('trc_alloc: failed to allocate arrays') 
  • branches/2011/dev_r2787_LOCEAN3_TRA_TRP/NEMOGCM/NEMO/TOP_SRC/trcdia.F90

    r2715 r2819  
    1111   !!                  !  2008-05 (C. Ethe re-organization) 
    1212   !!---------------------------------------------------------------------- 
    13 #if defined key_top && ! defined key_iomput 
     13#if defined key_top  
    1414   !!---------------------------------------------------------------------- 
    1515   !!   'key_top'                                                TOP models 
     
    2525   USE par_trc 
    2626   USE dianam    ! build name of file (routine) 
    27    USE ioipsl 
     27   USE ioipsl    ! I/O manager 
     28   USE iom       ! I/O manager 
     29   USE lib_mpp   ! MPP library 
    2830 
    2931   IMPLICIT NONE 
     
    3133 
    3234   PUBLIC   trc_dia        ! called by XXX module  
    33    PUBLIC   trc_dia_alloc  ! called by nemogcm.F90 
    3435 
    3536   INTEGER  ::   nit5      !: id for tracer output file 
     
    4142   INTEGER , ALLOCATABLE, SAVE, DIMENSION (:) ::   ndext50   !: integer arrays for ocean 3D index 
    4243   INTEGER , ALLOCATABLE, SAVE, DIMENSION (:) ::   ndext51   !: integer arrays for ocean surface index 
    43 # if defined key_diatrc 
     44 
    4445   INTEGER  ::   nitd      !: id for additional array output file 
    4546   INTEGER  ::   ndepitd   !: id for depth mesh 
    4647   INTEGER  ::   nhoritd   !: id for horizontal mesh 
    47 # endif 
    48 # if defined key_diabio 
     48 
    4949   INTEGER  ::   nitb        !:         id.         for additional array output file 
    5050   INTEGER  ::   ndepitb   !:  id for depth mesh 
    5151   INTEGER  ::   nhoritb   !:  id for horizontal mesh 
    52 # endif 
    5352 
    5453   !! * Substitutions 
     
    6766      !! ** Purpose :   output passive tracers fields  
    6867      !!--------------------------------------------------------------------- 
    69       INTEGER, INTENT(in) ::   kt   ! ocean time-step 
    70       ! 
    71       INTEGER ::   kindic   ! local integer 
     68      INTEGER, INTENT(in) ::   kt             ! ocean time-step 
     69      ! 
     70      INTEGER             ::  ierr,  kindic   ! local integer 
    7271      !!--------------------------------------------------------------------- 
    7372      ! 
    74       CALL trcdit_wr( kt, kindic )      ! outputs for tracer concentration 
    75       CALL trcdii_wr( kt, kindic )      ! outputs for additional arrays 
    76       CALL trcdib_wr( kt, kindic )      ! outputs for biological trends 
     73      IF( kt == nit000 )  THEN 
     74         ALLOCATE( ndext50(jpij*jpk), ndext51(jpij), STAT=ierr ) 
     75         IF( ierr > 0 ) THEN 
     76            CALL ctl_stop( 'STOP', 'trc_diat: unable to allocate arrays' )  ;   RETURN 
     77         ENDIF 
     78      ENDIF 
     79      ! 
     80      IF( .NOT.lk_iomput ) THEN 
     81                          CALL trcdit_wr( kt, kindic )      ! outputs for tracer concentration 
     82         IF( ln_diatrc )  CALL trcdii_wr( kt, kindic )      ! outputs for additional arrays 
     83         IF( ln_diabio )  CALL trcdib_wr( kt, kindic )      ! outputs for biological trends 
     84      ENDIF 
    7785      ! 
    7886   END SUBROUTINE trc_dia 
     
    145153       
    146154      IF( kt == nit000 ) THEN 
     155 
     156         IF(lwp) THEN                   ! control print 
     157            WRITE(numout,*) 
     158            WRITE(numout,*) '    frequency of outputs for passive tracers nn_writetrc = ', nn_writetrc 
     159            DO jn = 1, jptra 
     160               IF( ln_trc_wri(jn) )  WRITE(numout,*) ' ouput tracer nb : ', jn, '    short name : ', ctrcnm(jn)  
     161            END DO 
     162            WRITE(numout,*) ' ' 
     163         ENDIF 
    147164 
    148165         ! Compute julian date from starting date of the run 
     
    182199         ! Declare all the output fields as NETCDF variables 
    183200         DO jn = 1, jptra 
    184             IF( lutsav(jn) ) THEN 
     201            IF( ln_trc_wri(jn) ) THEN 
    185202               cltra  = TRIM( ctrcnm(jn) )   ! short title for tracer 
    186                cltral = TRIM( ctrcnl(jn) )   ! long title for tracer 
     203               cltral = TRIM( ctrcln(jn) )   ! long title for tracer 
    187204               cltrau = TRIM( ctrcun(jn) )   ! UNIT for tracer 
    188205               CALL histdef( nit5, cltra, cltral, cltrau, jpi, jpj, nhorit5,  & 
     
    209226      DO jn = 1, jptra 
    210227         cltra  = TRIM( ctrcnm(jn) )   ! short title for tracer 
    211          IF( lutsav(jn) ) CALL histwrite( nit5, cltra, it, trn(:,:,:,jn), ndimt50, ndext50 ) 
     228         IF( ln_trc_wri(jn) ) CALL histwrite( nit5, cltra, it, trn(:,:,:,jn), ndimt50, ndext50 ) 
    212229      END DO 
    213230 
     
    217234      ! 
    218235   END SUBROUTINE trcdit_wr 
    219  
    220 #if defined key_diatrc 
    221236 
    222237   SUBROUTINE trcdii_wr( kt, kindic ) 
     
    360375 
    361376   END SUBROUTINE trcdii_wr 
    362  
    363 # else 
    364    SUBROUTINE trcdii_wr( kt, kindic )                      ! Dummy routine 
    365       INTEGER, INTENT (in) :: kt, kindic 
    366    END SUBROUTINE trcdii_wr 
    367 # endif 
    368  
    369 # if defined key_diabio 
    370377 
    371378   SUBROUTINE trcdib_wr( kt, kindic ) 
     
    485492   END SUBROUTINE trcdib_wr 
    486493 
    487 # else 
    488  
    489    SUBROUTINE trcdib_wr( kt, kindic )                      ! Dummy routine 
    490       INTEGER, INTENT ( in ) ::   kt, kindic 
    491    END SUBROUTINE trcdib_wr 
    492  
    493 # endif  
    494  
    495    INTEGER FUNCTION trc_dia_alloc() 
    496       !!--------------------------------------------------------------------- 
    497       !!                     ***  ROUTINE trc_dia_alloc  *** 
    498       !!--------------------------------------------------------------------- 
    499       ALLOCATE( ndext50(jpij*jpk), ndext51(jpij), STAT=trc_dia_alloc ) 
    500       ! 
    501       IF( trc_dia_alloc /= 0 )   CALL ctl_warn('trc_dia_alloc : failed to allocate arrays') 
    502       ! 
    503    END FUNCTION trc_dia_alloc 
    504494#else 
    505495   !!---------------------------------------------------------------------- 
  • branches/2011/dev_r2787_LOCEAN3_TRA_TRP/NEMOGCM/NEMO/TOP_SRC/trcdta.F90

    r2715 r2819  
    77   !!              -   !  2004-03  (C. Ethe)  module 
    88   !!              -   !  2005-03  (O. Aumont, A. El Moussaoui) F90 
    9    !!---------------------------------------------------------------------- 
    10 #if  defined key_top  &&  defined key_dtatrc 
    11    !!---------------------------------------------------------------------- 
    12    !!   'key_top'  and  'key_dtatrc'        TOP model + passive tracer data 
    13    !!---------------------------------------------------------------------- 
    14    !!   trc_dta      : read ocean passive tracer data 
    15    !!---------------------------------------------------------------------- 
    16    USE oce_trc 
    17    USE par_trc 
    18    USE trc 
    19    USE lib_print 
    20    USE iom 
     9   !!            3.4   !  2010-11  (C. Ethe, G. Madec)  use of fldread + dynamical allocation  
     10   !!---------------------------------------------------------------------- 
     11#if  defined key_top  
     12   !!---------------------------------------------------------------------- 
     13   !!   'key_top'                                                TOP model  
     14   !!---------------------------------------------------------------------- 
     15   !!   trc_dta    : read and time interpolated passive tracer data 
     16   !!---------------------------------------------------------------------- 
     17   USE par_trc       !  passive tracers parameters 
     18   USE oce_trc       !  shared variables between ocean and passive tracers 
     19   USE trc           !  passive tracers common variables 
     20   USE iom           !  I/O manager 
     21   USE lib_mpp       !  MPP library 
     22   USE fldread       !  read input fields 
    2123 
    2224   IMPLICIT NONE 
     
    2426 
    2527   PUBLIC   trc_dta         ! called in trcini.F90 and trcdmp.F90 
    26    PUBLIC   trc_dta_alloc   ! called in nemogcm.F90 
    27  
    28    LOGICAL , PUBLIC, PARAMETER ::   lk_dtatrc = .TRUE.   !: temperature data flag 
    29    REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:,:) ::   trdta   !: tracer data at given time-step 
    30  
    31    REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:,:,:,:) ::   tracdta       ! tracer data at two consecutive times 
    32    INTEGER , ALLOCATABLE, SAVE, DIMENSION(:) ::   nlectr      !: switch for reading once 
    33    INTEGER , ALLOCATABLE, SAVE, DIMENSION(:) ::   ntrc1       !: number of 1st month when reading 12 monthly value 
    34    INTEGER , ALLOCATABLE, SAVE, DIMENSION(:) ::   ntrc2       !: number of 2nd month when reading 12 monthly value 
     28   PUBLIC   trc_dta_init    ! called in trcini.F90  
     29 
     30   INTEGER  , SAVE, PUBLIC                             :: nb_trcdta   ! number of tracers to be initialised with data 
     31   INTEGER  , SAVE, PUBLIC, ALLOCATABLE, DIMENSION(:)  :: n_trc_index ! indice of tracer which is initialised with data 
     32   INTEGER  , SAVE                                     :: ntra        ! MAX( 1, nb_trcdta ) to avoid compilation error with bounds checking 
     33   REAL(wp) , SAVE,         ALLOCATABLE, DIMENSION(:)  :: rf_trfac    ! multiplicative factor for tracer values 
     34   TYPE(FLD), SAVE,         ALLOCATABLE, DIMENSION(:)  :: sf_trcdta   ! structure of input SST (file informations, fields read) 
    3535 
    3636   !! * Substitutions 
    37 #  include "top_substitute.h90" 
    38    !!---------------------------------------------------------------------- 
    39    !! NEMO/TOP 3.3 , NEMO Consortium (2010) 
     37#  include "domzgr_substitute.h90" 
     38   !!---------------------------------------------------------------------- 
     39   !! NEMO/OPA 3.3 , NEMO Consortium (2010) 
    4040   !! $Id$  
    4141   !! Software governed by the CeCILL licence     (NEMOGCM/NEMO_CeCILL.txt) 
     
    4343CONTAINS 
    4444 
    45    SUBROUTINE trc_dta( kt ) 
     45   SUBROUTINE trc_dta_init 
     46      !!---------------------------------------------------------------------- 
     47      !!                   ***  ROUTINE trc_dta_init  *** 
     48      !!                     
     49      !! ** Purpose :   initialisation of passive tracer input data  
     50      !!  
     51      !! ** Method  : - Read namtsd namelist 
     52      !!              - allocates passive tracer data structure  
     53      !!---------------------------------------------------------------------- 
     54      ! 
     55      INTEGER            :: jl, jn                   ! dummy loop indicies 
     56      INTEGER            :: ierr0, ierr1, ierr2, ierr3       ! temporary integers 
     57      CHARACTER(len=100) :: clndta, clntrc 
     58      REAL(wp)           :: zfact 
     59      ! 
     60      CHARACTER(len=100) :: cn_dir 
     61      TYPE(FLD_N), DIMENSION(jptra) :: slf_i     ! array of namelist informations on the fields to read 
     62      TYPE(FLD_N), DIMENSION(jptra) :: sn_trcdta 
     63      REAL(wp)   , DIMENSION(jptra) :: rn_trfac    ! multiplicative factor for tracer values 
     64      !! 
     65      NAMELIST/namtrc_dta/ sn_trcdta, cn_dir, rn_trfac  
     66      !!---------------------------------------------------------------------- 
     67      ! 
     68      !  Initialisation 
     69      ierr0 = 0  ;  ierr1 = 0  ;  ierr2 = 0  ;  ierr3 = 0   
     70      ! Compute the number of tracers to be initialised with data 
     71      ALLOCATE( n_trc_index(jptra), STAT=ierr0 ) 
     72      IF( ierr0 > 0 ) THEN 
     73         CALL ctl_stop( 'trc_nam: unable to allocate n_trc_index' )   ;   RETURN 
     74      ENDIF 
     75      nb_trcdta      = 0 
     76      n_trc_index(:) = 0 
     77      DO jn = 1, jptra 
     78         IF( ln_trc_ini(jn) ) THEN 
     79             nb_trcdta       = nb_trcdta + 1  
     80             n_trc_index(jn) = nb_trcdta  
     81         ENDIF 
     82      ENDDO 
     83      ! 
     84      ntra = MAX( 1, nb_trcdta )   ! To avoid compilation error with bounds checking 
     85      WRITE(numout,*) ' ' 
     86      WRITE(numout,*) ' number of passive tracers to be initialize by data :', ntra 
     87      WRITE(numout,*) ' ' 
     88      !                         ! allocate the arrays (if necessary) 
     89      ! 
     90      cn_dir  = './'            ! directory in which the model is executed 
     91      DO jn = 1, jptra 
     92         WRITE( clndta,'("TR_",I1)' ) jn 
     93         clndta = TRIM( clndta ) 
     94         !                 !  file      ! frequency ! variable  ! time intep !  clim   ! 'yearly' or ! weights  ! rotation ! 
     95         !                 !  name      !  (hours)  !  name     !   (T/F)    !  (T/F)  !  'monthly'  ! filename ! pairs    ! 
     96         sn_trcdta(jn)  = FLD_N( clndta ,   -1      , clndta    ,  .false.   , .true.  ,  'monthly'  , ''       , ''       ) 
     97         ! 
     98         rn_trfac(jn) = 1._wp 
     99      END DO 
     100      ! 
     101      REWIND( numnat )               ! read nattrc 
     102      READ  ( numnat, namtrc_dta ) 
     103 
     104      IF( lwp ) THEN 
     105         DO jn = 1, jptra 
     106            IF( ln_trc_ini(jn) )  THEN    ! open input file only if ln_trc_ini(jn) is true 
     107               clndta = TRIM( sn_trcdta(jn)%clvar )  
     108               clntrc = TRIM( ctrcnm   (jn)       )  
     109               zfact  = rn_trfac(jn) 
     110               IF( clndta /=  clntrc ) THEN  
     111                  CALL ctl_warn( 'trc_dta_init: passive tracer data initialisation :  ',   & 
     112                  &              'the variable name in the data file : '//clndta//   &  
     113                  &              '  must be the same than the name of the passive tracer : '//clntrc//' ') 
     114               ENDIF 
     115               WRITE(numout,*) ' read an initial file for passive tracer number :', jn, ' name : ', clndta, &  
     116               &               ' multiplicative factor : ', zfact 
     117            ENDIF 
     118         END DO 
     119      ENDIF 
     120      ! 
     121      IF( nb_trcdta > 0 ) THEN       !  allocate only if the number of tracer to initialise is greater than zero 
     122         ALLOCATE( sf_trcdta(nb_trcdta), rf_trfac(nb_trcdta), STAT=ierr1 ) 
     123         IF( ierr1 > 0 ) THEN 
     124            CALL ctl_stop( 'trc_dta_ini: unable to allocate  sf_trcdta structure' )   ;   RETURN 
     125         ENDIF 
     126         ! 
     127         DO jn = 1, jptra 
     128            IF( ln_trc_ini(jn) ) THEN      ! update passive tracers arrays with input data read from file 
     129               jl = n_trc_index(jn) 
     130               slf_i(jl)    = sn_trcdta(jn) 
     131               rf_trfac(jl) = rn_trfac(jn) 
     132                                            ALLOCATE( sf_trcdta(jl)%fnow(jpi,jpj,jpk)   , STAT=ierr2 ) 
     133               IF( sn_trcdta(jn)%ln_tint )  ALLOCATE( sf_trcdta(jl)%fdta(jpi,jpj,jpk,2) , STAT=ierr3 ) 
     134               IF( ierr2 + ierr3 > 0 ) THEN 
     135                 CALL ctl_stop( 'trc_dta : unable to allocate passive tracer data arrays' )   ;   RETURN 
     136               ENDIF 
     137            ENDIF 
     138            !    
     139         ENDDO 
     140         !                         ! fill sf_trcdta with slf_i and control print 
     141         CALL fld_fill( sf_trcdta, slf_i, cn_dir, 'trc_dta', 'Passive tracer data', 'namtrc' ) 
     142         ! 
     143      ENDIF 
     144      ! 
     145   END SUBROUTINE trc_dta_init 
     146 
     147 
     148   SUBROUTINE trc_dta( kt, ptrc ) 
    46149      !!---------------------------------------------------------------------- 
    47150      !!                   ***  ROUTINE trc_dta  *** 
     151      !!                     
     152      !! ** Purpose :   provides passive tracer data at kt 
     153      !!  
     154      !! ** Method  : - call fldread routine 
     155      !!              - s- or mixed z-s coordinate: vertical interpolation on model mesh 
     156      !!              - ln_trcdmp=F: deallocates the data structure as they are not used 
    48157      !! 
    49       !! ** Purpose :   Reads passive tracer data (Levitus monthly data) 
    50       !! 
    51       !! ** Method  :   Read on unit numtr the interpolated tracer concentra- 
    52       !!      tion onto the global grid. Data begin at january.  
    53       !!      The value is centered at the middle of month.  
    54       !!      In the opa model, kt=1 agree with january 1.  
    55       !!      At each time step, a linear interpolation is applied between  
    56       !!      two monthly values. 
    57       !!---------------------------------------------------------------------- 
    58       INTEGER, INTENT(in) ::   kt     ! ocean time-step 
    59       !! 
    60       CHARACTER (len=39) ::   clname(jptra) 
    61       INTEGER, PARAMETER ::   jpmonth = 12    ! number of months 
    62       INTEGER ::   ji, jj, jn, jl  
    63       INTEGER ::   imois, iman, i15, ik  ! temporary integers  
    64       REAL(wp) ::   zxy, zl 
    65 !!gm HERE the daymod should be used instead of computation of month and co !! 
    66 !!gm      better in case of real calandar and leap-years ! 
    67       !!---------------------------------------------------------------------- 
    68  
    69       DO jn = 1, jptra 
    70  
    71          IF( lutini(jn) ) THEN  
    72  
    73             IF ( kt == nit000 ) THEN 
    74                !! 3D tracer data 
    75                IF(lwp)WRITE(numout,*) 
    76                IF(lwp)WRITE(numout,*) ' dta_trc: reading tracer'  
    77                IF(lwp)WRITE(numout,*) ' data file ', jn, ctrcnm(jn) 
    78                IF(lwp)WRITE(numout,*) 
    79                nlectr(jn) = 0 
     158      !! ** Action  :   ptrc   passive tracer data on medl mesh and interpolated at time-step kt 
     159      !!---------------------------------------------------------------------- 
     160      INTEGER                     , INTENT(in   ) ::   kt     ! ocean time-step 
     161      REAL(wp), DIMENSION(:,:,:,:), INTENT(  out) ::   ptrc   ! passive tracer data 
     162      ! 
     163      INTEGER ::   ji, jj, jk, jl, jn, jkk, ik    ! dummy loop indicies 
     164      REAL(wp)::   zl, zi 
     165      REAL(wp), DIMENSION(jpk) ::  ztp                ! 1D workspace 
     166      CHARACTER(len=100) :: clndta 
     167      !!---------------------------------------------------------------------- 
     168      ! 
     169      IF( nb_trcdta > 0 ) THEN 
     170         ! 
     171         CALL fld_read( kt, 1, sf_trcdta )      !==   read data at kt time step   ==! 
     172         ! 
     173         DO jn = 1, ntra 
     174            ptrc(:,:,:,jn) = sf_trcdta(jn)%fnow(:,:,:)    ! NO mask 
     175         ENDDO 
     176         ! 
     177         IF( ln_sco ) THEN                   !==   s- or mixed s-zps-coordinate   ==! 
     178            ! 
     179            IF( kt == nit000 .AND. lwp )THEN 
     180               WRITE(numout,*) 
     181               WRITE(numout,*) 'trc_dta: interpolates passive tracer data onto the s- or mixed s-z-coordinate mesh' 
    80182            ENDIF 
    81             ! Initialization 
    82             iman = jpmonth 
    83             i15  = nday / 16 
    84             imois = nmonth + i15 -1 
    85             IF( imois == 0 ) imois = iman 
    86  
    87  
    88             ! First call kt=nit000 
    89             ! -------------------- 
    90  
    91             IF ( kt == nit000 .AND. nlectr(jn) == 0 ) THEN 
    92                ntrc1(jn) = 0 
    93                IF(lwp) WRITE(numout,*) ' trc_dta : Levitus tracer data monthly fields' 
    94                ! open file  
    95 # if defined key_pisces 
    96                clname(jn) = 'data_1m_'//TRIM(ctrcnm(jn))//'_nomask' 
    97 # else 
    98                clname(jn) = TRIM(ctrcnm(jn)) 
    99 # endif 
    100                CALL iom_open ( clname(jn), numtr(jn) )               
    101  
    102             ENDIF 
    103  
    104 # if defined key_pisces 
    105             ! Read montly file 
    106             IF( ( kt == nit000 .AND. nlectr(jn) == 0)  .OR. imois /= ntrc1(jn) ) THEN 
    107                nlectr(jn) = 1 
    108  
    109                ! Calendar computation 
    110  
    111                ! ntrc1 number of the first file record used in the simulation 
    112                ! ntrc2 number of the last  file record 
    113  
    114                ntrc1(jn) = imois 
    115                ntrc2(jn) = ntrc1(jn) + 1 
    116                ntrc1(jn) = MOD( ntrc1(jn), iman ) 
    117                IF ( ntrc1(jn) == 0 ) ntrc1(jn) = iman 
    118                ntrc2(jn) = MOD( ntrc2(jn), iman ) 
    119                IF ( ntrc2(jn) == 0 ) ntrc2(jn) = iman 
    120                IF(lwp) WRITE(numout,*) 'first record file used ntrc1 ', ntrc1(jn)  
    121                IF(lwp) WRITE(numout,*) 'last  record file used ntrc2 ', ntrc2(jn) 
    122  
    123                ! Read montly passive tracer data Levitus  
    124  
    125                CALL iom_get ( numtr(jn), jpdom_data, ctrcnm(jn), tracdta(:,:,:,jn,1), ntrc1(jn) ) 
    126                CALL iom_get ( numtr(jn), jpdom_data, ctrcnm(jn), tracdta(:,:,:,jn,2), ntrc2(jn) ) 
    127  
    128                IF(lwp) THEN 
    129                   WRITE(numout,*) 
    130                   WRITE(numout,*) ' read tracer data ', ctrcnm(jn),' ok' 
    131                   WRITE(numout,*) 
     183            ! 
     184            DO jn = 1, ntra 
     185               DO jj = 1, jpj                         ! vertical interpolation of T & S 
     186                  DO ji = 1, jpi 
     187                     DO jk = 1, jpk                        ! determines the intepolated T-S profiles at each (i,j) points 
     188                        zl = fsdept_0(ji,jj,jk) 
     189                        IF(     zl < gdept_0(1  ) ) THEN          ! above the first level of data 
     190                           ztp(jk) =  ptrc(ji,jj,1    ,jn) 
     191                        ELSEIF( zl > gdept_0(jpk) ) THEN          ! below the last level of data 
     192                           ztp(jk) =  ptrc(ji,jj,jpkm1,jn) 
     193                        ELSE                                      ! inbetween : vertical interpolation between jkk & jkk+1 
     194                           DO jkk = 1, jpkm1                                  ! when  gdept(jkk) < zl < gdept(jkk+1) 
     195                              IF( (zl-gdept_0(jkk)) * (zl-gdept_0(jkk+1)) <= 0._wp ) THEN 
     196                                 zi = ( zl - gdept_0(jkk) ) / (gdept_0(jkk+1)-gdept_0(jkk)) 
     197                                 ztp(jk) = ptrc(ji,jj,jkk,jn) + ( ptrc(ji,jj,jkk+1,jn) - ptrc(ji,jj,jkk,jn) ) * zi  
     198                              ENDIF 
     199                           END DO 
     200                        ENDIF 
     201                     END DO 
     202                     DO jk = 1, jpkm1 
     203                        ptrc(ji,jj,jk,jn) = ztp(jk) * tmask(ji,jj,jk)     ! mask required for mixed zps-s-coord 
     204                     END DO 
     205                     ptrc(ji,jj,jpk,jn) = 0._wp 
     206                  END DO 
     207               END DO 
     208            ENDDO  
     209            !  
     210         ELSE                                !==   z- or zps- coordinate   ==! 
     211            !                              
     212            DO jn = 1, ntra 
     213               ptrc(:,:,:,jn) = ptrc(:,:,:,jn) * tmask(:,:,:)    ! Mask 
     214               ! 
     215               IF( ln_zps ) THEN                      ! zps-coordinate (partial steps) interpolation at the last ocean level 
     216                  DO jj = 1, jpj 
     217                     DO ji = 1, jpi 
     218                        ik = mbkt(ji,jj)  
     219                        IF( ik > 1 ) THEN 
     220                           zl = ( gdept_0(ik) - fsdept_0(ji,jj,ik) ) / ( gdept_0(ik) - gdept_0(ik-1) ) 
     221                           ptrc(ji,jj,ik,jn) = (1.-zl) * ptrc(ji,jj,ik,jn) + zl * ptrc(ji,jj,ik-1,jn) 
     222                        ENDIF 
     223                     END DO 
     224                  END DO 
    132225               ENDIF 
    133  
    134                ! Apply Mask 
    135                DO jl = 1, 2 
    136                   tracdta(:,:,:  ,jn,jl) = tracdta(:,:,:,jn,jl) * tmask(:,:,:)  
    137                   tracdta(:,:,jpk,jn,jl) = 0. 
    138                   IF( ln_zps ) THEN                ! z-coord. with partial steps 
    139                      DO jj = 1, jpj                ! interpolation of temperature at the last level 
    140                         DO ji = 1, jpi 
    141                            ik = mbkt(ji,jj) 
    142                            IF( ik > 2 ) THEN 
    143                               zl = ( gdept_0(ik) - fsdept_0(ji,jj,ik) ) / ( gdept_0(ik) - gdept_0(ik-1) ) 
    144                               tracdta(ji,jj,ik,jn,jl) = (1.-zl) * tracdta(ji,jj,ik  ,jn,jl)    & 
    145                                  &                    +     zl  * tracdta(ji,jj,ik-1,jn,jl) 
    146                            ENDIF 
    147                         END DO 
    148                      END DO 
    149                   ENDIF 
    150  
    151                END DO 
    152  
    153             ENDIF 
    154  
    155             IF(lwp) THEN 
    156                WRITE(numout,*) ctrcnm(jn), 'Levitus month ', ntrc1(jn), ntrc2(jn) 
     226            ENDDO  
     227            ! 
     228         ENDIF 
     229         ! 
     230         DO jn = 1, ntra 
     231            ptrc(:,:,:,jn) = ptrc(:,:,:,jn) * rf_trfac(jn)   !  multiplicative factor 
     232         ENDDO  
     233         ! 
     234         IF( lwp .AND. kt == nit000 ) THEN 
     235            DO jn = 1, ntra 
     236               clndta = TRIM( sf_trcdta(jn)%clvar )  
     237               WRITE(numout,*) ''//clndta//' data ' 
    157238               WRITE(numout,*) 
    158                WRITE(numout,*) ' Levitus month = ', ntrc1(jn), '  level = 1' 
    159                CALL prihre( tracdta(1,1,1,jn,1), jpi, jpj, 1, jpi, 20, 1   & 
    160                   &        ,jpj, 20, 1., numout ) 
    161                WRITE(numout,*) ' Levitus month = ', ntrc1(jn), '  level = ',jpk/2 
    162                CALL prihre( tracdta(1,1,jpk/2,jn,1), jpi, jpj, 1, jpi,    & 
    163                   &         20, 1, jpj, 20, 1., numout ) 
    164                WRITE(numout,*) ' Levitus month = ',ntrc1(jn),'  level = ',jpkm1 
    165                CALL prihre( tracdta(1,1,jpkm1,jn,1), jpi, jpj, 1, jpi,     & 
    166                   &         20, 1, jpj, 20, 1., numout ) 
    167             ENDIF 
    168  
    169             ! At every time step compute temperature data 
    170             zxy = FLOAT( nday + 15 - 30 * i15 ) / 30. 
    171             trdta(:,:,:,jn) =  ( 1. - zxy ) * tracdta(:,:,:,jn,1)    & 
    172                &              +       zxy   * tracdta(:,:,:,jn,2)  
    173  
    174             IF( jn == jpno3 )   trdta(:,:,:,jn) = trdta(:,:,:,jn) *   7.6e-6 
    175             IF( jn == jpdic )   trdta(:,:,:,jn) = trdta(:,:,:,jn) *   1.0e-6 
    176             IF( jn == jptal )   trdta(:,:,:,jn) = trdta(:,:,:,jn) *   1.0e-6 
    177             IF( jn == jpoxy )   trdta(:,:,:,jn) = trdta(:,:,:,jn) *  44.6e-6 
    178             IF( jn == jpsil )   trdta(:,:,:,jn) = trdta(:,:,:,jn) *   1.0e-6 
    179             IF( jn == jppo4 )   trdta(:,:,:,jn) = trdta(:,:,:,jn) * 122.0e-6 
    180  
    181             ! Close the file 
    182             ! -------------- 
    183              
    184             IF( kt == nitend )   CALL iom_close( numtr(jn) ) 
    185  
    186 # else 
    187             ! Read init file only 
    188             IF( kt == nit000  ) THEN 
    189                ntrc1(jn) = 1 
    190                CALL iom_get ( numtr(jn), jpdom_data, ctrcnm(jn), trdta(:,:,:,jn), ntrc1(jn) ) 
    191                trdta(:,:,:,jn) = trdta(:,:,:,jn) * tmask(:,:,:) 
    192                CALL iom_close ( numtr(jn) ) 
    193             ENDIF  
    194 # endif 
    195          ENDIF 
    196  
    197       END DO 
    198       ! 
     239               WRITE(numout,*)'  level = 1' 
     240               CALL prihre( ptrc(:,:,1    ,jn), jpi, jpj, 1, jpi, 20, 1, jpj, 20, 1., numout ) 
     241               WRITE(numout,*)'  level = ', jpk/2 
     242               CALL prihre( ptrc(:,:,jpk/2,jn), jpi, jpj, 1, jpi, 20, 1, jpj, 20, 1., numout ) 
     243               WRITE(numout,*)'  level = ', jpkm1 
     244               CALL prihre( ptrc(:,:,jpkm1,jn), jpi, jpj, 1, jpi, 20, 1, jpj, 20, 1., numout ) 
     245               WRITE(numout,*) 
     246            ENDDO 
     247         ENDIF 
     248         ! 
     249         IF( .NOT.ln_trcdmp ) THEN                   !==   deallocate data structure   ==!  
     250            !                                              (data used only for initialisation) 
     251            IF(lwp) WRITE(numout,*) 'trc_dta: deallocate data arrays as they are only use to initialize the run' 
     252            DO jn = 1, ntra 
     253                                             DEALLOCATE( sf_trcdta(jn)%fnow )     !  arrays in the structure 
     254               IF( sf_trcdta(jn)%ln_tint )   DEALLOCATE( sf_trcdta(jn)%fdta ) 
     255            ENDDO 
     256            ! 
     257         ENDIF 
     258         ! 
     259      ENDIF 
     260      !  
    199261   END SUBROUTINE trc_dta 
    200  
    201  
    202    INTEGER FUNCTION trc_dta_alloc() 
    203       !!---------------------------------------------------------------------- 
    204       !!                   ***  ROUTINE trc_dta_alloc  *** 
    205       !!---------------------------------------------------------------------- 
    206       ALLOCATE( trdta  (jpi,jpj,jpk,jptra  ) ,                    & 
    207          &      tracdta(jpi,jpj,jpk,jptra,2) ,                    & 
    208          &      nlectr(jptra) , ntrc1(jptra) , ntrc2(jptra) , STAT=trc_dta_alloc) 
    209          ! 
    210       IF( trc_dta_alloc /= 0 )   CALL ctl_warn('trc_dta_alloc : failed to allocate arrays') 
    211       ! 
    212    END FUNCTION trc_dta_alloc 
    213  
    214262#else 
    215263   !!---------------------------------------------------------------------- 
    216264   !!   Dummy module                              NO 3D passive tracer data 
    217265   !!---------------------------------------------------------------------- 
    218    LOGICAL , PUBLIC, PARAMETER ::   lk_dtatrc = .FALSE.   !: temperature data flag 
    219266CONTAINS 
    220267   SUBROUTINE trc_dta( kt )        ! Empty routine 
     
    222269   END SUBROUTINE trc_dta 
    223270#endif 
    224  
    225271   !!====================================================================== 
    226272END MODULE trcdta 
  • branches/2011/dev_r2787_LOCEAN3_TRA_TRP/NEMOGCM/NEMO/TOP_SRC/trcini.F90

    r2715 r2819  
    1616   !!   top_alloc :   allocate the TOP arrays 
    1717   !!---------------------------------------------------------------------- 
    18    USE oce_trc 
    19    USE trc 
    20    USE trcrst 
     18   USE oce_trc         ! shared variables between ocean and passive tracers 
     19   USE trc             ! passive tracers common variables 
     20   USE trcrst          ! passive tracers restart 
    2121   USE trcnam          ! Namelist read 
    2222   USE trcini_cfc      ! CFC      initialisation 
     
    2525   USE trcini_c14b     ! C14 bomb initialisation 
    2626   USE trcini_my_trc   ! MY_TRC   initialisation 
    27    USE trcdta    
    28    USE daymod 
     27   USE trcdta          ! initialisation form files 
     28   USE daymod          ! calendar manager 
    2929   USE zpshde          ! partial step: hor. derivative   (zps_hde routine) 
    3030   USE prtctl_trc      ! Print control passive tracers (prt_ctl_trc_init routine) 
     
    5656      !!                or read data or analytical formulation 
    5757      !!--------------------------------------------------------------------- 
    58       INTEGER ::   jk, jn    ! dummy loop indices 
     58      INTEGER ::   jk, jn, jl    ! dummy loop indices 
     59      INTEGER ::   ierr          ! local integer 
    5960      CHARACTER (len=25) :: charout 
     61      REAL(wp), ALLOCATABLE, DIMENSION(:,:,:,:) ::  ztrcdta   ! 4D  workspace 
    6062      !!--------------------------------------------------------------------- 
    6163 
     
    6567 
    6668      CALL top_alloc()              ! allocate TOP arrays 
     69 
     70      IF( ln_dm2dc .AND. ( lk_pisces .OR. lk_lobster ) )    & 
     71         &  CALL ctl_stop( ' The diurnal cycle is not compatible with PISCES or LOBSTER  ' ) 
     72 
     73      IF( nn_cla == 1 )   & 
     74         &  CALL ctl_stop( ' Cross Land Advection not yet implemented with passive tracer ; nn_cla must be 0' ) 
    6775 
    6876      !                             ! masked grid volume 
     
    7179      END DO 
    7280 
    73       !                             ! total volume of the ocean 
    74 #if ! defined key_degrad 
    75       areatot = glob_sum( cvol(:,:,:) ) 
    76 #else 
    77       areatot = glob_sum( cvol(:,:,:) * facvol(:,:,:) )  ! degrad option: reduction by facvol 
    78 #endif 
     81      !                           ! total volume of the ocean ( degrad option: reduction by facvol ) 
     82      IF( .NOT.lk_degrad )  THEN  ;  areatot = glob_sum( cvol(:,:,:) ) 
     83      ELSE                        ;  areatot = glob_sum( cvol(:,:,:) * facvol(:,:,:) ) 
     84      ENDIF 
    7985 
    8086      CALL trc_nam                  ! read passive tracers namelists 
    81  
    82       !                             ! restart for passive tracer (input) 
    83       IF( ln_rsttr ) THEN 
    84          IF(lwp) WRITE(numout,*) '       read a restart file for passive tracer : ', cn_trcrst_in 
    85          IF(lwp) WRITE(numout,*) ' ' 
    86       ELSE 
    87          IF( lwp .AND. lk_dtatrc ) THEN 
    88             DO jn = 1, jptra 
    89                IF( lutini(jn) )  &                  ! open input FILE only IF lutini(jn) is true 
    90                   &  WRITE(numout,*) ' read an initial file for passive tracer number :', jn, ' traceur : ', ctrcnm(jn)  
    91              END DO 
    92           ENDIF 
    93           IF( lwp ) WRITE(numout,*) 
    94       ENDIF 
    95  
    96       IF( ln_dm2dc .AND. ( lk_pisces .OR. lk_lobster ) )    & 
    97          &       CALL ctl_stop( ' The diurnal cycle is not compatible with PISCES or LOBSTER  ' ) 
    98  
    99       IF( nn_cla == 1 )   & 
    100          &       CALL ctl_stop( ' Cross Land Advection not yet implemented with passive tracer ; nn_cla must be 0' ) 
    10187 
    10288      IF( lk_lobster ) THEN   ;   CALL trc_ini_lobster      ! LOBSTER bio-model 
     
    119105      ELSE                    ;   IF(lwp) WRITE(numout,*) '          MY_TRC not used' 
    120106      ENDIF 
     107 
     108      IF( ln_trcdta )             CALL trc_dta_init 
    121109 
    122110      IF( ln_rsttr ) THEN 
     
    130118           CALL day_init               ! set calendar 
    131119        ENDIF 
    132 #if defined key_dtatrc 
    133         CALL trc_dta( nit000 )      ! Initialization of tracer from a file that may also be used for damping 
    134         DO jn = 1, jptra 
    135            IF( lutini(jn) )   trn(:,:,:,jn) = trdta(:,:,:,jn) * tmask(:,:,:)   ! initialisation from file if required 
    136         END DO 
    137 #endif 
     120        IF( ln_trcdta .AND. nb_trcdta > 0 ) THEN  ! Initialisation of tracer from a file that may also be used for damping 
     121            ALLOCATE( ztrcdta(jpi,jpj,jpk,nb_trcdta), STAT=ierr ) 
     122            IF( ierr > 0 ) THEN 
     123               CALL ctl_stop( 'trc_ini: unable to allocate ztrcdta array' )   ;   RETURN 
     124            ENDIF 
     125            ! 
     126            CALL trc_dta( nit000, ztrcdta )   ! read tracer data at nit000 
     127            ! 
     128            DO jn = 1, jptra 
     129               IF( ln_trc_ini(jn) ) THEN      ! update passive tracers arrays with input data read from file 
     130                  jl = n_trc_index(jn)  
     131                  trn(:,:,:,jn) = ztrcdta(:,:,:,jl) * tmask(:,:,:)   
     132               ENDIF 
     133            ENDDO 
     134            DEALLOCATE( ztrcdta )  
     135        ENDIF 
     136        ! 
    138137        trb(:,:,:,:) = trn(:,:,:,:) 
    139138        !  
     
    147146 
    148147      !            
    149       trai = 0._wp         ! Computation content of all tracers 
     148      trai(:) = 0._wp         ! Computation content of all tracers ( degrad option: reduction by facvol ) 
    150149      DO jn = 1, jptra 
    151 #if ! defined key_degrad 
    152          trai = trai + glob_sum( trn(:,:,:,jn) * cvol(:,:,:) ) 
    153 #else 
    154          trai = trai + glob_sum( trn(:,:,:,jn) * cvol(:,:,:) * facvol(:,:,:) ) ! degrad option: reduction by facvol 
    155 #endif 
     150         IF( .NOT.lk_degrad )  THEN  ;  trai(jn) =  glob_sum( trn(:,:,:,jn) * cvol(:,:,:) )  
     151         ELSE                        ;  trai(jn) =  glob_sum( trn(:,:,:,jn) * cvol(:,:,:) * facvol(:,:,:) ) 
     152         ENDIF 
    156153      END DO       
    157154 
     
    161158         WRITE(numout,*) '          *** Total number of passive tracer jptra = ', jptra 
    162159         WRITE(numout,*) '          *** Total volume of ocean                = ', areatot 
    163          WRITE(numout,*) '          *** Total inital content of all tracers  = ', trai 
     160         WRITE(numout,*) '          *** Total inital content of all tracers ' 
     161         DO jn = 1, jptra 
     162            WRITE(numout,*) ' tracer nb : ', jn, '  name : ', ctrcnm(jn), ' initial content :', trai(jn) 
     163         ENDDO 
    164164         WRITE(numout,*) 
    165165      ENDIF 
     
    186186      USE trczdf        , ONLY:   trc_zdf_alloc 
    187187      USE trdmod_trc_oce, ONLY:   trd_mod_trc_oce_alloc 
    188 #if ! defined key_iomput 
    189       USE trcdia        , ONLY:   trc_dia_alloc 
    190 #endif 
    191 #if defined key_trcdmp  
    192       USE trcdmp        , ONLY:   trc_dmp_alloc 
    193 #endif 
    194 #if defined key_dtatrc 
    195       USE trcdta        , ONLY:   trc_dta_alloc 
    196 #endif 
    197 #if defined key_trdmld_trc   ||   defined key_esopa 
     188#if defined key_trdmld_trc  
    198189      USE trdmld_trc    , ONLY:   trd_mld_trc_alloc 
    199190#endif 
     
    207198      ierr = ierr + trc_zdf_alloc() 
    208199      ierr = ierr + trd_mod_trc_oce_alloc() 
    209 #if ! defined key_iomput 
    210       ierr = ierr + trc_dia_alloc() 
    211 #endif 
    212 #if defined key_trcdmp  
    213       ierr = ierr + trc_dmp_alloc() 
    214 #endif 
    215 #if defined key_dtatrc 
    216       ierr = ierr + trc_dta_alloc() 
    217 #endif 
    218 #if defined key_trdmld_trc   ||   defined key_esopa 
     200#if defined key_trdmld_trc  
    219201      ierr = ierr + trd_mld_trc_alloc() 
    220202#endif 
  • branches/2011/dev_r2787_LOCEAN3_TRA_TRP/NEMOGCM/NEMO/TOP_SRC/trcnam.F90

    r2715 r2819  
    1818   !!   trc_nam    :  Read and print options for the passive tracer run (namelist) 
    1919   !!---------------------------------------------------------------------- 
    20    USE oce_trc 
    21    USE trc 
     20   USE oce_trc           ! shared variables between ocean and passive tracers 
     21   USE trc               ! passive tracers common variables 
    2222   USE trcnam_trp        ! Transport namelist 
    2323   USE trcnam_lobster    ! LOBSTER namelist 
     
    2626   USE trcnam_c14b       ! C14 SMS namelist 
    2727   USE trcnam_my_trc     ! MY_TRC SMS namelist 
     28   USE trdmod_oce        
    2829   USE trdmod_trc_oce 
     30   USE iom               ! I/O manager 
    2931 
    3032   IMPLICIT NONE 
     
    5355      !!                ( (LOBSTER, PISCES, CFC, MY_TRC ) 
    5456      !!--------------------------------------------------------------------- 
    55       INTEGER ::  jn 
    56  
     57      INTEGER ::  jn, ierr 
    5758      ! Definition of a tracer as a structure 
    58       TYPE PTRACER 
    59          CHARACTER(len = 20)  :: clsname  !: short name 
    60          CHARACTER(len = 80 ) :: cllname  !: long name 
    61          CHARACTER(len = 20 ) :: clunit   !: unit 
    62          LOGICAL              :: llinit   !: read in a file or not 
    63          LOGICAL              :: llsave   !: save the tracer or not 
    64       END TYPE PTRACER 
    65  
    66       TYPE(PTRACER) , DIMENSION(jptra) :: sn_tracer 
    67  
     59      TYPE(PTRACER), DIMENSION(jptra) :: sn_tracer  ! type of tracer for saving if not key_iomput 
    6860      !! 
    69       NAMELIST/namtrc/    nn_dttrc, nn_writetrc, ln_rsttr, nn_rsttr, & 
    70                           cn_trcrst_in, cn_trcrst_out, sn_tracer 
     61      NAMELIST/namtrc/ nn_dttrc, nn_writetrc, ln_rsttr, nn_rsttr, & 
     62         &             cn_trcrst_in, cn_trcrst_out, sn_tracer, ln_trcdta 
    7163#if defined key_trdmld_trc  || defined key_trdtrc 
    7264      NAMELIST/namtrc_trd/ nn_trd_trc, nn_ctls_trc, rn_ucf_trc, & 
    73                          ln_trdmld_trc_restart, ln_trdmld_trc_instant, & 
    74                          cn_trdrst_trc_in, cn_trdrst_trc_out, ln_trdtrc 
     65         &                ln_trdmld_trc_restart, ln_trdmld_trc_instant, & 
     66         &                cn_trdrst_trc_in, cn_trdrst_trc_out, ln_trdtrc 
    7567#endif 
     68      NAMELIST/namtrc_dia/ ln_diatrc, ln_diabio, nn_writedia, nn_writebio 
    7669 
    7770      !!--------------------------------------------------------------------- 
     
    8477      ! Namelist nattrc (files) 
    8578      ! ---------------------------------------------- 
    86       nn_dttrc    = 1                 ! default values 
    87       nn_writetrc = 10       
    88       ln_rsttr    = .FALSE. 
    89       nn_rsttr    =  0 
     79      nn_dttrc      = 1                 ! default values 
     80      nn_writetrc   = 10  
     81      ln_rsttr      = .FALSE. 
     82      nn_rsttr      =  0 
    9083      cn_trcrst_in  = 'restart_trc' 
    9184      cn_trcrst_out = 'restart_trc' 
     85      ! 
    9286      DO jn = 1, jptra 
    93          WRITE(ctrcnm(jn),'("TR_",I1)'           ) jn 
    94          WRITE(ctrcnl(jn),'("TRACER NUMBER ",I1)') jn 
    95          ctrcun(jn) = 'mmole/m3' 
    96          lutini(jn) = .FALSE.  
    97          lutsav(jn) = .TRUE.  
     87         WRITE( sn_tracer(jn)%clsname,'("TR_",I1)'           ) jn 
     88         WRITE( sn_tracer(jn)%cllname,'("TRACER NUMBER ",I1)') jn 
     89         sn_tracer(jn)%clunit = 'mmole/m3' 
     90         sn_tracer(jn)%llinit  = .FALSE. 
     91         sn_tracer(jn)%llsave  = .TRUE. 
    9892      END DO 
     93      ln_trcdta = .FALSE. 
     94 
    9995 
    10096      REWIND( numnat )               ! read nattrc 
     
    10298 
    10399      DO jn = 1, jptra 
    104          ctrcnm(jn) = TRIM( sn_tracer(jn)%clsname ) 
    105          ctrcnl(jn) = TRIM( sn_tracer(jn)%cllname ) 
    106          ctrcun(jn) = TRIM( sn_tracer(jn)%clunit  ) 
    107          lutini(jn) =       sn_tracer(jn)%llinit  
    108          lutsav(jn) =       sn_tracer(jn)%llsave 
     100         ctrcnm    (jn) = TRIM( sn_tracer(jn)%clsname ) 
     101         ctrcln    (jn) = TRIM( sn_tracer(jn)%cllname ) 
     102         ctrcun    (jn) = TRIM( sn_tracer(jn)%clunit  ) 
     103         ln_trc_ini(jn) =       sn_tracer(jn)%llinit 
     104         ln_trc_wri(jn) =       sn_tracer(jn)%llsave 
    109105      END DO 
    110106 
     
    113109         WRITE(numout,*) 
    114110         WRITE(numout,*) ' Namelist : namtrc' 
    115          WRITE(numout,*) '    time step freq. for pass. trac. nn_dttrc             = ', nn_dttrc 
    116          WRITE(numout,*) '    frequency of outputs for passive tracers nn_writetrc = ', nn_writetrc   
    117          WRITE(numout,*) '    restart LOGICAL for passive tr. ln_rsttr             = ', ln_rsttr 
    118          WRITE(numout,*) '    control of time step for p. tr. nn_rsttr             = ', nn_rsttr 
     111         WRITE(numout,*) '   time step freq. for passive tracer           nn_dttrc      = ', nn_dttrc 
     112         WRITE(numout,*) '   restart  for passive tracer                  ln_rsttr      = ', ln_rsttr 
     113         WRITE(numout,*) '   control of time step for passive tracer      nn_rsttr      = ', nn_rsttr 
     114         WRITE(numout,*) '   Read inputs data from file                   ln_trcdta     = ', ln_trcdta 
    119115         WRITE(numout,*) ' ' 
    120116         DO jn = 1, jptra 
    121             WRITE(numout,*) '   tracer nb             : ', jn  
    122             WRITE(numout,*) '   short name            : ', ctrcnm(jn) 
    123             WRITE(numout,*) '   long name             : ', ctrcnl(jn) 
    124             WRITE(numout,*) '   unit                  : ', ctrcun(jn) 
    125             WRITE(numout,*) '   initial value in FILE : ', lutini(jn)  
    126             WRITE(numout,*) ' ' 
     117            WRITE(numout,*) '  tracer nb : ', jn, '    short name : ', ctrcnm(jn) 
    127118         END DO 
     119         WRITE(numout,*) ' ' 
    128120      ENDIF 
    129121 
    130122      rdttrc(:) = rdttra(:) * FLOAT( nn_dttrc )   ! vertical profile of passive tracer time-step 
    131123   
    132       IF(lwp) WRITE(numout,*)  
    133       IF(lwp) WRITE(numout,*) '    Passive Tracer  time step    rdttrc  = ', rdttrc(1) 
    134       IF(lwp) WRITE(numout,*)  
    135  
    136 #if defined key_trdmld_trc || defined key_trdtrc 
    137       nn_trd_trc  = 20 
    138       nn_ctls_trc =  9 
    139       rn_ucf_trc   =  1. 
    140       ln_trdmld_trc_instant = .TRUE. 
    141       ln_trdmld_trc_restart =.FALSE. 
    142       cn_trdrst_trc_in  = "restart_mld_trc" 
    143       cn_trdrst_trc_out = "restart_mld_trc" 
    144       ln_trdtrc(:) = .FALSE. 
     124      IF(lwp) THEN                   ! control print 
     125        WRITE(numout,*)  
     126        WRITE(numout,*) '    Passive Tracer  time step    rdttrc  = ', rdttrc(1) 
     127        WRITE(numout,*)  
     128      ENDIF 
     129 
     130      ln_diatrc = .FALSE. 
     131      ln_diabio = .FALSE. 
     132      nn_writedia = 10 
     133      nn_writebio = 10 
    145134 
    146135      REWIND( numnat )               !  namelist namtoptrd : passive tracer trends diagnostic 
    147       READ  ( numnat, namtrc_trd ) 
    148  
    149      IF(lwp) THEN 
     136      READ  ( numnat, namtrc_dia ) 
     137 
     138      IF(lwp) THEN 
    150139         WRITE(numout,*) 
    151          WRITE(numout,*) ' trd_mld_trc_init : read namelist namtrc_trd                    ' 
    152          WRITE(numout,*) ' ~~~~~~~~~~~~~~~~                                               ' 
    153          WRITE(numout,*) '   * frequency of trends diagnostics   nn_trd_trc             = ', nn_trd_trc 
    154          WRITE(numout,*) '   * control surface type              nn_ctls_trc            = ', nn_ctls_trc 
    155          WRITE(numout,*) '   * restart for ML diagnostics        ln_trdmld_trc_restart  = ', ln_trdmld_trc_restart 
    156          WRITE(numout,*) '   * flag to diagnose trends of                                 ' 
    157          WRITE(numout,*) '     instantantaneous or mean ML T/S   ln_trdmld_trc_instant  = ', ln_trdmld_trc_instant 
    158          WRITE(numout,*) '   * unit conversion factor            rn_ucf_trc             = ', rn_ucf_trc 
    159          DO jn = 1, jptra 
    160             IF( ln_trdtrc(jn) ) WRITE(numout,*) '    compute ML trends for tracer number :', jn 
    161          END DO 
    162       ENDIF 
    163 #endif 
     140         WRITE(numout,*) 
     141         WRITE(numout,*) ' Namelist : namtrc_dia' 
     142         WRITE(numout,*) '    save additionnal diagnostics arrays         ln_diatrc   = ', ln_diatrc 
     143         WRITE(numout,*) '    save additionnal biology diagnostics arrays ln_diabio   = ', ln_diabio 
     144         WRITE(numout,*) '    frequency of outputs for additional arrays  nn_writedia = ', nn_writedia 
     145         WRITE(numout,*) '    frequency of outputs for biological trends  nn_writebio = ', nn_writebio 
     146         WRITE(numout,*) ' ' 
     147      ENDIF 
     148 
     149      IF( ln_diatrc .AND. .NOT. lk_iomput ) THEN  
     150         ALLOCATE( trc2d(jpi,jpj,jpdia2d), trc3d(jpi,jpj,jpk,jpdia3d),  & 
     151           &       ctrc2d(jpdia2d), ctrc2l(jpdia2d), ctrc2u(jpdia2d) ,  &  
     152           &       ctrc3d(jpdia3d), ctrc3l(jpdia3d), ctrc3u(jpdia3d) ,  STAT = ierr )  
     153         IF( ierr > 0 )   CALL ctl_stop( 'STOP', 'trcnam: unable to allocate add. diag. array' ) 
     154      ENDIF 
     155 
     156      IF( ( ln_diabio .AND. .NOT. lk_iomput ) .OR. l_trdtrc ) THEN 
     157         ALLOCATE( trbio (jpi,jpj,jpk,jpdiabio) , & 
     158           &       ctrbio(jpdiabio), ctrbil(jpdiabio), ctrbiu(jpdiabio), STAT = ierr )  
     159         IF( ierr > 0 )   CALL ctl_stop( 'STOP', 'trcnam: unable to allocate bio. diag. array' ) 
     160      ENDIF 
    164161 
    165162      ! namelist of transport 
    166163      ! --------------------- 
    167164      CALL trc_nam_trp 
     165 
     166 
     167      IF( ln_trcdmp .AND. .NOT.ln_trcdta ) THEN 
     168         CALL ctl_warn( 'trc_nam: passive tracer damping requires data from files we set ln_trcdta to TRUE' ) 
     169         ln_trcdta = .TRUE. 
     170      ENDIF 
     171      ! 
     172      IF( ln_rsttr .AND. .NOT.ln_trcdmp .AND. ln_trcdta ) THEN 
     173          CALL ctl_warn( 'trc_nam: passive tracer restart and  data intialisation, ',   & 
     174             &           'we keep the restart values and set ln_trcdta to FALSE' ) 
     175         ln_trcdta = .FALSE. 
     176      ENDIF 
     177      ! 
     178      IF( .NOT.ln_trcdta ) THEN 
     179         ln_trc_ini(:) = .FALSE. 
     180      ENDIF 
     181 
     182      IF(lwp) THEN                   ! control print 
     183         IF( ln_rsttr ) THEN 
     184            WRITE(numout,*) 
     185            WRITE(numout,*) '    read a restart file for passive tracer : ', TRIM( cn_trcrst_in ) 
     186            WRITE(numout,*) 
     187         ELSE 
     188            IF( .NOT.ln_trcdta ) THEN 
     189                WRITE(numout,*) 
     190                WRITE(numout,*) '  All the passive tracers are initialised with constant values ' 
     191                WRITE(numout,*) 
     192            ENDIF 
     193         ENDIF 
     194      ENDIF 
     195 
     196 
     197#if defined key_trdmld_trc || defined key_trdtrc 
     198         nn_trd_trc  = 20 
     199         nn_ctls_trc =  9 
     200         rn_ucf_trc   =  1. 
     201         ln_trdmld_trc_instant = .TRUE. 
     202         ln_trdmld_trc_restart =.FALSE. 
     203         cn_trdrst_trc_in  = "restart_mld_trc" 
     204         cn_trdrst_trc_out = "restart_mld_trc" 
     205         ln_trdtrc(:) = .FALSE. 
     206 
     207         REWIND( numnat )               !  namelist namtoptrd : passive tracer trends diagnostic 
     208         READ  ( numnat, namtrc_trd ) 
     209 
     210         IF(lwp) THEN 
     211            WRITE(numout,*) 
     212            WRITE(numout,*) ' trd_mld_trc_init : read namelist namtrc_trd                    ' 
     213            WRITE(numout,*) ' ~~~~~~~~~~~~~~~~                                               ' 
     214            WRITE(numout,*) '   * frequency of trends diagnostics   nn_trd_trc             = ', nn_trd_trc 
     215            WRITE(numout,*) '   * control surface type              nn_ctls_trc            = ', nn_ctls_trc 
     216            WRITE(numout,*) '   * restart for ML diagnostics        ln_trdmld_trc_restart  = ', ln_trdmld_trc_restart 
     217            WRITE(numout,*) '   * flag to diagnose trends of                                 ' 
     218            WRITE(numout,*) '     instantantaneous or mean ML T/S   ln_trdmld_trc_instant  = ', ln_trdmld_trc_instant 
     219            WRITE(numout,*) '   * unit conversion factor            rn_ucf_trc             = ', rn_ucf_trc 
     220            DO jn = 1, jptra 
     221               IF( ln_trdtrc(jn) ) WRITE(numout,*) '    compute ML trends for tracer number :', jn 
     222            END DO 
     223         ENDIF 
     224#endif 
    168225 
    169226 
  • branches/2011/dev_r2787_LOCEAN3_TRA_TRP/NEMOGCM/NEMO/TOP_SRC/trcrst.F90

    r2715 r2819  
    285285 
    286286      INTEGER  :: jn 
    287       REAL(wp) :: zdiag_var, zdiag_varmin, zdiag_varmax, zdiag_tot 
    288       REAL(wp) :: zder 
     287      REAL(wp) :: ztraf, zmin, zmax, zmean, zdrift 
    289288      !!---------------------------------------------------------------------- 
    290289 
     
    296295      ENDIF 
    297296       
    298       zdiag_tot = 0.e0 
    299       DO jn = 1, jptra 
    300 #  if defined key_degrad 
    301          zdiag_var = glob_sum( trn(:,:,:,jn) * cvol(:,:,:) * facvol(:,:,:) ) 
    302 #  else 
    303          zdiag_var = glob_sum( trn(:,:,:,jn) * cvol(:,:,:)  ) 
    304 #  endif 
    305          zdiag_varmin = MINVAL( trn(:,:,:,jn), mask= ((tmask*SPREAD(tmask_i,DIM=3,NCOPIES=jpk).NE.0.)) ) 
    306          zdiag_varmax = MAXVAL( trn(:,:,:,jn), mask= ((tmask*SPREAD(tmask_i,DIM=3,NCOPIES=jpk).NE.0.)) ) 
     297      DO jn = 1, jptra 
     298         IF( .NOT.lk_degrad )  THEN  ;  ztraf = glob_sum( trn(:,:,:,jn) * cvol(:,:,:) ) 
     299         ELSE                        ;  ztraf = glob_sum( trn(:,:,:,jn) * cvol(:,:,:) * facvol(:,:,:) ) 
     300         ENDIF 
     301         zmin = MINVAL( trn(:,:,:,jn), mask= ((tmask*SPREAD(tmask_i,DIM=3,NCOPIES=jpk).NE.0.)) ) 
     302         zmax = MAXVAL( trn(:,:,:,jn), mask= ((tmask*SPREAD(tmask_i,DIM=3,NCOPIES=jpk).NE.0.)) ) 
    307303         IF( lk_mpp ) THEN 
    308             CALL mpp_min( zdiag_varmin )      ! min over the global domain 
    309             CALL mpp_max( zdiag_varmax )      ! max over the global domain 
     304            CALL mpp_min( zmin )      ! min over the global domain 
     305            CALL mpp_max( zmax )      ! max over the global domain 
    310306         END IF 
    311          zdiag_tot = zdiag_tot + zdiag_var 
    312          zdiag_var = zdiag_var / areatot 
    313          IF(lwp) WRITE(numout,*) '   MEAN NO ', jn, ctrcnm(jn), ' = ', zdiag_var,   & 
    314             &                    ' MIN = ', zdiag_varmin, ' MAX = ', zdiag_varmax 
    315       END DO 
    316        
    317       zder = ( ( zdiag_tot - trai ) / ( trai + 1.e-12 )  ) * 100._wp 
    318       IF(lwp) WRITE(numout,*) '   Integral of all tracers over the full domain  = ', zdiag_tot 
    319       IF(lwp) WRITE(numout,*) '   Drift of the sum of all tracers =', zder, ' %' 
     307         zmean  = ztraf / areatot 
     308         zdrift = ( ( ztraf - trai(jn) ) / ( trai(jn) + 1.e-12 )  ) * 100._wp 
     309         IF(lwp) WRITE(numout,*) ' tracer nb : ', jn,'   ', TRIM( ctrcnm(jn) ) , & 
     310            &    ' mean = ', zmean, ' min = ', zmin, ' max = ', zmax, ' drift = ', zdrift, ' %' 
     311      END DO 
     312      WRITE(numout,*)  
    320313       
    321314   END SUBROUTINE trc_rst_stat 
  • branches/2011/dev_r2787_LOCEAN3_TRA_TRP/NEMOGCM/NEMO/TOP_SRC/trcsms.F90

    r2715 r2819  
    4747      !!--------------------------------------------------------------------- 
    4848 
    49       IF ( MOD( kt, nn_dttrc) /= 0 ) RETURN      ! this ROUTINE is called only every ndttrc time step 
    50  
    5149      IF( lk_lobster )   CALL trc_sms_lobster( kt )    ! main program of LOBSTER 
    5250      IF( lk_pisces  )   CALL trc_sms_pisces ( kt )    ! main program of PISCES  
  • branches/2011/dev_r2787_LOCEAN3_TRA_TRP/NEMOGCM/NEMO/TOP_SRC/trcstp.F90

    r2528 r2819  
    4949      !!------------------------------------------------------------------- 
    5050 
     51      IF( kt == nit000 ) THEN 
     52                               CALL iom_close( numrtr )     ! close input  passive tracers restart file 
     53         IF( lk_trdmld_trc  )  CALL trd_mld_trc_init        ! trends: Mixed-layer 
     54      ENDIF 
     55      ! 
    5156      IF( MOD( kt - 1 , nn_dttrc ) == 0 ) THEN      ! only every nn_dttrc time step 
    5257         ! 
     
    5863         tra(:,:,:,:) = 0.e0 
    5964         ! 
    60          IF( kt == nit000 .AND. lk_trdmld_trc  )  & 
    61             &                      CALL trd_mld_trc_init        ! trends: Mixed-layer 
    6265                                   CALL trc_rst_opn( kt )       ! Open tracer restart file  
    63          IF( lk_iomput ) THEN  ;   CALL trc_wri( kt )           ! output of passive tracers 
    64          ELSE                  ;   CALL trc_dia( kt ) 
     66         IF( lk_iomput ) THEN  ;   CALL trc_wri    ( kt )       ! output of passive tracers with iom I/O manager 
     67         ELSE                  ;   CALL trc_dia    ( kt )       ! output of passive tracers with old I/O manager 
    6568         ENDIF 
    66                                    CALL trc_sms( kt )           ! tracers: sink and source 
    67                                    CALL trc_trp( kt )           ! transport of passive tracers 
    68          IF( kt == nit000 )     CALL iom_close( numrtr )     ! close input  passive tracers restart file 
     69                                   CALL trc_sms    ( kt )       ! tracers: sources minus sinks 
     70                                   CALL trc_trp    ( kt )       ! transport of passive tracers 
    6971         IF( lrst_trc )            CALL trc_rst_wri( kt )       ! write tracer restart file 
    7072         IF( lk_trdmld_trc  )      CALL trd_mld_trc( kt )       ! trends: Mixed-layer 
  • branches/2011/dev_r2787_LOCEAN3_TRA_TRP/NEMOGCM/NEMO/TOP_SRC/trcwri.F90

    r2567 r2819  
    11MODULE trcwri 
    2    !!=================================================================================== 
     2   !!====================================================================== 
    33   !!                       *** MODULE trcwri *** 
    44   !!    TOP :   Output of passive tracers 
    5    !!==================================================================================== 
     5   !!====================================================================== 
    66   !! History :   1.0  !  2009-05 (C. Ethe)  Original code 
    77   !!---------------------------------------------------------------------- 
    8 #if defined key_top &&  defined key_iomput 
     8#if defined key_top && defined key_iomput 
    99   !!---------------------------------------------------------------------- 
    10    !!   'key_top' && 'key_iomput'                              TOP models 
     10   !!   'key_top'                                           TOP models 
    1111   !!---------------------------------------------------------------------- 
    1212   !! trc_wri_trc   :  outputs of concentration fields 
    1313   !!---------------------------------------------------------------------- 
    14    USE dom_oce         ! ocean space and time domain variables 
    15    USE oce_trc 
    16    USE trc 
    17    USE iom 
    18    USE dianam 
     14   USE dom_oce     ! ocean space and time domain variables 
     15   USE oce_trc     ! shared variables between ocean and passive tracers 
     16   USE trc         ! passive tracers common variables  
     17   USE iom         ! I/O manager 
     18   USE dianam      ! Output file name 
    1919 
    2020   IMPLICIT NONE 
     
    5050      !! ** Purpose :   output passive tracers fields  
    5151      !!--------------------------------------------------------------------- 
    52       INTEGER, INTENT( in ) :: kt       ! ocean time-step 
    53       INTEGER               :: jn 
    54       CHARACTER (len=20)    :: cltra 
    55       CHARACTER (len=40) :: clhstnam 
     52      INTEGER, INTENT( in )     :: kt       ! ocean time-step 
     53      INTEGER                   :: jn 
     54      CHARACTER (len=20)        :: cltra 
     55      CHARACTER (len=40)        :: clhstnam 
    5656      INTEGER ::   inum = 11            ! temporary logical unit 
    5757      !!--------------------------------------------------------------------- 
  • branches/2011/dev_r2787_LOCEAN3_TRA_TRP/NEMOGCM/TOOLS/COMPILE/cfg.txt

    r2413 r2819  
    66ORCA2_LIM3 OPA_SRC LIM_SRC_3 
    77ORCA2_LIM OPA_SRC LIM_SRC_2 NST_SRC 
     8ORCA2_LIM_CFC OPA_SRC LIM_SRC_2 NST_SRC TOP_SRC 
     9ORCA2_OFF_CFC OPA_SRC OFF_SRC TOP_SRC 
Note: See TracChangeset for help on using the changeset viewer.