Changeset 2019


Ignore:
Timestamp:
Apr 16, 2014, 7:16:58 AM (10 years ago)
Author:
fhourdin
Message:

Passage au format libre pour inclure les ficheirs du 1D dans lmdz1d.F90

Location:
LMDZ5/trunk/libf
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • LMDZ5/trunk/libf/dyn3d/conf_gcm.F

    r1984 r2019  
    22! $Id$
    33!
    4 c
    5 c
     4!
     5!
    66      SUBROUTINE conf_gcm( tapedef, etatinit, clesphy0 )
    7 c
     7!
    88      USE control_mod
    99#ifdef CPP_IOIPSL
     
    1717
    1818      IMPLICIT NONE
    19 c-----------------------------------------------------------------------
    20 c     Auteurs :   L. Fairhead , P. Le Van  .
    21 c
    22 c     Arguments :
    23 c
    24 c     tapedef   :
    25 c     etatinit  :     = TRUE   , on ne  compare pas les valeurs des para-
    26 c     -metres  du zoom  avec  celles lues sur le fichier start .
    27 c      clesphy0 :  sortie  .
    28 c
     19!-----------------------------------------------------------------------
     20!     Auteurs :   L. Fairhead , P. Le Van  .
     21!
     22!     Arguments :
     23!
     24!     tapedef   :
     25!     etatinit  :     = TRUE   , on ne  compare pas les valeurs des para-
     26!     -metres  du zoom  avec  celles lues sur le fichier start .
     27!      clesphy0 :  sortie  .
     28!
    2929       LOGICAL etatinit
    3030       INTEGER tapedef
     
    3333       PARAMETER(     longcles = 20 )
    3434       REAL clesphy0( longcles )
    35 c
    36 c   Declarations :
    37 c   --------------
     35!
     36!   Declarations :
     37!   --------------
    3838#include "dimensions.h"
    3939#include "paramet.h"
     
    4747! #include "clesphys.h"
    4848#include "iniprint.h"
    49 c
    50 c
    51 c   local:
    52 c   ------
     49!
     50!
     51!   local:
     52!   ------
    5353
    5454      CHARACTER ch1*72,ch2*72,ch3*72,ch4*12
     
    5858      INTEGER i
    5959      LOGICAL use_filtre_fft
    60 c
    61 c  -------------------------------------------------------------------
    62 c
    63 c       .........     Version  du 29/04/97       ..........
    64 c
    65 c   Nouveaux parametres nitergdiv,nitergrot,niterh,tetagdiv,tetagrot,
    66 c      tetatemp   ajoutes  pour la dissipation   .
    67 c
    68 c   Autre parametre ajoute en fin de liste de tapedef : ** fxyhypb **
    69 c
    70 c  Si fxyhypb = .TRUE. , choix de la fonction a derivee tangente hyperb.
    71 c    Sinon , choix de fxynew  , a derivee sinusoidale  ..
    72 c
    73 c   ......  etatinit = . TRUE. si defrun  est appele dans ETAT0_LMD  ou
    74 c         LIMIT_LMD  pour l'initialisation de start.dat (dic) et
    75 c                de limit.dat ( dic)                        ...........
    76 c           Sinon  etatinit = . FALSE .
    77 c
    78 c   Donc etatinit = .F.  si on veut comparer les valeurs de  grossismx ,
    79 c    grossismy,clon,clat, fxyhypb  lues sur  le fichier  start  avec
    80 c   celles passees  par run.def ,  au debut du gcm, apres l'appel a
    81 c    lectba . 
    82 c   Ces parmetres definissant entre autres la grille et doivent etre
    83 c   pareils et coherents , sinon il y aura  divergence du gcm .
    84 c
    85 c-----------------------------------------------------------------------
    86 c   initialisations:
    87 c   ----------------
     60!
     61!  -------------------------------------------------------------------
     62!
     63!       .........     Version  du 29/04/97       ..........
     64!
     65!   Nouveaux parametres nitergdiv,nitergrot,niterh,tetagdiv,tetagrot,
     66!      tetatemp   ajoutes  pour la dissipation   .
     67!
     68!   Autre parametre ajoute en fin de liste de tapedef : ** fxyhypb **
     69!
     70!  Si fxyhypb = .TRUE. , choix de la fonction a derivee tangente hyperb.
     71!    Sinon , choix de fxynew  , a derivee sinusoidale  ..
     72!
     73!   ......  etatinit = . TRUE. si defrun  est appele dans ETAT0_LMD  ou
     74!         LIMIT_LMD  pour l'initialisation de start.dat (dic) et
     75!                de limit.dat ( dic)                        ...........
     76!           Sinon  etatinit = . FALSE .
     77!
     78!   Donc etatinit = .F.  si on veut comparer les valeurs de  grossismx ,
     79!    grossismy,clon,clat, fxyhypb  lues sur  le fichier  start  avec
     80!   celles passees  par run.def ,  au debut du gcm, apres l'appel a
     81!    lectba . 
     82!   Ces parmetres definissant entre autres la grille et doivent etre
     83!   pareils et coherents , sinon il y aura  divergence du gcm .
     84!
     85!-----------------------------------------------------------------------
     86!   initialisations:
     87!   ----------------
    8888
    8989!Config  Key  = lunout
     
    9595      CALL getin('lunout', lunout)
    9696      IF (lunout /= 5 .and. lunout /= 6) THEN
    97         OPEN(UNIT=lunout,FILE='lmdz.out',ACTION='write',
     97        OPEN(UNIT=lunout,FILE='lmdz.out',ACTION='write',                     &
    9898     &          STATUS='unknown',FORM='formatted')
    9999      ENDIF
     
    107107      CALL getin('prt_level',prt_level)
    108108
    109 c-----------------------------------------------------------------------
    110 c  Parametres de controle du run:
    111 c-----------------------------------------------------------------------
     109!-----------------------------------------------------------------------
     110!  Parametres de controle du run:
     111!-----------------------------------------------------------------------
    112112!Config  Key  = planet_type
    113113!Config  Desc = planet type ("earth", "mars", "venus", ...)
     
    232232       CALL getin('dissip_period',dissip_period)
    233233
    234 ccc  ....   P. Le Van , modif le 29/04/97 .pour la dissipation  ...
    235 ccc
     234!cc  ....   P. Le Van , modif le 29/04/97 .pour la dissipation  ...
     235!cc
    236236
    237237!Config  Key  = lstardis
     
    348348       CALL getin('ok_guide',ok_guide)
    349349
    350 c    ...............................................................
     350!    ...............................................................
    351351
    352352!Config  Key  =  read_start
     
    390390      ENDDO
    391391
    392 ccc  ....   P. Le Van , ajout  le 7/03/95 .pour le zoom ...
    393 c     .........   (  modif  le 17/04/96 )   .........
    394 c
     392!cc  ....   P. Le Van , ajout  le 7/03/95 .pour le zoom ...
     393!     .........   (  modif  le 17/04/96 )   .........
     394!
    395395      IF( etatinit ) GO TO 100
    396396
     
    411411       CALL getin('clat',clatt)
    412412
    413 c
    414 c
     413!
     414!
    415415      IF( ABS(clat - clatt).GE. 0.001 )  THEN
    416         write(lunout,*)'conf_gcm: La valeur de clat passee par run.def',
     416        write(lunout,*)'conf_gcm: La valeur de clat passee par run.def',     &
    417417     &    ' est differente de celle lue sur le fichier  start '
    418418        STOP
     
    429429
    430430      IF( ABS(grossismx - grossismxx).GE. 0.001 )  THEN
    431         write(lunout,*)'conf_gcm: La valeur de grossismx passee par ',
     431        write(lunout,*)'conf_gcm: La valeur de grossismx passee par ',       &
    432432     &  'run.def est differente de celle lue sur le fichier  start '
    433433        STOP
     
    443443
    444444      IF( ABS(grossismy - grossismyy).GE. 0.001 )  THEN
    445         write(lunout,*)'conf_gcm: La valeur de grossismy passee par ',
     445        write(lunout,*)'conf_gcm: La valeur de grossismy passee par ',        &
    446446     & 'run.def est differente de celle lue sur le fichier  start '
    447447        STOP
     
    449449     
    450450      IF( grossismx.LT.1. )  THEN
    451         write(lunout,*)
     451        write(lunout,*)                                                        &
    452452     &       'conf_gcm: ***  ATTENTION !! grossismx < 1 .   *** '
    453453         STOP
     
    458458
    459459      IF( grossismy.LT.1. )  THEN
    460         write(lunout,*)
     460        write(lunout,*)                                                        &
    461461     &       'conf_gcm: ***  ATTENTION !! grossismy < 1 .   *** '
    462462         STOP
     
    466466
    467467      write(lunout,*)'conf_gcm: alphax alphay',alphax,alphay
    468 c
    469 c    alphax et alphay sont les anciennes formulat. des grossissements
    470 c
    471 c
     468!
     469!    alphax et alphay sont les anciennes formulat. des grossissements
     470!
     471!
    472472
    473473!Config  Key  = fxyhypb
     
    482482         IF( fxyhypbb )     THEN
    483483            write(lunout,*)' ********  PBS DANS  CONF_GCM  ******** '
    484             write(lunout,*)' *** fxyhypb lu sur le fichier start est ',
    485      *       'F alors  qu il est  T  sur  run.def  ***'
     484            write(lunout,*)' *** fxyhypb lu sur le fichier start est ',     &
     485     &       'F alors  qu il est  T  sur  run.def  ***'
    486486              STOP
    487487         ENDIF
     
    489489         IF( .NOT.fxyhypbb )   THEN
    490490            write(lunout,*)' ********  PBS DANS  CONF_GCM  ******** '
    491             write(lunout,*)' ***  fxyhypb lu sur le fichier start est ',
    492      *        'T alors  qu il est  F  sur  run.def  ****  '
     491            write(lunout,*)' ***  fxyhypb lu sur le fichier start est ',     &
     492     &        'T alors  qu il est  F  sur  run.def  ****  '
    493493              STOP
    494494         ENDIF
    495495      ENDIF
    496 c
     496!
    497497!Config  Key  = dzoomx
    498498!Config  Desc = extension en longitude
     
    505505      IF( fxyhypb )  THEN
    506506       IF( ABS(dzoomx - dzoomxx).GE. 0.001 )  THEN
    507         write(lunout,*)'conf_gcm: La valeur de dzoomx passee par ',
    508      *  'run.def est differente de celle lue sur le fichier  start '
     507        write(lunout,*)'conf_gcm: La valeur de dzoomx passee par ',         &
     508     &  'run.def est differente de celle lue sur le fichier  start '
    509509        STOP
    510510       ENDIF
     
    521521      IF( fxyhypb )  THEN
    522522       IF( ABS(dzoomy - dzoomyy).GE. 0.001 )  THEN
    523         write(lunout,*)'conf_gcm: La valeur de dzoomy passee par ',
    524      * 'run.def est differente de celle lue sur le fichier  start '
     523        write(lunout,*)'conf_gcm: La valeur de dzoomy passee par ',          &
     524     & 'run.def est differente de celle lue sur le fichier  start '
    525525        STOP
    526526       ENDIF
     
    536536      IF( fxyhypb )  THEN
    537537       IF( ABS(taux - tauxx).GE. 0.001 )  THEN
    538         write(lunout,*)'conf_gcm: La valeur de taux passee par ',
    539      * 'run.def est differente de celle lue sur le fichier  start '
     538        write(lunout,*)'conf_gcm: La valeur de taux passee par ',           &
     539     & 'run.def est differente de celle lue sur le fichier  start '
    540540        STOP
    541541       ENDIF
     
    551551      IF( fxyhypb )  THEN
    552552       IF( ABS(tauy - tauyy).GE. 0.001 )  THEN
    553         write(lunout,*)'conf_gcm: La valeur de tauy passee par ',
    554      * 'run.def est differente de celle lue sur le fichier  start '
     553        write(lunout,*)'conf_gcm: La valeur de tauy passee par ',           &
     554     & 'run.def est differente de celle lue sur le fichier  start '
    555555        STOP
    556556       ENDIF
    557557      ENDIF
    558558
    559 cc
     559!c
    560560      IF( .NOT.fxyhypb  )  THEN
    561561
     
    572572          IF( ysinuss )     THEN
    573573            write(lunout,*)' ********  PBS DANS  CONF_GCM  ******** '
    574             write(lunout,*)' *** ysinus lu sur le fichier start est F',
    575      *       ' alors  qu il est  T  sur  run.def  ***'
     574            write(lunout,*)' *** ysinus lu sur le fichier start est F',     &
     575     &       ' alors  qu il est  T  sur  run.def  ***'
    576576            STOP
    577577          ENDIF
     
    579579          IF( .NOT.ysinuss )   THEN
    580580            write(lunout,*)' ********  PBS DANS  CONF_GCM  ******** '
    581             write(lunout,*)' *** ysinus lu sur le fichier start est T',
    582      *        ' alors  qu il est  F  sur  run.def  ****  '
     581            write(lunout,*)' *** ysinus lu sur le fichier start est T',     &
     582     &        ' alors  qu il est  F  sur  run.def  ****  '
    583583              STOP
    584584          ENDIF
    585585        ENDIF
    586586      ENDIF ! of IF( .NOT.fxyhypb  )
    587 c
     587!
    588588!Config  Key  = offline
    589589!Config  Desc = Nouvelle eau liquide
     
    682682
    683683      RETURN
    684 c   ...............................................
    685 c
     684!   ...............................................
     685!
    686686100   CONTINUE
    687687!Config  Key  = clon
     
    718718
    719719      IF( grossismx.LT.1. )  THEN
    720         write(lunout,*)
    721      &   'conf_gcm: ***  ATTENTION !! grossismx < 1 .   *** '
     720        write(lunout,*)'conf_gcm: ***ATTENTION !! grossismx < 1 . *** '
    722721         STOP
    723722      ELSE
     
    727726
    728727      IF( grossismy.LT.1. )  THEN
    729         write(lunout,*)
    730      &  'conf_gcm: ***  ATTENTION !! grossismy < 1 .   *** '
     728        write(lunout,*) 'conf_gcm: ***ATTENTION !! grossismy < 1 . *** '
    731729         STOP
    732730      ELSE
     
    735733
    736734      write(lunout,*)'conf_gcm: alphax alphay ',alphax,alphay
    737 c
    738 c    alphax et alphay sont les anciennes formulat. des grossissements
    739 c
    740 c
     735!
     736!    alphax et alphay sont les anciennes formulat. des grossissements
     737!
     738!
    741739
    742740!Config  Key  = fxyhypb
     
    786784       ysinus = .TRUE.
    787785       CALL getin('ysinus',ysinus)
    788 c
     786!
    789787!Config  Key  = offline
    790788!Config  Desc = Nouvelle eau liquide
     
    864862      vert_prof_dissip = merge(1, 0, ok_strato .and. llm==39)
    865863      CALL getin('vert_prof_dissip', vert_prof_dissip)
    866       call assert(vert_prof_dissip == 0 .or. vert_prof_dissip ==  1,
    867      $     "bad value for vert_prof_dissip")
     864      call assert(vert_prof_dissip == 0 .or. vert_prof_dissip ==  1,        &
     865     &     "bad value for vert_prof_dissip")
    868866
    869867!Config  Key  = ok_gradsfile
     
    892890
    893891      write(lunout,*)' #########################################'
    894       write(lunout,*)' Configuration des parametres de cel0'
     892      write(lunout,*)' Configuration des parametres de cel0'                &
    895893     &             //'_limit: '
    896894      write(lunout,*)' planet_type = ', planet_type
     
    937935      write(lunout,*)' ok_limit = ', ok_limit
    938936      write(lunout,*)' ok_etat0 = ', ok_etat0
    939 c
     937!
    940938      RETURN
    941939      END
  • LMDZ5/trunk/libf/dyn3d_common/q_sat.F

    r1945 r2019  
    22! $Header$
    33!
    4 c
    5 c
     4!
     5!
    66
    77      subroutine q_sat(np,temp,pres,qsat)
    8 c
     8!
    99      IMPLICIT none
    10 c======================================================================
    11 c Autheur(s): Z.X. Li (LMD/CNRS)
    12 c  reecriture vectorisee par F. Hourdin.
    13 c Objet: calculer la vapeur d'eau saturante (formule Centre Euro.)
    14 c======================================================================
    15 c Arguments:
    16 c kelvin---input-R: temperature en Kelvin
    17 c millibar--input-R: pression en mb
    18 c
    19 c q_sat----output-R: vapeur d'eau saturante en kg/kg
    20 c======================================================================
    21 c
     10!======================================================================
     11! Autheur(s): Z.X. Li (LMD/CNRS)
     12!  reecriture vectorisee par F. Hourdin.
     13! Objet: calculer la vapeur d'eau saturante (formule Centre Euro.)
     14!======================================================================
     15! Arguments:
     16! kelvin---input-R: temperature en Kelvin
     17! millibar--input-R: pression en mb
     18!
     19! q_sat----output-R: vapeur d'eau saturante en kg/kg
     20!======================================================================
     21!
    2222      integer np
    2323      REAL temp(np),pres(np),qsat(np)
    24 c
     24!
    2525      REAL r2es
    2626      PARAMETER (r2es=611.14 *18.0153/28.9644)
    27 c
     27!
    2828      REAL r3les, r3ies, r3es
    2929      PARAMETER (R3LES=17.269)
    3030      PARAMETER (R3IES=21.875)
    31 c
     31!
    3232      REAL r4les, r4ies, r4es
    3333      PARAMETER (R4LES=35.86)
    3434      PARAMETER (R4IES=7.66)
    35 c
     35!
    3636      REAL rtt
    3737      PARAMETER (rtt=273.16)
    38 c
     38!
    3939      REAL retv
    4040      PARAMETER (retv=28.9644/18.0153 - 1.0)
     
    4242      real zqsat
    4343      integer ip
    44 c
    45 C     ------------------------------------------------------------------
    46 c
    47 c
     44!
     45!     ------------------------------------------------------------------
     46!
     47!
    4848
    4949      do ip=1,np
    5050
    51 c      write(*,*)'kelvin,millibar=',kelvin,millibar
    52 c       write(*,*)'temp,pres=',temp(ip),pres(ip)
    53 c
     51!      write(*,*)'kelvin,millibar=',kelvin,millibar
     52!       write(*,*)'temp,pres=',temp(ip),pres(ip)
     53!
    5454         IF (temp(ip) .LE. rtt) THEN
    5555            r3es = r3ies
     
    5959            r4es = r4les
    6060         ENDIF
    61 c
     61!
    6262         zqsat=r2es/pres(ip)*EXP(r3es*(temp(ip)-rtt)/(temp(ip)-r4es))
    6363         zqsat=MIN(0.5,ZQSAT)
    6464         zqsat=zqsat/(1.-retv *zqsat)
    65 c
     65!
    6666         qsat(ip)= zqsat
    67 c      write(*,*)'qsat=',qsat(ip)
     67!      write(*,*)'qsat=',qsat(ip)
    6868
    6969      enddo
    70 c
     70!
    7171      RETURN
    7272      END
  • LMDZ5/trunk/libf/phylmd/1DUTILS.h

    r2018 r2019  
    55! $Id: conf_unicol.F 1279 2010-08-04 17:20:56Z lahellec $
    66!
    7 c
    8 c
     7!
     8!
    99      SUBROUTINE conf_unicol
    10 c
     10!
    1111#ifdef CPP_IOIPSL
    1212      use IOIPSL
     
    1616#endif
    1717      IMPLICIT NONE
    18 c-----------------------------------------------------------------------
    19 c     Auteurs :   A. Lahellec  .
    20 c
    21 c   Declarations :
    22 c   --------------
     18!-----------------------------------------------------------------------
     19!     Auteurs :   A. Lahellec  .
     20!
     21!   Declarations :
     22!   --------------
    2323
    2424#include "compar1d.h"
     
    2828#include "fcg_racmo.h"
    2929#include "iniprint.h"
    30 c
    31 c
    32 c   local:
    33 c   ------
    34 
    35 c      CHARACTER ch1*72,ch2*72,ch3*72,ch4*12
     30!
     31!
     32!   local:
     33!   ------
     34
     35!      CHARACTER ch1*72,ch2*72,ch3*72,ch4*12
    3636     
    37 c
    38 c  -------------------------------------------------------------------
    39 c
    40 c      .........    Initilisation parametres du lmdz1D      ..........
    41 c
    42 c---------------------------------------------------------------------
    43 c   initialisations:
    44 c   ----------------
     37!
     38!  -------------------------------------------------------------------
     39!
     40!      .........    Initilisation parametres du lmdz1D      ..........
     41!
     42!---------------------------------------------------------------------
     43!   initialisations:
     44!   ----------------
    4545
    4646!Config  Key  = lunout
     
    6060!Config  Help = Niveau d'impression pour le débogage
    6161!Config         (0 = minimum d'impression)
    62 c      prt_level = 0
    63 c      CALL getin('prt_level',prt_level)
    64 
    65 c-----------------------------------------------------------------------
    66 c  Parametres de controle du run:
    67 c-----------------------------------------------------------------------
     62!      prt_level = 0
     63!      CALL getin('prt_level',prt_level)
     64
     65!-----------------------------------------------------------------------
     66!  Parametres de controle du run:
     67!-----------------------------------------------------------------------
    6868
    6969!Config  Key  = restart
     
    7171!Config  Def  = false
    7272!Config  Help = les fichiers restart doivent etre renomme en start
    73        restart = .FALSE.
     73       restart =.false.
    7474       CALL getin('restart',restart)
    7575
     
    137137!Config  Def  = false
    138138!Config  Help = forcage ou non par les flux de surface
    139        ok_flux_surf = .FALSE.
     139       ok_flux_surf =.false.
    140140       CALL getin('ok_flux_surf',ok_flux_surf)
    141141
     
    319319      write(lunout,*)' +++++++++++++++++++++++++++++++++++++++'
    320320      write(lunout,*)
    321 c
     321!
    322322      RETURN
    323323      END
     
    325325! $Id: dyn1deta0.F 1279 2010/07/30 A Lahellec$
    326326!
    327 c
    328       SUBROUTINE dyn1deta0(fichnom,plev,play,phi,phis,presnivs,
     327!
     328      SUBROUTINE dyn1deta0(fichnom,plev,play,phi,phis,presnivs,                 &
    329329     &                          ucov,vcov,temp,q,omega2)
    330330      USE dimphy
     
    339339
    340340      IMPLICIT NONE
    341 c=======================================================
    342 c Ecriture du fichier de redemarrage sous format NetCDF
    343 c=======================================================
    344 c   Declarations:
    345 c   -------------
     341!=======================================================
     342! Ecriture du fichier de redemarrage sous format NetCDF
     343!=======================================================
     344!   Declarations:
     345!   -------------
    346346#include "dimensions.h"
    347347#include "comconst.h"
     
    351351#include "netcdf.inc"
    352352
    353 c   Arguments:
    354 c   ----------
     353!   Arguments:
     354!   ----------
    355355      CHARACTER*(*) fichnom
    356 cAl1 plev tronque pour .nc mais plev(klev+1):=0
     356!Al1 plev tronque pour .nc mais plev(klev+1):=0
    357357      real :: plev(klon,klev),play (klon,klev),phi(klon,klev)
    358358      real :: presnivs(klon,klev)
    359359      real :: ucov(klon,klev),vcov(klon,klev),temp(klon,klev)
    360360      real :: q(klon,klev,nqtot),omega2(klon,klev)
    361 c      real :: ug(klev),vg(klev),fcoriolis
     361!      real :: ug(klev),vg(klev),fcoriolis
    362362      real :: phis(klon)
    363363
    364 c   Variables locales pour NetCDF:
    365 c   ------------------------------
     364!   Variables locales pour NetCDF:
     365!   ------------------------------
    366366      INTEGER iq
    367367      INTEGER length
     
    383383      print*,'after open startphy ',fichnom,nmq
    384384
    385 c
    386 c Lecture des parametres de controle:
    387 c
     385!
     386! Lecture des parametres de controle:
     387!
    388388      CALL get_var("controle",tab_cntrl)
    389389       
     
    394394      day_ref    = tab_cntrl(4)
    395395      annee_ref  = tab_cntrl(5)
    396 c      rad        = tab_cntrl(6)
    397 c      omeg       = tab_cntrl(7)
    398 c      g          = tab_cntrl(8)
    399 c      cpp        = tab_cntrl(9)
    400 c      kappa      = tab_cntrl(10)
    401 c      daysec     = tab_cntrl(11)
    402 c      dtvr       = tab_cntrl(12)
    403 c      etot0      = tab_cntrl(13)
    404 c      ptot0      = tab_cntrl(14)
    405 c      ztot0      = tab_cntrl(15)
    406 c      stot0      = tab_cntrl(16)
    407 c      ang0       = tab_cntrl(17)
    408 c      pa         = tab_cntrl(18)
    409 c      preff      = tab_cntrl(19)
    410 c
    411 c      clon       = tab_cntrl(20)
    412 c      clat       = tab_cntrl(21)
    413 c      grossismx  = tab_cntrl(22)
    414 c      grossismy  = tab_cntrl(23)
    415 c
     396!      rad        = tab_cntrl(6)
     397!      omeg       = tab_cntrl(7)
     398!      g          = tab_cntrl(8)
     399!      cpp        = tab_cntrl(9)
     400!      kappa      = tab_cntrl(10)
     401!      daysec     = tab_cntrl(11)
     402!      dtvr       = tab_cntrl(12)
     403!      etot0      = tab_cntrl(13)
     404!      ptot0      = tab_cntrl(14)
     405!      ztot0      = tab_cntrl(15)
     406!      stot0      = tab_cntrl(16)
     407!      ang0       = tab_cntrl(17)
     408!      pa         = tab_cntrl(18)
     409!      preff      = tab_cntrl(19)
     410!
     411!      clon       = tab_cntrl(20)
     412!      clat       = tab_cntrl(21)
     413!      grossismx  = tab_cntrl(22)
     414!      grossismy  = tab_cntrl(23)
     415!
    416416      IF ( tab_cntrl(24).EQ.1. )  THEN
    417         fxyhypb  = . TRUE .
    418 c        dzoomx   = tab_cntrl(25)
    419 c        dzoomy   = tab_cntrl(26)
    420 c        taux     = tab_cntrl(28)
    421 c        tauy     = tab_cntrl(29)
     417        fxyhypb  =.true.
     418!        dzoomx   = tab_cntrl(25)
     419!        dzoomy   = tab_cntrl(26)
     420!        taux     = tab_cntrl(28)
     421!        tauy     = tab_cntrl(29)
    422422      ELSE
    423         fxyhypb = . FALSE .
    424         ysinus  = . FALSE .
    425         IF( tab_cntrl(27).EQ.1. ) ysinus = . TRUE.
     423        fxyhypb = .false.
     424        ysinus  = .false.
     425        IF( tab_cntrl(27).EQ.1. ) ysinus =.true.
    426426      ENDIF
    427427
    428428      day_ini = tab_cntrl(30)
    429429      itau_dyn = tab_cntrl(31)
    430 c   .................................................................
    431 c
    432 c
    433 c      PRINT*,'rad,omeg,g,cpp,kappa',rad,omeg,g,cpp,kappa
    434 cAl1
    435        Print*,'day_ref,annee_ref,day_ini,itau_dyn',
     430!   .................................................................
     431!
     432!
     433!      PRINT*,'rad,omeg,g,cpp,kappa',rad,omeg,g,cpp,kappa
     434!Al1
     435       Print*,'day_ref,annee_ref,day_ini,itau_dyn',                         &
    436436     &              day_ref,annee_ref,day_ini,itau_dyn
    437437
    438 c  Lecture des champs
    439 c
     438!  Lecture des champs
     439!
    440440      plev(1,klev+1)=0.
    441441      CALL get_field("plev",plev,found)
     
    460460      Do iq=1,nqtot
    461461        CALL get_field("q"//nmq(iq),q(:,:,iq),found)
    462         IF (.NOT. found)
    463      &  PRINT*, modname//'Le champ <q'//nmq//'> est absent'
     462        IF (.NOT.found)PRINT*, modname//'Le champ <q'//nmq//'> est absent'
    464463      EndDo
    465464
    466465      CALL close_startphy
    467       print*,' close startphy'
    468      .      ,fichnom,play(1,1),play(1,klev),temp(1,klev)
    469 c
     466      print*,' close startphy',fichnom,play(1,1),play(1,klev),temp(1,klev)
     467!
    470468      RETURN
    471469      END
     
    473471! $Id: dyn1dredem.F 1279 2010/07/29 A Lahellec$
    474472!
    475 c
    476       SUBROUTINE dyn1dredem(fichnom,plev,play,phi,phis,presnivs,
     473!
     474      SUBROUTINE dyn1dredem(fichnom,plev,play,phi,phis,presnivs,           &
    477475     &                          ucov,vcov,temp,q,omega2)
    478476      USE dimphy
     
    485483
    486484      IMPLICIT NONE
    487 c=======================================================
    488 c Ecriture du fichier de redemarrage sous format NetCDF
    489 c=======================================================
    490 c   Declarations:
    491 c   -------------
     485!=======================================================
     486! Ecriture du fichier de redemarrage sous format NetCDF
     487!=======================================================
     488!   Declarations:
     489!   -------------
    492490#include "dimensions.h"
    493491#include "comconst.h"
     
    497495#include "netcdf.inc"
    498496
    499 c   Arguments:
    500 c   ----------
     497!   Arguments:
     498!   ----------
    501499      CHARACTER*(*) fichnom
    502 cAl1 plev tronque pour .nc mais plev(klev+1):=0
     500!Al1 plev tronque pour .nc mais plev(klev+1):=0
    503501      real :: plev(klon,klev),play (klon,klev),phi(klon,klev)
    504502      real :: presnivs(klon,klev)
     
    506504      real :: q(klon,klev,nqtot)
    507505      real :: omega2(klon,klev),rho(klon,klev+1)
    508 c      real :: ug(klev),vg(klev),fcoriolis
     506!      real :: ug(klev),vg(klev),fcoriolis
    509507      real :: phis(klon)
    510508
    511 c   Variables locales pour NetCDF:
    512 c   ------------------------------
     509!   Variables locales pour NetCDF:
     510!   ------------------------------
    513511      INTEGER nid
    514512      INTEGER ierr
     
    520518      character*20 modname
    521519      character*80 abort_message
    522 c
     520!
    523521      INTEGER nb
    524522      SAVE nb
     
    554552       tab_cntrl(11) = daysec
    555553       tab_cntrl(12) = dtvr
    556 c       tab_cntrl(13) = etot0
    557 c       tab_cntrl(14) = ptot0
    558 c       tab_cntrl(15) = ztot0
    559 c       tab_cntrl(16) = stot0
    560 c       tab_cntrl(17) = ang0
    561 c       tab_cntrl(18) = pa
    562 c       tab_cntrl(19) = preff
    563 c
    564 c    .....    parametres  pour le zoom      ......   
    565 
    566 c       tab_cntrl(20)  = clon
    567 c       tab_cntrl(21)  = clat
    568 c       tab_cntrl(22)  = grossismx
    569 c       tab_cntrl(23)  = grossismy
    570 c
     554!       tab_cntrl(13) = etot0
     555!       tab_cntrl(14) = ptot0
     556!       tab_cntrl(15) = ztot0
     557!       tab_cntrl(16) = stot0
     558!       tab_cntrl(17) = ang0
     559!       tab_cntrl(18) = pa
     560!       tab_cntrl(19) = preff
     561!
     562!    .....    parametres  pour le zoom      ......   
     563
     564!       tab_cntrl(20)  = clon
     565!       tab_cntrl(21)  = clat
     566!       tab_cntrl(22)  = grossismx
     567!       tab_cntrl(23)  = grossismy
     568!
    571569      IF ( fxyhypb )   THEN
    572570       tab_cntrl(24) = 1.
    573 c       tab_cntrl(25) = dzoomx
    574 c       tab_cntrl(26) = dzoomy
     571!       tab_cntrl(25) = dzoomx
     572!       tab_cntrl(26) = dzoomy
    575573       tab_cntrl(27) = 0.
    576 c       tab_cntrl(28) = taux
    577 c       tab_cntrl(29) = tauy
     574!       tab_cntrl(28) = taux
     575!       tab_cntrl(29) = tauy
    578576      ELSE
    579577       tab_cntrl(24) = 0.
    580 c       tab_cntrl(25) = dzoomx
    581 c       tab_cntrl(26) = dzoomy
     578!       tab_cntrl(25) = dzoomx
     579!       tab_cntrl(26) = dzoomy
    582580       tab_cntrl(27) = 0.
    583581       tab_cntrl(28) = 0.
     
    585583       IF( ysinus )  tab_cntrl(27) = 1.
    586584      ENDIF
    587 CAl1 iday_end -> day_end
     585!Al1 iday_end -> day_end
    588586       tab_cntrl(30) = FLOAT(day_end)
    589587       tab_cntrl(31) = FLOAT(itau_dyn + itaufin)
    590 c
     588!
    591589      CALL put_var("controle","Param. de controle Dyn1D",tab_cntrl)
    592 c
    593 
    594 c  Ecriture/extension de la coordonnee temps
     590!
     591
     592!  Ecriture/extension de la coordonnee temps
    595593
    596594      nb = nb + 1
    597595
    598 c  Ecriture des champs
    599 c
     596!  Ecriture des champs
     597!
    600598      CALL put_field("plev","p interfaces sauf la nulle",plev)
    601599      CALL put_field("play","",play)
     
    609607
    610608      Do iq=1,nqtot
    611         CALL put_field("q"//nmq(iq),"eau vap ou condens et traceurs",
    612      .                                                      q(:,:,iq))
     609        CALL put_field("q"//nmq(iq),"eau vap ou condens et traceurs",           &
     610     &                                                      q(:,:,iq))
    613611      EndDo
    614612      CALL close_restartphy
    615613
    616 c
     614!
    617615      RETURN
    618616      END
     
    770768!   -------
    771769 
    772       IF(ngrid.NE.2+(jm-2)*(im-1).AND.ngrid.NE.1)
    773      s    STOP 'probleme de dim'
     770      IF(ngrid.NE.2+(jm-2)*(im-1).AND.ngrid.NE.1)                          &
     771     &    STOP 'probleme de dim'
    774772!   traitement des poles
    775773      CALL SCOPY(nfield,pdyn,im*jm,pfi,ngrid)
     
    829827      pi=2.*ASIN(1.)
    830828 
    831       OPEN(99,file='sigma.def',status='old',form='formatted',
    832      s   iostat=ierr)
     829      OPEN(99,file='sigma.def',status='old',form='formatted',                   &
     830     &   iostat=ierr)
    833831 
    834832!-----------------------------------------------------------------------
     
    850848 
    851849       DO 1  l = 1, llm
    852        dsig(l) = (alpha+(1.-alpha)*exp(-beta*(llm-l)))*
    853      $          ( (tanh(gama*l)/tanh(gama*llm))**np +
    854      $            (1.-l/FLOAT(llm))*delta )
     850       dsig(l) = (alpha+(1.-alpha)*exp(-beta*(llm-l)))*                    &
     851     &          ( (tanh(gama*l)/tanh(gama*llm))**np +                      &
     852     &            (1.-l/FLOAT(llm))*delta )
    855853   1   CONTINUE
    856854 
     
    10051003
    10061004
    1007        SUBROUTINE advect_va(llm,omega,d_t_va,d_q_va,d_u_va,d_v_va,
    1008      s                q,temp,u,v,play)
     1005       SUBROUTINE advect_va(llm,omega,d_t_va,d_q_va,d_u_va,d_v_va,              &
     1006     &                q,temp,u,v,play)
    10091007!itlmd
    10101008!----------------------------------------------------------------------
     
    10311029!si omgup pour la couche 1, alors tendance nulle
    10321030        omgdown=max(omega(2),0.0)
    1033         alpha = rkappa*temp(l)*(1.+q(l,1)*rv/rd)/(play(l)*
    1034      &           (1.+q(l,1)))
    1035         d_t_va(l)= alpha*(omgdown)-
    1036      &              omgdown*(temp(l)-temp(l+1))
    1037      &              /(play(l)-play(l+1))             
    1038 
    1039         d_q_va(l,:)= -omgdown*(q(l,:)-q(l+1,:))
    1040      &              /(play(l)-play(l+1))             
    1041 
    1042         d_u_va(l)= -omgdown*(u(l)-u(l+1))
    1043      &              /(play(l)-play(l+1))             
    1044         d_v_va(l)= -omgdown*(v(l)-v(l+1))
    1045      &              /(play(l)-play(l+1))             
     1031        alpha = rkappa*temp(l)*(1.+q(l,1)*rv/rd)/(play(l)*(1.+q(l,1)))
     1032        d_t_va(l)= alpha*(omgdown)-omgdown*(temp(l)-temp(l+1))             &
     1033     &       /(play(l)-play(l+1))
     1034
     1035        d_q_va(l,:)= -omgdown*(q(l,:)-q(l+1,:))/(play(l)-play(l+1))             
     1036
     1037        d_u_va(l)= -omgdown*(u(l)-u(l+1))/(play(l)-play(l+1))             
     1038        d_v_va(l)= -omgdown*(v(l)-v(l+1))/(play(l)-play(l+1))             
    10461039
    10471040       
    10481041       elseif(l.eq.llm) then
    10491042        omgup=min(omega(l),0.0)
    1050         alpha = rkappa*temp(l)*(1.+q(l,1)*rv/rd)/(play(l)*
    1051      &           (1.+q(l,1)))
    1052         d_t_va(l)= alpha*(omgup)-
     1043        alpha = rkappa*temp(l)*(1.+q(l,1)*rv/rd)/(play(l)*(1.+q(l,1)))
     1044        d_t_va(l)= alpha*(omgup)-                                          &
     1045
    10531046!bug?     &              omgup*(temp(l-1)-temp(l))/(play(l-1)-plev(l))
    10541047     &              omgup*(temp(l-1)-temp(l))/(play(l-1)-play(l))
     
    10601053        omgup=min(omega(l),0.0)
    10611054        omgdown=max(omega(l+1),0.0)
    1062         alpha = rkappa*temp(l)*(1.+q(l,1)*rv/rd)/(play(l)*
    1063      &           (1.+q(l,1)))
    1064         d_t_va(l)= alpha*(omgup+omgdown)-
    1065      &              omgdown*(temp(l)-temp(l+1))
    1066      &              /(play(l)-play(l+1))-             
     1055        alpha = rkappa*temp(l)*(1.+q(l,1)*rv/rd)/(play(l)*(1.+q(l,1)))
     1056        d_t_va(l)= alpha*(omgup+omgdown)-omgdown*(temp(l)-temp(l+1))       &
     1057     &              /(play(l)-play(l+1))-                                  &
    10671058!bug?     &              omgup*(temp(l-1)-temp(l))/(play(l-1)-plev(l))
    10681059     &              omgup*(temp(l-1)-temp(l))/(play(l-1)-play(l))
    10691060!      print*, '  ??? '
    10701061
    1071         d_q_va(l,:)= -omgdown*(q(l,:)-q(l+1,:))
    1072      &              /(play(l)-play(l+1))-             
    1073      &              omgup*(q(l-1,:)-q(l,:))/(play(l-1)-play(l))
    1074         d_u_va(l)= -omgdown*(u(l)-u(l+1))
    1075      &              /(play(l)-play(l+1))-             
    1076      &              omgup*(u(l-1)-u(l))/(play(l-1)-play(l))
    1077         d_v_va(l)= -omgdown*(v(l)-v(l+1))
    1078      &              /(play(l)-play(l+1))-             
     1062        d_q_va(l,:)= -omgdown*(q(l,:)-q(l+1,:))                            &
     1063     &              /(play(l)-play(l+1))-                                  &
     1064     &              omgup*(q(l-1,:)-q(l,:))/(play(l-1)-play(l)) 
     1065        d_u_va(l)= -omgdown*(u(l)-u(l+1))                                  &
     1066     &              /(play(l)-play(l+1))-                                  &
     1067     &              omgup*(u(l-1)-u(l))/(play(l-1)-play(l)) 
     1068        d_v_va(l)= -omgdown*(v(l)-v(l+1))                                  &
     1069     &              /(play(l)-play(l+1))-                                  &
    10791070     &              omgup*(v(l-1)-v(l))/(play(l-1)-play(l))
    10801071       
     
    10861077        end
    10871078!       SUBROUTINE lstendH(llm,omega,d_t_va,d_q_va,d_u_va,d_v_va,
    1088        SUBROUTINE lstendH(llm,nqtot,omega,d_t_va,d_q_va,
    1089      !                q,temp,u,v,play)
     1079       SUBROUTINE lstendH(llm,nqtot,omega,d_t_va,d_q_va,                        &
     1080     &                q,temp,u,v,play)
    10901081!itlmd
    10911082!----------------------------------------------------------------------
     
    11431134!      d_v_va(k)  = -omdn*dvdp(k)-omup*dvdp(k-1)
    11441135      d_q_va(k,1)= -omdn*dqdp(k)-omup*dqdp(k-1)
    1145       d_t_va(k)  = -omdn*dtdp(k)-omup*dtdp(k-1)
    1146      :              +(omup+omdn)*cor(k)
     1136      d_t_va(k)  = -omdn*dtdp(k)-omup*dtdp(k-1)+(omup+omdn)*cor(k)
    11471137      enddo
    11481138
     
    11701160
    11711161!======================================================================
    1172       SUBROUTINE read_togacoare(fich_toga,nlev_toga,nt_toga
    1173      :             ,ts_toga,plev_toga,t_toga,q_toga,u_toga,v_toga,w_toga
    1174      :             ,ht_toga,vt_toga,hq_toga,vq_toga)
     1162      SUBROUTINE read_togacoare(fich_toga,nlev_toga,nt_toga                     &
     1163     &             ,ts_toga,plev_toga,t_toga,q_toga,u_toga,v_toga,w_toga        &
     1164     &             ,ht_toga,vt_toga,hq_toga,vq_toga)
    11751165      implicit none
    11761166
    1177 c-------------------------------------------------------------------------
    1178 c Read TOGA-COARE forcing data
    1179 c-------------------------------------------------------------------------
     1167!-------------------------------------------------------------------------
     1168! Read TOGA-COARE forcing data
     1169!-------------------------------------------------------------------------
    11801170
    11811171      integer nlev_toga,nt_toga
     
    12071197
    12081198       do k = 1, nlev_toga
    1209          read(21,230) plev_toga(k,ip), t_toga(k,ip), q_toga(k,ip)
    1210      :       ,u_toga(k,ip), v_toga(k,ip), w_toga(k,ip)
    1211      :       ,ht_toga(k,ip), vt_toga(k,ip), hq_toga(k,ip), vq_toga(k,ip)
     1199         read(21,230) plev_toga(k,ip), t_toga(k,ip), q_toga(k,ip)          &
     1200     &       ,u_toga(k,ip), v_toga(k,ip), w_toga(k,ip)                     &
     1201     &       ,ht_toga(k,ip), vt_toga(k,ip), hq_toga(k,ip), vq_toga(k,ip)
    12121202
    12131203! conversion in SI units:
     
    12331223          end
    12341224
    1235 c-------------------------------------------------------------------------
     1225!-------------------------------------------------------------------------
    12361226      SUBROUTINE read_sandu(fich_sandu,nlev_sandu,nt_sandu,ts_sandu)
    12371227      implicit none
    12381228
    1239 c-------------------------------------------------------------------------
    1240 c Read I.SANDU case forcing data
    1241 c-------------------------------------------------------------------------
     1229!-------------------------------------------------------------------------
     1230! Read I.SANDU case forcing data
     1231!-------------------------------------------------------------------------
    12421232
    12431233      integer nlev_sandu,nt_sandu
     
    12691259
    12701260!=====================================================================
    1271 c-------------------------------------------------------------------------
    1272       SUBROUTINE read_astex(fich_astex,nlev_astex,nt_astex,div_astex,
    1273      : ts_astex,ug_astex,vg_astex,ufa_astex,vfa_astex)
     1261!-------------------------------------------------------------------------
     1262      SUBROUTINE read_astex(fich_astex,nlev_astex,nt_astex,div_astex,      &
     1263     & ts_astex,ug_astex,vg_astex,ufa_astex,vfa_astex)
    12741264      implicit none
    12751265
    1276 c-------------------------------------------------------------------------
    1277 c Read Astex case forcing data
    1278 c-------------------------------------------------------------------------
     1266!-------------------------------------------------------------------------
     1267! Read Astex case forcing data
     1268!-------------------------------------------------------------------------
    12791269
    12801270      integer nlev_astex,nt_astex
     
    12971287      read(21,'(a)')
    12981288      read(21,'(a)')
    1299       read(21,223) iy, im, id, ih, div_astex(ip),ts_astex(ip),
    1300      :ug_astex(ip),vg_astex(ip),ufa_astex(ip),vfa_astex(ip)
     1289      read(21,223) iy, im, id, ih, div_astex(ip),ts_astex(ip),             &
     1290     &ug_astex(ip),vg_astex(ip),ufa_astex(ip),vfa_astex(ip)
    13011291      ts_astex(ip)=ts_astex(ip)+273.15
    1302       print *,'ts=',iy,im,id,ih,ip,div_astex(ip),ts_astex(ip),
    1303      :ug_astex(ip),vg_astex(ip),ufa_astex(ip),vg_astex(ip)
     1292      print *,'ts=',iy,im,id,ih,ip,div_astex(ip),ts_astex(ip),             &
     1293     &ug_astex(ip),vg_astex(ip),ufa_astex(ip),vg_astex(ip)
    13041294      enddo
    13051295      close(21)
     
    13101300          end
    13111301!=====================================================================
    1312       subroutine read_twpice(fich_twpice,nlevel,ntime
    1313      :     ,T_srf,plev,T,q,u,v,omega
    1314      :     ,T_adv_h,T_adv_v,q_adv_h,q_adv_v)
     1302      subroutine read_twpice(fich_twpice,nlevel,ntime                       &
     1303     &     ,T_srf,plev,T,q,u,v,omega                                       &
     1304     &     ,T_adv_h,T_adv_v,q_adv_h,q_adv_v)
    13151305
    13161306!program reading forcings of the TWP-ICE experiment
     
    17921782!=====================================================================
    17931783
    1794        SUBROUTINE interp_sandu_vertical(play,nlev_sandu,plev_prof
    1795      :         ,t_prof,thl_prof,q_prof,u_prof,v_prof,w_prof
    1796      :         ,omega_prof,o3mmr_prof
    1797      :         ,t_mod,thl_mod,q_mod,u_mod,v_mod,w_mod
    1798      :         ,omega_mod,o3mmr_mod,mxcalc)
     1784       SUBROUTINE interp_sandu_vertical(play,nlev_sandu,plev_prof          &
     1785     &         ,t_prof,thl_prof,q_prof,u_prof,v_prof,w_prof                &
     1786     &         ,omega_prof,o3mmr_prof                                      &
     1787     &         ,t_mod,thl_mod,q_mod,u_mod,v_mod,w_mod                      &
     1788     &         ,omega_mod,o3mmr_mod,mxcalc)
    17991789
    18001790       implicit none
     
    18021792#include "dimensions.h"
    18031793
    1804 c-------------------------------------------------------------------------
    1805 c Vertical interpolation of SANDUREF forcing data onto model levels
    1806 c-------------------------------------------------------------------------
     1794!-------------------------------------------------------------------------
     1795! Vertical interpolation of SANDUREF forcing data onto model levels
     1796!-------------------------------------------------------------------------
    18071797
    18081798       integer nlevmax
     
    18381828
    18391829         do k = 1, nlev_sandu-1
    1840           if (play(l).le.plev_prof(k)
    1841      :       .and. play(l).gt.plev_prof(k+1)) then
     1830          if (play(l).le.plev_prof(k).and. play(l).gt.plev_prof(k+1)) then
    18421831            k1=k
    18431832            k2=k+1
     
    18601849         v_mod(l)= v_prof(k2) - frac*(v_prof(k2)-v_prof(k1))
    18611850         w_mod(l)= w_prof(k2) - frac*(w_prof(k2)-w_prof(k1))
    1862          omega_mod(l)=omega_prof(k2)-
    1863      :      frac*(omega_prof(k2)-omega_prof(k1))
    1864          o3mmr_mod(l)=o3mmr_prof(k2)-
    1865      :      frac*(o3mmr_prof(k2)-o3mmr_prof(k1))
     1851         omega_mod(l)=omega_prof(k2)-frac*(omega_prof(k2)-omega_prof(k1))
     1852         o3mmr_mod(l)=o3mmr_prof(k2)-frac*(o3mmr_prof(k2)-o3mmr_prof(k1))
    18661853
    18671854         else !play>plev_prof(1)
     
    18841871        else ! above max altitude of forcing file
    18851872
    1886 cjyg
     1873!jyg
    18871874         fact=20.*(plev_prof(nlev_sandu)-play(l))/plev_prof(nlev_sandu) !jyg
    18881875         fact = max(fact,0.)                                           !jyg
     
    19091896          end
    19101897!=====================================================================
    1911        SUBROUTINE interp_astex_vertical(play,nlev_astex,plev_prof
    1912      :         ,t_prof,thl_prof,qv_prof,ql_prof,qt_prof,u_prof,v_prof
    1913      :         ,w_prof,tke_prof,o3mmr_prof
    1914      :         ,t_mod,thl_mod,qv_mod,ql_mod,qt_mod,u_mod,v_mod,w_mod
    1915      :         ,tke_mod,o3mmr_mod,mxcalc)
     1898       SUBROUTINE interp_astex_vertical(play,nlev_astex,plev_prof          &
     1899     &         ,t_prof,thl_prof,qv_prof,ql_prof,qt_prof,u_prof,v_prof      &
     1900     &         ,w_prof,tke_prof,o3mmr_prof                                 &
     1901     &         ,t_mod,thl_mod,qv_mod,ql_mod,qt_mod,u_mod,v_mod,w_mod       &
     1902     &         ,tke_mod,o3mmr_mod,mxcalc)
    19161903
    19171904       implicit none
     
    19191906#include "dimensions.h"
    19201907
    1921 c-------------------------------------------------------------------------
    1922 c Vertical interpolation of Astex forcing data onto model levels
    1923 c-------------------------------------------------------------------------
     1908!-------------------------------------------------------------------------
     1909! Vertical interpolation of Astex forcing data onto model levels
     1910!-------------------------------------------------------------------------
    19241911
    19251912       integer nlevmax
     
    19561943
    19571944         do k = 1, nlev_astex-1
    1958           if (play(l).le.plev_prof(k)
    1959      :       .and. play(l).gt.plev_prof(k+1)) then
     1945          if (play(l).le.plev_prof(k).and. play(l).gt.plev_prof(k+1)) then
    19601946            k1=k
    19611947            k2=k+1
     
    19811967         w_mod(l)= w_prof(k2) - frac*(w_prof(k2)-w_prof(k1))
    19821968         tke_mod(l)= tke_prof(k2) - frac*(tke_prof(k2)-tke_prof(k1))
    1983          o3mmr_mod(l)=o3mmr_prof(k2)-
    1984      :      frac*(o3mmr_prof(k2)-o3mmr_prof(k1))
     1969         o3mmr_mod(l)=o3mmr_prof(k2)-frac*(o3mmr_prof(k2)-o3mmr_prof(k1))
    19851970
    19861971         else !play>plev_prof(1)
     
    20051990        else ! above max altitude of forcing file
    20061991
    2007 cjyg
     1992!jyg
    20081993         fact=20.*(plev_prof(nlev_astex)-play(l))/plev_prof(nlev_astex) !jyg
    20091994         fact = max(fact,0.)                                           !jyg
     
    20332018
    20342019!======================================================================
    2035       SUBROUTINE read_rico(fich_rico,nlev_rico,ps_rico,play
    2036      :             ,ts_rico,t_rico,q_rico,u_rico,v_rico,w_rico
    2037      :             ,dth_dyn,dqh_dyn)
     2020      SUBROUTINE read_rico(fich_rico,nlev_rico,ps_rico,play                &
     2021     &             ,ts_rico,t_rico,q_rico,u_rico,v_rico,w_rico             &
     2022     &             ,dth_dyn,dqh_dyn)
    20382023      implicit none
    20392024
    2040 c-------------------------------------------------------------------------
    2041 c Read RICO forcing data
    2042 c-------------------------------------------------------------------------
     2025!-------------------------------------------------------------------------
     2026! Read RICO forcing data
     2027!-------------------------------------------------------------------------
    20432028#include "dimensions.h"
    20442029
     
    20812066          if(prico(l)>play(k)) then
    20822067              if(play(k)>prico(l+1)) then
    2083                 zlay(k)=zrico(l)+(play(k)-prico(l)) *
     2068                zlay(k)=zrico(l)+(play(k)-prico(l)) *                      &
    20842069     &              (zrico(l+1)-zrico(l))/(prico(l+1)-prico(l))
    2085               else
    2086                 zlay(k)=zrico(l)+(play(k)-prico(80))*
     2070              else 
     2071                zlay(k)=zrico(l)+(play(k)-prico(80))*                      &
    20872072     &              (zrico(81)-zrico(80))/(prico(81)-prico(80))
    20882073              endif
     
    20942079          u_rico(k)=-9.9 + (-1.9 + 9.9)*zlay(k)/4000
    20952080        elseif(4000 < zlay(k) .and. zlay(k) < 12000) then
    2096        u_rico(k)=  -1.9 + (30.0 + 1.9) /
    2097      :          (12000 - 4000) * (zlay(k) - 4000)
     2081       u_rico(k)=  -1.9 + (30.0 + 1.9) /                                   &
     2082     &          (12000 - 4000) * (zlay(k) - 4000)
    20982083        elseif(12000 < zlay(k) .and. zlay(k) < 13000) then
    20992084          u_rico(k)=30.0
    21002085        elseif(13000 < zlay(k) .and. zlay(k) < 20000) then
    2101           u_rico(k)=30.0 - (30.0) /
    2102      : (20000 - 13000) * (zlay(k) - 13000)
     2086          u_rico(k)=30.0 - (30.0) /                                        &
     2087     & (20000 - 13000) * (zlay(k) - 13000)
    21032088        else
    21042089          u_rico(k)=0.0
     
    21092094          q_rico(k)=16.0 + (13.8 - 16.0) / (740) * zlay(k)
    21102095        elseif(740 < zlay(k) .and. zlay(k) < 3260) then
    2111           q_rico(k)=13.8 + (2.4 - 13.8) /
    2112      :          (3260 - 740) * (zlay(k) - 740)
     2096          q_rico(k)=13.8 + (2.4 - 13.8) /                                   &
     2097     &          (3260 - 740) * (zlay(k) - 740)
    21132098        elseif(3260 < zlay(k) .and. zlay(k) < 4000) then
    2114           q_rico(k)=2.4 + (1.8 - 2.4) /
    2115      :               (4000 - 3260) * (zlay(k) - 3260)
     2099          q_rico(k)=2.4 + (1.8 - 2.4) /                                    &
     2100     &               (4000 - 3260) * (zlay(k) - 3260)
    21162101        elseif(4000 < zlay(k) .and. zlay(k) < 9000) then
    2117           q_rico(k)=1.8 + (0 - 1.8) /
    2118      :             (10000 - 4000) * (zlay(k) - 4000)
     2102          q_rico(k)=1.8 + (0 - 1.8) /                                      &
     2103     &             (10000 - 4000) * (zlay(k) - 4000)
    21192104        else
    21202105          q_rico(k)=0.0
     
    21252110          t_rico(k)=299.2 + (292.0 - 299.2) / (740) * zlay(k)
    21262111        elseif(740 < zlay(k) .and. zlay(k) < 4000) then
    2127           t_rico(k)=292.0 + (278.0 - 292.0) /
    2128      :       (4000 - 740) * (zlay(k) - 740)
     2112          t_rico(k)=292.0 + (278.0 - 292.0) /                              &                       
     2113     &       (4000 - 740) * (zlay(k) - 740)
    21292114        elseif(4000 < zlay(k) .and. zlay(k) < 15000) then
    2130           t_rico(k)=278.0 + (203.0 - 278.0) /
    2131      :       (15000 - 4000) * (zlay(k) - 4000)
     2115          t_rico(k)=278.0 + (203.0 - 278.0) /                              &
     2116     &       (15000 - 4000) * (zlay(k) - 4000)
    21322117        elseif(15000 < zlay(k) .and. zlay(k) < 17500) then
    2133           t_rico(k)=203.0 + (194.0 - 203.0) /
    2134      :       (17500 - 15000)* (zlay(k) - 15000)
     2118          t_rico(k)=203.0 + (194.0 - 203.0) /                              &
     2119     &       (17500 - 15000)* (zlay(k) - 15000)
    21352120        elseif(17500 < zlay(k) .and. zlay(k) < 20000) then
    2136           t_rico(k)=194.0 + (206.0 - 194.0) /
    2137      :       (20000 - 17500)* (zlay(k) - 17500)
     2121          t_rico(k)=194.0 + (206.0 - 194.0) /                              &
     2122     &       (20000 - 17500)* (zlay(k) - 17500)
    21382123        elseif(20000 < zlay(k) .and. zlay(k) < 60000) then
    2139           t_rico(k)=206.0 + (270.0 - 206.0) /
    2140      :        (60000 - 20000)* (zlay(k) - 20000)
     2124          t_rico(k)=206.0 + (270.0 - 206.0) /                              &
     2125     &        (60000 - 20000)* (zlay(k) - 20000)
    21412126        endif
    21422127
     
    21542139! dThrz+dTsw0+dTlw0
    21552140        if(0 < zlay(k) .and. zlay(k) < 4000) then
    2156           dth_dyn(k)=- 2.51 / 86400 + (-2.18 + 2.51 )/
    2157      :               (86400*4000) * zlay(k)
     2141          dth_dyn(k)=- 2.51 / 86400 + (-2.18 + 2.51 )/                     &
     2142     &               (86400*4000) * zlay(k)
    21582143        elseif(4000 < zlay(k) .and. zlay(k) < 5000) then
    2159           dth_dyn(k)=- 2.18 / 86400 + ( 2.18 ) /
    2160      :           (86400*(5000 - 4000)) * (zlay(k) - 4000)
     2144          dth_dyn(k)=- 2.18 / 86400 + ( 2.18 ) /                           &
     2145     &           (86400*(5000 - 4000)) * (zlay(k) - 4000)
    21612146        else
    21622147          dth_dyn(k)=0.0
     
    21642149! dQhrz
    21652150        if(0 < zlay(k) .and. zlay(k) < 3000) then
    2166           dqh_dyn(k)=-1.0 / 86400 + (0.345 + 1.0)/
    2167      :                    (86400*3000) * (zlay(k))
     2151          dqh_dyn(k)=-1.0 / 86400 + (0.345 + 1.0)/                         &
     2152     &                    (86400*3000) * (zlay(k))
    21682153        elseif(3000 < zlay(k) .and. zlay(k) < 4000) then
    21692154          dqh_dyn(k)=0.345 / 86400
    21702155        elseif(4000 < zlay(k) .and. zlay(k) < 5000) then
    2171           dqh_dyn(k)=0.345 / 86400 +
    2172      +   (-0.345)/(86400 * (5000 - 4000)) * (zlay(k)-4000)
     2156          dqh_dyn(k)=0.345 / 86400 +                                       &
     2157     &   (-0.345)/(86400 * (5000 - 4000)) * (zlay(k)-4000)
    21732158        else
    21742159          dqh_dyn(k)=0.0
     
    21962181
    21972182!======================================================================
    2198         SUBROUTINE interp_sandu_time(day,day1,annee_ref
    2199      i             ,year_ini_sandu,day_ini_sandu,nt_sandu,dt_sandu
    2200      i             ,nlev_sandu,ts_sandu,ts_prof)
     2183        SUBROUTINE interp_sandu_time(day,day1,annee_ref                    &
     2184     &             ,year_ini_sandu,day_ini_sandu,nt_sandu,dt_sandu         &
     2185     &             ,nlev_sandu,ts_sandu,ts_prof)
    22012186        implicit none
    22022187
     
    22472232       time_sandu2=(it_sandu2-1)*dt_sandu
    22482233       print *,'timeit day day_ini_sandu',timeit,day,day_ini_sandu
    2249        print *,'it_sandu1,it_sandu2,time_sandu1,time_sandu2',
    2250      .          it_sandu1,it_sandu2,time_sandu1,time_sandu2
     2234       print *,'it_sandu1,it_sandu2,time_sandu1,time_sandu2',              &
     2235     &          it_sandu1,it_sandu2,time_sandu1,time_sandu2
    22512236
    22522237       if (it_sandu1 .ge. nt_sandu) then
    2253         write(*,*) 'PB-stop: day, it_sandu1, it_sandu2, timeit: '
    2254      :        ,day,it_sandu1,it_sandu2,timeit/86400.
     2238        write(*,*) 'PB-stop: day, it_sandu1, it_sandu2, timeit: '          &
     2239     &        ,day,it_sandu1,it_sandu2,timeit/86400.
    22552240        stop
    22562241       endif
     
    22602245       frac=max(frac,0.0)
    22612246
    2262        ts_prof = ts_sandu(it_sandu2)
    2263      :          -frac*(ts_sandu(it_sandu2)-ts_sandu(it_sandu1))
    2264 
    2265          print*,
    2266      :'day,annee_ref,day_ini_sandu,timeit,it_sandu1,it_sandu2,SST:',
    2267      :day,annee_ref,day_ini_sandu,timeit/86400.,it_sandu1,
    2268      :it_sandu2,ts_prof
     2247       ts_prof = ts_sandu(it_sandu2)                                       &
     2248     &          -frac*(ts_sandu(it_sandu2)-ts_sandu(it_sandu1))
     2249
     2250         print*,                                                           &
     2251     &'day,annee_ref,day_ini_sandu,timeit,it_sandu1,it_sandu2,SST:',       &
     2252     &day,annee_ref,day_ini_sandu,timeit/86400.,it_sandu1,                  &
     2253     &it_sandu2,ts_prof
    22692254
    22702255        return
    22712256        END
    22722257!=====================================================================
    2273 c-------------------------------------------------------------------------
    2274       SUBROUTINE read_armcu(fich_armcu,nlev_armcu,nt_armcu,
    2275      : sens,flat,adv_theta,rad_theta,adv_qt)
     2258!-------------------------------------------------------------------------
     2259      SUBROUTINE read_armcu(fich_armcu,nlev_armcu,nt_armcu,                &
     2260     & sens,flat,adv_theta,rad_theta,adv_qt)
    22762261      implicit none
    22772262
    2278 c-------------------------------------------------------------------------
    2279 c Read ARM_CU case forcing data
    2280 c-------------------------------------------------------------------------
     2263!-------------------------------------------------------------------------
     2264! Read ARM_CU case forcing data
     2265!-------------------------------------------------------------------------
    22812266
    22822267      integer nlev_armcu,nt_armcu
     
    22962281      read(21,'(a)')
    22972282      read(21,'(a)')
    2298       read(21,223) iy, im, id, ih, in, sens(ip),flat(ip),
    2299      :             adv_theta(ip),rad_theta(ip),adv_qt(ip)
    2300       print *,'forcages=',iy,im,id,ih,in, sens(ip),flat(ip),
    2301      :             adv_theta(ip),rad_theta(ip),adv_qt(ip)
     2283      read(21,223) iy, im, id, ih, in, sens(ip),flat(ip),                  &
     2284     &             adv_theta(ip),rad_theta(ip),adv_qt(ip)
     2285      print *,'forcages=',iy,im,id,ih,in, sens(ip),flat(ip),               &
     2286     &             adv_theta(ip),rad_theta(ip),adv_qt(ip)
    23022287      enddo
    23032288      close(21)
     
    23092294
    23102295!=====================================================================
    2311        SUBROUTINE interp_toga_vertical(play,nlev_toga,plev_prof
    2312      :         ,t_prof,q_prof,u_prof,v_prof,w_prof
    2313      :         ,ht_prof,vt_prof,hq_prof,vq_prof
    2314      :         ,t_mod,q_mod,u_mod,v_mod,w_mod
    2315      :         ,ht_mod,vt_mod,hq_mod,vq_mod,mxcalc)
     2296       SUBROUTINE interp_toga_vertical(play,nlev_toga,plev_prof            &
     2297     &         ,t_prof,q_prof,u_prof,v_prof,w_prof                         &
     2298     &         ,ht_prof,vt_prof,hq_prof,vq_prof                            &
     2299     &         ,t_mod,q_mod,u_mod,v_mod,w_mod                              &
     2300     &         ,ht_mod,vt_mod,hq_mod,vq_mod,mxcalc)
    23162301 
    23172302       implicit none
     
    23192304#include "dimensions.h"
    23202305
    2321 c-------------------------------------------------------------------------
    2322 c Vertical interpolation of TOGA-COARE forcing data onto model levels
    2323 c-------------------------------------------------------------------------
     2306!-------------------------------------------------------------------------
     2307! Vertical interpolation of TOGA-COARE forcing data onto model levels
     2308!-------------------------------------------------------------------------
    23242309 
    23252310       integer nlevmax
     
    23572342
    23582343         do k = 1, nlev_toga-1
    2359           if (play(l).le.plev_prof(k)
    2360      :       .and. play(l).gt.plev_prof(k+1)) then
     2344          if (play(l).le.plev_prof(k).and. play(l).gt.plev_prof(k+1)) then
    23612345            k1=k
    23622346            k2=k+1
     
    24032387        else ! above max altitude of forcing file
    24042388 
    2405 cjyg
     2389!jyg
    24062390         fact=20.*(plev_prof(nlev_toga)-play(l))/plev_prof(nlev_toga) !jyg
    24072391         fact = max(fact,0.)                                           !jyg
     
    24302414 
    24312415!======================================================================
    2432         SUBROUTINE interp_astex_time(day,day1,annee_ref
    2433      i             ,year_ini_astex,day_ini_astex,nt_astex,dt_astex
    2434      i             ,nlev_astex,div_astex,ts_astex,ug_astex,vg_astex
    2435      i             ,ufa_astex,vfa_astex,div_prof,ts_prof,ug_prof,vg_prof
    2436      i             ,ufa_prof,vfa_prof)
     2416        SUBROUTINE interp_astex_time(day,day1,annee_ref                    &
     2417     &             ,year_ini_astex,day_ini_astex,nt_astex,dt_astex         &
     2418     &             ,nlev_astex,div_astex,ts_astex,ug_astex,vg_astex        &
     2419     &             ,ufa_astex,vfa_astex,div_prof,ts_prof,ug_prof,vg_prof   &
     2420     &             ,ufa_prof,vfa_prof)
    24372421        implicit none
    24382422
     
    24862470       time_astex2=(it_astex2-1)*dt_astex
    24872471       print *,'timeit day day_ini_astex',timeit,day,day_ini_astex
    2488        print *,'it_astex1,it_astex2,time_astex1,time_astex2',
    2489      .          it_astex1,it_astex2,time_astex1,time_astex2
     2472       print *,'it_astex1,it_astex2,time_astex1,time_astex2',              &
     2473     &          it_astex1,it_astex2,time_astex1,time_astex2
    24902474
    24912475       if (it_astex1 .ge. nt_astex) then
    2492         write(*,*) 'PB-stop: day, it_astex1, it_astex2, timeit: '
    2493      :        ,day,it_astex1,it_astex2,timeit/86400.
     2476        write(*,*) 'PB-stop: day, it_astex1, it_astex2, timeit: '          &
     2477     &        ,day,it_astex1,it_astex2,timeit/86400.
    24942478        stop
    24952479       endif
     
    24992483       frac=max(frac,0.0)
    25002484
    2501        div_prof = div_astex(it_astex2)
    2502      :          -frac*(div_astex(it_astex2)-div_astex(it_astex1))
    2503        ts_prof = ts_astex(it_astex2)
    2504      :          -frac*(ts_astex(it_astex2)-ts_astex(it_astex1))
    2505        ug_prof = ug_astex(it_astex2)
    2506      :          -frac*(ug_astex(it_astex2)-ug_astex(it_astex1))
    2507        vg_prof = vg_astex(it_astex2)
    2508      :          -frac*(vg_astex(it_astex2)-vg_astex(it_astex1))
    2509        ufa_prof = ufa_astex(it_astex2)
    2510      :          -frac*(ufa_astex(it_astex2)-ufa_astex(it_astex1))
    2511        vfa_prof = vfa_astex(it_astex2)
    2512      :          -frac*(vfa_astex(it_astex2)-vfa_astex(it_astex1))
    2513 
    2514          print*,
    2515      :'day,annee_ref,day_ini_astex,timeit,it_astex1,it_astex2,SST:',
    2516      :day,annee_ref,day_ini_astex,timeit/86400.,it_astex1,
    2517      :it_astex2,div_prof,ts_prof,ug_prof,vg_prof,ufa_prof,vfa_prof
     2485       div_prof = div_astex(it_astex2)                                     &
     2486     &          -frac*(div_astex(it_astex2)-div_astex(it_astex1))
     2487       ts_prof = ts_astex(it_astex2)                                        &
     2488     &          -frac*(ts_astex(it_astex2)-ts_astex(it_astex1))
     2489       ug_prof = ug_astex(it_astex2)                                       &
     2490     &          -frac*(ug_astex(it_astex2)-ug_astex(it_astex1))
     2491       vg_prof = vg_astex(it_astex2)                                       &
     2492     &          -frac*(vg_astex(it_astex2)-vg_astex(it_astex1))
     2493       ufa_prof = ufa_astex(it_astex2)                                     &
     2494     &          -frac*(ufa_astex(it_astex2)-ufa_astex(it_astex1))
     2495       vfa_prof = vfa_astex(it_astex2)                                     &
     2496     &          -frac*(vfa_astex(it_astex2)-vfa_astex(it_astex1))
     2497
     2498         print*,                                                           &
     2499     &'day,annee_ref,day_ini_astex,timeit,it_astex1,it_astex2,SST:',       &
     2500     &day,annee_ref,day_ini_astex,timeit/86400.,it_astex1,                 &
     2501     &it_astex2,div_prof,ts_prof,ug_prof,vg_prof,ufa_prof,vfa_prof
    25182502
    25192503        return
     
    25212505
    25222506!======================================================================
    2523         SUBROUTINE interp_toga_time(day,day1,annee_ref
    2524      i             ,year_ini_toga,day_ini_toga,nt_toga,dt_toga,nlev_toga
    2525      i             ,ts_toga,plev_toga,t_toga,q_toga,u_toga,v_toga,w_toga
    2526      i             ,ht_toga,vt_toga,hq_toga,vq_toga
    2527      o             ,ts_prof,plev_prof,t_prof,q_prof,u_prof,v_prof,w_prof
    2528      o             ,ht_prof,vt_prof,hq_prof,vq_prof)
     2507        SUBROUTINE interp_toga_time(day,day1,annee_ref                     &
     2508     &             ,year_ini_toga,day_ini_toga,nt_toga,dt_toga,nlev_toga   &
     2509     &             ,ts_toga,plev_toga,t_toga,q_toga,u_toga,v_toga,w_toga   &
     2510     &             ,ht_toga,vt_toga,hq_toga,vq_toga                        &
     2511     &             ,ts_prof,plev_prof,t_prof,q_prof,u_prof,v_prof,w_prof   &
     2512     &             ,ht_prof,vt_prof,hq_prof,vq_prof)
    25292513        implicit none
    25302514
     
    26182602
    26192603       if (it_toga1 .ge. nt_toga) then
    2620         write(*,*) 'PB-stop: day, it_toga1, it_toga2, timeit: '
    2621      :        ,day,it_toga1,it_toga2,timeit/86400.
     2604        write(*,*) 'PB-stop: day, it_toga1, it_toga2, timeit: '            &
     2605     &        ,day,it_toga1,it_toga2,timeit/86400.
    26222606        stop
    26232607       endif
     
    26272611       frac=max(frac,0.0)
    26282612
    2629        ts_prof = ts_toga(it_toga2)
    2630      :          -frac*(ts_toga(it_toga2)-ts_toga(it_toga1))
     2613       ts_prof = ts_toga(it_toga2)                                         &
     2614     &          -frac*(ts_toga(it_toga2)-ts_toga(it_toga1))
    26312615
    26322616!        print*,
     
    26352619
    26362620       do k=1,nlev_toga
    2637         plev_prof(k) = 100.*(plev_toga(k,it_toga2)
    2638      :          -frac*(plev_toga(k,it_toga2)-plev_toga(k,it_toga1)))
    2639         t_prof(k) = t_toga(k,it_toga2)
    2640      :          -frac*(t_toga(k,it_toga2)-t_toga(k,it_toga1))
    2641         q_prof(k) = q_toga(k,it_toga2)
    2642      :          -frac*(q_toga(k,it_toga2)-q_toga(k,it_toga1))
    2643         u_prof(k) = u_toga(k,it_toga2)
    2644      :          -frac*(u_toga(k,it_toga2)-u_toga(k,it_toga1))
    2645         v_prof(k) = v_toga(k,it_toga2)
    2646      :          -frac*(v_toga(k,it_toga2)-v_toga(k,it_toga1))
    2647         w_prof(k) = w_toga(k,it_toga2)
    2648      :          -frac*(w_toga(k,it_toga2)-w_toga(k,it_toga1))
    2649         ht_prof(k) = ht_toga(k,it_toga2)
    2650      :          -frac*(ht_toga(k,it_toga2)-ht_toga(k,it_toga1))
    2651         vt_prof(k) = vt_toga(k,it_toga2)
    2652      :          -frac*(vt_toga(k,it_toga2)-vt_toga(k,it_toga1))
    2653         hq_prof(k) = hq_toga(k,it_toga2)
    2654      :          -frac*(hq_toga(k,it_toga2)-hq_toga(k,it_toga1))
    2655         vq_prof(k) = vq_toga(k,it_toga2)
    2656      :          -frac*(vq_toga(k,it_toga2)-vq_toga(k,it_toga1))
     2621        plev_prof(k) = 100.*(plev_toga(k,it_toga2)                         &
     2622     &          -frac*(plev_toga(k,it_toga2)-plev_toga(k,it_toga1)))
     2623        t_prof(k) = t_toga(k,it_toga2)                                     &
     2624     &          -frac*(t_toga(k,it_toga2)-t_toga(k,it_toga1))
     2625        q_prof(k) = q_toga(k,it_toga2)                                     &
     2626     &          -frac*(q_toga(k,it_toga2)-q_toga(k,it_toga1))
     2627        u_prof(k) = u_toga(k,it_toga2)                                     &
     2628     &          -frac*(u_toga(k,it_toga2)-u_toga(k,it_toga1))
     2629        v_prof(k) = v_toga(k,it_toga2)                                     &
     2630     &          -frac*(v_toga(k,it_toga2)-v_toga(k,it_toga1))
     2631        w_prof(k) = w_toga(k,it_toga2)                                     &
     2632     &          -frac*(w_toga(k,it_toga2)-w_toga(k,it_toga1))
     2633        ht_prof(k) = ht_toga(k,it_toga2)                                   &
     2634     &          -frac*(ht_toga(k,it_toga2)-ht_toga(k,it_toga1))
     2635        vt_prof(k) = vt_toga(k,it_toga2)                                   &
     2636     &          -frac*(vt_toga(k,it_toga2)-vt_toga(k,it_toga1))
     2637        hq_prof(k) = hq_toga(k,it_toga2)                                   &
     2638     &          -frac*(hq_toga(k,it_toga2)-hq_toga(k,it_toga1))
     2639        vq_prof(k) = vq_toga(k,it_toga2)                                   &
     2640     &          -frac*(vq_toga(k,it_toga2)-vq_toga(k,it_toga1))
    26572641        enddo
    26582642
     
    26612645
    26622646!======================================================================
    2663         SUBROUTINE interp_armcu_time(day,day1,annee_ref
    2664      i             ,year_ini_armcu,day_ini_armcu,nt_armcu,dt_armcu
    2665      i             ,nlev_armcu,fs_armcu,fl_armcu,at_armcu,rt_armcu
    2666      i             ,aqt_armcu,fs_prof,fl_prof,at_prof,rt_prof,aqt_prof)
     2647        SUBROUTINE interp_armcu_time(day,day1,annee_ref                    &
     2648     &             ,year_ini_armcu,day_ini_armcu,nt_armcu,dt_armcu         &
     2649     &             ,nlev_armcu,fs_armcu,fl_armcu,at_armcu,rt_armcu         &
     2650     &             ,aqt_armcu,fs_prof,fl_prof,at_prof,rt_prof,aqt_prof)
    26672651        implicit none
    26682652
     
    27072691       time_armcu2=(it_armcu2-1)*dt_armcu
    27082692       print *,'timeit day day_ini_armcu',timeit,day,day_ini_armcu
    2709        print *,'it_armcu1,it_armcu2,time_armcu1,time_armcu2',
    2710      .          it_armcu1,it_armcu2,time_armcu1,time_armcu2
     2693       print *,'it_armcu1,it_armcu2,time_armcu1,time_armcu2',              &
     2694     &          it_armcu1,it_armcu2,time_armcu1,time_armcu2
    27112695
    27122696       if (it_armcu1 .ge. nt_armcu) then
    2713         write(*,*) 'PB-stop: day, it_armcu1, it_armcu2, timeit: '
    2714      :        ,day,it_armcu1,it_armcu2,timeit/86400.
     2697        write(*,*) 'PB-stop: day, it_armcu1, it_armcu2, timeit: '          &
     2698     &        ,day,it_armcu1,it_armcu2,timeit/86400.
    27152699        stop
    27162700       endif
     
    27202704       frac=max(frac,0.0)
    27212705
    2722        fs_prof = fs_armcu(it_armcu2)
    2723      :          -frac*(fs_armcu(it_armcu2)-fs_armcu(it_armcu1))
    2724        fl_prof = fl_armcu(it_armcu2)
    2725      :          -frac*(fl_armcu(it_armcu2)-fl_armcu(it_armcu1))
    2726        at_prof = at_armcu(it_armcu2)
    2727      :          -frac*(at_armcu(it_armcu2)-at_armcu(it_armcu1))
    2728        rt_prof = rt_armcu(it_armcu2)
    2729      :          -frac*(rt_armcu(it_armcu2)-rt_armcu(it_armcu1))
    2730        aqt_prof = aqt_armcu(it_armcu2)
    2731      :          -frac*(aqt_armcu(it_armcu2)-aqt_armcu(it_armcu1))
    2732 
    2733          print*,
    2734      :'day,annee_ref,day_ini_armcu,timeit,it_armcu1,it_armcu2,SST:',
    2735      :day,annee_ref,day_ini_armcu,timeit/86400.,it_armcu1,
    2736      :it_armcu2,fs_prof,fl_prof,at_prof,rt_prof,aqt_prof
     2706       fs_prof = fs_armcu(it_armcu2)                                       &
     2707     &          -frac*(fs_armcu(it_armcu2)-fs_armcu(it_armcu1))
     2708       fl_prof = fl_armcu(it_armcu2)                                       &
     2709     &          -frac*(fl_armcu(it_armcu2)-fl_armcu(it_armcu1))
     2710       at_prof = at_armcu(it_armcu2)                                       &
     2711     &          -frac*(at_armcu(it_armcu2)-at_armcu(it_armcu1))
     2712       rt_prof = rt_armcu(it_armcu2)                                       &
     2713     &          -frac*(rt_armcu(it_armcu2)-rt_armcu(it_armcu1))
     2714       aqt_prof = aqt_armcu(it_armcu2)                                       &
     2715     &          -frac*(aqt_armcu(it_armcu2)-aqt_armcu(it_armcu1))
     2716
     2717         print*,                                                           &
     2718     &'day,annee_ref,day_ini_armcu,timeit,it_armcu1,it_armcu2,SST:',       &
     2719     &day,annee_ref,day_ini_armcu,timeit/86400.,it_armcu1,                 &
     2720     &it_armcu2,fs_prof,fl_prof,at_prof,rt_prof,aqt_prof
    27372721
    27382722        return
     
    27402724
    27412725!=====================================================================
    2742       subroutine readprofiles(nlev_max,kmax,ntrac,height,
    2743      .           thlprof,qtprof,uprof,
    2744      .           vprof,e12prof,ugprof,vgprof,
    2745      .           wfls,dqtdxls,dqtdyls,dqtdtls,
    2746      .           thlpcar,tracer,nt1,nt2)
     2726      subroutine readprofiles(nlev_max,kmax,ntrac,height,                  &
     2727     &           thlprof,qtprof,uprof,                                     &
     2728     &           vprof,e12prof,ugprof,vgprof,                              &
     2729     &           wfls,dqtdxls,dqtdyls,dqtdtls,                             &
     2730     &           thlpcar,tracer,nt1,nt2)
    27472731      implicit none
    27482732
     
    27502734        logical :: llesread = .true.
    27512735
    2752         real height(nlev_max),thlprof(nlev_max),qtprof(nlev_max),
    2753      .       uprof(nlev_max),vprof(nlev_max),e12prof(nlev_max),
    2754      .       ugprof(nlev_max),vgprof(nlev_max),wfls(nlev_max),
    2755      .       dqtdxls(nlev_max),dqtdyls(nlev_max),dqtdtls(nlev_max),
    2756      .           thlpcar(nlev_max),tracer(nlev_max,ntrac)
     2736        real height(nlev_max),thlprof(nlev_max),qtprof(nlev_max),          &
     2737     &       uprof(nlev_max),vprof(nlev_max),e12prof(nlev_max),            &
     2738     &       ugprof(nlev_max),vgprof(nlev_max),wfls(nlev_max),             &
     2739     &       dqtdxls(nlev_max),dqtdyls(nlev_max),dqtdtls(nlev_max),        &
     2740     &           thlpcar(nlev_max),tracer(nlev_max,ntrac)
    27572741
    27582742        integer, parameter :: ilesfile=1
     
    27652749        read (ilesfile,*) kmax
    27662750        do k=1,kmax
    2767           read (ilesfile,*) height(k),thlprof(k),qtprof (k),
    2768      .                      uprof (k),vprof  (k),e12prof(k)
     2751          read (ilesfile,*) height(k),thlprof(k),qtprof (k),               &
     2752     &                      uprof (k),vprof  (k),e12prof(k)
    27692753        enddo
    27702754        close(ilesfile)
     
    27792763        endif
    27802764        do k=1,kmax
    2781           read (ilesfile,*) height(k),ugprof(k),vgprof(k),wfls(k),
    2782      .                      dqtdxls(k),dqtdyls(k),dqtdtls(k),thlpcar(k)
     2765          read (ilesfile,*) height(k),ugprof(k),vgprof(k),wfls(k),         &
     2766     &                      dqtdxls(k),dqtdyls(k),dqtdtls(k),thlpcar(k)
    27832767        end do
    27842768        close(ilesfile)
     
    28062790        end
    28072791!======================================================================
    2808       subroutine readprofile_sandu(nlev_max,kmax,height,pprof,tprof,
    2809      .       thlprof,qprof,uprof,vprof,wprof,omega,o3mmr)
     2792      subroutine readprofile_sandu(nlev_max,kmax,height,pprof,tprof,       &
     2793     &       thlprof,qprof,uprof,vprof,wprof,omega,o3mmr)
    28102794!======================================================================
    28112795      implicit none
     
    28142798        logical :: llesread = .true.
    28152799
    2816         real height(nlev_max),pprof(nlev_max),tprof(nlev_max),
    2817      .  thlprof(nlev_max),
    2818      .  qprof(nlev_max),uprof(nlev_max),vprof(nlev_max),
    2819      . wprof(nlev_max),omega(nlev_max),o3mmr(nlev_max)
     2800        real height(nlev_max),pprof(nlev_max),tprof(nlev_max)
     2801        real thlprof(nlev_max)
     2802        real qprof(nlev_max),uprof(nlev_max),vprof(nlev_max)
     2803        real wprof(nlev_max),omega(nlev_max),o3mmr(nlev_max)
    28202804
    28212805        integer, parameter :: ilesfile=1
     
    28282812        read (ilesfile,*) kmax
    28292813        do k=1,kmax
    2830           read (ilesfile,*) height(k),pprof(k),  tprof(k),thlprof(k),
    2831      .                      qprof (k),uprof(k),  vprof(k),  wprof(k),
    2832      .                      omega (k),o3mmr(k)
     2814          read (ilesfile,*) height(k),pprof(k),  tprof(k),thlprof(k),      &
     2815     &                      qprof (k),uprof(k),  vprof(k),  wprof(k),      &
     2816     &                      omega (k),o3mmr(k)
    28332817        enddo
    28342818        close(ilesfile)
     
    28382822
    28392823!======================================================================
    2840       subroutine readprofile_astex(nlev_max,kmax,height,pprof,tprof,
    2841      .    thlprof,qvprof,qlprof,qtprof,uprof,vprof,wprof,tkeprof,o3mmr)
     2824      subroutine readprofile_astex(nlev_max,kmax,height,pprof,tprof,       &
     2825     &    thlprof,qvprof,qlprof,qtprof,uprof,vprof,wprof,tkeprof,o3mmr)
    28422826!======================================================================
    28432827      implicit none
     
    28462830        logical :: llesread = .true.
    28472831
    2848         real height(nlev_max),pprof(nlev_max),tprof(nlev_max),
    2849      .  thlprof(nlev_max),qlprof(nlev_max),qtprof(nlev_max),
    2850      .  qvprof(nlev_max),uprof(nlev_max),vprof(nlev_max),
    2851      .  wprof(nlev_max),tkeprof(nlev_max),o3mmr(nlev_max)
     2832        real height(nlev_max),pprof(nlev_max),tprof(nlev_max),             &
     2833     &  thlprof(nlev_max),qlprof(nlev_max),qtprof(nlev_max),               &
     2834     &  qvprof(nlev_max),uprof(nlev_max),vprof(nlev_max),                  &
     2835     &  wprof(nlev_max),tkeprof(nlev_max),o3mmr(nlev_max)
    28522836
    28532837        integer, parameter :: ilesfile=1
     
    28602844        read (ilesfile,*) kmax
    28612845        do k=1,kmax
    2862           read (ilesfile,*) height(k),pprof(k),  tprof(k),thlprof(k),
    2863      .                qvprof (k),qlprof (k),qtprof (k),
    2864      .                uprof(k),  vprof(k),  wprof(k),tkeprof(k),o3mmr(k)
     2846          read (ilesfile,*) height(k),pprof(k),  tprof(k),thlprof(k),      &
     2847     &                qvprof (k),qlprof (k),qtprof (k),                    &
     2848     &                uprof(k),  vprof(k),  wprof(k),tkeprof(k),o3mmr(k)
    28652849        enddo
    28662850        close(ilesfile)
     
    28722856
    28732857!======================================================================
    2874       subroutine readprofile_armcu(nlev_max,kmax,height,pprof,uprof,
    2875      .       vprof,thetaprof,tprof,qvprof,rvprof,aprof,bprof)
     2858      subroutine readprofile_armcu(nlev_max,kmax,height,pprof,uprof,       &
     2859     &       vprof,thetaprof,tprof,qvprof,rvprof,aprof,bprof)
    28762860!======================================================================
    28772861      implicit none
     
    28802864        logical :: llesread = .true.
    28812865
    2882         real height(nlev_max),pprof(nlev_max),tprof(nlev_max),
    2883      .  thetaprof(nlev_max),rvprof(nlev_max),
    2884      .  qvprof(nlev_max),uprof(nlev_max),vprof(nlev_max),
    2885      . aprof(nlev_max+1),bprof(nlev_max+1)
     2866        real height(nlev_max),pprof(nlev_max),tprof(nlev_max)
     2867        real thetaprof(nlev_max),rvprof(nlev_max)
     2868        real qvprof(nlev_max),uprof(nlev_max),vprof(nlev_max)
     2869        real aprof(nlev_max+1),bprof(nlev_max+1)
    28862870
    28872871        integer, parameter :: ilesfile=1
     
    29022886        read (ilesfile,*) kmax
    29032887        do k=1,kmax
    2904           read (ilesfile,*) height(k)    ,pprof(k),  uprof(k), vprof(k),
    2905      .                      thetaprof(k) ,tprof(k), qvprof(k),rvprof(k)
     2888          read (ilesfile,*) height(k)    ,pprof(k),  uprof(k), vprof(k),   &
     2889     &                      thetaprof(k) ,tprof(k), qvprof(k),rvprof(k)
    29062890        enddo
    29072891        close(ilesfile)
     
    29262910        end
    29272911!=====================================================================
    2928       subroutine read_amma(fich_amma,nlevel,ntime
    2929      :     ,zz,pp,temp,qv,u,v,dw
    2930      :     ,dt,dq,sens,flat)
     2912      subroutine read_amma(fich_amma,nlevel,ntime                          &
     2913     &     ,zz,pp,temp,qv,u,v,dw                                           &
     2914     &     ,dt,dq,sens,flat)
    29312915
    29322916!program reading forcings of the AMMA case study
     
    31563140         end subroutine read_amma
    31573141!======================================================================
    3158         SUBROUTINE interp_amma_time(day,day1,annee_ref
    3159      i         ,year_ini_amma,day_ini_amma,nt_amma,dt_amma,nlev_amma
    3160      i         ,vitw_amma,ht_amma,hq_amma,lat_amma,sens_amma
    3161      o         ,vitw_prof,ht_prof,hq_prof,lat_prof,sens_prof)
     3142        SUBROUTINE interp_amma_time(day,day1,annee_ref                     &
     3143     &         ,year_ini_amma,day_ini_amma,nt_amma,dt_amma,nlev_amma       &
     3144     &         ,vitw_amma,ht_amma,hq_amma,lat_amma,sens_amma               &
     3145     &         ,vitw_prof,ht_prof,hq_prof,lat_prof,sens_prof)
    31623146        implicit none
    31633147
     
    32373221
    32383222       if (it_amma1 .gt. nt_amma) then
    3239         write(*,*) 'PB-stop: day, it_amma1, it_amma2, timeit: '
    3240      :        ,day,day_ini_amma,it_amma1,it_amma2,timeit/86400.
     3223        write(*,*) 'PB-stop: day, it_amma1, it_amma2, timeit: '            &
     3224     &        ,day,day_ini_amma,it_amma1,it_amma2,timeit/86400.
    32413225        stop
    32423226       endif
     
    32463230       frac=max(frac,0.0)
    32473231
    3248        lat_prof = lat_amma(it_amma2)
    3249      :          -frac*(lat_amma(it_amma2)-lat_amma(it_amma1))
    3250        sens_prof = sens_amma(it_amma2)
    3251      :          -frac*(sens_amma(it_amma2)-sens_amma(it_amma1))
     3232       lat_prof = lat_amma(it_amma2)                                       &
     3233     &          -frac*(lat_amma(it_amma2)-lat_amma(it_amma1))
     3234       sens_prof = sens_amma(it_amma2)                                     &
     3235     &          -frac*(sens_amma(it_amma2)-sens_amma(it_amma1))
    32523236
    32533237       do k=1,nlev_amma
    3254         vitw_prof(k) = vitw_amma(k,it_amma2)
    3255      :          -frac*(vitw_amma(k,it_amma2)-vitw_amma(k,it_amma1))
    3256         ht_prof(k) = ht_amma(k,it_amma2)
    3257      :          -frac*(ht_amma(k,it_amma2)-ht_amma(k,it_amma1))
    3258         hq_prof(k) = hq_amma(k,it_amma2)
    3259      :          -frac*(hq_amma(k,it_amma2)-hq_amma(k,it_amma1))
     3238        vitw_prof(k) = vitw_amma(k,it_amma2)                               &
     3239     &          -frac*(vitw_amma(k,it_amma2)-vitw_amma(k,it_amma1))
     3240        ht_prof(k) = ht_amma(k,it_amma2)                                   &
     3241     &          -frac*(ht_amma(k,it_amma2)-ht_amma(k,it_amma1))
     3242        hq_prof(k) = hq_amma(k,it_amma2)                                   &
     3243     &          -frac*(hq_amma(k,it_amma2)-hq_amma(k,it_amma1))
    32603244        enddo
    32613245
     
    32643248
    32653249!=====================================================================
    3266       subroutine read_fire(fich_fire,nlevel,ntime
    3267      :     ,zz,thl,qt,u,v,tke
    3268      :     ,ug,vg,wls,dqtdx,dqtdy,dqtdt,thl_rad)
     3250      subroutine read_fire(fich_fire,nlevel,ntime                          &
     3251     &     ,zz,thl,qt,u,v,tke                                              &
     3252     &     ,ug,vg,wls,dqtdx,dqtdy,dqtdt,thl_rad)
    32693253
    32703254!program reading forcings of the FIRE case study
  • LMDZ5/trunk/libf/phylmd/1D_decl_cases.h

    r2017 r2019  
    157157        logical :: Turb_fcg_gcssold
    158158
    159         common /turb_forcing/
    160      s  dtime_frcg,hthturb_gcssold, hqturb_gcssold,Turb_fcg_gcssold
     159        common /turb_forcing/                                                   &
     160     &  dtime_frcg,hthturb_gcssold, hqturb_gcssold,Turb_fcg_gcssold
    161161!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    162162! Declarations specifiques au cas Arm_cu
  • LMDZ5/trunk/libf/phylmd/1D_interp_cases.h

    r2017 r2019  
    44      if (forcing_GCSSold) then
    55
    6        call get_uvd(it,timestep,fich_gcssold_ctl,fich_gcssold_dat,
    7      :               ht_gcssold,hq_gcssold,hw_gcssold,
    8      :               hu_gcssold,hv_gcssold,
    9      :               hthturb_gcssold,hqturb_gcssold,Ts_gcssold,
    10      :               imp_fcg_gcssold,ts_fcg_gcssold,
    11      :               Tp_fcg_gcssold,Turb_fcg_gcssold)
     6       call get_uvd(it,timestep,fich_gcssold_ctl,fich_gcssold_dat,              &
     7     &               ht_gcssold,hq_gcssold,hw_gcssold,                          &
     8     &               hu_gcssold,hv_gcssold,                                     &
     9     &               hthturb_gcssold,hqturb_gcssold,Ts_gcssold,                 &
     10     &               imp_fcg_gcssold,ts_fcg_gcssold,                            &
     11     &               Tp_fcg_gcssold,Turb_fcg_gcssold)
    1212       if (prt_level.ge.1) then
    1313         print *,' get_uvd -> hqturb_gcssold ',it,hqturb_gcssold
     
    3838
    3939       if (prt_level.ge.1) then
    40         print*,
    41      : '#### ITAP,day,day1,(day-day1)*86400,(day-day1)*86400/dt_toga=',
    42      :    day,day1,(day-day1)*86400.,(day-day1)*86400/dt_toga
     40        print*,                                                             &
     41     & '#### ITAP,day,day1,(day-day1)*86400,(day-day1)*86400/dt_toga=',     &
     42     &    day,day1,(day-day1)*86400.,(day-day1)*86400/dt_toga
    4343       endif
    4444
    4545! time interpolation:
    46         CALL interp_toga_time(daytime,day1,annee_ref
    47      i             ,year_ini_toga,day_ju_ini_toga,nt_toga,dt_toga
    48      i             ,nlev_toga,ts_toga,plev_toga,t_toga,q_toga,u_toga
    49      i             ,v_toga,w_toga,ht_toga,vt_toga,hq_toga,vq_toga
    50      o             ,ts_prof,plev_prof,t_prof,q_prof,u_prof,v_prof,w_prof
    51      o             ,ht_prof,vt_prof,hq_prof,vq_prof)
     46        CALL interp_toga_time(daytime,day1,annee_ref                        &
     47     &             ,year_ini_toga,day_ju_ini_toga,nt_toga,dt_toga           &
     48     &             ,nlev_toga,ts_toga,plev_toga,t_toga,q_toga,u_toga        &
     49     &             ,v_toga,w_toga,ht_toga,vt_toga,hq_toga,vq_toga           &
     50     &             ,ts_prof,plev_prof,t_prof,q_prof,u_prof,v_prof,w_prof    &
     51     &             ,ht_prof,vt_prof,hq_prof,vq_prof)
    5252
    5353        if (type_ts_forcing.eq.1) ts_cur = ts_prof ! SST used in read_tsurf1d
    5454
    5555! vertical interpolation:
    56       CALL interp_toga_vertical(play,nlev_toga,plev_prof
    57      :         ,t_prof,q_prof,u_prof,v_prof,w_prof
    58      :         ,ht_prof,vt_prof,hq_prof,vq_prof
    59      :         ,t_mod,q_mod,u_mod,v_mod,w_mod
    60      :         ,ht_mod,vt_mod,hq_mod,vq_mod,mxcalc)
     56      CALL interp_toga_vertical(play,nlev_toga,plev_prof                    &
     57     &         ,t_prof,q_prof,u_prof,v_prof,w_prof                          &
     58     &         ,ht_prof,vt_prof,hq_prof,vq_prof                             &
     59     &         ,t_mod,q_mod,u_mod,v_mod,w_mod                               &
     60     &         ,ht_mod,vt_mod,hq_mod,vq_mod,mxcalc)
    6161
    6262! large-scale forcing :
     
    8484      if (forcing_twpice) then
    8585
    86         print*,
    87      : '#### ITAP,day,day1,(day-day1)*86400,(day-day1)*86400/dt_twpi=',
    88      :    daytime,day1,(daytime-day1)*86400.,
    89      :    (daytime-day1)*86400/dt_twpi
     86        print*,                                                             &
     87     & '#### ITAP,day,day1,(day-day1)*86400,(day-day1)*86400/dt_twpi=',     &
     88     &    daytime,day1,(daytime-day1)*86400.,                               &
     89     &    (daytime-day1)*86400/dt_twpi
    9090
    9191! time interpolation:
    92         CALL interp_toga_time(daytime,day1,annee_ref
    93      i       ,year_ini_twpi,day_ju_ini_twpi,nt_twpi,dt_twpi,nlev_twpi
    94      i       ,ts_twpi,plev_twpi,t_twpi,q_twpi,u_twpi,v_twpi,w_twpi
    95      i       ,ht_twpi,vt_twpi,hq_twpi,vq_twpi
    96      o       ,ts_proftwp,plev_proftwp,t_proftwp,q_proftwp,u_proftwp
    97      o       ,v_proftwp,w_proftwp
    98      o       ,ht_proftwp,vt_proftwp,hq_proftwp,vq_proftwp)
     92        CALL interp_toga_time(daytime,day1,annee_ref                        &
     93     &       ,year_ini_twpi,day_ju_ini_twpi,nt_twpi,dt_twpi,nlev_twpi       &
     94     &       ,ts_twpi,plev_twpi,t_twpi,q_twpi,u_twpi,v_twpi,w_twpi          &
     95     &       ,ht_twpi,vt_twpi,hq_twpi,vq_twpi                               &
     96     &       ,ts_proftwp,plev_proftwp,t_proftwp,q_proftwp,u_proftwp         &
     97     &       ,v_proftwp,w_proftwp                                           &
     98     &       ,ht_proftwp,vt_proftwp,hq_proftwp,vq_proftwp)
    9999
    100100! vertical interpolation:
    101       CALL interp_toga_vertical(play,nlev_twpi,plev_proftwp
    102      :         ,t_proftwp,q_proftwp,u_proftwp,v_proftwp,w_proftwp
    103      :         ,ht_proftwp,vt_proftwp,hq_proftwp,vq_proftwp
    104      :         ,t_mod,q_mod,u_mod,v_mod,w_mod
    105      :         ,ht_mod,vt_mod,hq_mod,vq_mod,mxcalc)
     101      CALL interp_toga_vertical(play,nlev_twpi,plev_proftwp                 &
     102     &         ,t_proftwp,q_proftwp,u_proftwp,v_proftwp,w_proftwp           &
     103     &         ,ht_proftwp,vt_proftwp,hq_proftwp,vq_proftwp                 &
     104     &         ,t_mod,q_mod,u_mod,v_mod,w_mod                               &
     105     &         ,ht_mod,vt_mod,hq_mod,vq_mod,mxcalc)
    106106
    107107
    108108!calcul de l'advection verticale a partir du omega
    109 cCalcul des gradients verticaux
    110 cinitialisation
     109!Calcul des gradients verticaux
     110!initialisation
    111111      d_t_z(:)=0.
    112112      d_q_z(:)=0.
     
    114114      d_q_dyn_z(:)=0.
    115115      DO l=2,llm-1
    116        d_t_z(l)=(temp(l+1)-temp(l-1))
    117      &          /(play(l+1)-play(l-1))
    118        d_q_z(l)=(q(l+1,1)-q(l-1,1))
    119      &          /(play(l+1)-play(l-1))
     116       d_t_z(l)=(temp(l+1)-temp(l-1))/(play(l+1)-play(l-1))
     117       d_q_z(l)=(q(l+1,1)-q(l-1,1))/(play(l+1)-play(l-1))
    120118      ENDDO
    121119      d_t_z(1)=d_t_z(2)
     
    124122      d_q_z(llm)=d_q_z(llm-1)
    125123
    126 cCalcul de l advection verticale
     124!Calcul de l advection verticale
    127125      d_t_dyn_z(:)=w_mod(:)*d_t_z(:)
    128126      d_q_dyn_z(:)=w_mod(:)*d_q_z(:)
     
    133131!           if (phi(l).gt.5000.) then
    134132        if (phi(l).gt.0.) then
    135         u(l)=u(l)
    136      .      +timestep*(u_mod(l)-u(l))/(2.*3600.)
    137         v(l)=v(l)
    138      .      +timestep*(v_mod(l)-v(l))/(2.*3600.)
     133        u(l)=u(l)+timestep*(u_mod(l)-u(l))/(2.*3600.)
     134        v(l)=v(l)+timestep*(v_mod(l)-v(l))/(2.*3600.)
    139135           endif   
    140136        else
     
    150146           if ((zz(l).le.16000.).and.(zz(l).gt.15000.)) then
    151147             zfact=(zz(l)-15000.)/1000.
    152         q(l,1)=q(l,1)
    153      .      +timestep*(q_mod(l)-q(l,1))/(6.*3600.)*zfact
    154         temp(l)=temp(l)
    155      .      +timestep*(t_mod(l)-temp(l))/(6.*3600.)*zfact
     148        q(l,1)=q(l,1)+timestep*(q_mod(l)-q(l,1))/(6.*3600.)*zfact
     149        temp(l)=temp(l)+timestep*(t_mod(l)-temp(l))/(6.*3600.)*zfact
    156150           else if (zz(l).gt.16000.) then
    157         q(l,1)=q(l,1)
    158      .      +timestep*(q_mod(l)-q(l,1))/(6.*3600.)
    159         temp(l)=temp(l)
    160      .      +timestep*(t_mod(l)-temp(l))/(6.*3600.)
     151        q(l,1)=q(l,1)+timestep*(q_mod(l)-q(l,1))/(6.*3600.)
     152        temp(l)=temp(l)+timestep*(t_mod(l)-temp(l))/(6.*3600.)
    161153           endif
    162154        enddo   
     
    189181       if (forcing_amma) then
    190182
    191         print*,
    192      : '#### ITAP,day,day1,(day-day1)*86400,(day-day1)*86400/dt_amma=',
    193      :    daytime,day1,(daytime-day1)*86400.,
    194      :    (daytime-day1)*86400/dt_amma
     183        print*,                                                             &
     184     & '#### ITAP,day,day1,(day-day1)*86400,(day-day1)*86400/dt_amma=',     &
     185     &    daytime,day1,(daytime-day1)*86400.,                               &
     186     &    (daytime-day1)*86400/dt_amma
    195187
    196188! time interpolation using TOGA interpolation routine
    197         CALL interp_amma_time(daytime,day1,annee_ref
    198      i       ,year_ini_amma,day_ju_ini_amma,nt_amma,dt_amma,nlev_amma
    199      i       ,vitw_amma,ht_amma,hq_amma,lat_amma,sens_amma
    200      o       ,vitw_profamma,ht_profamma,hq_profamma,lat_profamma
    201      :       ,sens_profamma)
     189        CALL interp_amma_time(daytime,day1,annee_ref                        &
     190     &       ,year_ini_amma,day_ju_ini_amma,nt_amma,dt_amma,nlev_amma       &
     191     &       ,vitw_amma,ht_amma,hq_amma,lat_amma,sens_amma                  &
     192     &       ,vitw_profamma,ht_profamma,hq_profamma,lat_profamma            &
     193     &       ,sens_profamma)
    202194
    203195      print*,'apres interpolation temporelle AMMA'
     
    213205! vertical interpolation using TOGA interpolation routine:
    214206!      write(*,*)'avant interp vert', t_proftwp
    215       CALL interp_toga_vertical(play,nlev_amma,plev_amma
    216      :         ,th_profamma,q_profamma,u_profamma,v_profamma
    217      :         ,vitw_profamma
    218      :         ,ht_profamma,vt_profamma,hq_profamma,vq_profamma
    219      :         ,t_mod,q_mod,u_mod,v_mod,w_mod
    220      :         ,ht_mod,vt_mod,hq_mod,vq_mod,mxcalc)
     207      CALL interp_toga_vertical(play,nlev_amma,plev_amma                      &
     208     &         ,th_profamma,q_profamma,u_profamma,v_profamma                 &
     209     &         ,vitw_profamma                                               &
     210     &         ,ht_profamma,vt_profamma,hq_profamma,vq_profamma             &
     211     &         ,t_mod,q_mod,u_mod,v_mod,w_mod                               &
     212     &         ,ht_mod,vt_mod,hq_mod,vq_mod,mxcalc)
    221213       write(*,*) 'Profil initial forcing AMMA interpole'
    222214
    223215
    224216!calcul de l'advection verticale a partir du omega
    225 cCalcul des gradients verticaux
    226 cinitialisation
     217!Calcul des gradients verticaux
     218!initialisation
    227219      do l=1,llm
    228220      d_t_z(l)=0.
     
    231223
    232224      DO l=2,llm-1
    233        d_t_z(l)=(temp(l+1)-temp(l-1))
    234      &          /(play(l+1)-play(l-1))
    235        d_q_z(l)=(q(l+1,1)-q(l-1,1))
    236      &          /(play(l+1)-play(l-1))
     225       d_t_z(l)=(temp(l+1)-temp(l-1))/(play(l+1)-play(l-1))
     226       d_q_z(l)=(q(l+1,1)-q(l-1,1))/(play(l+1)-play(l-1))
    237227      ENDDO
    238228      d_t_z(1)=d_t_z(2)
     
    250240!        d_th_adv(l) = alpha*omega(l)/rcpd+ht_mod(l)-omega(l)*d_t_z(l)
    251241!attention: on impose dth
    252         d_th_adv(l) = alpha*omega(l)/rcpd+
     242        d_th_adv(l) = alpha*omega(l)/rcpd+                                  &
    253243     &         ht_mod(l)*(play(l)/pzero)**rkappa-omega(l)*d_t_z(l)
    254244!        d_th_adv(l) = 0.
     
    275265!       call lstendH(llm,omega,dt_dyn,dq_dyn,du_dyn, dv_dyn,
    276266!     :  q,temp,u,v,play)
    277        call lstendH(llm,nqtot,omega,dt_dyn,dq_dyn,
    278      :  q,temp,u,v,play)
     267       call lstendH(llm,nqtot,omega,dt_dyn,dq_dyn,q,temp,u,v,play)
    279268
    280269        do l=1,llm
     
    290279      if (forcing_armcu) then
    291280
    292         print*,
    293      : '#### ITAP,day,day1,(day-day1)*86400,(day-day1)*86400/dt_armcu=',
    294      :    day,day1,(day-day1)*86400.,(day-day1)*86400/dt_armcu
     281        print*,                                                             &
     282     & '#### ITAP,day,day1,(day-day1)*86400,(day-day1)*86400/dt_armcu=',    &
     283     &    day,day1,(day-day1)*86400.,(day-day1)*86400/dt_armcu
    295284
    296285! time interpolation:
    297286! ATTENTION, cet appel ne convient pas pour TOGA !!
    298287! revoir 1DUTILS.h et les arguments
    299       CALL interp_armcu_time(daytime,day1,annee_ref
    300      i            ,year_ini_armcu,day_ju_ini_armcu,nt_armcu,dt_armcu
    301      i            ,nlev_armcu,sens_armcu,flat_armcu,adv_theta_armcu
    302      i            ,rad_theta_armcu,adv_qt_armcu,sens_prof,flat_prof
    303      i            ,adv_theta_prof,rad_theta_prof,adv_qt_prof)
     288      CALL interp_armcu_time(daytime,day1,annee_ref                         &
     289     &            ,year_ini_armcu,day_ju_ini_armcu,nt_armcu,dt_armcu        &
     290     &            ,nlev_armcu,sens_armcu,flat_armcu,adv_theta_armcu          &
     291     &            ,rad_theta_armcu,adv_qt_armcu,sens_prof,flat_prof         &
     292     &            ,adv_theta_prof,rad_theta_prof,adv_qt_prof)
    304293
    305294! vertical interpolation:
     
    346335      if (forcing_sandu) then
    347336
    348         print*,
    349      : '#### ITAP,day,day1,(day-day1)*86400,(day-day1)*86400/dt_sandu=',
    350      :    day,day1,(day-day1)*86400.,(day-day1)*86400/dt_sandu
     337        print*,                                                             &
     338     & '#### ITAP,day,day1,(day-day1)*86400,(day-day1)*86400/dt_sandu=',    &
     339     &    day,day1,(day-day1)*86400.,(day-day1)*86400/dt_sandu
    351340
    352341! time interpolation:
    353342! ATTENTION, cet appel ne convient pas pour TOGA !!
    354343! revoir 1DUTILS.h et les arguments
    355       CALL interp_sandu_time(daytime,day1,annee_ref
    356      i             ,year_ini_sandu,day_ju_ini_sandu,nt_sandu,dt_sandu
    357      i             ,nlev_sandu
    358      i             ,ts_sandu,ts_prof)
     344      CALL interp_sandu_time(daytime,day1,annee_ref                         &
     345     &             ,year_ini_sandu,day_ju_ini_sandu,nt_sandu,dt_sandu       &
     346     &             ,nlev_sandu                                              &
     347     &             ,ts_sandu,ts_prof)
    359348
    360349        if (type_ts_forcing.eq.1) ts_cur = ts_prof ! SST used in read_tsurf1d
    361350
    362351! vertical interpolation:
    363       CALL interp_sandu_vertical(play,nlev_sandu,plev_profs
    364      :         ,t_profs,thl_profs,q_profs,u_profs,v_profs,w_profs
    365      :         ,omega_profs,o3mmr_profs
    366      :         ,t_mod,thl_mod,q_mod,u_mod,v_mod,w_mod
    367      :         ,omega_mod,o3mmr_mod,mxcalc)
    368 !calcul de l'advection verticale
    369 cCalcul des gradients verticaux
    370 cinitialisation
    371       d_t_z(:)=0.
    372       d_q_z(:)=0.
    373       d_t_dyn_z(:)=0.
    374       d_q_dyn_z(:)=0.
    375 ! schema centre
    376 !     DO l=2,llm-1
    377 !      d_t_z(l)=(temp(l+1)-temp(l-1))
    378 !    &          /(play(l+1)-play(l-1))
    379 !      d_q_z(l)=(q(l+1,1)-q(l-1,1))
    380 !    &          /(play(l+1)-play(l-1))
    381 ! schema amont
    382       DO l=2,llm-1
    383        d_t_z(l)=(temp(l+1)-temp(l))/(play(l+1)-play(l))
    384        d_q_z(l)=(q(l+1,1)-q(l,1))/(play(l+1)-play(l))
    385 !     print *,'l temp2 temp0 play2 play0 omega_mod',
    386 !    & temp(l+1),temp(l-1),play(l+1),play(l-1),omega_mod(l)
    387       ENDDO
    388       d_t_z(1)=d_t_z(2)
    389       d_q_z(1)=d_q_z(2)
    390       d_t_z(llm)=d_t_z(llm-1)
    391       d_q_z(llm)=d_q_z(llm-1)
    392 
    393 !  calcul de l advection verticale
    394 ! Confusion w (m/s) et omega (Pa/s) !!
    395       d_t_dyn_z(:)=omega_mod(:)*d_t_z(:)
    396       d_q_dyn_z(:)=omega_mod(:)*d_q_z(:)
    397 !     do l=1,llm
    398 !      print *,'d_t_dyn omega_mod d_t_z d_q_dyn d_q_z',
    399 !    :l,d_t_dyn_z(l),omega_mod(l),d_t_z(l),d_q_dyn_z(l),d_q_z(l)
    400 !     enddo
    401 
    402 
    403 ! large-scale forcing : pour le cas Sandu ces forcages sont la SST
    404 ! et une divergence constante -> profil de omega
    405       tsurf = ts_prof
    406       write(*,*) 'SST suivante: ',tsurf
    407       do l = 1, llm
    408        omega(l) = omega_mod(l)
    409        omega2(l)= omega(l)/rg*airefi ! flxmass_w calcule comme ds physiq
    410 
    411        alpha = rd*temp(l)*(1.+(rv/rd-1.)*q(l,1))/play(l)
    412 !
    413 !      d_th_adv(l) = 0.0
    414 !      d_q_adv(l,1) = 0.0
    415 !CR:test advection=0
    416 !calcul de l'advection verticale
    417         d_th_adv(l) = alpha*omega(l)/rcpd-d_t_dyn_z(l)
    418 !        print*,'temp adv',l,-d_t_dyn_z(l)
    419         d_q_adv(l,1) = -d_q_dyn_z(l)
    420 !        print*,'q adv',l,-d_q_dyn_z(l)
    421        dt_cooling(l) = 0.0
    422       enddo
    423       endif ! forcing_sandu
    424 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    425 !---------------------------------------------------------------------
    426 ! Interpolation forcing in time and onto model levels
    427 !---------------------------------------------------------------------
    428       if (forcing_astex) then
    429 
    430         print*,
    431      : '#### ITAP,day,day1,(day-day1)*86400,(day-day1)*86400/dt_astex=',
    432      :    day,day1,(day-day1)*86400.,(day-day1)*86400/dt_astex
    433 
    434 ! time interpolation:
    435 ! ATTENTION, cet appel ne convient pas pour TOGA !!
    436 ! revoir 1DUTILS.h et les arguments
    437       CALL interp_astex_time(daytime,day1,annee_ref
    438      i             ,year_ini_astex,day_ju_ini_astex,nt_astex,dt_astex
    439      i             ,nlev_astex,div_astex,ts_astex,ug_astex,vg_astex
    440      i             ,ufa_astex,vfa_astex,div_prof,ts_prof,ug_prof,vg_prof
    441      i             ,ufa_prof,vfa_prof)
    442 
    443         if (type_ts_forcing.eq.1) ts_cur = ts_prof ! SST used in read_tsurf1d
    444 
    445 ! vertical interpolation:
    446       CALL interp_astex_vertical(play,nlev_astex,plev_profa
    447      :         ,t_profa,thl_profa,qv_profa,ql_profa,qt_profa
    448      :         ,u_profa,v_profa,w_profa,tke_profa,o3mmr_profa
    449      :         ,t_mod,thl_mod,qv_mod,ql_mod,qt_mod,u_mod,v_mod,w_mod
    450      :         ,tke_mod,o3mmr_mod,mxcalc)
     352      CALL interp_sandu_vertical(play,nlev_sandu,plev_profs                 &
     353     &         ,t_profs,thl_profs,q_profs,u_profs,v_profs,w_profs           &
     354     &         ,omega_profs,o3mmr_profs                                     &
     355     &         ,t_mod,thl_mod,q_mod,u_mod,v_mod,w_mod                       &
     356     &         ,omega_mod,o3mmr_mod,mxcalc)
    451357!calcul de l'advection verticale
    452358!Calcul des gradients verticaux
     
    476382!  calcul de l advection verticale
    477383! Confusion w (m/s) et omega (Pa/s) !!
    478       d_t_dyn_z(:)=w_mod(:)*d_t_z(:)
    479       d_q_dyn_z(:)=w_mod(:)*d_q_z(:)
     384      d_t_dyn_z(:)=omega_mod(:)*d_t_z(:)
     385      d_q_dyn_z(:)=omega_mod(:)*d_q_z(:)
    480386!     do l=1,llm
    481387!      print *,'d_t_dyn omega_mod d_t_z d_q_dyn d_q_z',
     
    484390
    485391
    486 ! large-scale forcing : pour le cas Astex ces forcages sont la SST
    487 ! la divergence,ug,vg,ufa,vfa
     392! large-scale forcing : pour le cas Sandu ces forcages sont la SST
     393! et une divergence constante -> profil de omega
    488394      tsurf = ts_prof
    489395      write(*,*) 'SST suivante: ',tsurf
    490396      do l = 1, llm
    491        omega(l) = w_mod(l)
     397       omega(l) = omega_mod(l)
    492398       omega2(l)= omega(l)/rg*airefi ! flxmass_w calcule comme ds physiq
    493399
     
    504410       dt_cooling(l) = 0.0
    505411      enddo
     412      endif ! forcing_sandu
     413!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
     414!---------------------------------------------------------------------
     415! Interpolation forcing in time and onto model levels
     416!---------------------------------------------------------------------
     417      if (forcing_astex) then
     418
     419        print*,                                                             &
     420     & '#### ITAP,day,day1,(day-day1)*86400,(day-day1)*86400/dt_astex=',    &
     421     &    day,day1,(day-day1)*86400.,(day-day1)*86400/dt_astex
     422
     423! time interpolation:
     424! ATTENTION, cet appel ne convient pas pour TOGA !!
     425! revoir 1DUTILS.h et les arguments
     426      CALL interp_astex_time(daytime,day1,annee_ref                         &
     427     &             ,year_ini_astex,day_ju_ini_astex,nt_astex,dt_astex       &
     428     &             ,nlev_astex,div_astex,ts_astex,ug_astex,vg_astex         &
     429     &             ,ufa_astex,vfa_astex,div_prof,ts_prof,ug_prof,vg_prof    &
     430     &             ,ufa_prof,vfa_prof)
     431
     432        if (type_ts_forcing.eq.1) ts_cur = ts_prof ! SST used in read_tsurf1d
     433
     434! vertical interpolation:
     435      CALL interp_astex_vertical(play,nlev_astex,plev_profa                 &
     436     &         ,t_profa,thl_profa,qv_profa,ql_profa,qt_profa                &
     437     &         ,u_profa,v_profa,w_profa,tke_profa,o3mmr_profa               &
     438     &         ,t_mod,thl_mod,qv_mod,ql_mod,qt_mod,u_mod,v_mod,w_mod        &
     439     &         ,tke_mod,o3mmr_mod,mxcalc)
     440!calcul de l'advection verticale
     441!Calcul des gradients verticaux
     442!initialisation
     443      d_t_z(:)=0.
     444      d_q_z(:)=0.
     445      d_t_dyn_z(:)=0.
     446      d_q_dyn_z(:)=0.
     447! schema centre
     448!     DO l=2,llm-1
     449!      d_t_z(l)=(temp(l+1)-temp(l-1))
     450!    &          /(play(l+1)-play(l-1))
     451!      d_q_z(l)=(q(l+1,1)-q(l-1,1))
     452!    &          /(play(l+1)-play(l-1))
     453! schema amont
     454      DO l=2,llm-1
     455       d_t_z(l)=(temp(l+1)-temp(l))/(play(l+1)-play(l))
     456       d_q_z(l)=(q(l+1,1)-q(l,1))/(play(l+1)-play(l))
     457!     print *,'l temp2 temp0 play2 play0 omega_mod',
     458!    & temp(l+1),temp(l-1),play(l+1),play(l-1),omega_mod(l)
     459      ENDDO
     460      d_t_z(1)=d_t_z(2)
     461      d_q_z(1)=d_q_z(2)
     462      d_t_z(llm)=d_t_z(llm-1)
     463      d_q_z(llm)=d_q_z(llm-1)
     464
     465!  calcul de l advection verticale
     466! Confusion w (m/s) et omega (Pa/s) !!
     467      d_t_dyn_z(:)=w_mod(:)*d_t_z(:)
     468      d_q_dyn_z(:)=w_mod(:)*d_q_z(:)
     469!     do l=1,llm
     470!      print *,'d_t_dyn omega_mod d_t_z d_q_dyn d_q_z',
     471!    :l,d_t_dyn_z(l),omega_mod(l),d_t_z(l),d_q_dyn_z(l),d_q_z(l)
     472!     enddo
     473
     474
     475! large-scale forcing : pour le cas Astex ces forcages sont la SST
     476! la divergence,ug,vg,ufa,vfa
     477      tsurf = ts_prof
     478      write(*,*) 'SST suivante: ',tsurf
     479      do l = 1, llm
     480       omega(l) = w_mod(l)
     481       omega2(l)= omega(l)/rg*airefi ! flxmass_w calcule comme ds physiq
     482
     483       alpha = rd*temp(l)*(1.+(rv/rd-1.)*q(l,1))/play(l)
     484!
     485!      d_th_adv(l) = 0.0
     486!      d_q_adv(l,1) = 0.0
     487!CR:test advection=0
     488!calcul de l'advection verticale
     489        d_th_adv(l) = alpha*omega(l)/rcpd-d_t_dyn_z(l)
     490!        print*,'temp adv',l,-d_t_dyn_z(l)
     491        d_q_adv(l,1) = -d_q_dyn_z(l)
     492!        print*,'q adv',l,-d_q_dyn_z(l)
     493       dt_cooling(l) = 0.0
     494      enddo
    506495      endif ! forcing_astex
    507496!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
  • LMDZ5/trunk/libf/phylmd/1D_nudge_sandu_astex.h

    r2017 r2019  
    2020!     print *,'l dt  relax dtadv',l,dt_phys(l),relax_thl(l),d_th_adv(l)
    2121      enddo
    22         u(1:mxcalc)=u(1:mxcalc) + timestep*(
    23      .              du_phys(1:mxcalc) - relax_u(1:mxcalc))
    24         v(1:mxcalc)=v(1:mxcalc) + timestep*(
    25                  dv_phys(1:mxcalc) - relax_v(1:mxcalc))
    26 c       q(1:mxcalc,:)=q(1:mxcalc,:)+timestep*(
    27 c    .              dq(1:mxcalc,:) - relax_q(1:mxcalc,:)+
    28 c    .              d_q_adv(1:mxcalc,:))
    29         q(1:mxcalc,1)=q(1:mxcalc,1)+timestep*(
    30      .      dq(1:mxcalc,1) - relax_q(1:mxcalc,1)+d_q_adv(1:mxcalc,1))
    31         q(1:mxcalc,2)=q(1:mxcalc,2)+timestep*(
    32      .      dq(1:mxcalc,2) - relax_q(1:mxcalc,2)+d_q_adv(1:mxcalc,2))
    33         temp(1:mxcalc)=temp(1:mxcalc)+timestep*(
    34      .      dt_phys(1:mxcalc)-relax_thl(1:mxcalc)+d_th_adv(1:mxcalc))
     22        u(1:mxcalc)=u(1:mxcalc) + timestep*(                                &         
     23     &              du_phys(1:mxcalc) - relax_u(1:mxcalc))
     24        v(1:mxcalc)=v(1:mxcalc) + timestep*(                                &
     25     &               dv_phys(1:mxcalc) - relax_v(1:mxcalc))
     26!       q(1:mxcalc,:)=q(1:mxcalc,:)+timestep*(
     27!    .              dq(1:mxcalc,:) - relax_q(1:mxcalc,:)+
     28!    .              d_q_adv(1:mxcalc,:))
     29        q(1:mxcalc,1)=q(1:mxcalc,1)+timestep*(                              &
     30     &      dq(1:mxcalc,1) - relax_q(1:mxcalc,1)+d_q_adv(1:mxcalc,1))
     31        q(1:mxcalc,2)=q(1:mxcalc,2)+timestep*(                              &
     32     &      dq(1:mxcalc,2) - relax_q(1:mxcalc,2)+d_q_adv(1:mxcalc,2))
     33        temp(1:mxcalc)=temp(1:mxcalc)+timestep*(                            &
     34     &      dt_phys(1:mxcalc)-relax_thl(1:mxcalc)+d_th_adv(1:mxcalc))
  • LMDZ5/trunk/libf/phylmd/1D_read_forc_cases.h

    r2017 r2019  
    88      nq2=0
    99
    10       if (forcing_les .or. forcing_radconv
    11      :    .or. forcing_GCSSold .or. forcing_fire) then
     10      if (forcing_les .or. forcing_radconv                                      &
     11     &    .or. forcing_GCSSold .or. forcing_fire) then
    1212
    1313      if (forcing_fire) then
     
    1616!----------------------------------------------------------------------
    1717      fich_fire='fire.nc'
    18       call read_fire(fich_fire,nlev_fire,nt_fire
    19      :     ,height,tttprof,qtprof,uprof,vprof,e12prof
    20      :     ,ugprof,vgprof,wfls,dqtdxls
    21      :     ,dqtdyls,dqtdtls,thlpcar)
     18      call read_fire(fich_fire,nlev_fire,nt_fire                                &
     19     &     ,height,tttprof,qtprof,uprof,vprof,e12prof                           &
     20     &     ,ugprof,vgprof,wfls,dqtdxls                                          &
     21     &     ,dqtdyls,dqtdtls,thlpcar)
    2222      write(*,*) 'Forcing FIRE lu'
    2323      kmax=120            ! nombre de niveaux dans les profils et forcages
     
    2828!----------------------------------------------------------------------
    2929
    30       call readprofiles(nlev_max,kmax,nqtot,height,
    31      .           tttprof,qtprof,uprof,vprof,
    32      .           e12prof,ugprof,vgprof,
    33      .           wfls,dqtdxls,dqtdyls,dqtdtls,
    34      .           thlpcar,qprof,nq1,nq2)
     30      call readprofiles(nlev_max,kmax,nqtot,height,                             &
     31     &           tttprof,qtprof,uprof,vprof,                                    &
     32     &           e12prof,ugprof,vgprof,                                         &
     33     &           wfls,dqtdxls,dqtdyls,dqtdtls,                                  &
     34     &           thlpcar,qprof,nq1,nq2)
    3535      endif
    3636
     
    6666        ug(l)   = ugprof(kmax)-frac*( ugprof(kmax)- ugprof(kmax-1))
    6767        vg(l)   = vgprof(kmax)-frac*( vgprof(kmax)- vgprof(kmax-1))
    68         IF (nq2>0) q(l,nq1:nq2)=qprof(kmax,nq1:nq2)
    69      s               -frac*(qprof(kmax,nq1:nq2)-qprof(kmax-1,nq1:nq2))
     68        IF (nq2>0) q(l,nq1:nq2)=qprof(kmax,nq1:nq2)                         &
     69     &               -frac*(qprof(kmax,nq1:nq2)-qprof(kmax-1,nq1:nq2))
    7070        omega(l)=   wfls(kmax)-frac*(   wfls(kmax)-   wfls(kmax-1))
    7171
    7272        dq_dyn(l,1) = dqtdtls(kmax)-frac*(dqtdtls(kmax)-dqtdtls(kmax-1))
    73         dt_cooling(l)
    74      .          =thlpcar(kmax)-frac*(thlpcar(kmax)-thlpcar(kmax-1))
     73        dt_cooling(l)=thlpcar(kmax)-frac*(thlpcar(kmax)-thlpcar(kmax-1))
    7574        do k=2,kmax
    7675          frac = (height(k)-zlay(l))/(height(k)-height(k-1))
     
    9190            ug(l)   = ugprof(k)-frac*( ugprof(k)- ugprof(k-1))
    9291            vg(l)   = vgprof(k)-frac*( vgprof(k)- vgprof(k-1))
    93             IF (nq2>0) q(l,nq1:nq2)=qprof(k,nq1:nq2)
    94      s                   -frac*(qprof(k,nq1:nq2)-qprof(k-1,nq1:nq2))
     92            IF (nq2>0) q(l,nq1:nq2)=qprof(k,nq1:nq2)                        &
     93     &                   -frac*(qprof(k,nq1:nq2)-qprof(k-1,nq1:nq2))
    9594            omega(l)=   wfls(k)-frac*(   wfls(k)-   wfls(k-1))
    9695            dq_dyn(l,1)=dqtdtls(k)-frac*(dqtdtls(k)-dqtdtls(k-1))
    97             dt_cooling(l)
    98      .              =thlpcar(k)-frac*(thlpcar(k)-thlpcar(k-1))
     96            dt_cooling(l)=thlpcar(k)-frac*(thlpcar(k)-thlpcar(k-1))
    9997          elseif(zlay(l)<height(1)) then ! profils uniformes pour z<height(1)
    10098            ttt =tttprof(1)
     
    144142       fich_gcssold_dat = './forcing8.dat'
    145143       call copie(llm,play,psurf,fich_gcssold_ctl)
    146        call get_uvd2(it,timestep,fich_gcssold_ctl,fich_gcssold_dat,
    147      :               ht_gcssold,hq_gcssold,hw_gcssold,
    148      :               hu_gcssold,hv_gcssold,
    149      :               hthturb_gcssold,hqturb_gcssold,Ts_gcssold,
    150      :               imp_fcg_gcssold,ts_fcg_gcssold,
    151      :               Tp_fcg_gcssold,Turb_fcg_gcssold)
     144       call get_uvd2(it,timestep,fich_gcssold_ctl,fich_gcssold_dat,         &
     145     &               ht_gcssold,hq_gcssold,hw_gcssold,                      &
     146     &               hu_gcssold,hv_gcssold,                                 &
     147     &               hthturb_gcssold,hqturb_gcssold,Ts_gcssold,             &
     148     &               imp_fcg_gcssold,ts_fcg_gcssold,                        &
     149     &               Tp_fcg_gcssold,Turb_fcg_gcssold)
    152150       print *,' get_uvd2 -> hqturb_gcssold ',hqturb_gcssold
    153151      endif ! forcing_GCSSold
     
    160158!       call writefield_phy('omega', omega,llm+1)
    161159      fich_rico = 'rico.txt'
    162        call read_rico(fich_rico,nlev_rico,ps_rico,play
    163      :             ,ts_rico,t_rico,q_rico,u_rico,v_rico,w_rico
    164      :             ,dth_rico,dqh_rico)
     160       call read_rico(fich_rico,nlev_rico,ps_rico,play                      &
     161     &             ,ts_rico,t_rico,q_rico,u_rico,v_rico,w_rico              &
     162     &             ,dth_rico,dqh_rico)
    165163        print*, ' on a lu et prepare RICO'
    166164
     
    189187! read TOGA-COARE forcing (native vertical grid, nt_toga timesteps):
    190188      fich_toga = './d_toga/ifa_toga_coare_v21_dime.txt'
    191       CALL read_togacoare(fich_toga,nlev_toga,nt_toga
    192      :         ,ts_toga,plev_toga,t_toga,q_toga,u_toga,v_toga,w_toga
    193      :         ,ht_toga,vt_toga,hq_toga,vq_toga)
     189      CALL read_togacoare(fich_toga,nlev_toga,nt_toga                       &
     190     &         ,ts_toga,plev_toga,t_toga,q_toga,u_toga,v_toga,w_toga        &
     191     &         ,ht_toga,vt_toga,hq_toga,vq_toga)
    194192
    195193       write(*,*) 'Forcing TOGA lu'
     
    197195! time interpolation for initial conditions:
    198196      write(*,*) 'AVT 1ere INTERPOLATION: day,day1 = ',day,day1
    199       CALL interp_toga_time(daytime,day1,annee_ref
    200      i             ,year_ini_toga,day_ju_ini_toga,nt_toga,dt_toga
    201      i             ,nlev_toga,ts_toga,plev_toga,t_toga,q_toga,u_toga
    202      i             ,v_toga,w_toga,ht_toga,vt_toga,hq_toga,vq_toga
    203      o             ,ts_prof,plev_prof,t_prof,q_prof,u_prof,v_prof,w_prof
    204      o             ,ht_prof,vt_prof,hq_prof,vq_prof)
     197      CALL interp_toga_time(daytime,day1,annee_ref                          &
     198     &             ,year_ini_toga,day_ju_ini_toga,nt_toga,dt_toga           &
     199     &             ,nlev_toga,ts_toga,plev_toga,t_toga,q_toga,u_toga        &
     200     &             ,v_toga,w_toga,ht_toga,vt_toga,hq_toga,vq_toga           &
     201     &             ,ts_prof,plev_prof,t_prof,q_prof,u_prof,v_prof,w_prof    &
     202     &             ,ht_prof,vt_prof,hq_prof,vq_prof)
    205203
    206204! vertical interpolation:
    207       CALL interp_toga_vertical(play,nlev_toga,plev_prof
    208      :         ,t_prof,q_prof,u_prof,v_prof,w_prof
    209      :         ,ht_prof,vt_prof,hq_prof,vq_prof
    210      :         ,t_mod,q_mod,u_mod,v_mod,w_mod
    211      :         ,ht_mod,vt_mod,hq_mod,vq_mod,mxcalc)
     205      CALL interp_toga_vertical(play,nlev_toga,plev_prof                    &
     206     &         ,t_prof,q_prof,u_prof,v_prof,w_prof                          &
     207     &         ,ht_prof,vt_prof,hq_prof,vq_prof                             &
     208     &         ,t_mod,q_mod,u_mod,v_mod,w_mod                               &
     209     &         ,ht_mod,vt_mod,hq_mod,vq_mod,mxcalc)
    212210       write(*,*) 'Profil initial forcing TOGA interpole'
    213211
     
    239237      if (forcing_twpice) then
    240238!read TWP-ICE forcings
    241       fich_twpice=
    242      : 'd_twpi/twp180iopsndgvarana_v2.1_C3.c1.20060117.000000.cdf'
    243       call read_twpice(fich_twpice,nlev_twpi,nt_twpi
    244      :     ,ts_twpi,plev_twpi,t_twpi,q_twpi,u_twpi,v_twpi,w_twpi
    245      :     ,ht_twpi,vt_twpi,hq_twpi,vq_twpi)
     239     fich_twpice='d_twpi/twp180iopsndgvarana_v2.1_C3.c1.20060117.000000.cdf'
     240      call read_twpice(fich_twpice,nlev_twpi,nt_twpi                        &
     241     &     ,ts_twpi,plev_twpi,t_twpi,q_twpi,u_twpi,v_twpi,w_twpi            &
     242     &     ,ht_twpi,vt_twpi,hq_twpi,vq_twpi)
    246243
    247244      write(*,*) 'Forcing TWP-ICE lu'
    248245!Time interpolation for initial conditions using TOGA interpolation routine
    249246         write(*,*) 'AVT 1ere INTERPOLATION: day,day1 = ',daytime,day1   
    250       CALL interp_toga_time(daytime,day1,annee_ref
    251      i          ,year_ini_twpi,day_ju_ini_twpi,nt_twpi,dt_twpi,nlev_twpi
    252      i             ,ts_twpi,plev_twpi,t_twpi,q_twpi,u_twpi,v_twpi,w_twpi
    253      i             ,ht_twpi,vt_twpi,hq_twpi,vq_twpi
    254      o             ,ts_proftwp,plev_proftwp,t_proftwp,q_proftwp
    255      o             ,u_proftwp,v_proftwp,w_proftwp
    256      o             ,ht_proftwp,vt_proftwp,hq_proftwp,vq_proftwp)
     247      CALL interp_toga_time(daytime,day1,annee_ref                          &
     248     &          ,year_ini_twpi,day_ju_ini_twpi,nt_twpi,dt_twpi,nlev_twpi    &
     249     &             ,ts_twpi,plev_twpi,t_twpi,q_twpi,u_twpi,v_twpi,w_twpi    &
     250     &             ,ht_twpi,vt_twpi,hq_twpi,vq_twpi                         &
     251     &             ,ts_proftwp,plev_proftwp,t_proftwp,q_proftwp             &
     252     &             ,u_proftwp,v_proftwp,w_proftwp                           &
     253     &             ,ht_proftwp,vt_proftwp,hq_proftwp,vq_proftwp)
    257254
    258255! vertical interpolation using TOGA interpolation routine:
    259256!      write(*,*)'avant interp vert', t_proftwp
    260       CALL interp_toga_vertical(play,nlev_twpi,plev_proftwp
    261      :         ,t_proftwp,q_proftwp,u_proftwp,v_proftwp,w_proftwp
    262      :         ,ht_proftwp,vt_proftwp,hq_proftwp,vq_proftwp
    263      :         ,t_mod,q_mod,u_mod,v_mod,w_mod
    264      :         ,ht_mod,vt_mod,hq_mod,vq_mod,mxcalc)
     257      CALL interp_toga_vertical(play,nlev_twpi,plev_proftwp                 &
     258     &         ,t_proftwp,q_proftwp,u_proftwp,v_proftwp,w_proftwp           &
     259     &         ,ht_proftwp,vt_proftwp,hq_proftwp,vq_proftwp                 &
     260     &         ,t_mod,q_mod,u_mod,v_mod,w_mod                               &
     261     &         ,ht_mod,vt_mod,hq_mod,vq_mod,mxcalc)
    265262!       write(*,*) 'Profil initial forcing TWP-ICE interpole',t_mod
    266263
     
    295292!read AMMA forcings
    296293      fich_amma='amma.nc'
    297       call read_amma(fich_amma,nlev_amma,nt_amma
    298      :     ,z_amma,plev_amma,th_amma,q_amma,u_amma,v_amma,vitw_amma
    299      :     ,ht_amma,hq_amma,sens_amma,lat_amma)
     294      call read_amma(fich_amma,nlev_amma,nt_amma                            &
     295     &     ,z_amma,plev_amma,th_amma,q_amma,u_amma,v_amma,vitw_amma         &
     296     &     ,ht_amma,hq_amma,sens_amma,lat_amma)
    300297
    301298      write(*,*) 'Forcing AMMA lu'
     
    318315! vertical interpolation using TOGA interpolation routine:
    319316!      write(*,*)'avant interp vert', t_proftwp
    320       CALL interp_toga_vertical(play,nlev_amma,plev_amma
    321      :         ,th_ammai,q_ammai,u_ammai,v_ammai,vitw_ammai
    322      :         ,ht_ammai,vt_ammai,hq_ammai,vq_ammai
    323      :         ,t_mod,q_mod,u_mod,v_mod,w_mod
    324      :         ,ht_mod,vt_mod,hq_mod,vq_mod,mxcalc)
     317      CALL interp_toga_vertical(play,nlev_amma,plev_amma                    &
     318     &         ,th_ammai,q_ammai,u_ammai,v_ammai,vitw_ammai                 &
     319     &         ,ht_ammai,vt_ammai,hq_ammai,vq_ammai                         &
     320     &         ,t_mod,q_mod,u_mod,v_mod,w_mod                               &
     321     &         ,ht_mod,vt_mod,hq_mod,vq_mod,mxcalc)
    325322!       write(*,*) 'Profil initial forcing TWP-ICE interpole',t_mod
    326323
     
    351348       dt_cooling(l)=0.
    352349      enddo     
    353        write(*,*) 'Profil initial forcing AMMA interpole temp39',
    354      &           temp(39)
     350       write(*,*) 'Prof initeforcing AMMA interpole temp39',temp(39)
    355351     
    356352
     
    374370       write(*,*) 'Avant lecture Forcing Arm_Cu'
    375371      fich_armcu = './ifa_armcu.txt'
    376       CALL read_armcu(fich_armcu,nlev_armcu,nt_armcu,
    377      : sens_armcu,flat_armcu,adv_theta_armcu,
    378      : rad_theta_armcu,adv_qt_armcu)
     372      CALL read_armcu(fich_armcu,nlev_armcu,nt_armcu,                       &
     373     & sens_armcu,flat_armcu,adv_theta_armcu,                               &
     374     & rad_theta_armcu,adv_qt_armcu)
    379375       write(*,*) 'Forcing Arm_Cu lu'
    380376
     
    391387!----------------------------------------------------------------------
    392388
    393       call readprofile_armcu(nlev_max,kmax,height,play_mod,u_mod,
    394      .           v_mod,theta_mod,t_mod,qv_mod,rv_mod,ap,bp)
     389      call readprofile_armcu(nlev_max,kmax,height,play_mod,u_mod,           &
     390     &           v_mod,theta_mod,t_mod,qv_mod,rv_mod,ap,bp)
    395391
    396392! time interpolation for initial conditions:
     
    406402      print *,'dt_armcu=',dt_armcu
    407403      print *,'nlev_armcu=',nlev_armcu
    408       CALL interp_armcu_time(daytime,day1,annee_ref
    409      i            ,year_ini_armcu,day_ju_ini_armcu,nt_armcu,dt_armcu
    410      i            ,nlev_armcu,sens_armcu,flat_armcu,adv_theta_armcu
    411      i            ,rad_theta_armcu,adv_qt_armcu,sens_prof,flat_prof
    412      i            ,adv_theta_prof,rad_theta_prof,adv_qt_prof)
     404      CALL interp_armcu_time(daytime,day1,annee_ref                         &
     405     &            ,year_ini_armcu,day_ju_ini_armcu,nt_armcu,dt_armcu        &
     406     &            ,nlev_armcu,sens_armcu,flat_armcu,adv_theta_armcu         &
     407     &            ,rad_theta_armcu,adv_qt_armcu,sens_prof,flat_prof         &
     408     &            ,adv_theta_prof,rad_theta_prof,adv_qt_prof)
    413409       write(*,*) 'Forcages interpoles dans temps'
    414410
     
    456452      do l = 1, llm
    457453      plev(l+1) = ap(llm-l+1)+bp(llm-l+1)*psurf
    458       print *,'Read_forc: l height play plev zlay temp',
    459      :   l,height(l),play(l),plev(l),zlay(l),temp(l)
     454      print *,'Read_forc: l height play plev zlay temp',                    &
     455     &   l,height(l),play(l),plev(l),zlay(l),temp(l)
    460456      enddo
    461457! For this case, fluxes are imposed
     
    482478!----------------------------------------------------------------------
    483479
    484       call readprofile_sandu(nlev_max,kmax,height,plev_profs,t_profs,
    485      .           thl_profs,q_profs,u_profs,v_profs,
    486      .           w_profs,omega_profs,o3mmr_profs)
     480      call readprofile_sandu(nlev_max,kmax,height,plev_profs,t_profs,       &
     481     &           thl_profs,q_profs,u_profs,v_profs,                         &
     482     &           w_profs,omega_profs,o3mmr_profs)
    487483
    488484! time interpolation for initial conditions:
     
    500496      print *,'dt_sandu=',dt_sandu
    501497      print *,'nlev_sandu=',nlev_sandu
    502       CALL interp_sandu_time(daytime,day1,annee_ref
    503      i             ,year_ini_sandu,day_ju_ini_sandu,nt_sandu,dt_sandu
    504      i             ,nlev_sandu
    505      i             ,ts_sandu,ts_prof)
     498      CALL interp_sandu_time(daytime,day1,annee_ref                         &
     499     &             ,year_ini_sandu,day_ju_ini_sandu,nt_sandu,dt_sandu       &
     500     &             ,nlev_sandu                                              &
     501     &             ,ts_sandu,ts_prof)
    506502
    507503! vertical interpolation:
    508504      print *,'Avant interp_vertical: nlev_sandu=',nlev_sandu
    509       CALL interp_sandu_vertical(play,nlev_sandu,plev_profs
    510      :         ,t_profs,thl_profs,q_profs,u_profs,v_profs,w_profs
    511      :         ,omega_profs,o3mmr_profs
    512      :         ,t_mod,thl_mod,q_mod,u_mod,v_mod,w_mod
    513      :         ,omega_mod,o3mmr_mod,mxcalc)
     505      CALL interp_sandu_vertical(play,nlev_sandu,plev_profs                 &
     506     &         ,t_profs,thl_profs,q_profs,u_profs,v_profs,w_profs           &
     507     &         ,omega_profs,o3mmr_profs                                     &
     508     &         ,t_mod,thl_mod,q_mod,u_mod,v_mod,w_mod                       &
     509     &         ,omega_mod,o3mmr_mod,mxcalc)
    514510       write(*,*) 'Profil initial forcing SANDU interpole'
    515511
     
    548544! read astex forcing :
    549545      fich_astex = './ifa_astex.txt'
    550       CALL read_astex(fich_astex,nlev_astex,nt_astex,div_astex,ts_astex,
    551      :  ug_astex,vg_astex,ufa_astex,vfa_astex)
     546      CALL read_astex(fich_astex,nlev_astex,nt_astex,div_astex,ts_astex,    &
     547     &  ug_astex,vg_astex,ufa_astex,vfa_astex)
    552548
    553549       write(*,*) 'Forcing Astex lu'
     
    557553!----------------------------------------------------------------------
    558554
    559       call readprofile_astex(nlev_max,kmax,height,plev_profa,t_profa,
    560      .           thl_profa,qv_profa,ql_profa,qt_profa,u_profa,v_profa,
    561      .           w_profa,tke_profa,o3mmr_profa)
     555      call readprofile_astex(nlev_max,kmax,height,plev_profa,t_profa,       &
     556     &           thl_profa,qv_profa,ql_profa,qt_profa,u_profa,v_profa,      &
     557     &           w_profa,tke_profa,o3mmr_profa)
    562558
    563559! time interpolation for initial conditions:
     
    575571      print *,'dt_astex=',dt_astex
    576572      print *,'nlev_astex=',nlev_astex
    577       CALL interp_astex_time(daytime,day1,annee_ref
    578      i             ,year_ini_astex,day_ju_ini_astex,nt_astex,dt_astex
    579      i             ,nlev_astex,div_astex,ts_astex,ug_astex,vg_astex
    580      i             ,ufa_astex,vfa_astex,div_prof,ts_prof,ug_prof,vg_prof
    581      i             ,ufa_prof,vfa_prof)
     573      CALL interp_astex_time(daytime,day1,annee_ref                         &
     574     &             ,year_ini_astex,day_ju_ini_astex,nt_astex,dt_astex       &
     575     &             ,nlev_astex,div_astex,ts_astex,ug_astex,vg_astex         &
     576     &             ,ufa_astex,vfa_astex,div_prof,ts_prof,ug_prof,vg_prof    &
     577     &             ,ufa_prof,vfa_prof)
    582578
    583579! vertical interpolation:
    584580      print *,'Avant interp_vertical: nlev_astex=',nlev_astex
    585       CALL interp_astex_vertical(play,nlev_astex,plev_profa
    586      :         ,t_profa,thl_profa,qv_profa,ql_profa,qt_profa
    587      :         ,u_profa,v_profa,w_profa,tke_profa,o3mmr_profa
    588      :         ,t_mod,thl_mod,qv_mod,ql_mod,qt_mod,u_mod,v_mod,w_mod
    589      :         ,tke_mod,o3mmr_mod,mxcalc)
     581      CALL interp_astex_vertical(play,nlev_astex,plev_profa                 &
     582     &         ,t_profa,thl_profa,qv_profa,ql_profa,qt_profa                &
     583     &         ,u_profa,v_profa,w_profa,tke_profa,o3mmr_profa               &
     584     &         ,t_mod,thl_mod,qv_mod,ql_mod,qt_mod,u_mod,v_mod,w_mod        &
     585     &         ,tke_mod,o3mmr_mod,mxcalc)
    590586       write(*,*) 'Profil initial forcing Astex interpole'
    591587
  • LMDZ5/trunk/libf/phylmd/1Dconv.h

    r2017 r2019  
    1         subroutine get_uvd(itap,dtime,file_forctl,file_fordat,
    2      :       ht,hq,hw,hu,hv,hthturb,hqturb,
    3      :       Ts,imp_fcg,ts_fcg,Tp_fcg,Turb_fcg)
    4 c
     1        subroutine get_uvd(itap,dtime,file_forctl,file_fordat,                  &
     2     &       ht,hq,hw,hu,hv,hthturb,hqturb,                                     &
     3     &       Ts,imp_fcg,ts_fcg,Tp_fcg,Turb_fcg)                                 
     4!
    55        implicit none
    66 
    7 cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
    8 c cette routine permet d obtenir u_convg,v_convg,ht,hq et ainsi de
    9 c pouvoir calculer la convergence et le cisaillement dans la physiq
    10 ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
     7!ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
     8! cette routine permet d obtenir u_convg,v_convg,ht,hq et ainsi de
     9! pouvoir calculer la convergence et le cisaillement dans la physiq
     10!cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
    1111
    1212#include "YOMCST.h"
     
    2929      COMMON/com2_phys_gcss/playm,hplaym,nblvlm
    3030
    31 c======================================================================
    32 c methode: on va chercher les donnees du mesoNH de meteo france, on y
    33 c          a acces a tout pas detemps grace a la routine rdgrads qui
    34 c          est une boucle lisant dans ces fichiers.
    35 c          Puis on interpole ces donnes sur les 11 niveaux du gcm et
    36 c          et sur les pas de temps de ce meme gcm
    37 c----------------------------------------------------------------------
    38 c input:
    39 c       pasmax     :nombre de pas de temps maximum du mesoNH
    40 c       dt         :pas de temps du meso_NH (en secondes)
    41 c----------------------------------------------------------------------
     31!======================================================================
     32! methode: on va chercher les donnees du mesoNH de meteo france, on y
     33!          a acces a tout pas detemps grace a la routine rdgrads qui
     34!          est une boucle lisant dans ces fichiers.
     35!          Puis on interpole ces donnes sur les 11 niveaux du gcm et
     36!          et sur les pas de temps de ce meme gcm
     37!----------------------------------------------------------------------
     38! input:
     39!       pasmax     :nombre de pas de temps maximum du mesoNH
     40!       dt         :pas de temps du meso_NH (en secondes)
     41!----------------------------------------------------------------------
    4242      integer pasmax,dt
    4343      save pasmax,dt
    44 c----------------------------------------------------------------------
    45 c arguments:
    46 c           itap   :compteur de la physique(le nombre de ces pas est
    47 c                   fixe dans la subroutine calcul_ini_gcm de interpo
    48 c                   -lation
    49 c           dtime  :pas detemps du gcm (en secondes)
    50 c           ht     :convergence horizontale de temperature(K/s)
    51 c           hq     :    "         "       d humidite (kg/kg/s)
    52 c           hw     :vitesse verticale moyenne (m/s**2)
    53 c           hu     :convergence horizontale d impulsion le long de x
    54 c                  (kg/(m^2 s^2)
    55 c           hv     : idem le long de y.
    56 c           Ts     : Temperature de surface (K)
    57 c           imp_fcg: var. logical .eq. T si forcage en impulsion
    58 c           ts_fcg: var. logical .eq. T si forcage en Ts present dans fichier
    59 c           Tp_fcg: var. logical .eq. T si forcage donne en Temp potentielle
    60 c           Turb_fcg: var. logical .eq. T si forcage turbulent present dans fichier
    61 c----------------------------------------------------------------------
     44!----------------------------------------------------------------------
     45! arguments:
     46!           itap   :compteur de la physique(le nombre de ces pas est
     47!                   fixe dans la subroutine calcul_ini_gcm de interpo
     48!                   -lation
     49!           dtime  :pas detemps du gcm (en secondes)
     50!           ht     :convergence horizontale de temperature(K/s)
     51!           hq     :    "         "       d humidite (kg/kg/s)
     52!           hw     :vitesse verticale moyenne (m/s**2)
     53!           hu     :convergence horizontale d impulsion le long de x
     54!                  (kg/(m^2 s^2)
     55!           hv     : idem le long de y.
     56!           Ts     : Temperature de surface (K)
     57!           imp_fcg: var. logical .eq. T si forcage en impulsion
     58!           ts_fcg: var. logical .eq. T si forcage en Ts present dans fichier
     59!           Tp_fcg: var. logical .eq. T si forcage donne en Temp potentielle
     60!           Turb_fcg: var. logical .eq. T si forcage turbulent present dans fichier
     61!----------------------------------------------------------------------
    6262        integer itap
    6363        real dtime
     
    7474        logical Tp_fcg
    7575        logical Turb_fcg
    76 c----------------------------------------------------------------------
    77 c Variables internes de get_uvd (note : l interpolation temporelle
    78 c est faite entre les pas de temps before et after, sur les variables
    79 c definies sur la grille du SCM; on atteint exactement les valeurs Meso
    80 c aux milieux des pas de temps Meso)
    81 c     time0     :date initiale en secondes
    82 c     time      :temps associe a chaque pas du SCM
    83 c     pas       :numero du pas du meso_NH (on lit en pas : le premier pas
    84 c                 des donnees est duplique)
    85 c     pasprev   :numero du pas de lecture precedent
    86 c     htaft     :advection horizontale de temp. au pas de temps after
    87 c     hqaft     :    "         "      d humidite        "
    88 c     hwaft     :vitesse verticalle moyenne  au pas de temps after
    89 c     huaft,hvaft :advection horizontale d impulsion au pas de temps after
    90 c     tsaft     : surface temperature 'after time step'
    91 c     htbef     :idem htaft, mais pour le pas de temps before
    92 c     hqbef     :voir hqaft
    93 c     hwbef     :voir hwaft
    94 c     hubef,hvbef : idem huaft,hvaft, mais pour before
    95 c     tsbef     : surface temperature 'before time step'
    96 c----------------------------------------------------------------------
     76!----------------------------------------------------------------------
     77! Variables internes de get_uvd (note : l interpolation temporelle
     78! est faite entre les pas de temps before et after, sur les variables
     79! definies sur la grille du SCM; on atteint exactement les valeurs Meso
     80! aux milieux des pas de temps Meso)
     81!     time0     :date initiale en secondes
     82!     time      :temps associe a chaque pas du SCM
     83!     pas       :numero du pas du meso_NH (on lit en pas : le premier pas
     84!                 des donnees est duplique)
     85!     pasprev   :numero du pas de lecture precedent
     86!     htaft     :advection horizontale de temp. au pas de temps after
     87!     hqaft     :    "         "      d humidite        "
     88!     hwaft     :vitesse verticalle moyenne  au pas de temps after
     89!     huaft,hvaft :advection horizontale d impulsion au pas de temps after
     90!     tsaft     : surface temperature 'after time step'
     91!     htbef     :idem htaft, mais pour le pas de temps before
     92!     hqbef     :voir hqaft
     93!     hwbef     :voir hwaft
     94!     hubef,hvbef : idem huaft,hvaft, mais pour before
     95!     tsbef     : surface temperature 'before time step'
     96!----------------------------------------------------------------------
    9797        integer time0,pas,pasprev
    9898        save time0,pas,pasprev
     
    106106        real Tsbef
    107107        save htbef,hqbef,hwbef,hubef,hvbef,hthturbbef,hqturbbef
    108 c
     108!
    109109        real timeaft,timebef
    110110        save timeaft,timebef
    111111        integer temps
    112112        character*4 string
    113 c----------------------------------------------------------------------
    114 c variables arguments de la subroutine rdgrads
    115 c---------------------------------------------------------------------
     113!----------------------------------------------------------------------
     114! variables arguments de la subroutine rdgrads
     115!---------------------------------------------------------------------
    116116        integer icompt,icomp1 !compteurs de rdgrads
    117117        real z(100)         ! altitude (grille Meso)
     
    128128        real hqturb_mes(100) !tendance horizontale d humidite, due aux
    129129                              !flux turbulents
    130 c
    131 c---------------------------------------------------------------------
    132 c variable argument de la subroutine copie
    133 c---------------------------------------------------------------------
    134 c SB        real pplay(100)    !pression en milieu de couche du gcm
    135 c SB                            !argument de la physique
    136 c---------------------------------------------------------------------
    137 c variables destinees a la lecture du pas de temps du fichier de donnees
    138 c---------------------------------------------------------------------
     130!
     131!---------------------------------------------------------------------
     132! variable argument de la subroutine copie
     133!---------------------------------------------------------------------
     134! SB        real pplay(100)    !pression en milieu de couche du gcm
     135! SB                            !argument de la physique
     136!---------------------------------------------------------------------
     137! variables destinees a la lecture du pas de temps du fichier de donnees
     138!---------------------------------------------------------------------
    139139       character*80 aaa,atemps,spaces,apasmax
    140140       integer nch,imn,ipa
    141 c---------------------------------------------------------------------
    142 c  procedures appelees
     141!---------------------------------------------------------------------
     142!  procedures appelees
    143143        external rdgrads    !lire en iterant dans forcing.dat
    144 c---------------------------------------------------------------------
     144!---------------------------------------------------------------------
    145145               print*,'le pas itap est:',itap
    146 c*** on determine le pas du meso_NH correspondant au nouvel itap ***
    147 c*** pour aller chercher les champs dans rdgrads                 ***
    148 c
     146!*** on determine le pas du meso_NH correspondant au nouvel itap ***
     147!*** pour aller chercher les champs dans rdgrads                 ***
     148!
    149149        time=time0+itap*dtime
    150 cc        temps=int(time/dt+1)
    151 cc        pas=min(temps,pasmax)
     150!c        temps=int(time/dt+1)
     151!c        pas=min(temps,pasmax)
    152152        temps = 1 + int((dt + 2*time)/(2*dt))
    153153        pas=min(temps,pasmax-1)
    154154             print*,'le pas Meso est:',pas
    155 c
    156 c
    157 c===================================================================
    158 c
    159 c*** on remplit les champs before avec les champs after du pas   ***
    160 c*** precedent en format gcm                                     ***
     155!
     156!
     157!===================================================================
     158!
     159!*** on remplit les champs before avec les champs after du pas   ***
     160!*** precedent en format gcm                                     ***
    161161        if(pas.gt.pasprev)then
    162162          do i=1,klev
     
    180180         print *, imp_fcg,ts_fcg,Turb_fcg,pas,nblvlm,icompt
    181181                       print*,'le pas pas est:',pas
    182 c*** on va chercher les nouveaux champs after dans toga.dat     ***
    183 c*** champs en format meso_NH                                   ***
    184           open(99,FILE=file_fordat,FORM='UNFORMATTED',
    185      .             ACCESS='DIRECT',RECL=8)
    186           call rdgrads(99,icompt,nblvlm,z,ht_mes,hq_mes,hw_mes
    187      .                  ,hu_mes,hv_mes,hthturb_mes,hqturb_mes
    188      .                  ,ts_fcg,ts_subr,imp_fcg,Turb_fcg)
    189 c
     182!*** on va chercher les nouveaux champs after dans toga.dat     ***
     183!*** champs en format meso_NH                                   ***
     184          open(99,FILE=file_fordat,FORM='UNFORMATTED',                        &
     185     &             ACCESS='DIRECT',RECL=8)
     186          call rdgrads(99,icompt,nblvlm,z,ht_mes,hq_mes,hw_mes                &
     187     &                  ,hu_mes,hv_mes,hthturb_mes,hqturb_mes                 &
     188     &                  ,ts_fcg,ts_subr,imp_fcg,Turb_fcg)
     189!
    190190
    191191               if(Tp_fcg) then
    192 c     (le forcage est donne en temperature potentielle)
     192!     (le forcage est donne en temperature potentielle)
    193193         do i = 1,nblvlm
    194194           ht_mes(i) = ht_mes(i)*(hplaym(i)/1000.)**rkappa
     
    200200         enddo
    201201        endif  ! Turb_fcg
    202 c
     202!
    203203               print*,'ht_mes ',(ht_mes(i),i=1,nblvlm)
    204204               print*,'hq_mes ',(hq_mes(i),i=1,nblvlm)
     
    213213                  endif
    214214          IF (ts_fcg) print*,'ts_subr', ts_subr
    215 c*** on interpole les champs meso_NH sur les niveaux de pression***
    216 c*** gcm . on obtient le nouveau champ after                    ***
     215!*** on interpole les champs meso_NH sur les niveaux de pression***
     216!*** gcm . on obtient le nouveau champ after                    ***
    217217            do k=1,klev
    218218             if (JM(k) .eq. 0) then
     
    237237               endif ! imp_fcg
    238238               if(Turb_fcg) then
    239            hThTurbaft(k)=coef1(k)*hThTurb_mes(jm(k))
    240      $               +coef2(k)*hThTurb_mes(jm(k)+1)
    241            hqTurbaft(k) =coef1(k)*hqTurb_mes(jm(k))
    242      $               +coef2(k)*hqTurb_mes(jm(k)+1)
     239           hThTurbaft(k)=coef1(k)*hThTurb_mes(jm(k))                            &
     240     &               +coef2(k)*hThTurb_mes(jm(k)+1)
     241           hqTurbaft(k) =coef1(k)*hqTurb_mes(jm(k))                             &
     242     &               +coef2(k)*hqTurb_mes(jm(k)+1)
    243243               endif ! Turb_fcg
    244244             endif ! JM(k) .eq. 0
     
    250250         endif ! pas.gt.pasprev    fin du bloc relatif au passage au pas
    251251                                  !de temps (meso) suivant
    252 c*** si on atteint le pas max des donnees experimentales ,on     ***
    253 c*** on conserve les derniers champs calcules                    ***
     252!*** si on atteint le pas max des donnees experimentales ,on     ***
     253!*** on conserve les derniers champs calcules                    ***
    254254      if(temps.ge.pasmax)then
    255255          do ll=1,klev
     
    264264          ts_subr = tsaft
    265265      else ! temps.ge.pasmax
    266 c*** on interpole sur les pas de temps de 10mn du gcm a partir   ***
    267 c** des pas de temps de 1h du meso_NH                            ***
     266!*** on interpole sur les pas de temps de 10mn du gcm a partir   ***
     267!** des pas de temps de 1h du meso_NH                            ***
    268268         do j=1,klev
    269269         ht(j)=((timeaft-time)*htbef(j)+(time-timebef)*htaft(j))/dt
     
    275275             endif ! imp_fcg
    276276             if(Turb_fcg) then
    277          hThTurb(j)=((timeaft-time)*hThTurbbef(j)
    278      $           +(time-timebef)*hThTurbaft(j))/dt
    279          hqTurb(j)= ((timeaft-time)*hqTurbbef(j)
    280      $           +(time-timebef)*hqTurbaft(j))/dt
     277         hThTurb(j)=((timeaft-time)*hThTurbbef(j)                           &
     278     &           +(time-timebef)*hThTurbaft(j))/dt
     279         hqTurb(j)= ((timeaft-time)*hqTurbbef(j)                            &
     280     &           +(time-timebef)*hqTurbaft(j))/dt
    281281             endif ! Turb_fcg
    282282         enddo
    283283         ts_subr = ((timeaft-time)*tsbef + (time-timebef)*tsaft)/dt
    284284       endif ! temps.ge.pasmax
    285 c
     285!
    286286        print *,' time,timebef,timeaft',time,timebef,timeaft
    287287        print *,' ht,htbef,htaft,hthturb,hthturbbef,hthturbaft'
    288288        do j= 1,klev
    289            print *, j,ht(j),htbef(j),htaft(j),
    290      $             hthturb(j),hthturbbef(j),hthturbaft(j)
     289           print *, j,ht(j),htbef(j),htaft(j),                              &
     290     &             hthturb(j),hthturbbef(j),hthturbaft(j)
    291291        enddo
    292292        print *,' hq,hqbef,hqaft,hqturb,hqturbbef,hqturbaft'
    293293        do j= 1,klev
    294            print *, j,hq(j),hqbef(j),hqaft(j),
    295      $             hqturb(j),hqturbbef(j),hqturbaft(j)
     294           print *, j,hq(j),hqbef(j),hqaft(j),                              &
     295     &             hqturb(j),hqturbbef(j),hqturbaft(j)
    296296        enddo
    297 c
    298 c-------------------------------------------------------------------
    299 c
     297!
     298!-------------------------------------------------------------------
     299!
    300300         IF (Ts_fcg) Ts = Ts_subr
    301301         return
    302 c
    303 c-----------------------------------------------------------------------
    304 c on sort les champs de "convergence" pour l instant initial 'in'
    305 c ceci se passe au pas temps itap=0 de la physique
    306 c-----------------------------------------------------------------------
    307         entry get_uvd2(itap,dtime,file_forctl,file_fordat,
    308      .           ht,hq,hw,hu,hv,hThTurb,hqTurb,ts,
    309      .           imp_fcg,ts_fcg,Tp_fcg,Turb_fcg)
     302!
     303!-----------------------------------------------------------------------
     304! on sort les champs de "convergence" pour l instant initial 'in'
     305! ceci se passe au pas temps itap=0 de la physique
     306!-----------------------------------------------------------------------
     307        entry get_uvd2(itap,dtime,file_forctl,file_fordat,                  &
     308     &           ht,hq,hw,hu,hv,hThTurb,hqTurb,ts,                          &
     309     &           imp_fcg,ts_fcg,Tp_fcg,Turb_fcg)
    310310             print*,'le pas itap est:',itap
    311 c
    312 c===================================================================
    313 c
     311!
     312!===================================================================
     313!
    314314       write(*,'(a)') 'OPEN '//file_forctl
    315315       open(97,FILE=file_forctl,FORM='FORMATTED')
    316 c
    317 c------------------
     316!
     317!------------------
    318318      do i=1,1000
    319319      read(97,1000,end=999) string
     
    322322      enddo
    323323 50   backspace(97)
    324 c-------------------------------------------------------------------
    325 c   *** on lit le pas de temps dans le fichier de donnees ***
    326 c   *** "forcing.ctl" et pasmax                           ***
    327 c-------------------------------------------------------------------
     324!-------------------------------------------------------------------
     325!   *** on lit le pas de temps dans le fichier de donnees ***
     326!   *** "forcing.ctl" et pasmax                           ***
     327!-------------------------------------------------------------------
    328328      read(97,2000) aaa
    329329 2000  format (a80)
     
    344344         print*,'pasmax est',pasmax
    345345      CLOSE(97)
    346 c------------------------------------------------------------------
    347 c *** on lit le pas de temps initial de la simulation ***
    348 c------------------------------------------------------------------
     346!------------------------------------------------------------------
     347! *** on lit le pas de temps initial de la simulation ***
     348!------------------------------------------------------------------
    349349                  in=itap
    350 cc                  pasprev=in
    351 cc                  time0=dt*(pasprev-1)
     350!c                  pasprev=in
     351!c                  time0=dt*(pasprev-1)
    352352                  pasprev=in-1
    353353                  time0=dt*pasprev
    354 C
     354!
    355355          close(98)
    356 c
     356!
    357357      write(*,'(a)') 'OPEN '//file_fordat
    358       open(99,FILE=file_fordat,FORM='UNFORMATTED',
    359      .          ACCESS='DIRECT',RECL=8)
     358      open(99,FILE=file_fordat,FORM='UNFORMATTED',                          &
     359     &          ACCESS='DIRECT',RECL=8)
    360360          icomp1 = nblvlm*4
    361361          IF (ts_fcg) icomp1 = icomp1 + 1
     
    363363          IF (Turb_fcg) icomp1 = icomp1 + nblvlm*2
    364364          icompt = icomp1*(in-1)
    365           call rdgrads(99,icompt,nblvlm,z,ht_mes,hq_mes,hw_mes
    366      .                   ,hu_mes,hv_mes,hthturb_mes,hqturb_mes
    367      .                   ,ts_fcg,ts_subr,imp_fcg,Turb_fcg)
     365          call rdgrads(99,icompt,nblvlm,z,ht_mes,hq_mes,hw_mes              &
     366     &                   ,hu_mes,hv_mes,hthturb_mes,hqturb_mes              &
     367     &                   ,ts_fcg,ts_subr,imp_fcg,Turb_fcg)
    368368          print *, 'get_uvd : rdgrads ->'
    369369          print *, tp_fcg
    370 c
    371 c following commented out because we have temperature already in ARM case
    372 c   (otherwise this is the potential temperature )
    373 c------------------------------------------------------------------------
     370!
     371! following commented out because we have temperature already in ARM case
     372!   (otherwise this is the potential temperature )
     373!------------------------------------------------------------------------
    374374               if(Tp_fcg) then
    375375          do i = 1,nblvlm
     
    389389                 print*,'hqTurb ',     (hqTurb_mes(i),i=1,nblvlm)
    390390              endif ! Turb_fcg
    391 c----------------------------------------------------------------------
    392 c on a obtenu des champs initiaux sur les niveaux du meso_NH
    393 c on interpole sur les niveaux du gcm(niveau pression bien sur!)
    394 c-----------------------------------------------------------------------
     391!----------------------------------------------------------------------
     392! on a obtenu des champs initiaux sur les niveaux du meso_NH
     393! on interpole sur les niveaux du gcm(niveau pression bien sur!)
     394!-----------------------------------------------------------------------
    395395            do k=1,klev
    396396             if (JM(k) .eq. 0) then
    397 cFKC bug? ne faut il pas convertir tsol en tendance ????
    398 cRT bug taken care of by removing the stuff
     397!FKC bug? ne faut il pas convertir tsol en tendance ????
     398!RT bug taken care of by removing the stuff
    399399           htaft(k)=              ht_mes(jm(k)+1)
    400400           hqaft(k)=              hq_mes(jm(k)+1)
     
    417417               endif ! imp_fcg
    418418               if(Turb_fcg) then
    419            hThTurbaft(k)=coef1(k)*hThTurb_mes(jm(k))
    420      $                  +coef2(k)*hThTurb_mes(jm(k)+1)
    421            hqTurbaft(k) =coef1(k)*hqTurb_mes(jm(k))
    422      $                  +coef2(k)*hqTurb_mes(jm(k)+1)
     419           hThTurbaft(k)=coef1(k)*hThTurb_mes(jm(k))                        &
     420     &                  +coef2(k)*hThTurb_mes(jm(k)+1)
     421           hqTurbaft(k) =coef1(k)*hqTurb_mes(jm(k))                         &
     422     &                  +coef2(k)*hqTurb_mes(jm(k)+1)
    423423               endif ! Turb_fcg
    424424             endif ! JM(k) .eq. 0
    425425            enddo
    426426            tsaft = ts_subr
    427 c valeurs initiales des champs de convergence
     427! valeurs initiales des champs de convergence
    428428          do k=1,klev
    429429             ht(k)=htaft(k)
     
    442442          close(99)
    443443          close(98)
    444 c
    445 c-------------------------------------------------------------------
    446 c
    447 c
     444!
     445!-------------------------------------------------------------------
     446!
     447!
    448448 100      IF (Ts_fcg) Ts = Ts_subr
    449449        return
    450 c
     450!
    451451999     continue
    452452        stop 'erreur lecture, file forcing.ctl'
    453453        end
    454454
    455       SUBROUTINE advect_tvl(dtime,zt,zq,vu_f,vv_f,t_f,q_f
    456      :                     ,d_t_adv,d_q_adv)
     455      SUBROUTINE advect_tvl(dtime,zt,zq,vu_f,vv_f,t_f,q_f                   &
     456     &                     ,d_t_adv,d_q_adv)
    457457      use dimphy
    458458      implicit none
    459459
    460460#include "dimensions.h"
    461 ccccc#include "dimphy.h"
     461!cccc#include "dimphy.h"
    462462
    463463      integer k
    464464      real dtime, fact, du, dv, cx, cy, alx, aly
    465465      real zt(klev), zq(klev,3)
    466      :   , vu_f(klev), vv_f(klev), t_f(klev), q_f(klev,3)
     466      real vu_f(klev), vv_f(klev), t_f(klev), q_f(klev,3)
    467467
    468468      real d_t_adv(klev), d_q_adv(klev,3)
    469469
    470 c Velocity of moving cell
     470! Velocity of moving cell
    471471      data cx,cy /12., -2./
    472472
    473 c Dimensions of moving cell
    474       data alx,aly /100 000.,150 000./
     473! Dimensions of moving cell
     474      data alx,aly /100000.,150000./
    475475
    476476      do k = 1, klev
     
    490490      implicit none
    491491
    492 ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
    493 c cette routine remplit les COMMON com1_phys_gcss et com2_phys_gcss.h
    494 cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
     492!cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
     493! cette routine remplit les COMMON com1_phys_gcss et com2_phys_gcss.h
     494!ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
    495495
    496496      INTEGER klev !nombre de niveau de pression du GCM
     
    514514      klev = klevgcm
    515515
    516 c---------------------------------------------------------------------
    517 c pression au milieu des couches du gcm dans la physiq
    518 c (SB: remplace le call conv_lipress_gcm(playgcm) )
    519 c---------------------------------------------------------------------
     516!---------------------------------------------------------------------
     517! pression au milieu des couches du gcm dans la physiq
     518! (SB: remplace le call conv_lipress_gcm(playgcm) )
     519!---------------------------------------------------------------------
    520520
    521521       do k = 1, klev
     
    524524       enddo
    525525
    526 c----------------------------------------------------------------------
    527 c lecture du descripteur des donnees Meso-NH (forcing.ctl):
    528 c  -> nb niveaux du meso.NH (nblvlm) + pressions meso.NH
    529 c (on remplit le COMMON com2_phys_gcss)
    530 c----------------------------------------------------------------------
     526!----------------------------------------------------------------------
     527! lecture du descripteur des donnees Meso-NH (forcing.ctl):
     528!  -> nb niveaux du meso.NH (nblvlm) + pressions meso.NH
     529! (on remplit le COMMON com2_phys_gcss)
     530!----------------------------------------------------------------------
    531531
    532532      call mesolupbis(file_forctl)
     
    534534      print*,'la valeur de nblvlm est:',nblvlm
    535535
    536 c----------------------------------------------------------------------
    537 c etude de la correspondance entre les niveaux meso.NH et GCM;
    538 c calcul des coefficients d interpolation coef1 et coef2
    539 c (on remplit le COMMON com1_phys_gcss)
    540 c----------------------------------------------------------------------
     536!----------------------------------------------------------------------
     537! etude de la correspondance entre les niveaux meso.NH et GCM;
     538! calcul des coefficients d interpolation coef1 et coef2
     539! (on remplit le COMMON com1_phys_gcss)
     540!----------------------------------------------------------------------
    541541
    542542      call corresbis(psolgcm)
    543543
    544 c---------------------------------------------------------
    545 c TEST sur le remplissage de com1_phys_gcss et com2_phys_gcss:
    546 c---------------------------------------------------------
     544!---------------------------------------------------------
     545! TEST sur le remplissage de com1_phys_gcss et com2_phys_gcss:
     546!---------------------------------------------------------
    547547 
    548548      write(*,*) ' '
     
    562562      SUBROUTINE mesolupbis(file_forctl)
    563563      implicit none
    564 c
    565 cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
    566 c
    567 c Lecture descripteur des donnees MESO-NH (forcing.ctl):
    568 c -------------------------------------------------------
    569 c
    570 c     Cette subroutine lit dans le fichier de controle "essai.ctl"
    571 c     et affiche le nombre de niveaux du Meso-NH ainsi que les valeurs
    572 c     des pressions en milieu de couche du Meso-NH (en Pa puis en hPa).
    573 cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
    574 c
     564!
     565!ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
     566!
     567! Lecture descripteur des donnees MESO-NH (forcing.ctl):
     568! -------------------------------------------------------
     569!
     570!     Cette subroutine lit dans le fichier de controle "essai.ctl"
     571!     et affiche le nombre de niveaux du Meso-NH ainsi que les valeurs
     572!     des pressions en milieu de couche du Meso-NH (en Pa puis en hPa).
     573!ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
     574!
    575575      INTEGER nblvlm !nombre de niveau de pression du mesoNH
    576576      REAL playm(100)  !pression en Pa milieu de chaque couche Meso-NH
     
    588588      lu=9
    589589      open(lu,file=file_forctl,form='formatted')
    590 c
     590!
    591591      do i=1,1000
    592592      read(lu,1000,end=999) a
    593593      if (a .eq. 'ZDEF') go to 100
    594594      enddo
    595 c
     595!
    596596 100  backspace(lu)
    597597      print*,'  DESCRIPTION DES 2 MODELES : '
    598598      print*,' '
    599 c
     599!
    600600      read(lu,2000) aaa
    601601 2000  format (a80)
     
    604604         read(anblvl,*) nblvlm
    605605
    606 c
     606!
    607607      print*,'nbre de niveaux de pression Meso-NH :',nblvlm
    608608      print*,' '
    609609      print*,'pression en Pa de chaque couche du meso-NH :'
    610 c
     610!
    611611      read(lu,*) (playm(mlz),mlz=1,nblvlm)
    612 c      Si la pression est en HPa, la multiplier par 100
     612!      Si la pression est en HPa, la multiplier par 100
    613613      if (playm(1) .lt. 10000.) then
    614614        do mlz = 1,nblvlm
     
    617617      endif
    618618      print*,(playm(mlz),mlz=1,nblvlm)
    619 c
     619!
    620620 1000 format (a4)
    621621 1001 format(5x,i2)
    622 c
     622!
    623623      print*,' '
    624624      do mlzh=1,nblvlm
    625625      hplaym(mlzh)=playm(mlzh)/100.
    626626      enddo
    627 c
     627!
    628628      print*,'pression en hPa de chaque couche du meso-NH: '
    629629      print*,(hplaym(mlzh),mlzh=1,nblvlm)
    630 c
     630!
    631631      close (lu)
    632632      return
    633 c
     633!
    634634 999  stop 'erreur lecture des niveaux pression des donnees'
    635635      end
    636636
    637       SUBROUTINE rdgrads(itape,icount,nl,z,ht,hq,hw,hu,hv,hthtur,hqtur,
    638      :  ts_fcg,ts,imp_fcg,Turb_fcg)
     637      SUBROUTINE rdgrads(itape,icount,nl,z,ht,hq,hw,hu,hv,hthtur,hqtur,     &
     638     &  ts_fcg,ts,imp_fcg,Turb_fcg)
    639639      IMPLICIT none
    640640      INTEGER itape,icount,icomp, nl
     
    642642      real hthtur(nl),hqtur(nl)
    643643      real ts
    644 c
     644!
    645645      INTEGER k
    646 c
     646!
    647647      LOGICAL imp_fcg,ts_fcg,Turb_fcg
    648 c
     648!
    649649      icomp = icount
    650 c
    651 c
     650!
     651!
    652652         do k=1,nl
    653653            icomp=icomp+1
     
    664664            read(itape,rec=icomp)hQ(k)
    665665         enddo
    666 c
     666!
    667667             if(turb_fcg) then
    668668         do k=1,nl
     
    676676             endif
    677677         print *,' apres lecture hthtur, hqtur'
    678 c
     678!
    679679          if(imp_fcg) then
    680680
     
    689689
    690690          endif
    691 c
     691!
    692692         do k=1,nl
    693693            icomp=icomp+1
    694694            read(itape,rec=icomp)hw(k)
    695695         enddo
    696 c
     696!
    697697              if(ts_fcg) then
    698698         icomp=icomp+1
    699699         read(itape,rec=icomp)ts
    700700              endif
    701 c
     701!
    702702      print *,' rdgrads ->'
    703703
     
    708708      implicit none
    709709
    710 ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
    711 c Cette subroutine calcule et affiche les valeurs des coefficients
    712 c d interpolation qui serviront dans la formule d interpolation elle-
    713 c meme.
    714 cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
     710!cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
     711! Cette subroutine calcule et affiche les valeurs des coefficients
     712! d interpolation qui serviront dans la formule d interpolation elle-
     713! meme.
     714!ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
    715715
    716716      INTEGER klev    !nombre de niveau de pression du GCM
     
    737737          mlz = 0
    738738          JM(1) = mlz
    739           coef1(1)=(playm(mlz+1)-val)
    740      *             /(playm(mlz+1)-psol)
    741           coef2(1)=(val-psol)
    742      *             /(playm(mlz+1)-psol)
     739          coef1(1)=(playm(mlz+1)-val)/(playm(mlz+1)-psol)
     740          coef2(1)=(val-psol)/(playm(mlz+1)-psol)
    743741       else if (val .gt. playm(nblvlm)) then
    744742         do mlz=1,nblvlm
    745           if (     val .le. playm(mlz)
    746      *       .and. val .gt. playm(mlz+1))then
     743          if (     val .le. playm(mlz).and. val .gt. playm(mlz+1))then
    747744           JM(k)=mlz
    748            coef1(k)=(playm(mlz+1)-val)
    749      *              /(playm(mlz+1)-playm(mlz))
    750            coef2(k)=(val-playm(mlz))
    751      *              /(playm(mlz+1)-playm(mlz))
     745           coef1(k)=(playm(mlz+1)-val)/(playm(mlz+1)-playm(mlz))
     746           coef2(k)=(val-playm(mlz))/(playm(mlz+1)-playm(mlz))
    752747          endif
    753748         enddo
     
    758753       endif
    759754      enddo
    760 c
    761 cc      if (play(klev) .le. playm(nblvlm)) then
    762 cc         mlz=nblvlm-1
    763 cc         JM(klev)=mlz
    764 cc         coef1(klev)=(playm(mlz+1)-val)
    765 cc     *            /(playm(mlz+1)-playm(mlz))
    766 cc         coef2(klev)=(val-playm(mlz))
    767 cc     *            /(playm(mlz+1)-playm(mlz))
    768 cc      endif
    769 c
     755!
     756!c      if (play(klev) .le. playm(nblvlm)) then
     757!c         mlz=nblvlm-1
     758!c         JM(klev)=mlz
     759!c         coef1(klev)=(playm(mlz+1)-val)
     760!c     *            /(playm(mlz+1)-playm(mlz))
     761!c         coef2(klev)=(val-playm(mlz))
     762!c     *            /(playm(mlz+1)-playm(mlz))
     763!c      endif
     764!
    770765      print*,' '
    771766      print*,'         INTERPOLATION  : '
     
    776771      print*,(JM(k),k=1,klev)
    777772      print*,' '
    778       print*,'valeurs du premier coef d"interpolation pour les 9 niveaux
    779      *: '
     773      print*,'vals du premier coef d"interpolation pour les 9 niveaux: '
    780774      print*,(coef1(k),k=1,klev)
    781775      print*,' '
    782       print*,'valeurs du deuxieme coef d"interpolation pour les 9 niveau
    783      *x: '
     776      print*,'valeurs du deuxieme coef d"interpolation pour les 9 niveaux:'
    784777      print*,(coef2(k),k=1,klev)
    785 c
     778!
    786779      return
    787780      end
    788781      SUBROUTINE GETSCH(STR,DEL,TRM,NTH,SST,NCH)
    789 C***************************************************************
    790 C*                                                             *
    791 C*                                                             *
    792 C* GETSCH                                                      *
    793 C*                                                             *
    794 C*                                                             *
    795 C* modified by :                                               *
    796 C***************************************************************
    797 C*   Return in SST the character string found between the NTH-1 and NTH
    798 C*   occurence of the delimiter 'DEL' but before the terminator 'TRM' in
    799 C*   the input string 'STR'. If TRM=DEL then STR is considered unlimited.
    800 C*   NCH=Length of the string returned in SST or =-1 if NTH is <1 or if
    801 C*   NTH is greater than the number of delimiters in STR.
     782!***************************************************************
     783!*                                                             *
     784!*                                                             *
     785!* GETSCH                                                      *
     786!*                                                             *
     787!*                                                             *
     788!* modified by :                                               *
     789!***************************************************************
     790!*   Return in SST the character string found between the NTH-1 and NTH
     791!*   occurence of the delimiter 'DEL' but before the terminator 'TRM' in
     792!*   the input string 'STR'. If TRM=DEL then STR is considered unlimited.
     793!*   NCH=Length of the string returned in SST or =-1 if NTH is <1 or if
     794!*   NTH is greater than the number of delimiters in STR.
    802795      IMPLICIT INTEGER (A-Z)
    803796      CHARACTER STR*(*),DEL*1,TRM*1,SST*(*)
     
    811804          IF(LENGTH.LT.0) LENGTH=LEN(STR)
    812805        ENDIF
    813 C*     Find beginning and end of the NTH DEL-limited substring in STR
     806!*     Find beginning and end of the NTH DEL-limited substring in STR
    814807        END=-1
    815808        DO 1,N=1,NTH
     
    818811        END=BEG+INDEX(STR(BEG:LENGTH),DEL)-2
    819812        IF(END.EQ.BEG-2) END=LENGTH
    820 C*        PRINT *,'NTH,LENGTH,N,BEG,END=',NTH,LENGTH,N,BEG,END
     813!*        PRINT *,'NTH,LENGTH,N,BEG,END=',NTH,LENGTH,N,BEG,END
    821814    1   CONTINUE
    822815        NCH=END-BEG+1
     
    825818      END
    826819      CHARACTER*(*) FUNCTION SPACES(STR,NSPACE)
    827 C
    828 C CERN PROGLIB# M433    SPACES          .VERSION KERNFOR  4.14  860211
    829 C ORIG.  6/05/86 M.GOOSSENS/DD
    830 C
    831 C-    The function value SPACES returns the character string STR with
    832 C-    leading blanks removed and each occurence of one or more blanks
    833 C-    replaced by NSPACE blanks inside the string STR
    834 C
     820!
     821! CERN PROGLIB# M433    SPACES          .VERSION KERNFOR  4.14  860211
     822! ORIG.  6/05/86 M.GOOSSENS/DD
     823!
     824!-    The function value SPACES returns the character string STR with
     825!-    leading blanks removed and each occurence of one or more blanks
     826!-    replaced by NSPACE blanks inside the string STR
     827!
    835828      CHARACTER*(*) STR
    836 C
     829!
    837830      LENSPA = LEN(SPACES)
    838831      SPACES = ' '
     
    857850  999 END
    858851      FUNCTION INDEXC(STR,SSTR)
    859 C
    860 C CERN PROGLIB# M433    INDEXC          .VERSION KERNFOR  4.14  860211
    861 C ORIG. 26/03/86 M.GOOSSENS/DD
    862 C
    863 C-    Find the leftmost position where substring SSTR does not match
    864 C-    string STR scanning forward
    865 C
     852!
     853! CERN PROGLIB# M433    INDEXC          .VERSION KERNFOR  4.14  860211
     854! ORIG. 26/03/86 M.GOOSSENS/DD
     855!
     856!-    Find the leftmost position where substring SSTR does not match
     857!-    string STR scanning forward
     858!
    866859      CHARACTER*(*) STR,SSTR
    867 C
     860!
    868861      LENS   = LEN(STR)
    869862      LENSS  = LEN(SSTR)
    870 C
     863!
    871864      DO 10 I=1,LENS-LENSS+1
    872865          IF (STR(I:I+LENSS-1).NE.SSTR) THEN
     
    876869   10 CONTINUE
    877870      INDEXC = 0
    878 C
     871!
    879872  999 END
  • LMDZ5/trunk/libf/phylmd/compar1d.h

    r2017 r2019  
    2727      logical :: ok_old_disvert
    2828
    29       common/com_par1d/
     29      common/com_par1d/                                                 &
    3030     & nat_surf,tsurf,rugos,                                            &
    3131     & qsol,qsurf,psurf,zsurf,albedo,time,time_ini,xlat,xlon,airefi,    &
    3232     & wtsurf,wqsurf,restart_runoff,xagesno,qsolinp,zpicinp,            &
    33      & forcing_type,
     33     & forcing_type,                                                    &
    3434     & restart,ok_old_disvert
    3535
  • LMDZ5/trunk/libf/phylmd/fcg_gcssold.h

    r2017 r2019  
    22! $Id: fcg_gcssold.h 2010-08-10 17:02:56Z lahellec $
    33!
    4       logical :: imp_fcg_gcssold,ts_fcg_gcssold,Tp_fcg_gcssold,
    5      $ Tp_ini_gcssold,
    6      $ xTurb_fcg_gcssold
     4      logical :: imp_fcg_gcssold,ts_fcg_gcssold,Tp_fcg_gcssold
     5      logical :: Tp_ini_gcssold
     6      logical :: xTurb_fcg_gcssold
    77
    8       common /fcg_gcssold/imp_fcg_gcssold,ts_fcg_gcssold,Tp_fcg_gcssold,
    9      $ Tp_ini_gcssold,
    10      $ xTurb_fcg_gcssold
     8      common /fcg_gcssold/imp_fcg_gcssold,ts_fcg_gcssold,Tp_fcg_gcssold,        &
     9     & Tp_ini_gcssold,                                                          &
     10     & xTurb_fcg_gcssold
    1111
    1212!$OMP THREADPRIVATE(/fcg_gcssold/)
  • LMDZ5/trunk/libf/phylmd/lmdz1d.F90

    r2017 r2019  
    44#include "../dyn3d_common/disvert.F90"
    55
    6       CALL lmdz1d
    7 
    8       END
     6
     7      PROGRAM lmdz1d
     8
     9      USE ioipsl, only: ju2ymds, ymds2ju, ioconf_calendar
     10      use phys_state_var_mod
     11      use comgeomphy
     12      use dimphy
     13      use surface_data, only : type_ocean,ok_veget
     14      use pbl_surface_mod, only : ftsoil, pbl_surface_init,                     &
     15     &                            pbl_surface_final
     16      use fonte_neige_mod, only : fonte_neige_init, fonte_neige_final
     17
     18      use infotrac ! new
     19      use control_mod
     20      USE indice_sol_mod
     21      USE phyaqua_mod
     22
     23      implicit none
     24#include "dimensions.h"
     25#include "YOMCST.h"
     26#include "temps.h"
     27!!#include "control.h"
     28#include "iniprint.h"
     29#include "clesphys.h"
     30#include "dimsoil.h"
     31!#include "indicesol.h"
     32
     33#include "comvert.h"
     34#include "compar1d.h"
     35#include "flux_arp.h"
     36#include "tsoilnudge.h"
     37#include "fcg_gcssold.h"
     38!!!#include "fbforcing.h"
     39
     40!=====================================================================
     41! DECLARATIONS
     42!=====================================================================
     43
     44!---------------------------------------------------------------------
     45!  Externals
     46!---------------------------------------------------------------------
     47      external fq_sat
     48      real fq_sat
     49
     50!---------------------------------------------------------------------
     51!  Arguments d' initialisations de la physique (USER DEFINE)
     52!---------------------------------------------------------------------
     53
     54      integer, parameter :: ngrid=1
     55      real :: zcufi    = 1.
     56      real :: zcvfi    = 1.
     57
     58!-      real :: nat_surf
     59!-      logical :: ok_flux_surf
     60!-      real :: fsens
     61!-      real :: flat
     62!-      real :: tsurf
     63!-      real :: rugos
     64!-      real :: qsol(1:2)
     65!-      real :: qsurf
     66!-      real :: psurf
     67!-      real :: zsurf
     68!-      real :: albedo
     69!-
     70!-      real :: time     = 0.
     71!-      real :: time_ini
     72!-      real :: xlat
     73!-      real :: xlon
     74!-      real :: wtsurf
     75!-      real :: wqsurf
     76!-      real :: restart_runoff
     77!-      real :: xagesno
     78!-      real :: qsolinp
     79!-      real :: zpicinp
     80!-
     81      real :: fnday
     82      real :: day, daytime
     83      real :: day1
     84      real :: heure
     85      integer :: jour
     86      integer :: mois
     87      integer :: an
     88 
     89!---------------------------------------------------------------------
     90!  Declarations related to forcing and initial profiles
     91!---------------------------------------------------------------------
     92
     93        integer :: kmax = llm
     94        integer llm700,nq1,nq2
     95        INTEGER, PARAMETER :: nlev_max=1000, nqmx=1000
     96        real timestep, frac
     97        real height(nlev_max),tttprof(nlev_max),qtprof(nlev_max)
     98        real  uprof(nlev_max),vprof(nlev_max),e12prof(nlev_max)
     99        real  ugprof(nlev_max),vgprof(nlev_max),wfls(nlev_max)
     100        real  dqtdxls(nlev_max),dqtdyls(nlev_max)
     101        real  dqtdtls(nlev_max),thlpcar(nlev_max)
     102        real  qprof(nlev_max,nqmx)
     103
     104!        integer :: forcing_type
     105        logical :: forcing_les     = .false.
     106        logical :: forcing_armcu   = .false.
     107        logical :: forcing_rico    = .false.
     108        logical :: forcing_radconv = .false.
     109        logical :: forcing_toga    = .false.
     110        logical :: forcing_twpice  = .false.
     111        logical :: forcing_amma    = .false.
     112        logical :: forcing_GCM2SCM = .false.
     113        logical :: forcing_GCSSold = .false.
     114        logical :: forcing_sandu   = .false.
     115        logical :: forcing_astex   = .false.
     116        logical :: forcing_fire    = .false.
     117        integer :: type_ts_forcing ! 0 = SST constant; 1 = SST read from a file
     118!                                                            (cf read_tsurf1d.F)
     119
     120!vertical advection computation
     121!       real d_t_z(llm), d_q_z(llm)
     122!       real d_t_dyn_z(llm), d_q_dyn_z(llm)
     123!       real zz(llm)
     124!       real zfact
     125
     126!flag forcings
     127        logical :: nudge_wind=.true.
     128        logical :: nudge_thermo=.false.
     129        logical :: cptadvw=.true.
     130!=====================================================================
     131! DECLARATIONS FOR EACH CASE
     132!=====================================================================
     133!
     134#include "1D_decl_cases.h"
     135!
     136!---------------------------------------------------------------------
     137!  Declarations related to vertical discretization:
     138!---------------------------------------------------------------------
     139      real :: pzero=1.e5
     140      real :: play (llm),zlay (llm),sig_s(llm),plev(llm+1)
     141      real :: playd(llm),zlayd(llm),ap_amma(llm+1),bp_amma(llm+1),poub
     142
     143!---------------------------------------------------------------------
     144!  Declarations related to variables
     145!---------------------------------------------------------------------
     146
     147      real :: phi(llm)
     148      real :: teta(llm),tetal(llm),temp(llm),u(llm),v(llm),w(llm)
     149      real :: rlat_rad(1),rlon_rad(1)
     150      real :: omega(llm+1),omega2(llm),rho(llm+1)
     151      real :: ug(llm),vg(llm),fcoriolis
     152      real :: sfdt, cfdt
     153      real :: du_phys(llm),dv_phys(llm),dt_phys(llm)
     154      real :: dt_dyn(llm)
     155      real :: dt_cooling(llm),d_th_adv(llm)
     156      real :: alpha
     157      real :: ttt
     158
     159      REAL, ALLOCATABLE, DIMENSION(:,:):: q
     160      REAL, ALLOCATABLE, DIMENSION(:,:):: dq
     161      REAL, ALLOCATABLE, DIMENSION(:,:):: dq_dyn
     162      REAL, ALLOCATABLE, DIMENSION(:,:):: d_q_adv
     163!     REAL, ALLOCATABLE, DIMENSION(:):: d_th_adv
     164
     165!---------------------------------------------------------------------
     166!  Initialization of surface variables
     167!---------------------------------------------------------------------
     168      real :: run_off_lic_0(1)
     169      real :: fder(1),snsrf(1,nbsrf),qsurfsrf(1,nbsrf)
     170      real :: evap(1,nbsrf),frugs(1,nbsrf)
     171      real :: tsoil(1,nsoilmx,nbsrf)
     172      real :: agesno(1,nbsrf)
     173
     174!---------------------------------------------------------------------
     175!  Call to phyredem
     176!---------------------------------------------------------------------
     177      logical :: ok_writedem =.true.
     178     
     179!---------------------------------------------------------------------
     180!  Call to physiq
     181!---------------------------------------------------------------------
     182      integer, parameter :: longcles=20
     183      logical :: firstcall=.true.
     184      logical :: lastcall=.false.
     185      real :: phis    = 0.0
     186      real :: clesphy0(longcles) = 0.0
     187      real :: dpsrf
     188
     189!---------------------------------------------------------------------
     190!  Initializations of boundary conditions
     191!---------------------------------------------------------------------
     192      integer, parameter :: yd = 360
     193      real :: phy_nat (yd) = 0.0 ! 0=ocean libre,1=land,2=glacier,3=banquise
     194      real :: phy_alb (yd)  ! Albedo land only (old value condsurf_jyg=0.3)
     195      real :: phy_sst (yd)  ! SST (will not be used; cf read_tsurf1d.F)
     196      real :: phy_bil (yd) = 1.0 ! Ne sert que pour les slab_ocean
     197      real :: phy_rug (yd) ! Longueur rugosite utilisee sur land only
     198      real :: phy_ice (yd) = 0.0 ! Fraction de glace
     199      real :: phy_fter(yd) = 0.0 ! Fraction de terre
     200      real :: phy_foce(yd) = 0.0 ! Fraction de ocean
     201      real :: phy_fsic(yd) = 0.0 ! Fraction de glace
     202      real :: phy_flic(yd) = 0.0 ! Fraction de glace
     203
     204!---------------------------------------------------------------------
     205!  Fichiers et d'autres variables
     206!---------------------------------------------------------------------
     207      integer :: k,l,i,it=1,mxcalc
     208      integer jjmp1
     209      parameter (jjmp1=jjm+1-1/jjm)
     210      INTEGER nbteta
     211      PARAMETER(nbteta=3)
     212      REAL dudyn(iim+1,jjmp1,llm)
     213      REAL PVteta(1,nbteta)
     214      INTEGER read_climoz
     215!Al1
     216      integer ecrit_slab_oc !1=ecrit,-1=lit,0=no file
     217      data ecrit_slab_oc/-1/
     218
     219!=====================================================================
     220! INITIALIZATIONS
     221!=====================================================================
     222! Initialization of Common turb_forcing
     223       dtime_frcg = 0.
     224       Turb_fcg_gcssold=.false.
     225       hthturb_gcssold = 0.
     226       hqturb_gcssold = 0.
     227
     228!---------------------------------------------------------------------
     229! OPTIONS OF THE 1D SIMULATION (lmdz1d.def => unicol.def)
     230!---------------------------------------------------------------------
     231!Al1
     232        call conf_unicol
     233!Al1 moves this gcssold var from common fcg_gcssold to
     234        Turb_fcg_gcssold = xTurb_fcg_gcssold
     235! --------------------------------------------------------------------
     236        close(1)
     237!Al1
     238        write(*,*) 'lmdz1d.def lu => unicol.def'
     239
     240! forcing_type defines the way the SCM is forced:
     241!forcing_type = 0 ==> forcing_les = .true.
     242!             initial profiles from file prof.inp.001
     243!             no forcing by LS convergence ;
     244!             surface temperature imposed ;
     245!             radiative cooling may be imposed (iflag_radia=0 in physiq.def)
     246!forcing_type = 1 ==> forcing_radconv = .true.
     247!             idem forcing_type = 0, but the imposed radiative cooling
     248!             is set to 0 (hence, if iflag_radia=0 in physiq.def,
     249!             then there is no radiative cooling at all)
     250!forcing_type = 2 ==> forcing_toga = .true.
     251!             initial profiles from TOGA-COARE IFA files
     252!             LS convergence and SST imposed from TOGA-COARE IFA files
     253!forcing_type = 3 ==> forcing_GCM2SCM = .true.
     254!             initial profiles from the GCM output
     255!             LS convergence imposed from the GCM output
     256!forcing_type = 4 ==> forcing_twpice = .true.
     257!             initial profiles from TWP-ICE cdf file
     258!             LS convergence, omega and SST imposed from TWP-ICE files
     259!forcing_type = 5 ==> forcing_rico = .true.
     260!             initial profiles from RICO files
     261!             LS convergence imposed from RICO files
     262!forcing_type = 6 ==> forcing_amma = .true.
     263!             initial profiles from AMMA nc file
     264!             LS convergence, omega and surface fluxes imposed from AMMA file 
     265!forcing_type = 40 ==> forcing_GCSSold = .true.
     266!             initial profile from GCSS file
     267!             LS convergence imposed from GCSS file
     268!forcing_type = 50 ==> forcing_fire = .true.
     269!             forcing from fire.nc
     270!forcing_type = 59 ==> forcing_sandu = .true.
     271!             initial profiles from sanduref file: see prof.inp.001
     272!             SST varying with time and divergence constante: see ifa_sanduref.txt file
     273!             Radiation has to be computed interactively
     274!forcing_type = 60 ==> forcing_astex = .true.
     275!             initial profiles from file: see prof.inp.001
     276!             SST,divergence,ug,vg,ufa,vfa varying with time : see ifa_astex.txt file
     277!             Radiation has to be computed interactively
     278!forcing_type = 61 ==> forcing_armcu = .true.
     279!             initial profiles from file: see prof.inp.001
     280!             sensible and latent heat flux imposed: see ifa_arm_cu_1.txt
     281!             large scale advective forcing & radiative tendencies applied below 1000m: see ifa_arm_cu_2.txt
     282!             use geostrophic wind ug=10m/s vg=0m/s. Duration of the case 53100s
     283!             Radiation to be switched off
     284!
     285      if (forcing_type .eq.0) THEN
     286       forcing_les = .true.
     287      elseif (forcing_type .eq.1) THEN
     288       forcing_radconv = .true.
     289      elseif (forcing_type .eq.2) THEN
     290       forcing_toga    = .true.
     291      elseif (forcing_type .eq.3) THEN
     292       forcing_GCM2SCM = .true.
     293      elseif (forcing_type .eq.4) THEN
     294       forcing_twpice = .true.
     295      elseif (forcing_type .eq.5) THEN
     296       forcing_rico = .true.
     297      elseif (forcing_type .eq.6) THEN
     298       forcing_amma = .true.
     299      elseif (forcing_type .eq.40) THEN
     300       forcing_GCSSold = .true.
     301      elseif (forcing_type .eq.50) THEN
     302       forcing_fire = .true.
     303      elseif (forcing_type .eq.59) THEN
     304       forcing_sandu   = .true.
     305      elseif (forcing_type .eq.60) THEN
     306       forcing_astex   = .true.
     307      elseif (forcing_type .eq.61) THEN
     308       forcing_armcu = .true.
     309       IF(llm.NE.19.AND.llm.NE.40) stop 'Erreur nombre de niveaux !!'
     310      else
     311       write (*,*) 'ERROR : unknown forcing_type ', forcing_type
     312       stop 'Forcing_type should be 0,1,2,3,4,5,6 or 40,59,60,61'
     313      ENDIF
     314      print*,"forcing type=",forcing_type
     315
     316! if type_ts_forcing=0, the surface temp of 1D simulation is constant in time
     317! (specified by tsurf in lmdz1d.def); if type_ts_forcing=1, the surface temperature
     318! varies in time according to a forcing (e.g. forcing_toga) and is passed to read_tsurf1d.F
     319! through the common sst_forcing.
     320
     321        type_ts_forcing = 0
     322        if (forcing_toga.or.forcing_sandu.or.forcing_astex)                 &
     323     &    type_ts_forcing = 1
     324
     325!---------------------------------------------------------------------
     326!  Definition of the run
     327!---------------------------------------------------------------------
     328
     329      call conf_gcm( 99, .TRUE. , clesphy0 )
     330!-----------------------------------------------------------------------
     331!   Choix du calendrier
     332!   -------------------
     333
     334!      calend = 'earth_365d'
     335      if (calend == 'earth_360d') then
     336        call ioconf_calendar('360d')
     337        write(*,*)'CALENDRIER CHOISI: Terrestre a 360 jours/an'
     338      else if (calend == 'earth_365d') then
     339        call ioconf_calendar('noleap')
     340        write(*,*)'CALENDRIER CHOISI: Terrestre a 365 jours/an'
     341      else if (calend == 'earth_366d') then
     342        call ioconf_calendar('all_leap')
     343        write(*,*)'CALENDRIER CHOISI: Terrestre bissextile'
     344      else if (calend == 'gregorian') then
     345        call ioconf_calendar('gregorian') ! not to be used by normal users
     346        write(*,*)'CALENDRIER CHOISI: Gregorien'
     347      else
     348        write (*,*) 'ERROR : unknown calendar ', calend
     349        stop 'calend should be 360d,earth_365d,earth_366d,gregorian'
     350      endif
     351!-----------------------------------------------------------------------
     352!
     353!c Date :
     354!      La date est supposee donnee sous la forme [annee, numero du jour dans
     355!      l annee] ; l heure est donnee dans time_ini, lu dans lmdz1d.def.
     356!      On appelle ymds2ju pour convertir [annee, jour] en [jour Julien].
     357!      Le numero du jour est dans "day". L heure est traitee separement.
     358!      La date complete est dans "daytime" (l'unite est le jour).
     359      if (nday>0) then
     360         fnday=nday
     361      else
     362         fnday=-nday/float(day_step)
     363      endif
     364
     365! Special case for arm_cu which lasts less than one day : 53100s !! (MPL 20111026)
     366      IF(forcing_type .EQ. 61) fnday=53100./86400.
     367! Special case for amma which lasts less than one day : 64800s !! (MPL 20120216)
     368      IF(forcing_type .EQ. 6) fnday=64800./86400.
     369      annee_ref = anneeref
     370      mois = 1
     371      day_ref = dayref
     372      heure = 0.
     373      itau_dyn = 0
     374      itau_phy = 0
     375      call ymds2ju(annee_ref,mois,day_ref,heure,day)
     376      day_ini = int(day)
     377      day_end = day_ini + fnday
     378
     379      IF (forcing_type .eq.2) THEN
     380! Convert the initial date of Toga-Coare to Julian day
     381      call ymds2ju                                                          &
     382     & (year_ini_toga,mth_ini_toga,day_ini_toga,heure,day_ju_ini_toga)
     383
     384      ELSEIF (forcing_type .eq.4) THEN
     385! Convert the initial date of TWPICE to Julian day
     386      call ymds2ju                                                          &
     387     & (year_ini_twpi,mth_ini_twpi,day_ini_twpi,heure_ini_twpi              &
     388     & ,day_ju_ini_twpi)
     389      ELSEIF (forcing_type .eq.6) THEN
     390! Convert the initial date of AMMA to Julian day
     391      call ymds2ju                                                          &
     392     & (year_ini_amma,mth_ini_amma,day_ini_amma,heure_ini_amma              &
     393     & ,day_ju_ini_amma)
     394
     395      ELSEIF (forcing_type .eq.59) THEN
     396! Convert the initial date of Sandu case to Julian day
     397      call ymds2ju                                                          &
     398     &   (year_ini_sandu,mth_ini_sandu,day_ini_sandu,                       &
     399     &    time_ini*3600.,day_ju_ini_sandu)
     400
     401      ELSEIF (forcing_type .eq.60) THEN
     402! Convert the initial date of Astex case to Julian day
     403      call ymds2ju                                                          &
     404     &   (year_ini_astex,mth_ini_astex,day_ini_astex,                        &
     405     &    time_ini*3600.,day_ju_ini_astex)
     406
     407      ELSEIF (forcing_type .eq.61) THEN
     408
     409! Convert the initial date of Arm_cu case to Julian day
     410      call ymds2ju                                                          &
     411     & (year_ini_armcu,mth_ini_armcu,day_ini_armcu,heure_ini_armcu          &
     412     & ,day_ju_ini_armcu)
     413      ENDIF
     414
     415      daytime = day + time_ini/24. ! 1st day and initial time of the simulation
     416! Print out the actual date of the beginning of the simulation :
     417      call ju2ymds(daytime,year_print, month_print,day_print,sec_print)
     418      print *,' Time of beginning : ',                                      &
     419     &        year_print, month_print, day_print, sec_print
     420
     421!---------------------------------------------------------------------
     422! Initialization of dimensions, geometry and initial state
     423!---------------------------------------------------------------------
     424      call init_phys_lmdz(1,1,llm,1,(/1/))
     425      call suphel
     426      call initcomgeomphy
     427      call infotrac_init
     428
     429      if (nqtot>nqmx) STOP'Augmenter nqmx dans lmdz1d.F'
     430      allocate(q(llm,nqtot)) ; q(:,:)=0.
     431      allocate(dq(llm,nqtot))
     432      allocate(dq_dyn(llm,nqtot))
     433      allocate(d_q_adv(llm,nqtot))
     434!     allocate(d_th_adv(llm))
     435
     436!
     437!   No ozone climatology need be read in this pre-initialization
     438!          (phys_state_var_init is called again in physiq)
     439      read_climoz = 0
     440!
     441      call phys_state_var_init(read_climoz)
     442
     443      if (ngrid.ne.klon) then
     444         print*,'stop in inifis'
     445         print*,'Probleme de dimensions :'
     446         print*,'ngrid = ',ngrid
     447         print*,'klon  = ',klon
     448         stop
     449      endif
     450!!!=====================================================================
     451!!! Feedback forcing values for Gateaux differentiation (al1)
     452!!!=====================================================================
     453!!! Surface Planck forcing bracketing call radiation
     454!!      surf_Planck = 0.
     455!!      surf_Conv   = 0.
     456!!      write(*,*) 'Gateaux-dif Planck,Conv:',surf_Planck,surf_Conv
     457!!! a mettre dans le lmdz1d.def ou autre
     458!!
     459!!
     460      qsol = qsolinp
     461      qsurf = fq_sat(tsurf,psurf/100.)
     462      rlat=xlat
     463      rlon=xlon
     464      day1= day_ini
     465      time=daytime-day
     466      ts_toga(1)=tsurf ! needed by read_tsurf1d.F
     467      rho(1)=psurf/(rd*tsurf*(1.+(rv/rd-1.)*qsurf))
     468
     469!
     470!! mpl et jyg le 22/08/2012 :
     471!!  pour que les cas a flux de surface imposes marchent
     472      IF(.NOT.ok_flux_surf.or.max(abs(wtsurf),abs(wqsurf))>0.) THEN
     473       fsens=-wtsurf*rcpd*rho(1)
     474       flat=-wqsurf*rlvtt*rho(1)
     475       print *,'Flux: ok_flux wtsurf wqsurf',ok_flux_surf,wtsurf,wqsurf
     476      ENDIF
     477      print*,'Flux sol ',fsens,flat
     478!!      ok_flux_surf=.false.
     479!!      fsens=-wtsurf*rcpd*rho(1)
     480!!      flat=-wqsurf*rlvtt*rho(1)
     481!!!!
     482
     483! Vertical discretization and pressure levels at half and mid levels:
     484
     485      pa   = 5e4
     486!!      preff= 1.01325e5
     487      preff = psurf
     488      IF (ok_old_disvert) THEN
     489        call disvert0(pa,preff,ap,bp,dpres,presnivs,nivsigs,nivsig)
     490        print *,'On utilise disvert0'
     491      ELSE
     492        call disvert(pa,preff,ap,bp,dpres,presnivs,nivsigs,nivsig,          &
     493     &                 scaleheight)
     494        print *,'On utilise disvert'
     495!       Nouvelle version disvert permettant d imposer ap,bp (modif L.Guez) MPL 18092012
     496!       Dans ce cas, on lit ap,bp dans le fichier hybrid.txt
     497      ENDIF
     498      sig_s=presnivs/preff
     499      plev =ap+bp*psurf
     500      play = 0.5*(plev(1:llm)+plev(2:llm+1))
     501!cc      zlay=-rd*300.*log(play/psurf)/rg ! moved after reading profiles
     502
     503      IF (forcing_type .eq. 59) THEN
     504! pour forcing_sandu, on cherche l'indice le plus proche de 700hpa#3000m
     505      write(*,*) '***********************'
     506      do l = 1, llm
     507       write(*,*) 'l,play(l),presnivs(l): ',l,play(l),presnivs(l)
     508       if (trouve_700 .and. play(l).le.70000) then
     509         llm700=l
     510         print *,'llm700,play=',llm700,play(l)/100.
     511         trouve_700= .false.
     512       endif
     513      enddo
     514      write(*,*) '***********************'
     515      ENDIF
     516
     517!
     518!=====================================================================
     519! EVENTUALLY, READ FORCING DATA :
     520!=====================================================================
     521
     522#include "1D_read_forc_cases.h"
     523
     524      if (forcing_GCM2SCM) then
     525        write (*,*) 'forcing_GCM2SCM not yet implemented'
     526        stop 'in initialization'
     527      endif ! forcing_GCM2SCM
     528
     529      print*,'mxcalc=',mxcalc
     530      print*,'zlay=',zlay(mxcalc)
     531      print*,'play=',play(mxcalc)
     532
     533!Al1 pour SST forced, appellé depuis ocean_forced_noice
     534      ts_cur = tsurf ! SST used in read_tsurf1d
     535!=====================================================================
     536! Initialisation de la physique :
     537!=====================================================================
     538
     539!  Rq: conf_phys.F90 lit tous les flags de physiq.def; conf_phys appele depuis physiq.F
     540!
     541! day_step, iphysiq lus dans gcm.def ci-dessus
     542! timestep: calcule ci-dessous from rday et day_step
     543! ngrid=1
     544! llm: defini dans .../modipsl/modeles/LMDZ4/libf/grid/dimension
     545! rday: defini dans suphel.F (86400.)
     546! day_ini: lu dans run.def (dayref)
     547! rlat_rad,rlon-rad: transformes en radian de rlat,rlon lus dans lmdz1d.def (en degres)
     548! airefi,zcufi,zcvfi initialises au debut de ce programme
     549! rday,ra,rg,rd,rcpd declares dans YOMCST.h et calcules dans suphel.F
     550      day_step = float(nsplit_phys)*day_step/float(iphysiq)
     551      write (*,*) 'Time step divided by nsplit_phys (=',nsplit_phys,')'
     552      timestep =rday/day_step
     553      dtime_frcg = timestep
     554!
     555      zcufi=airefi
     556      zcvfi=airefi
     557!
     558      rlat_rad(:)=rlat(:)*rpi/180.
     559      rlon_rad(:)=rlon(:)*rpi/180.
     560
     561      call iniphysiq(ngrid,llm,rday,day_ini,timestep,                        &
     562     &     rlat_rad,rlon_rad,airefi,zcufi,zcvfi,ra,rg,rd,rcpd,(/1/))
     563      print*,'apres iniphysiq'
     564
     565! 2 PARAMETRES QUI DEVRAIENT ETRE LUS DANS run.def MAIS NE LE SONT PAS ICI:
     566      co2_ppm= 330.0
     567      solaire=1370.0
     568
     569! Ecriture du startphy avant le premier appel a la physique.
     570! On le met juste avant pour avoir acces a tous les champs
     571! NB: les clesphy0 seront remplies dans phyredem d'apres les flags lus dans gcm.def
     572
     573      if (ok_writedem) then
     574
     575!--------------------------------------------------------------------------
     576! pbl_surface_init (called here) and pbl_surface_final (called by phyredem)
     577! need : qsol fder snow qsurf evap rugos agesno ftsoil
     578!--------------------------------------------------------------------------
     579
     580        type_ocean = "force"
     581        run_off_lic_0(1) = restart_runoff
     582        call fonte_neige_init(run_off_lic_0)
     583
     584        fder=0.
     585        snsrf(1,:)=0.        ! couverture de neige des sous surface
     586        qsurfsrf(1,:)=qsurf ! humidite de l'air des sous surface
     587        evap=0.
     588        frugs(1,:)=rugos     ! couverture de neige des sous surface
     589        agesno  = xagesno
     590        tsoil(:,:,:)=tsurf
     591!------ AMMA 2e run avec modele sol et rayonnement actif (MPL 23052012)
     592!       tsoil(1,1,1)=299.18
     593!       tsoil(1,2,1)=300.08
     594!       tsoil(1,3,1)=301.88
     595!       tsoil(1,4,1)=305.48
     596!       tsoil(1,5,1)=308.00
     597!       tsoil(1,6,1)=308.00
     598!       tsoil(1,7,1)=308.00
     599!       tsoil(1,8,1)=308.00
     600!       tsoil(1,9,1)=308.00
     601!       tsoil(1,10,1)=308.00
     602!       tsoil(1,11,1)=308.00
     603!-----------------------------------------------------------------------
     604        call pbl_surface_init(qsol, fder, snsrf, qsurfsrf,                  &
     605     &                                    evap, frugs, agesno, tsoil)
     606
     607!------------------ prepare limit conditions for limit.nc -----------------
     608!--   Ocean force
     609
     610        print*,'avant phyredem'
     611        pctsrf(1,:)=0.
     612        if (nat_surf.eq.0.) then
     613          pctsrf(1,is_oce)=1.
     614          pctsrf(1,is_ter)=0.
     615        else
     616          pctsrf(1,is_oce)=0.
     617          pctsrf(1,is_ter)=1.
     618        end if
     619
     620        print*,'nat_surf,pctsrf(1,is_oce),pctsrf(1,is_ter)',nat_surf         &
     621     &        ,pctsrf(1,is_oce),pctsrf(1,is_ter)
     622
     623        zmasq=pctsrf(1,is_ter)+pctsrf(1,is_lic)
     624        zpic = zpicinp
     625        ftsol=tsurf
     626        falb1 = albedo                           
     627        falb2 = albedo                           
     628        rugoro=rugos
     629        t_ancien(1,:)=temp(:)
     630        q_ancien(1,:)=q(:,1)
     631        pbl_tke=1.e-8
     632
     633        rain_fall=0.
     634        snow_fall=0.
     635        solsw=0.
     636        sollw=0.
     637        radsol=0.
     638        rnebcon=0.
     639        ratqs=0.
     640        clwcon=0.
     641        zmea=0.
     642        zstd=0.
     643        zsig=0.
     644        zgam=0.
     645        zval=0.
     646        zthe=0.
     647        sig1=0.
     648        w01=0.
     649        u_ancien(1,:)=u(:)
     650        v_ancien(1,:)=v(:)
     651 
     652!------------------------------------------------------------------------
     653! Make file containing restart for the physics (startphy.nc)
     654!
     655! NB: List of the variables to be written by phyredem (via put_field):
     656! rlon,rlat,zmasq,pctsrf(:,is_ter),pctsrf(:,is_lic),pctsrf(:,is_oce)
     657! pctsrf(:,is_sic),ftsol(:,nsrf),tsoil(:,isoil,nsrf),qsurf(:,nsrf)
     658! qsol,falb1(:,nsrf),falb2(:,nsrf),evap(:,nsrf),snow(:,nsrf)
     659! radsol,solsw,sollw,fder,rain_fall,snow_fall,frugs(:,nsrf)
     660! agesno(:,nsrf),zmea,zstd,zsig,zgam,zthe,zpic,zval,rugoro
     661! t_ancien,q_ancien,frugs(:,is_oce),clwcon(:,1),rnebcon(:,1),ratqs(:,1)
     662! run_off_lic_0,pbl_tke(:,1:klev,nsrf),zmax0,f0,sig1,w01
     663! wake_deltat,wake_deltaq,wake_s,wake_cstar,wake_fip
     664!------------------------------------------------------------------------
     665!Al1 =============== restart option ==========================
     666        if (.not.restart) then
     667          call phyredem ("startphy.nc")
     668        else
     669! (desallocations)
     670        print*,'callin surf final'
     671          call pbl_surface_final(qsol, fder, snsrf, qsurfsrf,               &
     672     &                                    evap, frugs, agesno, tsoil)
     673        print*,'after surf final'
     674          CALL fonte_neige_final(run_off_lic_0)
     675        endif
     676
     677        ok_writedem=.false.
     678        print*,'apres phyredem'
     679
     680      endif ! ok_writedem
     681     
     682!------------------------------------------------------------------------
     683! Make file containing boundary conditions (limit.nc) **Al1->restartdyn***
     684! --------------------------------------------------
     685! NB: List of the variables to be written in limit.nc
     686!     (by writelim.F, subroutine of 1DUTILS.h):
     687!        phy_nat,phy_alb,phy_sst,phy_bil,phy_rug,phy_ice,
     688!        phy_fter,phy_foce,phy_flic,phy_fsic)
     689!------------------------------------------------------------------------
     690      do i=1,yd
     691        phy_nat(i)  = nat_surf
     692        phy_alb(i)  = albedo
     693        phy_sst(i)  = tsurf ! read_tsurf1d will be used instead
     694        phy_rug(i)  = rugos
     695        phy_fter(i) = pctsrf(1,is_ter)
     696        phy_foce(i) = pctsrf(1,is_oce)
     697        phy_fsic(i) = pctsrf(1,is_sic)
     698        phy_flic(i) = pctsrf(1,is_lic)
     699      enddo
     700
     701! fabrication de limit.nc
     702      call writelim (1,phy_nat,phy_alb,phy_sst,phy_bil,phy_rug,             &
     703     &               phy_ice,phy_fter,phy_foce,phy_flic,phy_fsic)
     704
     705
     706      call phys_state_var_end
     707!Al1
     708      if (restart) then
     709        print*,'call to restart dyn 1d'
     710        Call dyn1deta0("start1dyn.nc",plev,play,phi,phis,presnivs,          &
     711     &              u,v,temp,q,omega2)
     712
     713       print*,'fnday,annee_ref,day_ref,day_ini',                            &
     714     &     fnday,annee_ref,day_ref,day_ini
     715!**      call ymds2ju(annee_ref,mois,day_ini,heure,day)
     716       day = day_ini
     717       day_end = day_ini + nday
     718       daytime = day + time_ini/24. ! 1st day and initial time of the simulation
     719
     720! Print out the actual date of the beginning of the simulation :
     721       call ju2ymds(daytime, an, mois, jour, heure)
     722       print *,' Time of beginning : y m d h',an, mois,jour,heure/3600.
     723
     724       day = int(daytime)
     725       time=daytime-day
     726 
     727       print*,'****** intialised fields from restart1dyn *******'
     728       print*,'plev,play,phi,phis,presnivs,u,v,temp,q,omega2'
     729       print*,'temp(1),q(1,1),u(1),v(1),plev(1),phis :'
     730       print*,temp(1),q(1,1),u(1),v(1),plev(1),phis
     731! raz for safety
     732       do l=1,llm
     733         dq_dyn(l,1) = 0.
     734       enddo
     735      endif
     736!Al1 ================  end restart =================================
     737      IF (ecrit_slab_oc.eq.1) then
     738         open(97,file='div_slab.dat',STATUS='UNKNOWN')
     739       elseif (ecrit_slab_oc.eq.0) then
     740         open(97,file='div_slab.dat',STATUS='OLD')
     741       endif
     742!=====================================================================
     743! START OF THE TEMPORAL LOOP :
     744!=====================================================================
     745           
     746      do while(it.le.nint(fnday*day_step))
     747
     748       if (prt_level.ge.1) then
     749         print*,'XXXXXXXXXXXXXXXXXXX ITAP,day,time=',                       &
     750     &                                it,day,time,nint(fnday*day_step)
     751         print*,'PAS DE TEMPS ',timestep
     752       endif
     753!Al1 demande de restartphy.nc
     754       if (it.eq.nint(fnday*day_step)) lastcall=.True.
     755
     756!---------------------------------------------------------------------
     757! Interpolation of forcings in time and onto model levels
     758!---------------------------------------------------------------------
     759
     760#include "1D_interp_cases.h"
     761
     762      if (forcing_GCM2SCM) then
     763        write (*,*) 'forcing_GCM2SCM not yet implemented'
     764        stop 'in time loop'
     765      endif ! forcing_GCM2SCM
     766
     767!---------------------------------------------------------------------
     768!  Geopotential :
     769!---------------------------------------------------------------------
     770
     771        phi(1)=RD*temp(1)*(plev(1)-play(1))/(.5*(plev(1)+play(1)))
     772        do l = 1, llm-1
     773          phi(l+1)=phi(l)+RD*(temp(l)+temp(l+1))*                           &
     774     &    (play(l)-play(l+1))/(play(l)+play(l+1))
     775        enddo
     776
     777!---------------------------------------------------------------------
     778! Listing output for debug prt_level>=1
     779!---------------------------------------------------------------------
     780       if (prt_level>=1) then
     781         print *,' avant physiq : -------- day time ',day,time
     782         write(*,*) 'firstcall,lastcall,phis',                               &
     783     &               firstcall,lastcall,phis
     784         write(*,'(a10,2a4,4a13)') 'BEFOR1 IT=','it','l',                   &
     785     &        'presniv','plev','play','phi'
     786         write(*,'(a10,2i4,4f13.2)') ('BEFOR1 IT= ',it,l,                   &
     787     &         presnivs(l),plev(l),play(l),phi(l),l=1,llm)
     788         write(*,'(a11,2a4,a11,6a8)') 'BEFOR2','it','l',                    &
     789     &         'presniv','u','v','temp','q1','q2','omega2'
     790         write(*,'(a11,2i4,f11.2,5f8.2,e10.2)') ('BEFOR2 IT= ',it,l,         &
     791     &   presnivs(l),u(l),v(l),temp(l),q(l,1),q(l,2),omega2(l),l=1,llm)
     792       endif
     793
     794!---------------------------------------------------------------------
     795!   Call physiq :
     796!---------------------------------------------------------------------
     797
     798        call physiq(ngrid,llm,                                              &
     799     &              firstcall,lastcall,                                     &
     800     &              day,time,timestep,                                      &
     801     &              plev,play,phi,phis,presnivs,clesphy0,                   &
     802     &              u,v,temp,q,omega2,                                      &
     803     &              du_phys,dv_phys,dt_phys,dq,dpsrf,                        &
     804     &              dudyn,PVteta)
     805        firstcall=.false.
     806
     807!---------------------------------------------------------------------
     808! Listing output for debug prt_level>=1
     809!---------------------------------------------------------------------
     810        if (prt_level>=1) then
     811          write(*,'(a11,2a4,4a13)') 'AFTER1 IT=','it','l',                  &
     812     &        'presniv','plev','play','phi'
     813          write(*,'(a11,2i4,4f13.2)') ('AFTER1 it= ',it,l,                  &
     814     &    presnivs(l),plev(l),play(l),phi(l),l=1,llm)
     815          write(*,'(a11,2a4,a11,6a8)') 'AFTER2','it','l',                   &
     816     &         'presniv','u','v','temp','q1','q2','omega2'
     817          write(*,'(a11,2i4,f11.2,5f8.2,e10.2)') ('AFTER2 it= ',it,l,       &
     818     &    presnivs(l),u(l),v(l),temp(l),q(l,1),q(l,2),omega2(l),l=1,llm)
     819          write(*,'(a11,2a4,a11,5a8)') 'AFTER3','it','l',                   &
     820     &         'presniv','du_phys','dv_phys','dt_phys','dq1','dq2'   
     821           write(*,'(a11,2i4,f11.2,5f8.2)') ('AFTER3 it= ',it,l,            &
     822     &      presnivs(l),86400*du_phys(l),86400*dv_phys(l),                   &
     823     &       86400*dt_phys(l),86400*dq(l,1),dq(l,2),l=1,llm)
     824          write(*,*) 'dpsrf',dpsrf
     825        endif
     826!---------------------------------------------------------------------
     827!   Add physical tendencies :
     828!---------------------------------------------------------------------
     829
     830       fcoriolis=2.*sin(rpi*xlat/180.)*romega
     831       if (forcing_radconv .or. forcing_fire) then
     832         fcoriolis=0.0
     833         dt_cooling=0.0
     834         d_th_adv=0.0
     835         d_q_adv=0.0
     836       endif
     837
     838       if (forcing_toga .or. forcing_GCSSold .or. forcing_twpice            &
     839     &    .or.forcing_amma) then
     840         fcoriolis=0.0 ; ug=0. ; vg=0.
     841       endif
     842         if(forcing_rico) then
     843          dt_cooling=0.
     844        endif
     845
     846      print*, 'fcoriolis ', fcoriolis, xlat
     847
     848        du_age(1:mxcalc)=fcoriolis*(v(1:mxcalc)-vg(1:mxcalc))
     849       dv_age(1:mxcalc)=-fcoriolis*(u(1:mxcalc)-ug(1:mxcalc))
     850
     851!!!!!!!!!!!!!!!!!!!!!!!!
     852! Geostrophic wind
     853!!!!!!!!!!!!!!!!!!!!!!!!
     854       sfdt = sin(0.5*fcoriolis*timestep)
     855       cfdt = cos(0.5*fcoriolis*timestep)
     856!
     857        du_age(1:mxcalc)= -2.*sfdt/timestep*                                &
     858     &          (sfdt*(u(1:mxcalc)-ug(1:mxcalc)) -                          &
     859     &           cfdt*(v(1:mxcalc)-vg(1:mxcalc))  )
     860!!     : fcoriolis*(v(1:mxcalc)-vg(1:mxcalc))
     861!
     862       dv_age(1:mxcalc)= -2.*sfdt/timestep*                                 &
     863     &          (cfdt*(u(1:mxcalc)-ug(1:mxcalc)) +                           &
     864     &           sfdt*(v(1:mxcalc)-vg(1:mxcalc))  )
     865!!     : -fcoriolis*(u(1:mxcalc)-ug(1:mxcalc))
     866!
     867!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
     868!         call  writefield_phy('dv_age' ,dv_age,llm)
     869!         call  writefield_phy('du_age' ,du_age,llm)
     870!         call  writefield_phy('du_phys' ,du_phys,llm)
     871!         call  writefield_phy('u_tend' ,u,llm)
     872!         call  writefield_phy('u_g' ,ug,llm)
     873!
     874!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
     875!! Increment state variables
     876!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
     877! pour les cas sandu et astex, on reclacule u,v,q,temp et teta dans 1D_nudge_sandu_astex.h
     878! au dessus de 700hpa, on relaxe vers les profils initiaux
     879      if (forcing_sandu .OR. forcing_astex) then
     880#include "1D_nudge_sandu_astex.h"
     881      else
     882        u(1:mxcalc)=u(1:mxcalc) + timestep*(                                &
     883     &              du_phys(1:mxcalc)                                       &
     884     &             +du_age(1:mxcalc) )           
     885        v(1:mxcalc)=v(1:mxcalc) + timestep*(                                 &
     886     &              dv_phys(1:mxcalc)                                       &
     887     &             +dv_age(1:mxcalc) )
     888        q(1:mxcalc,:)=q(1:mxcalc,:)+timestep*(                              &
     889     &                dq(1:mxcalc,:)                                        &
     890     &               +d_q_adv(1:mxcalc,:) )
     891
     892        if (prt_level.ge.1) then
     893          print *,                                                          &
     894     &    'physiq-> temp(1),dt_phys(1),d_th_adv(1),dt_cooling(1) ',         &
     895     &              temp(1),dt_phys(1),d_th_adv(1),dt_cooling(1)
     896           print*,du_phys
     897           print*, v
     898           print*, vg
     899        endif
     900
     901        temp(1:mxcalc)=temp(1:mxcalc)+timestep*(                            &
     902     &              dt_phys(1:mxcalc)                                       &
     903     &             +d_th_adv(1:mxcalc)                                      &
     904     &             +dt_cooling(1:mxcalc))  ! Taux de chauffage ou refroid.
     905
     906      endif  ! forcing_sandu or forcing_astex
     907
     908        teta=temp*(pzero/play)**rkappa
     909!
     910!---------------------------------------------------------------------
     911!   Nudge soil temperature if requested
     912!---------------------------------------------------------------------
     913
     914      IF (nudge_tsoil) THEN
     915       ftsoil(1,isoil_nudge,:) = ftsoil(1,isoil_nudge,:)                     &
     916     &  -timestep/tau_soil_nudge*(ftsoil(1,isoil_nudge,:)-Tsoil_nudge)
     917      ENDIF
     918
     919!---------------------------------------------------------------------
     920!   Add large-scale tendencies (advection, etc) :
     921!---------------------------------------------------------------------
     922
     923!cc nrlmd
     924!cc        tmpvar=teta
     925!cc        call advect_vert(llm,omega,timestep,tmpvar,plev)
     926!cc
     927!cc        teta(1:mxcalc)=tmpvar(1:mxcalc)
     928!cc        tmpvar(:)=q(:,1)
     929!cc        call advect_vert(llm,omega,timestep,tmpvar,plev)
     930!cc        q(1:mxcalc,1)=tmpvar(1:mxcalc)
     931!cc        tmpvar(:)=q(:,2)
     932!cc        call advect_vert(llm,omega,timestep,tmpvar,plev)
     933!cc        q(1:mxcalc,2)=tmpvar(1:mxcalc)
     934
     935!---------------------------------------------------------------------
     936!   Air temperature :
     937!---------------------------------------------------------------------       
     938        if (lastcall) then
     939          print*,'Pas de temps final ',it
     940          call ju2ymds(daytime, an, mois, jour, heure)
     941          print*,'a la date : a m j h',an, mois, jour ,heure/3600.
     942        endif
     943
     944!  incremente day time
     945!        print*,'daytime bef',daytime,1./day_step
     946        daytime = daytime+1./day_step
     947!Al1dbg
     948        day = int(daytime+0.1/day_step)
     949!        time = max(daytime-day,0.0)
     950!Al1&jyg: correction de bug
     951!cc        time = real(mod(it,day_step))/day_step
     952        time = time_ini/24.+real(mod(it,day_step))/day_step
     953!        print*,'daytime nxt time',daytime,time
     954        it=it+1
     955
     956      enddo
     957
     958!Al1
     959      if (ecrit_slab_oc.ne.-1) close(97)
     960
     961!Al1 Call to 1D equivalent of dynredem (an,mois,jour,heure ?)
     962! -------------------------------------
     963       call dyn1dredem("restart1dyn.nc",                                    &
     964     &              plev,play,phi,phis,presnivs,                            &
     965     &              u,v,temp,q,omega2)
     966
     967        CALL abort_gcm ('lmdz1d   ','The End  ',0)
     968
     969      end
     970
     971#include "1DUTILS.h"
     972#include "1Dconv.h"
     973
     974
Note: See TracChangeset for help on using the changeset viewer.