Ignore:
Timestamp:
Jun 26, 2014, 6:07:05 PM (11 years ago)
Author:
emillour
Message:

Common dynamics:
Some updates to keep up with LMDZ5 Earth model evolution
(up to LMDZ5 rev 2070). See file "DOC/chantiers/commit_importants.log"
for detailed list of changes.
Note that the updates of exner* routines change (as expected) results
at numerical roundoff level.
EM

Location:
trunk/LMDZ.COMMON/libf
Files:
3 deleted
21 edited
5 moved

Legend:

Unmodified
Added
Removed
  • trunk/LMDZ.COMMON/libf/bibio/wxios.F90

    r1300 r1302  
    2626   
    2727    !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    28     !   str + i   =>   str_i   !!!!!!!!!!!!!!!!!!!!
    29     !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    30    
    31     SUBROUTINE concat(str, str2, str_str2)
    32         CHARACTER(len=*), INTENT(IN) :: str, str2
    33         CHARACTER(len=20), INTENT(OUT) :: str_str2
    34        
    35        
    36         str_str2 = TRIM(ADJUSTL(str//"_"//TRIM(ADJUSTL(str2))))
    37         !IF (prt_level >= 10) WRITE(lunout,*) "Xios. ",str,"+",str2,"=",str_str2
    38     END SUBROUTINE concat
    39    
    40     !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    4128    !   36day => 36d etc     !!!!!!!!!!!!!!!!!!!!
    4229    !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
     
    10996    !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    11097
    111     SUBROUTINE wxios_init(xios_ctx_name, locom, outcom)
     98    SUBROUTINE wxios_init(xios_ctx_name, locom, outcom, type_ocean)
    11299        IMPLICIT NONE
    113100        INCLUDE 'iniprint.h'
     
    116103      INTEGER, INTENT(IN), OPTIONAL :: locom
    117104      INTEGER, INTENT(OUT), OPTIONAL :: outcom
     105      CHARACTER(len=6), INTENT(IN), OPTIONAL :: type_ocean
    118106
    119107   
     
    142130        g_ctx_name = xios_ctx_name
    143131       
    144         CALL wxios_context_init()
    145        
     132        ! Si couple alors init fait dans cpl_init
     133        IF (.not. PRESENT(type_ocean)) THEN
     134            CALL wxios_context_init()
     135        ENDIF
     136
    146137    END SUBROUTINE wxios_init
    147138
     
    158149        g_ctx = xios_ctx
    159150
    160         IF (prt_level >= 10) WRITE(lunout,*) "wxios_context_init: Current context is ",trim(g_ctx_name)
    161 
     151        IF (prt_level >= 10) THEN
     152          WRITE(lunout,*) "wxios_context_init: Current context is ",trim(g_ctx_name)
     153          WRITE(lunout,*) "     now call xios_solve_inheritance()"
     154        ENDIF
    162155        !Une première analyse des héritages:
    163156        CALL xios_solve_inheritance()
     
    303296    ! Pour déclarer un axe vertical !!!!!!!!!!!!!!!
    304297    !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    305     SUBROUTINE wxios_add_vaxis(axisgroup_id, axis_file, axis_size, axis_value)
    306         IMPLICIT NONE
    307         INCLUDE 'iniprint.h'
    308 
    309         CHARACTER (len=*), INTENT(IN) :: axisgroup_id, axis_file
     298    SUBROUTINE wxios_add_vaxis(axis_id, axis_size, axis_value)
     299        IMPLICIT NONE
     300        INCLUDE 'iniprint.h'
     301
     302        CHARACTER (len=*), INTENT(IN) :: axis_id
    310303        INTEGER, INTENT(IN) :: axis_size
    311304        REAL, DIMENSION(axis_size), INTENT(IN) :: axis_value
    312305       
    313         TYPE(xios_axisgroup) :: axgroup
    314         TYPE(xios_axis) :: ax
    315         CHARACTER(len=20) :: axis_id
    316        
    317        
    318         !Préparation du nom de l'axe:
    319         CALL concat(axisgroup_id, axis_file, axis_id)
     306!        TYPE(xios_axisgroup) :: axgroup
     307!        TYPE(xios_axis) :: ax
     308!        CHARACTER(len=50) :: axis_id
     309       
     310!        IF (len_trim(axisgroup_id).gt.len(axis_id)) THEN
     311!          WRITE(lunout,*) "wxios_add_vaxis: error, size of axis_id too small!!"
     312!          WRITE(lunout,*) "     increase it to at least ",len_trim(axisgroup_id)
     313!          CALL abort_gcm("wxios_add_vaxis","len(axis_id) too small",1)
     314!        ENDIF
     315!        axis_id=trim(axisgroup_id)
    320316       
    321317        !On récupère le groupe d'axes qui va bien:
    322         CALL xios_get_axisgroup_handle(axisgroup_id, axgroup)
     318        !CALL xios_get_axisgroup_handle(axisgroup_id, axgroup)
    323319       
    324320        !On ajoute l'axe correspondant à ce fichier:
    325         CALL xios_add_axis(axgroup, ax, TRIM(ADJUSTL(axis_id)))
     321        !CALL xios_add_axis(axgroup, ax, TRIM(ADJUSTL(axis_id)))
    326322       
    327323        !Et on le parametrise:
    328         CALL xios_set_axis_attr_hdl(ax, size=axis_size, value=axis_value)
     324        !CALL xios_set_axis_attr_hdl(ax, size=axis_size, value=axis_value)
     325       
     326        ! Ehouarn: New way to declare axis, without axis_group:
     327        CALL xios_set_axis_attr(trim(axis_id),size=axis_size,value=axis_value)
    329328       
    330329        !Vérification:
     
    332331            IF (prt_level >= 10) WRITE(lunout,*) "wxios_add_vaxis: Axis created: ", TRIM(ADJUSTL(axis_id))
    333332        ELSE
    334             WRITE(*,*) "wxios_add_vaxis: Invalid axis: ", TRIM(ADJUSTL(axis_id))
     333            WRITE(lunout,*) "wxios_add_vaxis: Invalid axis: ", TRIM(ADJUSTL(axis_id))
    335334        END IF
    336335
     
    367366       
    368367            IF (xios_is_valid_file("X"//fname)) THEN
    369                 IF (prt_level >= 10) WRITE(lunout,*) "wxios_add_file: New file: ", "X"//fname
    370                 IF (prt_level >= 10) WRITE(lunout,*) "wxios_add_file: output_freq=",TRIM(ADJUSTL(nffreq)),"; output_lvl=",flvl
     368                IF (prt_level >= 10) THEN
     369                  WRITE(lunout,*) "wxios_add_file: New file: ", "X"//fname
     370                  WRITE(lunout,*) "wxios_add_file: output_freq=",TRIM(ADJUSTL(nffreq)),"; output_lvl=",flvl
     371                ENDIF
    371372            ELSE
    372                 WRITE(*,*) "wxios_add_file: Error, invalid file: ", "X"//trim(fname)
    373                 WRITE(*,*) "wxios_add_file: output_freq=",TRIM(ADJUSTL(nffreq)),"; output_lvl=",flvl
     373                WRITE(lunout,*) "wxios_add_file: Error, invalid file: ", "X"//trim(fname)
     374                WRITE(lunout,*) "wxios_add_file: output_freq=",TRIM(ADJUSTL(nffreq)),"; output_lvl=",flvl
    374375            END IF
    375376        ELSE
    376             IF (prt_level >= 10) WRITE(lunout,*) "wxios_add_file: File ",trim(fname), " défined using XML."
    377                 CALL xios_set_file_attr(fname, enabled=.TRUE.)
     377            IF (prt_level >= 10) THEN
     378              WRITE(lunout,*) "wxios_add_file: File ",trim(fname), " défined using XML."
     379            ENDIF
     380            ! Ehouarn: add an enable=.true. on top of xml definitions... why???
     381            CALL xios_set_file_attr(fname, enabled=.TRUE.)
    378382        END IF
    379383    END SUBROUTINE wxios_add_file
    380384   
    381385    !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    382     ! Pour créer un champ      !!!!!!!!!!!!!!!
     386    ! Pour créer un champ      !!!!!!!!!!!!!!!!!!!!
    383387    !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    384388    SUBROUTINE wxios_add_field(fieldname, fieldgroup, fieldlongname, fieldunit)
     
    418422   
    419423    !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    420     ! Pour déclarer un champ      !!!!!!!!!!!!!!!
     424    ! Pour déclarer un champ      !!!!!!!!!!!!!!!!!
    421425    !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    422426    SUBROUTINE wxios_add_field_to_file(fieldname, fdim, fid, fname, fieldlongname, fieldunit, field_level, op)
     
    432436        CHARACTER(len=*), INTENT(IN) :: op
    433437       
    434         CHARACTER(len=20) :: axis_id
     438        CHARACTER(len=20) :: axis_id ! Ehouarn: dangerous...
    435439        CHARACTER(len=100) :: operation
    436440        TYPE(xios_file) :: f
     
    441445       
    442446       
    443         !Préparation du nom de l'axe:
    444         CALL concat("presnivs", fname, axis_id)
     447        ! Ajout Abd pour NMC:
     448        IF (fid.LE.6) THEN
     449          axis_id="presnivs"
     450        ELSE
     451          axis_id="plev"
     452        ENDIF
    445453       
    446454        !on prépare le nom de l'opération:
     
    448456       
    449457       
    450        
    451458        !On selectionne le bon groupe de champs:
    452459        IF (fdim.EQ.2) THEN
    453             CALL xios_get_fieldgroup_handle("fields_2D", fieldgroup)
     460          CALL xios_get_fieldgroup_handle("fields_2D", fieldgroup)
    454461        ELSE
    455462          CALL xios_get_fieldgroup_handle("fields_3D", fieldgroup)
     
    515522            !Sinon on se contente de l'activer:
    516523            CALL xios_set_field_attr(fieldname, enabled=.TRUE.)
     524            !NB: This will override an enable=.false. set by a user in the xml file;
     525            !   then the only way to not output the field is by changing its
     526            !   output level
    517527        ENDIF       
    518528       
    519529    END SUBROUTINE wxios_add_field_to_file
    520530   
    521     SUBROUTINE wxios_update_calendar(ito)
    522         INTEGER, INTENT(IN) :: ito
    523         CALL xios_update_calendar(ito)
    524     END SUBROUTINE wxios_update_calendar
    525    
    526     SUBROUTINE wxios_write_2D(fieldname, fdata)
    527         CHARACTER(len=*), INTENT(IN) :: fieldname
    528         REAL, DIMENSION(:,:), INTENT(IN) :: fdata
    529        
    530         CALL xios_send_field(fieldname, fdata)
    531     END SUBROUTINE wxios_write_2D
    532    
    533     SUBROUTINE wxios_write_3D(fieldname, fdata)
    534         CHARACTER(len=*), INTENT(IN) :: fieldname
    535         REAL, DIMENSION(:,:,:), INTENT(IN) :: fdata
    536        
    537         CALL xios_send_field(fieldname, fdata)
    538     END SUBROUTINE wxios_write_3D
     531!    SUBROUTINE wxios_update_calendar(ito)
     532!        INTEGER, INTENT(IN) :: ito
     533!        CALL xios_update_calendar(ito)
     534!    END SUBROUTINE wxios_update_calendar
     535!   
     536!    SUBROUTINE wxios_write_2D(fieldname, fdata)
     537!        CHARACTER(len=*), INTENT(IN) :: fieldname
     538!        REAL, DIMENSION(:,:), INTENT(IN) :: fdata
     539!
     540!        CALL xios_send_field(fieldname, fdata)
     541!    END SUBROUTINE wxios_write_2D
     542   
     543!    SUBROUTINE wxios_write_3D(fieldname, fdata)
     544!        CHARACTER(len=*), INTENT(IN) :: fieldname
     545!        REAL, DIMENSION(:,:,:), INTENT(IN) :: fdata
     546!       
     547!        CALL xios_send_field(fieldname, fdata)
     548!    END SUBROUTINE wxios_write_3D
    539549   
    540550    SUBROUTINE wxios_closedef()
  • trunk/LMDZ.COMMON/libf/dyn3d/calfis.F

    r1256 r1302  
    172172      REAL unskap, pksurcp
    173173      save unskap
    174 
    175 cIM diagnostique PVteta, Amip2
    176       INTEGER,PARAMETER :: ntetaSTD=3
    177       REAL,SAVE :: rtetaSTD(ntetaSTD)=(/350.,380.,405./) ! Earth-specific, beware !!
    178       REAL PVteta(ngridmx,ntetaSTD)
    179174
    180175      REAL flxwfi(ngridmx,llm)  ! Flux de masse verticale sur la grille physiq
     
    651646      ENDDO
    652647c
    653       if (planet_type=="earth") then
    654 #ifdef CPP_EARTH
    655 ! PVtheta calls tetalevel, which is in the (Earth) physics
    656 cIM calcul PV a teta=350, 380, 405K
    657       CALL PVtheta(ngridmx,llm,pucov,pvcov,pteta,
    658      $           ztfi,zplay,zplev,
    659      $           ntetaSTD,rtetaSTD,PVteta)
    660 #endif
    661       endif
    662 c
    663648c On change de grille, dynamique vers physiq, pour le flux de masse verticale
    664649      CALL gr_dyn_fi(llm,iip1,jjp1,ngridmx,flxw,flxwfi)
     
    713698     .             zdqfi,
    714699     .             zdpsrf,
    715 cIM diagnostique PVteta, Amip2         
    716      .             pducov,
    717      .             PVteta)
     700     .             pducov)
    718701
    719702      else if ( planet_type=="generic" ) then
  • trunk/LMDZ.COMMON/libf/dyn3d/ce0l.F90

    r1019 r1302  
    11!
    2 ! $Id: ce0l.F90 1511 2011-04-28 15:21:47Z jghattas $
     2! $Id: ce0l.F90 1984 2014-02-18 09:59:29Z emillour $
    33!
    44!-------------------------------------------------------------------------------
     
    3030#ifndef CPP_EARTH
    3131#include "iniprint.h"
    32   WRITE(lunout,*)'limit_netcdf: Earth-specific program, needs Earth physics'
     32  WRITE(lunout,*)'limit_netcdf: Earth-specific routine, needs Earth physics'
    3333#else
    3434!-------------------------------------------------------------------------------
     
    9494  END IF
    9595
    96   IF (grilles_gcm_netcdf) THEN
    97      WRITE(lunout,'(//)')
    98      WRITE(lunout,*) '  ***************************  '
    99      WRITE(lunout,*) '  ***  grilles_gcm_netcdf ***  '
    100      WRITE(lunout,*) '  ***************************  '
    101      WRITE(lunout,'(//)')
    102      CALL grilles_gcm_netcdf_sub(masque,phis)
    103   END IF
     96 
     97  WRITE(lunout,'(//)')
     98  WRITE(lunout,*) '  ***************************  '
     99  WRITE(lunout,*) '  ***  grilles_gcm_netcdf ***  '
     100  WRITE(lunout,*) '  ***************************  '
     101  WRITE(lunout,'(//)')
     102  CALL grilles_gcm_netcdf_sub(masque,phis)
     103
    104104#endif
    105105! of #ifndef CPP_EARTH #else
     
    108108!
    109109!-------------------------------------------------------------------------------
     110
  • trunk/LMDZ.COMMON/libf/dyn3d/conf_gcm.F

    r1189 r1302  
    22! $Id: conf_gcm.F 1418 2010-07-19 15:11:24Z jghattas $
    33!
    4 c
    5 c
     4!
     5!
    66      SUBROUTINE conf_gcm( tapedef, etatinit )
    7 c
     7!
    88      USE control_mod
    99#ifdef CPP_IOIPSL
     
    1818
    1919      IMPLICIT NONE
    20 c-----------------------------------------------------------------------
    21 c     Auteurs :   L. Fairhead , P. Le Van  .
    22 c
    23 c     Arguments :
    24 c
    25 c     tapedef   :
    26 c     etatinit  :     = TRUE   , on ne  compare pas les valeurs des para-
    27 c     -metres  du zoom  avec  celles lues sur le fichier start .
    28 c
     20!-----------------------------------------------------------------------
     21!     Auteurs :   L. Fairhead , P. Le Van  .
     22!
     23!     Arguments :
     24!
     25!     tapedef   :
     26!     etatinit  :     = TRUE   , on ne  compare pas les valeurs des para-
     27!     -metres  du zoom  avec  celles lues sur le fichier start .
     28!
    2929       LOGICAL etatinit
    3030       INTEGER tapedef
    3131
    32 c   Declarations :
    33 c   --------------
     32!   Declarations :
     33!   --------------
    3434#include "dimensions.h"
    3535#include "paramet.h"
     
    4343! FH 2008/05/09 On elimine toutes les clefs physiques dans la dynamique
    4444! #include "clesphys.h"
    45 c
    46 c
    47 c   local:
    48 c   ------
     45!
     46!
     47!   local:
     48!   ------
    4949
    5050      CHARACTER ch1*72,ch2*72,ch3*72,ch4*12
     
    5454      INTEGER i
    5555      LOGICAL use_filtre_fft
    56 c
    57 c  -------------------------------------------------------------------
    58 c
    59 c       .........     Version  du 29/04/97       ..........
    60 c
    61 c   Nouveaux parametres nitergdiv,nitergrot,niterh,tetagdiv,tetagrot,
    62 c      tetatemp   ajoutes  pour la dissipation   .
    63 c
    64 c   Autre parametre ajoute en fin de liste de tapedef : ** fxyhypb **
    65 c
    66 c  Si fxyhypb = .TRUE. , choix de la fonction a derivee tangente hyperb.
    67 c    Sinon , choix de fxynew  , a derivee sinusoidale  ..
    68 c
    69 c   ......  etatinit = . TRUE. si defrun  est appele dans ETAT0_LMD  ou
    70 c         LIMIT_LMD  pour l'initialisation de start.dat (dic) et
    71 c                de limit.dat ( dic)                        ...........
    72 c           Sinon  etatinit = . FALSE .
    73 c
    74 c   Donc etatinit = .F.  si on veut comparer les valeurs de  grossismx ,
    75 c    grossismy,clon,clat, fxyhypb  lues sur  le fichier  start  avec
    76 c   celles passees  par run.def ,  au debut du gcm, apres l'appel a
    77 c    lectba . 
    78 c   Ces parmetres definissant entre autres la grille et doivent etre
    79 c   pareils et coherents , sinon il y aura  divergence du gcm .
    80 c
    81 c-----------------------------------------------------------------------
    82 c   initialisations:
    83 c   ----------------
     56!
     57!  -------------------------------------------------------------------
     58!
     59!       .........     Version  du 29/04/97       ..........
     60!
     61!   Nouveaux parametres nitergdiv,nitergrot,niterh,tetagdiv,tetagrot,
     62!      tetatemp   ajoutes  pour la dissipation   .
     63!
     64!   Autre parametre ajoute en fin de liste de tapedef : ** fxyhypb **
     65!
     66!  Si fxyhypb = .TRUE. , choix de la fonction a derivee tangente hyperb.
     67!    Sinon , choix de fxynew  , a derivee sinusoidale  ..
     68!
     69!   ......  etatinit = . TRUE. si defrun  est appele dans ETAT0_LMD  ou
     70!         LIMIT_LMD  pour l'initialisation de start.dat (dic) et
     71!                de limit.dat ( dic)                        ...........
     72!           Sinon  etatinit = . FALSE .
     73!
     74!   Donc etatinit = .F.  si on veut comparer les valeurs de  grossismx ,
     75!    grossismy,clon,clat, fxyhypb  lues sur  le fichier  start  avec
     76!   celles passees  par run.def ,  au debut du gcm, apres l'appel a
     77!    lectba . 
     78!   Ces parmetres definissant entre autres la grille et doivent etre
     79!   pareils et coherents , sinon il y aura  divergence du gcm .
     80!
     81!-----------------------------------------------------------------------
     82!   initialisations:
     83!   ----------------
    8484
    8585!Config  Key  = lunout
     
    9191      CALL getin('lunout', lunout)
    9292      IF (lunout /= 5 .and. lunout /= 6) THEN
    93         OPEN(UNIT=lunout,FILE='lmdz.out',ACTION='write',
     93        OPEN(UNIT=lunout,FILE='lmdz.out',ACTION='write',                     &
    9494     &          STATUS='unknown',FORM='formatted')
    9595      ENDIF
     
    103103      CALL getin('prt_level',prt_level)
    104104
    105 c-----------------------------------------------------------------------
    106 c  Parametres de controle du run:
    107 c-----------------------------------------------------------------------
     105!-----------------------------------------------------------------------
     106!  Parametres de controle du run:
     107!-----------------------------------------------------------------------
    108108!Config  Key  = planet_type
    109109!Config  Desc = planet type ("earth", "mars", "venus", ...)
     
    264264       CALL getin('dissip_period',dissip_period)
    265265
    266 ccc  ....   P. Le Van , modif le 29/04/97 .pour la dissipation  ...
    267 ccc
     266!cc  ....   P. Le Van , modif le 29/04/97 .pour la dissipation  ...
     267!cc
    268268
    269269!Config  Key  = lstardis
     
    430430       CALL getin('ok_guide',ok_guide)
    431431
    432 c    ...............................................................
     432!    ...............................................................
    433433
    434434!Config  Key  =  read_start
     
    587587      CALL getin('ok_etat0',ok_etat0)
    588588
    589 !Config  Key  = grilles_gcm_netcdf
    590 !Config  Desc = creation de fichier grilles_gcm.nc dans create_etat0_limit
    591 !Config  Def  = n
    592       grilles_gcm_netcdf = .FALSE.
    593       CALL getin('grilles_gcm_netcdf',grilles_gcm_netcdf)
    594 
    595 c----------------------------------------
    596 c Parameters for zonal averages in the case of Titan
     589!----------------------------------------
     590! Parameters for zonal averages in the case of Titan
    597591      moyzon_mu = .false.
    598592      moyzon_ch = .false.
     
    601595       CALL getin('moyzon_ch', moyzon_ch)
    602596      endif
    603 c----------------------------------------
    604 
    605 c----------------------------------------
    606 ccc  ....   P. Le Van , ajout  le 7/03/95 .pour le zoom ...
    607 c     .........   (  modif  le 17/04/96 )   .........
    608 c
    609 C ZOOM PARAMETERS ... the ones read in start.nc prevail anyway ! (SL, 2012)
    610 c
    611 c----------------------------------------
     597!----------------------------------------
     598
     599!----------------------------------------
     600!cc  ....   P. Le Van , ajout  le 7/03/95 .pour le zoom ...
     601!     .........   (  modif  le 17/04/96 )   .........
     602!
     603! ZOOM PARAMETERS ... the ones read in start.nc prevail anyway ! (SL, 2012)
     604!
     605!----------------------------------------
    612606      IF( etatinit ) then
    613607
     
    645639
    646640      IF( grossismx.LT.1. )  THEN
    647         write(lunout,*)
    648      &   'conf_gcm: ***  ATTENTION !! grossismx < 1 .   *** '
     641        write(lunout,*)                                                        &
     642     &       'conf_gcm: ***  ATTENTION !! grossismx < 1 .   *** '
    649643         STOP
    650644      ELSE
     
    654648
    655649      IF( grossismy.LT.1. )  THEN
    656         write(lunout,*)
    657      &  'conf_gcm: ***  ATTENTION !! grossismy < 1 .   *** '
     650        write(lunout,*)                                                        &
     651     &       'conf_gcm: ***  ATTENTION !! grossismy < 1 .   *** '
    658652         STOP
    659653      ELSE
     
    662656
    663657      write(lunout,*)'conf_gcm: alphax alphay ',alphax,alphay
    664 c
    665 c    alphax et alphay sont les anciennes formulat. des grossissements
    666 c
    667 c
     658!
     659!    alphax et alphay sont les anciennes formulat. des grossissements
     660!
     661!
    668662
    669663!Config  Key  = fxyhypb
     
    737731c
    738732      IF( ABS(clat - clatt).GE. 0.001 )  THEN
    739         write(lunout,*)'conf_gcm: La valeur de clat passee par run.def',
     733        write(lunout,*)'conf_gcm: La valeur de clat passee par run.def',     &
    740734     &    ' est differente de celle lue sur le fichier  start '
    741735        STOP
     
    752746
    753747      IF( ABS(grossismx - grossismxx).GE. 0.001 )  THEN
    754         write(lunout,*)'conf_gcm: La valeur de grossismx passee par ',
     748        write(lunout,*)'conf_gcm: La valeur de grossismx passee par ',       &
    755749     &  'run.def est differente de celle lue sur le fichier  start '
    756750        STOP
     
    766760
    767761      IF( ABS(grossismy - grossismyy).GE. 0.001 )  THEN
    768         write(lunout,*)'conf_gcm: La valeur de grossismy passee par ',
     762        write(lunout,*)'conf_gcm: La valeur de grossismy passee par ',        &
    769763     & 'run.def est differente de celle lue sur le fichier  start '
    770764        STOP
     
    772766     
    773767      IF( grossismx.LT.1. )  THEN
    774         write(lunout,*)
     768        write(lunout,*)                                                        &
    775769     &       'conf_gcm: ***  ATTENTION !! grossismx < 1 .   *** '
    776770         STOP
     
    781775
    782776      IF( grossismy.LT.1. )  THEN
    783         write(lunout,*)
     777        write(lunout,*)                                                        &
    784778     &       'conf_gcm: ***  ATTENTION !! grossismy < 1 .   *** '
    785779         STOP
     
    789783
    790784      write(lunout,*)'conf_gcm: alphax alphay',alphax,alphay
    791 c
    792 c    alphax et alphay sont les anciennes formulat. des grossissements
    793 c
    794 c
     785!
     786!    alphax et alphay sont les anciennes formulat. des grossissements
     787!
     788!
    795789
    796790!Config  Key  = fxyhypb
     
    805799         IF( fxyhypbb )     THEN
    806800            write(lunout,*)' ********  PBS DANS  CONF_GCM  ******** '
    807             write(lunout,*)' *** fxyhypb lu sur le fichier start est ',
    808      *       'F alors  qu il est  T  sur  run.def  ***'
     801            write(lunout,*)' *** fxyhypb lu sur le fichier start est ',     &
     802     &       'F alors  qu il est  T  sur  run.def  ***'
    809803              STOP
    810804         ENDIF
     
    812806         IF( .NOT.fxyhypbb )   THEN
    813807            write(lunout,*)' ********  PBS DANS  CONF_GCM  ******** '
    814             write(lunout,*)' ***  fxyhypb lu sur le fichier start est ',
    815      *        'T alors  qu il est  F  sur  run.def  ****  '
     808            write(lunout,*)' ***  fxyhypb lu sur le fichier start est ',     &
     809     &        'T alors  qu il est  F  sur  run.def  ****  '
    816810              STOP
    817811         ENDIF
    818812      ENDIF
    819 c
     813!
    820814!Config  Key  = dzoomx
    821815!Config  Desc = extension en longitude
     
    828822      IF( fxyhypb )  THEN
    829823       IF( ABS(dzoomx - dzoomxx).GE. 0.001 )  THEN
    830         write(lunout,*)'conf_gcm: La valeur de dzoomx passee par ',
    831      *  'run.def est differente de celle lue sur le fichier  start '
     824        write(lunout,*)'conf_gcm: La valeur de dzoomx passee par ',         &
     825     &  'run.def est differente de celle lue sur le fichier  start '
    832826        STOP
    833827       ENDIF
     
    844838      IF( fxyhypb )  THEN
    845839       IF( ABS(dzoomy - dzoomyy).GE. 0.001 )  THEN
    846         write(lunout,*)'conf_gcm: La valeur de dzoomy passee par ',
    847      * 'run.def est differente de celle lue sur le fichier  start '
     840        write(lunout,*)'conf_gcm: La valeur de dzoomy passee par ',          &
     841     & 'run.def est differente de celle lue sur le fichier  start '
    848842        STOP
    849843       ENDIF
     
    859853      IF( fxyhypb )  THEN
    860854       IF( ABS(taux - tauxx).GE. 0.001 )  THEN
    861         write(lunout,*)'conf_gcm: La valeur de taux passee par ',
    862      * 'run.def est differente de celle lue sur le fichier  start '
     855        write(lunout,*)'conf_gcm: La valeur de taux passee par ',           &
     856     & 'run.def est differente de celle lue sur le fichier  start '
    863857        STOP
    864858       ENDIF
     
    874868      IF( fxyhypb )  THEN
    875869       IF( ABS(tauy - tauyy).GE. 0.001 )  THEN
    876         write(lunout,*)'conf_gcm: La valeur de tauy passee par ',
    877      * 'run.def est differente de celle lue sur le fichier  start '
     870        write(lunout,*)'conf_gcm: La valeur de tauy passee par ',           &
     871     & 'run.def est differente de celle lue sur le fichier  start '
    878872        STOP
    879873       ENDIF
     
    895889          IF( ysinuss )     THEN
    896890            write(lunout,*)' ********  PBS DANS  CONF_GCM  ******** '
    897             write(lunout,*)' *** ysinus lu sur le fichier start est F',
    898      *       ' alors  qu il est  T  sur  run.def  ***'
     891            write(lunout,*)' *** ysinus lu sur le fichier start est F',     &
     892     &       ' alors  qu il est  T  sur  run.def  ***'
    899893            STOP
    900894          ENDIF
     
    902896          IF( .NOT.ysinuss )   THEN
    903897            write(lunout,*)' ********  PBS DANS  CONF_GCM  ******** '
    904             write(lunout,*)' *** ysinus lu sur le fichier start est T',
    905      *        ' alors  qu il est  F  sur  run.def  ****  '
     898            write(lunout,*)' *** ysinus lu sur le fichier start est T',     &
     899     &        ' alors  qu il est  F  sur  run.def  ****  '
    906900              STOP
    907901          ENDIF
     
    910904
    911905      endif ! etatinit
    912 c----------------------------------------
     906!----------------------------------------
    913907
    914908
     
    962956      write(lunout,*)' ok_limit = ', ok_limit
    963957      write(lunout,*)' ok_etat0 = ', ok_etat0
    964       write(lunout,*)' grilles_gcm_netcdf = ', grilles_gcm_netcdf
    965958      if (planet_type=="titan") then
    966959       write(lunout,*)' moyzon_mu = ', moyzon_mu
  • trunk/LMDZ.COMMON/libf/dyn3d/gcm.F

    r1300 r1302  
    107107      REAL ps(ip1jmp1)                       ! pression  au sol
    108108      REAL p (ip1jmp1,llmp1  )               ! pression aux interfac.des couches
    109       REAL pks(ip1jmp1)                      ! exner au  sol
    110       REAL pk(ip1jmp1,llm)                   ! exner au milieu des couches
    111       REAL pkf(ip1jmp1,llm)                  ! exner filt.au milieu des couches
    112109      REAL masse(ip1jmp1,llm)                ! masse d'air
    113110      REAL phis(ip1jmp1)                     ! geopotentiel au sol
     
    133130      data call_iniphys/.true./
    134131
    135       REAL alpha(ip1jmp1,llm),beta(ip1jmp1,llm)
    136132c+jld variables test conservation energie
    137133c      REAL ecin(ip1jmp1,llm),ecin0(ip1jmp1,llm)
     
    500496c   ------------------------
    501497
    502       day_end=day_ini+nday
     498      if (nday>=0) then ! standard case
     499        day_end=day_ini+nday
     500      else ! special case when nday <0, run -nday dynamical steps
     501        day_end=day_ini-nday/day_step
     502      endif
    503503      if (less1day) then
    504504        day_end=day_ini+floor(time_0+fractday)
  • trunk/LMDZ.COMMON/libf/dyn3d/guide_mod.F90

    r1300 r1302  
    437437! Sauvegarde du guidage?
    438438    f_out=((MOD(itau,iguide_sav).EQ.0).AND.guide_sav) 
    439     IF (f_out) CALL guide_out("S",jjp1,1,ps)
     439    IF (f_out) CALL guide_out("SP",jjp1,1,ps)
    440440   
    441441    if (guide_u) then
     
    447447        if (guide_zon) CALL guide_zonave(1,jjp1,llm,f_add)
    448448        CALL guide_addfield(ip1jmp1,llm,f_add,alpha_u)
    449         IF (f_out) CALL guide_out("U",jjp1,llm,f_add/factt)
     449        IF (f_out) CALL guide_out("ua",jjp1,llm,(1.-tau)*ugui1+tau*ugui2)
     450        IF (f_out) CALL guide_out("u",jjp1,llm,ucov)
     451        IF (f_out) CALL guide_out("ucov",jjp1,llm,f_add/factt)
    450452        ucov=ucov+f_add
    451453    endif
     
    459461        if (guide_zon) CALL guide_zonave(2,jjp1,llm,f_add)
    460462        CALL guide_addfield(ip1jmp1,llm,f_add,alpha_T)
    461         IF (f_out) CALL guide_out("T",jjp1,llm,f_add/factt)
     463        IF (f_out) CALL guide_out("teta",jjp1,llm,f_add/factt)
    462464        teta=teta+f_add
    463465    endif
     
    471473        if (guide_zon) CALL guide_zonave(2,jjp1,1,f_add(1:ip1jmp1,1))
    472474        CALL guide_addfield(ip1jmp1,1,f_add(1:ip1jmp1,1),alpha_P)
    473         IF (f_out) CALL guide_out("P",jjp1,1,f_add(1:ip1jmp1,1)/factt)
     475        IF (f_out) CALL guide_out("ps",jjp1,1,f_add(1:ip1jmp1,1)/factt)
    474476        ps=ps+f_add(1:ip1jmp1,1)
    475477        CALL pression(ip1jmp1,ap,bp,ps,p)
     
    485487        if (guide_zon) CALL guide_zonave(2,jjp1,llm,f_add)
    486488        CALL guide_addfield(ip1jmp1,llm,f_add,alpha_Q)
    487         IF (f_out) CALL guide_out("Q",jjp1,llm,f_add/factt)
     489        IF (f_out) CALL guide_out("q",jjp1,llm,f_add/factt)
    488490        q=q+f_add
    489491    endif
     
    497499        if (guide_zon) CALL guide_zonave(2,jjm,llm,f_add(1:ip1jm,:))
    498500        CALL guide_addfield(ip1jm,llm,f_add(1:ip1jm,:),alpha_v)
    499         IF (f_out) CALL guide_out("V",jjm,llm,f_add(1:ip1jm,:)/factt)
     501        IF (f_out) CALL guide_out("v",jjm,llm,vcov)
     502        IF (f_out) CALL guide_out("va",jjm,llm,(1.-tau)*vgui1+tau*vgui2)
     503        IF (f_out) CALL guide_out("vcov",jjm,llm,f_add(1:ip1jm,:)/factt)
    500504        vcov=vcov+f_add(1:ip1jm,:)
    501505    endif
     
    589593  SUBROUTINE guide_interp(psi,teta)
    590594 
     595  use exner_hyb_m, only: exner_hyb
     596  use exner_milieu_m, only: exner_milieu
    591597  IMPLICIT NONE
    592598
     
    610616  REAL, DIMENSION (iip1,jjm,llm)     :: pbary
    611617  ! Variables pour fonction Exner (P milieu couche)
    612   REAL, DIMENSION (iip1,jjp1,llm)    :: pk, pkf
    613   REAL, DIMENSION (iip1,jjp1,llm)    :: alpha, beta
     618  REAL, DIMENSION (iip1,jjp1,llm)    :: pk
    614619  REAL, DIMENSION (iip1,jjp1)        :: pks   
    615620  REAL                               :: prefkap,unskap
     
    676681    CALL pression( ip1jmp1, ap, bp, psi, p )
    677682    if (pressure_exner) then
    678       CALL exner_hyb(ip1jmp1,psi,p,alpha,beta,pks,pk,pkf)
     683      CALL exner_hyb(ip1jmp1,psi,p,pks,pk)
    679684    else
    680       CALL exner_milieu(ip1jmp1,psi,p,beta,pks,pk,pkf)
     685      CALL exner_milieu(ip1jmp1,psi,p,pks,pk)
    681686    endif
    682687!    ....  Calcul de pls , pression au milieu des couches ,en Pascals
     
    15071512   
    15081513    ! Variables entree
    1509     CHARACTER, INTENT(IN)                          :: varname
     1514    CHARACTER*(*), INTENT(IN)                          :: varname
    15101515    INTEGER,   INTENT (IN)                         :: hsize,vsize
    15111516    REAL, DIMENSION (iip1,hsize,vsize), INTENT(IN) :: field
     
    15161521    INTEGER       :: nid, id_lonu, id_lonv, id_latu, id_latv, id_tim, id_lev
    15171522    INTEGER       :: vid_lonu,vid_lonv,vid_latu,vid_latv,vid_cu,vid_cv,vid_lev
     1523    INTEGER       :: vid_au,vid_av
    15181524    INTEGER, DIMENSION (3) :: dim3
    15191525    INTEGER, DIMENSION (4) :: dim4,count,start
    1520     INTEGER                :: ierr, varid
     1526    INTEGER                :: ierr, varid,l
     1527    REAL, DIMENSION (iip1,hsize,vsize) :: field2
    15211528
    15221529    print *,'Guide: output timestep',timestep,'var ',varname
     
    15421549        ierr=NF_DEF_VAR(nid,"LEVEL",NF_FLOAT,1,id_lev,vid_lev)
    15431550        ierr=NF_DEF_VAR(nid,"cu",NF_FLOAT,2,(/id_lonu,id_latu/),vid_cu)
     1551        ierr=NF_DEF_VAR(nid,"au",NF_FLOAT,2,(/id_lonu,id_latu/),vid_au)
    15441552        ierr=NF_DEF_VAR(nid,"cv",NF_FLOAT,2,(/id_lonv,id_latv/),vid_cv)
     1553        ierr=NF_DEF_VAR(nid,"av",NF_FLOAT,2,(/id_lonv,id_latv/),vid_av)
    15451554       
    15461555        ierr=NF_ENDDEF(nid)
     
    15551564        ierr = NF_PUT_VAR_DOUBLE(nid,vid_cu,cu)
    15561565        ierr = NF_PUT_VAR_DOUBLE(nid,vid_cv,cv)
     1566        ierr = NF_PUT_VAR_DOUBLE(nid,vid_au,alpha_u)
     1567        ierr = NF_PUT_VAR_DOUBLE(nid,vid_av,alpha_v)
    15571568#else
    15581569        ierr = NF_PUT_VAR_REAL(nid,vid_lonu,rlonu*180./pi)
     
    15631574        ierr = NF_PUT_VAR_REAL(nid,vid_cu,cu)
    15641575        ierr = NF_PUT_VAR_REAL(nid,vid_cv,cv)
     1576        ierr = NF_PUT_VAR_REAL(nid,vid_au,alpha_u)
     1577        ierr = NF_PUT_VAR_REAL(nid,vid_av,alpha_v)
    15651578#endif
    15661579! --------------------------------------------------------------------
     
    15791592        IF (guide_u) THEN
    15801593            dim4=(/id_lonu,id_latu,id_lev,id_tim/)
     1594            ierr = NF_DEF_VAR(nid,"u",NF_FLOAT,4,dim4,varid)
     1595            ierr = NF_DEF_VAR(nid,"ua",NF_FLOAT,4,dim4,varid)
    15811596            ierr = NF_DEF_VAR(nid,"ucov",NF_FLOAT,4,dim4,varid)
    15821597        ENDIF
     
    15841599        IF (guide_v) THEN
    15851600            dim4=(/id_lonv,id_latv,id_lev,id_tim/)
     1601            ierr = NF_DEF_VAR(nid,"v",NF_FLOAT,4,dim4,varid)
     1602            ierr = NF_DEF_VAR(nid,"va",NF_FLOAT,4,dim4,varid)
    15861603            ierr = NF_DEF_VAR(nid,"vcov",NF_FLOAT,4,dim4,varid)
    15871604        ENDIF
     
    16061623    ierr=NF_OPEN("guide_ins.nc",NF_WRITE,nid)
    16071624
     1625    IF (varname=="SP") timestep=timestep+1
     1626
     1627    ierr = NF_INQ_VARID(nid,varname,varid)
    16081628    SELECT CASE (varname)
    1609     CASE ("S")
    1610         timestep=timestep+1
    1611         ierr = NF_INQ_VARID(nid,"SP",varid)
     1629    CASE ("SP","ps")
    16121630        start=(/1,1,timestep,0/)
    16131631        count=(/iip1,jjp1,1,0/)
    1614 #ifdef NC_DOUBLE
    1615         ierr = NF_PUT_VARA_DOUBLE(nid,varid,start,count,field)
    1616 #else
    1617         ierr = NF_PUT_VARA_REAL(nid,varid,start,count,field)
    1618 #endif
    1619     CASE ("P")
    1620         ierr = NF_INQ_VARID(nid,"ps",varid)
    1621         start=(/1,1,timestep,0/)
    1622         count=(/iip1,jjp1,1,0/)
    1623 #ifdef NC_DOUBLE
    1624         ierr = NF_PUT_VARA_DOUBLE(nid,varid,start,count,field)
    1625 #else
    1626         ierr = NF_PUT_VARA_REAL(nid,varid,start,count,field)
    1627 #endif
    1628     CASE ("U")
    1629         ierr = NF_INQ_VARID(nid,"ucov",varid)
     1632    CASE ("v","va","vcov")
     1633        start=(/1,1,1,timestep/)
     1634        count=(/iip1,jjm,llm,1/)
     1635    CASE DEFAULT
    16301636        start=(/1,1,1,timestep/)
    16311637        count=(/iip1,jjp1,llm,1/)
     1638    END SELECT
     1639
     1640    SELECT CASE (varname)
     1641    CASE("u","ua")
     1642        DO l=1,llm ; field2(:,2:jjm,l)=field(:,2:jjm,l)/cu(:,2:jjm) ; ENDDO
     1643        field2(:,1,:)=0. ; field2(:,jjp1,:)=0.
     1644    CASE("v","va")
     1645        DO l=1,llm ; field2(:,:,l)=field(:,:,l)/cv(:,:) ; ENDDO
     1646    CASE DEFAULT
     1647        field2=field
     1648    END SELECT
     1649
     1650
    16321651#ifdef NC_DOUBLE
    1633         ierr = NF_PUT_VARA_DOUBLE(nid,varid,start,count,field)
     1652    ierr = NF_PUT_VARA_DOUBLE(nid,varid,start,count,field2)
    16341653#else
    1635         ierr = NF_PUT_VARA_REAL(nid,varid,start,count,field)
     1654    ierr = NF_PUT_VARA_REAL(nid,varid,start,count,field2)
    16361655#endif
    1637     CASE ("V")
    1638         ierr = NF_INQ_VARID(nid,"vcov",varid)
    1639         start=(/1,1,1,timestep/)
    1640         count=(/iip1,jjm,llm,1/)
    1641 #ifdef NC_DOUBLE
    1642         ierr = NF_PUT_VARA_DOUBLE(nid,varid,start,count,field)
    1643 #else
    1644         ierr = NF_PUT_VARA_REAL(nid,varid,start,count,field)
    1645 #endif
    1646     CASE ("T")
    1647         ierr = NF_INQ_VARID(nid,"teta",varid)
    1648         start=(/1,1,1,timestep/)
    1649         count=(/iip1,jjp1,llm,1/)
    1650 #ifdef NC_DOUBLE
    1651         ierr = NF_PUT_VARA_DOUBLE(nid,varid,start,count,field)
    1652 #else
    1653         ierr = NF_PUT_VARA_REAL(nid,varid,start,count,field)
    1654 #endif
    1655     CASE ("Q")
    1656         ierr = NF_INQ_VARID(nid,"q",varid)
    1657         start=(/1,1,1,timestep/)
    1658         count=(/iip1,jjp1,llm,1/)
    1659 #ifdef NC_DOUBLE
    1660         ierr = NF_PUT_VARA_DOUBLE(nid,varid,start,count,field)
    1661 #else
    1662         ierr = NF_PUT_VARA_REAL(nid,varid,start,count,field)
    1663 #endif
    1664     END SELECT
    1665  
     1656
    16661657    ierr = NF_CLOSE(nid)
    16671658
  • trunk/LMDZ.COMMON/libf/dyn3d/leapfrog.F

    r1189 r1302  
    2020     &                       ok_dynzon,periodav,ok_dyn_ave,iecri,
    2121     &                       ok_dyn_ins,output_grads_dyn
     22      use exner_hyb_m, only: exner_hyb
     23      use exner_milieu_m, only: exner_milieu
    2224      use cpdet_mod, only: cpdet,tpot2t,t2tpot
    2325      use sponge_mod, only: callsponge,mode_sponge,sponge
     
    217219      endif
    218220
    219       itaufin   = nday*day_step
     221      if (nday>=0) then
     222         itaufin   = nday*day_step
     223      else
     224         ! to run a given (-nday) number of dynamical steps
     225         itaufin   = -nday
     226      endif
    220227      if (less1day) then
    221228c MODIF VENUS: to run less than one day:
     
    262269      CALL pression ( ip1jmp1, ap, bp, ps, p       )
    263270      if (pressure_exner) then
    264         CALL exner_hyb( ip1jmp1, ps, p,alpha,beta, pks, pk, pkf )
     271        CALL exner_hyb( ip1jmp1, ps, p, pks, pk, pkf )
    265272      else
    266         CALL exner_milieu( ip1jmp1, ps, p, beta, pks, pk, pkf )
     273        CALL exner_milieu( ip1jmp1, ps, p, pks, pk, pkf )
    267274      endif
    268275
     
    476483         CALL pression (  ip1jmp1, ap, bp, ps,  p      )
    477484         if (pressure_exner) then
    478            CALL exner_hyb(  ip1jmp1, ps, p,alpha,beta,pks, pk, pkf )
     485           CALL exner_hyb(  ip1jmp1, ps, p,pks, pk, pkf )
    479486         else
    480            CALL exner_milieu( ip1jmp1, ps, p, beta, pks, pk, pkf )
     487           CALL exner_milieu( ip1jmp1, ps, p, pks, pk, pkf )
    481488         endif
     489
     490! Compute geopotential (physics might need it)
     491         CALL geopot  ( ip1jmp1, teta  , pk , pks,  phis  , phi   )
    482492
    483493           jD_cur = jD_ref + day_ini - day_ref +                        &
     
    551561          CALL massdair(p,masse)
    552562          if (pressure_exner) then
    553             CALL exner_hyb(ip1jmp1,ps,p,alpha,beta,pks,pk,pkf)
     563            CALL exner_hyb( ip1jmp1, ps, p, pks, pk, pkf )
    554564          else
    555             CALL exner_milieu(ip1jmp1,ps,p,beta,pks,pk,pkf)
     565            CALL exner_milieu( ip1jmp1, ps, p, pks, pk, pkf )
    556566          endif
    557567         
     
    604614        CALL pression ( ip1jmp1, ap, bp, ps, p                  )
    605615        if (pressure_exner) then
    606           CALL exner_hyb( ip1jmp1, ps, p,alpha,beta, pks, pk, pkf )
     616          CALL exner_hyb( ip1jmp1, ps, p, pks, pk, pkf )
    607617        else
    608           CALL exner_milieu( ip1jmp1, ps, p, beta, pks, pk, pkf )
     618          CALL exner_milieu( ip1jmp1, ps, p, pks, pk, pkf )
    609619        endif
    610620        CALL massdair(p,masse)
  • trunk/LMDZ.COMMON/libf/dyn3d/logic.h

    r1056 r1302  
    1111     &  statcl,conser,apdiss,apdelq,saison,ecripar,fxyhypb,ysinus       &
    1212     &  ,read_start,ok_guide,ok_strato,tidal,ok_gradsfile               &
    13      &  ,ok_limit,ok_etat0,grilles_gcm_netcdf,hybrid                    &
     13     &  ,ok_limit,ok_etat0,hybrid                                       &
    1414     &  ,moyzon_mu,moyzon_ch
    1515
     
    1919     & apdiss,apdelq,saison,ecripar,fxyhypb,ysinus                      &
    2020     &  ,read_start,ok_guide,ok_strato,tidal,ok_gradsfile               &
    21      &  ,ok_limit,ok_etat0,grilles_gcm_netcdf
     21     &  ,ok_limit,ok_etat0
     22
    2223      logical hybrid ! vertical coordinate is hybrid if true (sigma otherwise)
    2324                     ! (only used if disvert_type==2)
  • trunk/LMDZ.COMMON/libf/dyn3d_common/disvert.F90

    r1300 r1302  
    11! $Id: disvert.F90 1645 2012-07-30 16:01:50Z lguez $
    22
    3 SUBROUTINE disvert(pa,preff,ap,bp,dpres,presnivs,nivsigs,nivsig,scaleheight)
     3SUBROUTINE disvert()
    44
    55  ! Auteur : P. Le Van
    66
     7#ifdef CPP_IOIPSL
     8  use ioipsl, only: getin
     9#else
     10  USE ioipsl_getincom, only: getin
     11#endif
    712  use new_unit_m, only: new_unit
    8   use ioipsl, only: getin
    913  use assert_m, only: assert
    1014
     
    1317  include "dimensions.h"
    1418  include "paramet.h"
     19  include "comvert.h"
     20  include "comconst.h"
    1521  include "iniprint.h"
    1622  include "logic.h"
    1723
    18   ! s = sigma ** kappa : coordonnee verticale
    19   ! dsig(l) : epaisseur de la couche l ds la coord. s
    20   ! sig(l) : sigma a l'interface des couches l et l-1
    21   ! ds(l) : distance entre les couches l et l-1 en coord.s
    22 
    23   real,intent(in) :: pa, preff
    24   real,intent(out) :: ap(llmp1) ! in Pa
    25   real, intent(out):: bp(llmp1)
    26   real,intent(out) :: dpres(llm), nivsigs(llm), nivsig(llmp1)
    27   real,intent(out) :: presnivs(llm)
    28   real,intent(out) :: scaleheight
    29 
     24!-------------------------------------------------------------------------------
     25! Purpose: Vertical distribution functions for LMDZ.
     26!          Triggered by the levels number llm.
     27!-------------------------------------------------------------------------------
     28! Read    in "comvert.h":
     29! pa                         !--- PURE PRESSURE COORDINATE FOR P<pa (in Pascals)
     30! preff                      !--- REFERENCE PRESSURE                 (101325 Pa)
     31! Written in "comvert.h":
     32! ap(llm+1), bp(llm+1)       !--- Ap, Bp HYBRID COEFFICIENTS AT INTERFACES
     33! aps(llm),  bps(llm)        !--- Ap, Bp HYBRID COEFFICIENTS AT MID-LAYERS
     34! dpres(llm)                 !--- PRESSURE DIFFERENCE FOR EACH LAYER
     35! presnivs(llm)              !--- PRESSURE AT EACH MID-LAYER
     36! scaleheight                !--- VERTICAL SCALE HEIGHT            (Earth: 8kms)
     37! nivsig(llm+1)              !--- SIGMA INDEX OF EACH LAYER INTERFACE
     38! nivsigs(llm)               !--- SIGMA INDEX OF EACH MID-LAYER
     39!-------------------------------------------------------------------------------
     40! Local variables:
    3041  REAL sig(llm+1), dsig(llm)
    31   real zk, zkm1, dzk1, dzk2, k0, k1
     42  REAL sig0(llm+1), zz(llm+1)
     43  REAL zk, zkm1, dzk1, dzk2, z, k0, k1
    3244
    3345  INTEGER l, unit
    3446  REAL dsigmin
     47  REAL vert_scale,vert_dzmin,vert_dzlow,vert_z0low,vert_dzmid,vert_z0mid,vert_h_mid,vert_dzhig,vert_z0hig,vert_h_hig
     48
    3549  REAL alpha, beta, deltaz
    3650  REAL x
    3751  character(len=*),parameter :: modname="disvert"
    3852
    39   character(len=6):: vert_sampling
     53  character(len=24):: vert_sampling
    4054  ! (allowed values are "param", "tropo", "strato" and "read")
    4155
    4256  !-----------------------------------------------------------------------
    4357
    44   print *, "Call sequence information: disvert"
     58  WRITE(lunout,*) TRIM(modname)//" starts"
    4559
    4660  ! default scaleheight is 8km for earth
     
    4963  vert_sampling = merge("strato", "tropo ", ok_strato) ! default value
    5064  call getin('vert_sampling', vert_sampling)
    51   print *, 'vert_sampling = ' // vert_sampling
     65  WRITE(lunout,*) TRIM(modname)//' vert_sampling = ' // vert_sampling
     66  if (llm==39 .and. vert_sampling=="strato") then
     67     dsigmin=0.3 ! Vieille option par défaut pour CMIP5
     68  else
     69     dsigmin=1.
     70  endif
     71  call getin('dsigmin', dsigmin)
     72  WRITE(LUNOUT,*) trim(modname), 'Discretisation verticale DSIGMIN=',dsigmin
     73
    5274
    5375  select case (vert_sampling)
     
    86108
    87109     ap = pa * (sig - bp)
    88   case("tropo")
     110  case("sigma")
    89111     DO l = 1, llm
    90112        x = 2*asin(1.) * (l - 0.5) / (llm + 1)
    91         dsig(l) = 1.0 + 7.0 * SIN(x)**2
     113        dsig(l) = dsigmin + 7.0 * SIN(x)**2
    92114     ENDDO
    93115     dsig = dsig / sum(dsig)
     
    98120
    99121     bp(1)=1.
     122     bp(2: llm) = sig(2:llm)
     123     bp(llmp1) = 0.
     124     ap(:)=0.
     125  case("tropo")
     126     DO l = 1, llm
     127        x = 2*asin(1.) * (l - 0.5) / (llm + 1)
     128        dsig(l) = dsigmin + 7.0 * SIN(x)**2
     129     ENDDO
     130     dsig = dsig / sum(dsig)
     131     sig(llm+1) = 0.
     132     DO l = llm, 1, -1
     133        sig(l) = sig(l+1) + dsig(l)
     134     ENDDO
     135
     136     bp(1)=1.
    100137     bp(2: llm) = EXP(1. - 1. / sig(2: llm)**2)
    101138     bp(llmp1) = 0.
     
    104141     ap(2: llm + 1) = pa * (sig(2: llm + 1) - bp(2: llm + 1))
    105142  case("strato")
    106      if (llm==39) then
    107         dsigmin=0.3
    108      else if (llm==50) then
    109         dsigmin=1.
    110      else
    111         write(lunout,*) trim(modname), ' ATTENTION discretisation z a ajuster'
    112         dsigmin=1.
    113      endif
    114      WRITE(LUNOUT,*) trim(modname), 'Discretisation verticale DSIGMIN=',dsigmin
    115 
    116143     DO l = 1, llm
    117144        x = 2*asin(1.) * (l - 0.5) / (llm + 1)
     
    131158     ap(1)=0.
    132159     ap(2: llm + 1) = pa * (sig(2: llm + 1) - bp(2: llm + 1))
     160  case("strato_correct")
     161!==================================================================
     162! Fredho 2014/05/18, Saint-Louis du Senegal
     163! Cette version de la discretisation strato est corrige au niveau
     164! du passage des sig aux ap, bp
     165! la version precedente donne un coude dans l'epaisseur des couches
     166! vers la tropopause
     167!==================================================================
     168
     169
     170     DO l = 1, llm
     171        x = 2*asin(1.) * (l - 0.5) / (llm + 1)
     172        dsig(l) =(dsigmin + 7. * SIN(x)**2) &
     173             *(0.5*(1.-tanh(1.*(x-asin(1.))/asin(1.))))**2
     174     ENDDO
     175     dsig = dsig / sum(dsig)
     176     sig0(llm+1) = 0.
     177     DO l = llm, 1, -1
     178        sig0(l) = sig0(l+1) + dsig(l)
     179     ENDDO
     180     sig=racinesig(sig0)
     181
     182     bp(1)=1.
     183     bp(2:llm)=EXP(1.-1./sig(2: llm)**2)
     184     bp(llmp1)=0.
     185
     186     ap(1)=0.
     187     ap(2:llm)=pa*(sig(2:llm)-bp(2:llm))
     188     ap(llm+1)=0.
     189
     190  CASE("strato_custom0")
     191!=======================================================
     192! Version Transitoire
     193    ! custumize strato distribution with specific alpha & beta values and function
     194    ! depending on llm (experimental and temporary)!
     195    SELECT CASE (llm)
     196      CASE(55)
     197        alpha=0.45
     198        beta=4.0
     199      CASE(63)
     200        alpha=0.45
     201        beta=5.0
     202      CASE(71)
     203        alpha=3.05
     204        beta=65.
     205      CASE(79)
     206        alpha=3.20
     207        ! alpha=2.05 ! FLOTT 79 (PLANTE)
     208        beta=70.
     209    END SELECT
     210    ! Or used values provided by user in def file:
     211    CALL getin("strato_alpha",alpha)
     212    CALL getin("strato_beta",beta)
     213   
     214    ! Build geometrical distribution
     215    scaleheight=7.
     216    zz(1)=0.
     217    IF (llm==55.OR.llm==63) THEN
     218      DO l=1,llm
     219        z=zz(l)/scaleheight
     220        zz(l+1)=zz(l)+0.03+z*1.5*(1.-TANH(z-0.5))+alpha*(1.+TANH(z-1.5))     &
     221                            +5.0*EXP((l-llm)/beta)
     222      ENDDO
     223    ELSEIF (llm==71) THEN !.OR.llm==79) THEN      ! FLOTT 79 (PLANTE)
     224      DO l=1,llm
     225        z=zz(l)
     226        zz(l+1)=zz(l)+0.02+0.88*TANH(z/2.5)+alpha*(1.+TANH((z-beta)/15.))
     227      ENDDO
     228    ELSEIF (llm==79) THEN
     229      DO l=1,llm
     230        z=zz(l)
     231        zz(l+1)=zz(l)+0.02+0.80*TANH(z/3.8)+alpha*(1+TANH((z-beta)/17.))     &
     232                            +0.03*TANH(z/.25)
     233      ENDDO
     234    ENDIF ! of IF (llm==55.OR.llm==63) ...
     235   
     236
     237    ! Build sigma distribution
     238    sig0=EXP(-zz(:)/scaleheight)
     239    sig0(llm+1)=0.
     240!    sig=ridders(sig0)
     241    sig=racinesig(sig0)
     242   
     243    ! Compute ap() and bp()
     244    bp(1)=1.
     245    bp(2:llm)=EXP(1.-1./sig(2:llm)**2)
     246    bp(llm+1)=0.
     247    ap=pa*(sig-bp)
     248
     249  CASE("strato_custom")
     250!===================================================================
     251! David Cugnet, François Lott, Lionel Guez, Ehouoarn Millour, Fredho
     252! 2014/05
     253! custumize strato distribution
     254! Al the parameter are given in km assuming a given scalehigh
     255    vert_scale=7.     ! scale hight
     256    vert_dzmin=0.02   ! width of first layer
     257    vert_dzlow=1.     ! dz in the low atmosphere
     258    vert_z0low=8.     ! height at which resolution recches dzlow
     259    vert_dzmid=3.     ! dz in the mid atmsophere
     260    vert_z0mid=70.    ! height at which resolution recches dzmid
     261    vert_h_mid=20.    ! width of the transition
     262    vert_dzhig=11.    ! dz in the high atmsophere
     263    vert_z0hig=80.    ! height at which resolution recches dz
     264    vert_h_hig=20.    ! width of the transition
     265!===================================================================
     266
     267    call getin('vert_scale',vert_scale)
     268    call getin('vert_dzmin',vert_dzmin)
     269    call getin('vert_dzlow',vert_dzlow)
     270    call getin('vert_z0low',vert_z0low)
     271    CALL getin('vert_dzmid',vert_dzmid)
     272    CALL getin('vert_z0mid',vert_z0mid)
     273    call getin('vert_h_mid',vert_h_mid)
     274    call getin('vert_dzhig',vert_dzhig)
     275    call getin('vert_z0hig',vert_z0hig)
     276    call getin('vert_h_hig',vert_h_hig)
     277
     278    scaleheight=vert_scale ! for consistency with further computations
     279    ! Build geometrical distribution
     280    zz(1)=0.
     281    DO l=1,llm
     282       z=zz(l)
     283       zz(l+1)=zz(l)+vert_dzmin+vert_dzlow*TANH(z/vert_z0low)+                &
     284&      (vert_dzmid-vert_dzlow)* &
     285&           (TANH((z-vert_z0mid)/vert_h_mid)-TANH((-vert_z0mid)/vert_h_mid)) &
     286&     +(vert_dzhig-vert_dzmid-vert_dzlow)*                                  &
     287&           (TANH((z-vert_z0hig)/vert_h_hig)-TANH((-vert_z0hig)/vert_h_hig))
     288    ENDDO
     289
     290
     291!===================================================================
     292! Comment added Fredho 2014/05/18, Saint-Louis, Senegal
     293! From approximate z to ap, bp, so that p=ap+bp*p0 and p/p0=exp(-z/H)
     294! sig0 is p/p0
     295! sig is an intermediate distribution introduce to estimate bp
     296! 1.   sig0=exp(-z/H)
     297! 2.   inversion of sig0=(1-pa/p0)*sig+(1-pa/p0)*exp(1-1/sig**2)
     298! 3.   bp=exp(1-1/sig**2)
     299! 4.   ap deduced from  the combination of 2 and 3 so that sig0=ap/p0+bp
     300!===================================================================
     301
     302    sig0=EXP(-zz(:)/vert_scale)
     303    sig0(llm+1)=0.
     304    sig=racinesig(sig0)
     305    bp(1)=1.
     306    bp(2:llm)=EXP(1.-1./sig(2:llm)**2)
     307    bp(llm+1)=0.
     308    ap=pa*(sig-bp)
     309
    133310  case("read")
    134311     ! Read "ap" and "bp". First line is skipped (title line). "ap"
     
    178355  write(lunout, *) presnivs
    179356
     357CONTAINS
     358
     359!-------------------------------------------------------------------------------
     360!
     361FUNCTION ridders(sig) RESULT(sg)
     362!
     363!-------------------------------------------------------------------------------
     364  IMPLICIT NONE
     365!-------------------------------------------------------------------------------
     366! Purpose: Search for s solving (Pa/Preff)*s+(1-Pa/Preff)*EXP(1-1./s**2)=sg
     367! Notes:   Uses Ridders' method, quite robust. Initial bracketing: 0<=sg<=1.
     368! Reference: Ridders, C. F. J. "A New Algorithm for Computing a Single Root of a
     369!       Real Continuous Function" IEEE Trans. Circuits Systems 26, 979-980, 1979
     370!-------------------------------------------------------------------------------
     371! Arguments:
     372  REAL, INTENT(IN)  :: sig(:)
     373  REAL              :: sg(SIZE(sig))
     374!-------------------------------------------------------------------------------
     375! Local variables:
     376  INTEGER :: it, ns, maxit
     377  REAL :: c1, c2, x1, x2, x3, x4, f1, f2, f3, f4, s, xx, distrib
     378!-------------------------------------------------------------------------------
     379  ns=SIZE(sig); maxit=9999
     380  c1=Pa/Preff; c2=1.-c1
     381  DO l=1,ns
     382    xx=HUGE(1.)
     383    x1=0.0; f1=distrib(x1,c1,c2,sig(l))
     384    x2=1.0; f2=distrib(x2,c1,c2,sig(l))
     385    DO it=1,maxit
     386      x3=0.5*(x1+x2); f3=distrib(x3,c1,c2,sig(l))
     387      s=SQRT(f3**2-f1*f2);                 IF(s==0.) EXIT
     388      x4=x3+(x3-x1)*(SIGN(1.,f1-f2)*f3/s); IF(ABS(10.*LOG(x4-xx))<=1E-5) EXIT
     389      xx=x4; f4=distrib(x4,c1,c2,sig(l));  IF(f4==0.) EXIT
     390      IF(SIGN(f3,f4)/=f3) THEN;      x1=x3; f1=f3; x2=xx; f2=f4
     391      ELSE IF(SIGN(f1,f4)/=f1) THEN; x2=xx; f2=f4
     392      ELSE IF(SIGN(f2,f4)/=f2) THEN; x1=xx; f1=f4
     393      ELSE; CALL abort_gcm("ridders",'Algorithm failed (which is odd...')
     394      END IF
     395      IF(ABS(10.*LOG(ABS(x2-x1)))<=1E-5) EXIT       !--- ERROR ON SIG <= 0.01m           
     396    END DO
     397    IF(it==maxit+1) WRITE(lunout,'(a,i3)')'WARNING in ridder: failed to converg&
     398     &e for level ',l
     399    sg(l)=xx
     400  END DO
     401  sg(1)=1.; sg(ns)=0.
     402
     403END FUNCTION ridders
     404
     405FUNCTION racinesig(sig) RESULT(sg)
     406!
     407!-------------------------------------------------------------------------------
     408  IMPLICIT NONE
     409!-------------------------------------------------------------------------------
     410! Fredho 2014/05/18
     411! Purpose: Search for s solving (Pa/Preff)*sg+(1-Pa/Preff)*EXP(1-1./sg**2)=s
     412! Notes:   Uses Newton Raphson search
     413!-------------------------------------------------------------------------------
     414! Arguments:
     415  REAL, INTENT(IN)  :: sig(:)
     416  REAL              :: sg(SIZE(sig))
     417!-------------------------------------------------------------------------------
     418! Local variables:
     419  INTEGER :: it, ns, maxit
     420  REAL :: c1, c2, x1, x2, x3, x4, f1, f2, f3, f4, s, xx, distrib
     421!-------------------------------------------------------------------------------
     422  ns=SIZE(sig); maxit=100
     423  c1=Pa/Preff; c2=1.-c1
     424  DO l=2,ns-1
     425    sg(l)=sig(l)
     426    DO it=1,maxit
     427       f1=exp(1-1./sg(l)**2)*(1.-c1)
     428       sg(l)=sg(l)-(c1*sg(l)+f1-sig(l))/(c1+2*f1*sg(l)**(-3))
     429    ENDDO
     430!   print*,'SSSSIG ',sig(l),sg(l),c1*sg(l)+exp(1-1./sg(l)**2)*(1.-c1)
     431  ENDDO
     432  sg(1)=1.; sg(ns)=0.
     433
     434END FUNCTION racinesig
     435
     436
     437
     438
    180439END SUBROUTINE disvert
     440
     441!-------------------------------------------------------------------------------
     442
     443FUNCTION distrib(x,c1,c2,x0) RESULT(res)
     444!
     445!-------------------------------------------------------------------------------
     446! Arguments:
     447  REAL, INTENT(IN) :: x, c1, c2, x0
     448  REAL             :: res
     449!-------------------------------------------------------------------------------
     450  res=c1*x+c2*EXP(1-1/(x**2))-x0
     451
     452END FUNCTION distrib
     453
     454
     455
  • trunk/LMDZ.COMMON/libf/dyn3d_common/exner_hyb_m.F90

    r1300 r1302  
    1 !
    2 ! $Id $
    3 !
    4       SUBROUTINE  exner_hyb ( ngrid, ps, p,alpha,beta, pks, pk, pkf )
    5 c
    6 c     Auteurs :  P.Le Van  , Fr. Hourdin  .
    7 c    ..........
    8 c
    9 c    ....  ngrid, ps,p             sont des argum.d'entree  au sous-prog ...
    10 c    .... alpha,beta, pks,pk,pkf   sont des argum.de sortie au sous-prog ...
    11 c
    12 c   ************************************************************************
    13 c    Calcule la fonction d'Exner pk = Cp * p ** kappa , aux milieux des
    14 c    couches .   Pk(l) sera calcule aux milieux  des couches l ,entre les
    15 c    pressions p(l) et p(l+1) ,definis aux interfaces des llm couches .
    16 c   ************************************************************************
    17 c  .. N.B : Au sommet de l'atmosphere,  p(llm+1) = 0. , et ps et pks sont
    18 c    la pression et la fonction d'Exner  au  sol  .
    19 c
    20 c                                 -------- z                                   
    21 c    A partir des relations  ( 1 ) p*dz(pk) = kappa *pk*dz(p)      et
    22 c                            ( 2 ) pk(l) = alpha(l)+ beta(l)*pk(l-1)
    23 c    ( voir note de Fr.Hourdin )  ,
    24 c
    25 c    on determine successivement , du haut vers le bas des couches, les
    26 c    coef. alpha(llm),beta(llm) .,.,alpha(l),beta(l),,,alpha(2),beta(2),
    27 c    puis pk(ij,1). Ensuite ,on calcule,du bas vers le haut des couches, 
    28 c     pk(ij,l)  donne  par la relation (2),  pour l = 2 a l = llm .
    29 c
    30 c
    31       IMPLICIT NONE
    32 c
    33 #include "dimensions.h"
    34 #include "paramet.h"
    35 #include "comconst.h"
    36 #include "comgeom.h"
    37 #include "comvert.h"
    38 #include "serre.h"
     1module exner_hyb_m
    392
    40       INTEGER  ngrid
    41       REAL p(ngrid,llmp1),pk(ngrid,llm),pkf(ngrid,llm)
    42       REAL ps(ngrid),pks(ngrid), alpha(ngrid,llm),beta(ngrid,llm)
     3  IMPLICIT NONE
    434
    44 c    .... variables locales   ...
     5contains
    456
    46       INTEGER l, ij
    47       REAL unpl2k,dellta
     7  SUBROUTINE  exner_hyb ( ngrid, ps, p, pks, pk, pkf )
    488
    49       REAL ppn(iim),pps(iim)
    50       REAL xpn, xps
    51       REAL SSUM
    52 c
    53       logical,save :: firstcall=.true.
    54       character(len=*),parameter :: modname="exner_hyb"
    55      
    56       ! Sanity check
    57       if (firstcall) then
    58         ! sanity checks for Shallow Water case (1 vertical layer)
    59         if (llm.eq.1) then
     9    !     Auteurs :  P.Le Van  , Fr. Hourdin  .
     10    !    ..........
     11    !
     12    !    ....  ngrid, ps,p             sont des argum.d'entree  au sous-prog ...
     13    !    ....  pks,pk,pkf   sont des argum.de sortie au sous-prog ...
     14    !
     15    !   ************************************************************************
     16    !    Calcule la fonction d'Exner pk = Cp * (p/preff) ** kappa , aux milieux des
     17    !    couches .   Pk(l) sera calcule aux milieux  des couches l ,entre les
     18    !    pressions p(l) et p(l+1) ,definis aux interfaces des llm couches .
     19    !   ************************************************************************
     20    !  .. N.B : Au sommet de l'atmosphere,  p(llm+1) = 0. , et ps et pks sont
     21    !    la pression et la fonction d'Exner  au  sol  .
     22    !
     23    !                                 -------- z
     24    !    A partir des relations  ( 1 ) p*dz(pk) = kappa *pk*dz(p)      et
     25    !                            ( 2 ) pk(l) = alpha(l)+ beta(l)*pk(l-1)
     26    !    ( voir note de Fr.Hourdin )  ,
     27    !
     28    !    on determine successivement , du haut vers le bas des couches, les
     29    !    coef. alpha(llm),beta(llm) .,.,alpha(l),beta(l),,,alpha(2),beta(2),
     30    !    puis pk(ij,1). Ensuite ,on calcule,du bas vers le haut des couches, 
     31    !     pk(ij,l)  donne  par la relation (2),  pour l = 2 a l = llm .
     32    !
     33    !
     34    !
     35    include "dimensions.h"
     36    include "paramet.h"
     37    include "comconst.h"
     38    include "comgeom.h"
     39    include "comvert.h"
     40    include "serre.h"
     41
     42    INTEGER  ngrid
     43    REAL p(ngrid,llmp1),pk(ngrid,llm)
     44    real, optional:: pkf(ngrid,llm)
     45    REAL ps(ngrid),pks(ngrid), alpha(ngrid,llm),beta(ngrid,llm)
     46
     47    !    .... variables locales   ...
     48
     49    INTEGER l, ij
     50    REAL unpl2k,dellta
     51
     52    logical,save :: firstcall=.true.
     53    character(len=*),parameter :: modname="exner_hyb"
     54
     55    ! Sanity check
     56    if (firstcall) then
     57       ! sanity checks for Shallow Water case (1 vertical layer)
     58       if (llm.eq.1) then
    6059          if (kappa.ne.1) then
    61             call abort_gcm(modname,
    62      &      "kappa!=1 , but running in Shallow Water mode!!",42)
     60             call abort_gcm(modname, &
     61                  "kappa!=1 , but running in Shallow Water mode!!",42)
    6362          endif
    6463          if (cpp.ne.r) then
    65             call abort_gcm(modname,
    66      &      "cpp!=r , but running in Shallow Water mode!!",42)
     64             call abort_gcm(modname, &
     65                  "cpp!=r , but running in Shallow Water mode!!",42)
    6766          endif
    68         endif ! of if (llm.eq.1)
     67       endif ! of if (llm.eq.1)
    6968
    70         firstcall=.false.
    71       endif ! of if (firstcall)
     69       firstcall=.false.
     70    endif ! of if (firstcall)
    7271
    73       if (llm.eq.1) then
    74        
    75         ! Compute pks(:),pk(:),pkf(:)
    76        
    77         DO   ij  = 1, ngrid
    78           pks(ij) = (cpp/preff) * ps(ij)
     72    ! Specific behaviour for Shallow Water (1 vertical layer) case:
     73    if (llm.eq.1) then
     74
     75       ! Compute pks(:),pk(:),pkf(:)
     76
     77       DO   ij  = 1, ngrid
     78          pks(ij) = (cpp/preff) * ps(ij)
    7979          pk(ij,1) = .5*pks(ij)
    80         ENDDO
    81        
    82         CALL SCOPY   ( ngrid * llm, pk, 1, pkf, 1 )
    83         CALL filtreg ( pkf, jmp1, llm, 2, 1, .TRUE., 1 )
    84        
    85         ! our work is done, exit routine
    86         return
     80       ENDDO
    8781
    88       endif ! of if (llm.eq.1)
     82       if (present(pkf)) then
     83          pkf = pk
     84          CALL filtreg ( pkf, jmp1, llm, 2, 1, .TRUE., 1 )
     85       end if
    8986
    90 !!!! General case:
    91      
    92       unpl2k    = 1.+ 2.* kappa
    93 c
    94       DO   ij  = 1, ngrid
    95         pks(ij) = cpp * ( ps(ij)/preff ) ** kappa
    96       ENDDO
     87       ! our work is done, exit routine
     88       return
     89    endif ! of if (llm.eq.1)
    9790
    98       DO  ij   = 1, iim
    99         ppn(ij) = aire(   ij   ) * pks(  ij     )
    100         pps(ij) = aire(ij+ip1jm) * pks(ij+ip1jm )
    101       ENDDO
    102       xpn      = SSUM(iim,ppn,1) /apoln
    103       xps      = SSUM(iim,pps,1) /apols
     91    ! General case:
    10492
    105       DO ij   = 1, iip1
    106         pks(   ij     )  =  xpn
    107         pks( ij+ip1jm )  =  xps
    108       ENDDO
    109 c
    110 c
    111 c    .... Calcul des coeff. alpha et beta  pour la couche l = llm ..
    112 c
    113       DO     ij      = 1, ngrid
     93    unpl2k    = 1.+ 2.* kappa
     94
     95    !     -------------
     96    !     Calcul de pks
     97    !     -------------
     98
     99    DO   ij  = 1, ngrid
     100       pks(ij) = cpp * ( ps(ij)/preff ) ** kappa
     101    ENDDO
     102
     103    !    .... Calcul des coeff. alpha et beta  pour la couche l = llm ..
     104    !
     105    DO     ij      = 1, ngrid
    114106       alpha(ij,llm) = 0.
    115107       beta (ij,llm) = 1./ unpl2k
    116       ENDDO
    117 c
    118 c     ... Calcul des coeff. alpha et beta  pour l = llm-1  a l = 2 ...
    119 c
    120       DO l = llm -1 , 2 , -1
    121 c
    122         DO ij = 1, ngrid
    123         dellta = p(ij,l)* unpl2k + p(ij,l+1)* ( beta(ij,l+1)-unpl2k )
    124         alpha(ij,l)  = - p(ij,l+1) / dellta * alpha(ij,l+1)
    125         beta (ij,l)  =   p(ij,l  ) / dellta   
    126         ENDDO
    127 c
    128       ENDDO
    129 c
    130 c  ***********************************************************************
    131 c     .....  Calcul de pk pour la couche 1 , pres du sol  ....
    132 c
    133       DO   ij   = 1, ngrid
    134        pk(ij,1) = ( p(ij,1)*pks(ij) - 0.5*alpha(ij,2)*p(ij,2) )  /
    135      *    (  p(ij,1)* (1.+kappa) + 0.5*( beta(ij,2)-unpl2k )* p(ij,2) )
    136       ENDDO
    137 c
    138 c    ..... Calcul de pk(ij,l) , pour l = 2 a l = llm  ........
    139 c
    140       DO l = 2, llm
    141         DO   ij   = 1, ngrid
    142          pk(ij,l) = alpha(ij,l) + beta(ij,l) * pk(ij,l-1)
    143         ENDDO
    144       ENDDO
    145 c
    146 c
    147       CALL SCOPY   ( ngrid * llm, pk, 1, pkf, 1 )
    148       CALL filtreg ( pkf, jmp1, llm, 2, 1, .TRUE., 1 )
    149      
     108    ENDDO
     109    !
     110    !     ... Calcul des coeff. alpha et beta  pour l = llm-1  a l = 2 ...
     111    !
     112    DO l = llm -1 , 2 , -1
     113       !
     114       DO ij = 1, ngrid
     115          dellta = p(ij,l)* unpl2k + p(ij,l+1)* ( beta(ij,l+1)-unpl2k )
     116          alpha(ij,l)  = - p(ij,l+1) / dellta * alpha(ij,l+1)
     117          beta (ij,l)  =   p(ij,l  ) / dellta   
     118       ENDDO
     119    ENDDO
    150120
    151       RETURN
    152       END
     121    !  ***********************************************************************
     122    !     .....  Calcul de pk pour la couche 1 , pres du sol  ....
     123    !
     124    DO   ij   = 1, ngrid
     125       pk(ij,1) = ( p(ij,1)*pks(ij) - 0.5*alpha(ij,2)*p(ij,2) )  / &
     126            (  p(ij,1)* (1.+kappa) + 0.5*( beta(ij,2)-unpl2k )* p(ij,2) )
     127    ENDDO
     128    !
     129    !    ..... Calcul de pk(ij,l) , pour l = 2 a l = llm  ........
     130    !
     131    DO l = 2, llm
     132       DO   ij   = 1, ngrid
     133          pk(ij,l) = alpha(ij,l) + beta(ij,l) * pk(ij,l-1)
     134       ENDDO
     135    ENDDO
     136
     137    if (present(pkf)) then
     138       !    calcul de pkf
     139       pkf = pk
     140       CALL filtreg ( pkf, jmp1, llm, 2, 1, .TRUE., 1 )
     141    end if
     142
     143  END SUBROUTINE exner_hyb
     144
     145end module exner_hyb_m
     146
  • trunk/LMDZ.COMMON/libf/dyn3d_common/exner_milieu_m.F90

    r1300 r1302  
    1 !
    2 ! $Id $
    3 !
    4       SUBROUTINE  exner_milieu ( ngrid, ps, p,beta, pks, pk, pkf )
    5 c
    6 c     Auteurs :  F. Forget , Y. Wanherdrick
    7 c P.Le Van  , Fr. Hourdin  .
    8 c    ..........
    9 c
    10 c    ....  ngrid, ps,p             sont des argum.d'entree  au sous-prog ...
    11 c    .... beta, pks,pk,pkf   sont des argum.de sortie au sous-prog ...
    12 c
    13 c   ************************************************************************
    14 c    Calcule la fonction d'Exner pk = Cp * (p/preff) ** kappa , aux milieux des
    15 c    couches .   Pk(l) sera calcule aux milieux  des couches l ,entre les
    16 c    pressions p(l) et p(l+1) ,definis aux interfaces des llm couches .
    17 c   ************************************************************************
    18 c    .. N.B : Au sommet de l'atmosphere,  p(llm+1) = 0. , et ps et pks sont
    19 c    la pression et la fonction d'Exner  au  sol  .
    20 c
    21 c     WARNING : CECI est une version speciale de exner_hyb originale
    22 c               Utilise dans la version martienne pour pouvoir
    23 c               tourner avec des coordonnees verticales complexe
    24 c              => Il ne verifie PAS la condition la proportionalite en
    25 c              energie totale/ interne / potentielle (F.Forget 2001)
    26 c    ( voir note de Fr.Hourdin )  ,
    27 c
    28       IMPLICIT NONE
    29 c
    30 #include "dimensions.h"
    31 #include "paramet.h"
    32 #include "comconst.h"
    33 #include "comgeom.h"
    34 #include "comvert.h"
    35 #include "serre.h"
     1module exner_milieu_m
    362
    37       INTEGER  ngrid
    38       REAL p(ngrid,llmp1),pk(ngrid,llm),pkf(ngrid,llm)
    39       REAL ps(ngrid),pks(ngrid), beta(ngrid,llm)
     3  IMPLICIT NONE
    404
    41 c    .... variables locales   ...
     5contains
    426
    43       INTEGER l, ij
    44       REAL dum1
     7  SUBROUTINE  exner_milieu ( ngrid, ps, p, pks, pk, pkf )
     8    !
     9    !     Auteurs :  F. Forget , Y. Wanherdrick
     10    ! P.Le Van  , Fr. Hourdin  .
     11    !    ..........
     12    !
     13    !    ....  ngrid, ps,p             sont des argum.d'entree  au sous-prog ...
     14    !    ....  pks,pk,pkf   sont des argum.de sortie au sous-prog ...
     15    !
     16    !   ************************************************************************
     17    !    Calcule la fonction d'Exner pk = Cp * (p/preff) ** kappa , aux milieux des
     18    !    couches .   Pk(l) sera calcule aux milieux  des couches l ,entre les
     19    !    pressions p(l) et p(l+1) ,definis aux interfaces des llm couches .
     20    !   ************************************************************************
     21    !  .. N.B : Au sommet de l'atmosphere,  p(llm+1) = 0. , et ps et pks sont
     22    !    la pression et la fonction d'Exner  au  sol  .
     23    !
     24    !     WARNING : CECI est une version speciale de exner_hyb originale
     25    !               Utilise dans la version martienne pour pouvoir
     26    !               tourner avec des coordonnees verticales complexe
     27    !              => Il ne verifie PAS la condition la proportionalite en
     28    !              energie totale/ interne / potentielle (F.Forget 2001)
     29    !    ( voir note de Fr.Hourdin )  ,
     30    !
     31    !
     32    include "dimensions.h"
     33    include "paramet.h"
     34    include "comconst.h"
     35    include "comgeom.h"
     36    include "comvert.h"
     37    include "serre.h"
    4538
    46       REAL ppn(iim),pps(iim)
    47       REAL xpn, xps
    48       REAL SSUM
    49       EXTERNAL SSUM
    50       logical,save :: firstcall=.true.
    51       character(len=*),parameter :: modname="exner_milieu"
     39    INTEGER  ngrid
     40    REAL p(ngrid,llmp1),pk(ngrid,llm)
     41    real, optional:: pkf(ngrid,llm)
     42    REAL ps(ngrid),pks(ngrid)
    5243
    53       ! Sanity check
    54       if (firstcall) then
    55         ! sanity checks for Shallow Water case (1 vertical layer)
    56         if (llm.eq.1) then
     44    !    .... variables locales   ...
     45
     46    INTEGER l, ij
     47    REAL dum1
     48
     49    logical,save :: firstcall=.true.
     50    character(len=*),parameter :: modname="exner_milieu"
     51
     52    ! Sanity check
     53    if (firstcall) then
     54       ! sanity checks for Shallow Water case (1 vertical layer)
     55       if (llm.eq.1) then
    5756          if (kappa.ne.1) then
    58             call abort_gcm(modname,
    59      &      "kappa!=1 , but running in Shallow Water mode!!",42)
     57             call abort_gcm(modname, &
     58                  "kappa!=1 , but running in Shallow Water mode!!",42)
    6059          endif
    6160          if (cpp.ne.r) then
    62             call abort_gcm(modname,
    63      &      "cpp!=r , but running in Shallow Water mode!!",42)
     61             call abort_gcm(modname, &
     62                  "cpp!=r , but running in Shallow Water mode!!",42)
    6463          endif
    65         endif ! of if (llm.eq.1)
     64       endif ! of if (llm.eq.1)
    6665
    67         firstcall=.false.
    68       endif ! of if (firstcall)
     66       firstcall=.false.
     67    endif ! of if (firstcall)
    6968
    70 !!!! Specific behaviour for Shallow Water (1 vertical layer) case:
    71       if (llm.eq.1) then
    72      
    73         ! Compute pks(:),pk(:),pkf(:)
    74        
    75         DO   ij  = 1, ngrid
    76           pks(ij) = (cpp/preff) * ps(ij) 
     69    ! Specific behaviour for Shallow Water (1 vertical layer) case:
     70    if (llm.eq.1) then
     71
     72       ! Compute pks(:),pk(:),pkf(:)
     73
     74       DO   ij  = 1, ngrid
     75          pks(ij) = (cpp/preff) * ps(ij)
    7776          pk(ij,1) = .5*pks(ij)
    78         ENDDO
    79        
    80         CALL SCOPY   ( ngrid * llm, pk, 1, pkf, 1 )
    81         CALL filtreg ( pkf, jmp1, llm, 2, 1, .TRUE., 1 )
    82        
    83         ! our work is done, exit routine
    84         return
     77       ENDDO
    8578
    86       endif ! of if (llm.eq.1)
     79       if (present(pkf)) then
     80          pkf = pk
     81          CALL filtreg ( pkf, jmp1, llm, 2, 1, .TRUE., 1 )
     82       end if
    8783
    88 !!!! General case:
     84       ! our work is done, exit routine
     85       return
     86    endif ! of if (llm.eq.1)
    8987
    90 c     -------------
    91 c     Calcul de pks
    92 c     -------------
    93    
    94       DO   ij  = 1, ngrid
    95         pks(ij) = cpp * ( ps(ij)/preff ) ** kappa
    96       ENDDO
     88    ! General case:
    9789
    98       DO  ij   = 1, iim
    99         ppn(ij) = aire(   ij   ) * pks(  ij     )
    100         pps(ij) = aire(ij+ip1jm) * pks(ij+ip1jm )
    101       ENDDO
    102       xpn      = SSUM(iim,ppn,1) /apoln
    103       xps      = SSUM(iim,pps,1) /apols
     90    !     -------------
     91    !     Calcul de pks
     92    !     -------------
    10493
    105       DO ij   = 1, iip1
    106         pks(   ij     )  =  xpn
    107         pks( ij+ip1jm )  =  xps
    108       ENDDO
    109 c
    110 c
    111 c    .... Calcul de pk  pour la couche l
    112 c    --------------------------------------------
    113 c
    114       dum1 = cpp * (2*preff)**(-kappa)
    115       DO l = 1, llm-1
    116         DO   ij   = 1, ngrid
    117          pk(ij,l) = dum1 * (p(ij,l) + p(ij,l+1))**kappa
    118         ENDDO
    119       ENDDO
     94    DO   ij  = 1, ngrid
     95       pks(ij) = cpp * ( ps(ij)/preff ) ** kappa
     96    ENDDO
    12097
    121 c    .... Calcul de pk  pour la couche l = llm ..
    122 c    (on met la meme distance (en log pression)  entre Pk(llm)
    123 c    et Pk(llm -1) qu'entre Pk(llm-1) et Pk(llm-2)
     98    !    .... Calcul de pk  pour la couche l
     99    !    --------------------------------------------
     100    !
     101    dum1 = cpp * (2*preff)**(-kappa)
     102    DO l = 1, llm-1
     103       DO   ij   = 1, ngrid
     104          pk(ij,l) = dum1 * (p(ij,l) + p(ij,l+1))**kappa
     105       ENDDO
     106    ENDDO
    124107
    125       DO   ij   = 1, ngrid
    126          pk(ij,llm) = pk(ij,llm-1)**2 / pk(ij,llm-2)
    127       ENDDO
     108    !    .... Calcul de pk  pour la couche l = llm ..
     109    !    (on met la meme distance (en log pression)  entre Pk(llm)
     110    !    et Pk(llm -1) qu'entre Pk(llm-1) et Pk(llm-2)
    128111
     112    DO   ij   = 1, ngrid
     113       pk(ij,llm) = pk(ij,llm-1)**2 / pk(ij,llm-2)
     114    ENDDO
    129115
    130 c    calcul de pkf
    131 c    -------------
    132       CALL SCOPY   ( ngrid * llm, pk, 1, pkf, 1 )
    133       CALL filtreg ( pkf, jmp1, llm, 2, 1, .TRUE., 1 )
    134      
    135 c    EST-CE UTILE ?? : calcul de beta
    136 c    --------------------------------
    137       DO l = 2, llm
    138         DO   ij   = 1, ngrid
    139           beta(ij,l) = pk(ij,l) / pk(ij,l-1)   
    140         ENDDO
    141       ENDDO
     116    if (present(pkf)) then
     117       !    calcul de pkf
     118       pkf = pk
     119       CALL filtreg ( pkf, jmp1, llm, 2, 1, .TRUE., 1 )
     120    end if
    142121
    143       RETURN
    144       END
     122  END SUBROUTINE exner_milieu
     123
     124end module exner_milieu_m
     125
  • trunk/LMDZ.COMMON/libf/dyn3d_common/iniacademic.F90

    r1300 r1302  
    1414#endif
    1515  USE Write_Field
     16  use exner_hyb_m, only: exner_hyb
     17  use exner_milieu_m, only: exner_milieu
    1618
    1719  !   Author:    Frederic Hourdin      original: 15/01/93
     
    5456  REAL pks(ip1jmp1)                      ! exner au  sol
    5557  REAL pk(ip1jmp1,llm)                   ! exner au milieu des couches
    56   REAL pkf(ip1jmp1,llm)                  ! exner filt.au milieu des couches
    5758  REAL phi(ip1jmp1,llm)                  ! geopotentiel
    5859  REAL ddsin,zsig,tetapv,w_pv  ! variables auxiliaires
     
    223224        CALL pression ( ip1jmp1, ap, bp, ps, p       )
    224225        if (pressure_exner) then
    225           CALL exner_hyb( ip1jmp1, ps, p,alpha,beta, pks, pk, pkf )
    226         else
    227           call exner_milieu(ip1jmp1,ps,p,beta,pks,pk,pkf)
     226          CALL exner_hyb( ip1jmp1, ps, p, pks, pk)
     227        else
     228          call exner_milieu(ip1jmp1,ps,p,pks,pk)
    228229        endif
    229230        CALL massdair(p,masse)
  • trunk/LMDZ.COMMON/libf/dyn3d_common/iniconst.F90

    r1300 r1302  
    7373  if (disvert_type==1) then
    7474     ! standard case for Earth (automatic generation of levels)
    75      call disvert(pa,preff,ap,bp,dpres,presnivs,nivsigs,nivsig, scaleheight)
     75     call disvert()
    7676  else if (disvert_type==2) then
    7777     ! standard case for planets (levels generated using z2sig.def file)
  • trunk/LMDZ.COMMON/libf/dyn3d_common/q_sat.F

    r1300 r1302  
    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
     73
  • trunk/LMDZ.COMMON/libf/dyn3dpar/calfis_p.F

    r1256 r1302  
    225225      save unskap
    226226
    227 cIM diagnostique PVteta, Amip2
    228       INTEGER,PARAMETER :: ntetaSTD=3
    229       REAL,SAVE :: rtetaSTD(ntetaSTD)=(/350.,380.,405./) ! Earth-specific, beware !!
    230       REAL PVteta(klon,ntetaSTD)
    231      
    232      
    233227      REAL SSUM
    234228
     
    267261      klon=klon_mpi
    268262     
    269       PVteta(:,:)=0.
    270            
    271263      IF ( firstcal )  THEN
    272264        debut = .TRUE.
     
    684676      endif
    685677
    686 
    687       IF (is_sequential.and.(planet_type=="earth")) THEN
    688 #ifdef CPP_EARTH
    689 ! PVtheta calls tetalevel, which is in the physics
    690 cIM calcul PV a teta=350, 380, 405K
    691         CALL PVtheta(ngridmx,llm,pucov,pvcov,pteta,
    692      $           ztfi,zplay,zplev,
    693      $           ntetaSTD,rtetaSTD,PVteta)
    694 c
    695 #endif
    696       ENDIF
    697 
    698678c On change de grille, dynamique vers physiq, pour le flux de masse verticale
    699679      CALL gr_dyn_fi_p(llm,iip1,jjp1,klon,flxw,flxwfi)
     
    923903     .             zdqfi_omp,
    924904     .             zdpsrf_omp,
    925 cIM diagnostique PVteta, Amip2         
    926      .             pducov,
    927      .             PVteta)
     905     .             pducov)
    928906
    929907      else if ( planet_type=="generic" ) then
  • trunk/LMDZ.COMMON/libf/dyn3dpar/ce0l.F90

    r1019 r1302  
    11!
    2 ! $Id: ce0l.F90 1615 2012-02-10 15:42:26Z emillour $
     2! $Id: ce0l.F90 1984 2014-02-18 09:59:29Z emillour $
    33!
    44!-------------------------------------------------------------------------------
     
    115115  END IF
    116116
    117   IF (grilles_gcm_netcdf) THEN
    118      WRITE(lunout,'(//)')
    119      WRITE(lunout,*) '  ***************************  '
    120      WRITE(lunout,*) '  ***  grilles_gcm_netcdf ***  '
    121      WRITE(lunout,*) '  ***************************  '
    122      WRITE(lunout,'(//)')
    123      CALL grilles_gcm_netcdf_sub(masque,phis)
    124   END IF
     117  WRITE(lunout,'(//)')
     118  WRITE(lunout,*) '  ***************************  '
     119  WRITE(lunout,*) '  ***  grilles_gcm_netcdf ***  '
     120  WRITE(lunout,*) '  ***************************  '
     121  WRITE(lunout,'(//)')
     122  CALL grilles_gcm_netcdf_sub(masque,phis)
    125123 
    126124#ifdef CPP_MPI
     
    137135!
    138136!-------------------------------------------------------------------------------
     137
  • trunk/LMDZ.COMMON/libf/dyn3dpar/conf_gcm.F

    r1300 r1302  
    22! $Id: conf_gcm.F 1438 2010-10-08 10:19:34Z jghattas $
    33!
    4 c
    5 c
     4!
     5!
    66      SUBROUTINE conf_gcm( tapedef, etatinit )
    7 c
     7!
    88#ifdef CPP_IOIPSL
    99      use IOIPSL
     
    2020      use sponge_mod_p, only: callsponge,mode_sponge,nsponge,tetasponge
    2121      IMPLICIT NONE
    22 c-----------------------------------------------------------------------
    23 c     Auteurs :   L. Fairhead , P. Le Van  .
    24 c
    25 c     Arguments :
    26 c
    27 c     tapedef   :
    28 c     etatinit  :     = TRUE   , on ne  compare pas les valeurs des para-
    29 c     -metres  du zoom  avec  celles lues sur le fichier start .
    30 c
     22!-----------------------------------------------------------------------
     23!     Auteurs :   L. Fairhead , P. Le Van  .
     24!
     25!     Arguments :
     26!
     27!     tapedef   :
     28!     etatinit  :     = TRUE   , on ne  compare pas les valeurs des para-
     29!     -metres  du zoom  avec  celles lues sur le fichier start .
     30!
    3131       LOGICAL etatinit
    3232       INTEGER tapedef
    3333
    34 c   Declarations :
    35 c   --------------
     34!   Declarations :
     35!   --------------
    3636#include "dimensions.h"
    3737#include "paramet.h"
     
    4545! FH 2008/05/09 On elimine toutes les clefs physiques dans la dynamique
    4646! #include "clesphys.h"
    47 c
    48 c
    49 c   local:
    50 c   ------
     47!
     48!
     49!   local:
     50!   ------
    5151
    5252      CHARACTER ch1*72,ch2*72,ch3*72,ch4*12
     
    6060      integer,external :: OMP_GET_NUM_THREADS
    6161#endif     
    62 c
    63 c  -------------------------------------------------------------------
    64 c
    65 c       .........     Version  du 29/04/97       ..........
    66 c
    67 c   Nouveaux parametres nitergdiv,nitergrot,niterh,tetagdiv,tetagrot,
    68 c      tetatemp   ajoutes  pour la dissipation   .
    69 c
    70 c   Autre parametre ajoute en fin de liste de tapedef : ** fxyhypb **
    71 c
    72 c  Si fxyhypb = .TRUE. , choix de la fonction a derivee tangente hyperb.
    73 c    Sinon , choix de fxynew  , a derivee sinusoidale  ..
    74 c
    75 c   ......  etatinit = . TRUE. si defrun  est appele dans ETAT0_LMD  ou
    76 c         LIMIT_LMD  pour l'initialisation de start.dat (dic) et
    77 c                de limit.dat ( dic)                        ...........
    78 c           Sinon  etatinit = . FALSE .
    79 c
    80 c   Donc etatinit = .F.  si on veut comparer les valeurs de  grossismx ,
    81 c    grossismy,clon,clat, fxyhypb  lues sur  le fichier  start  avec
    82 c   celles passees  par run.def ,  au debut du gcm, apres l'appel a
    83 c    lectba . 
    84 c   Ces parmetres definissant entre autres la grille et doivent etre
    85 c   pareils et coherents , sinon il y aura  divergence du gcm .
    86 c
    87 c-----------------------------------------------------------------------
    88 c   initialisations:
    89 c   ----------------
     62!
     63!  -------------------------------------------------------------------
     64!
     65!       .........     Version  du 29/04/97       ..........
     66!
     67!   Nouveaux parametres nitergdiv,nitergrot,niterh,tetagdiv,tetagrot,
     68!      tetatemp   ajoutes  pour la dissipation   .
     69!
     70!   Autre parametre ajoute en fin de liste de tapedef : ** fxyhypb **
     71!
     72!  Si fxyhypb = .TRUE. , choix de la fonction a derivee tangente hyperb.
     73!    Sinon , choix de fxynew  , a derivee sinusoidale  ..
     74!
     75!   ......  etatinit = . TRUE. si defrun  est appele dans ETAT0_LMD  ou
     76!         LIMIT_LMD  pour l'initialisation de start.dat (dic) et
     77!                de limit.dat ( dic)                        ...........
     78!           Sinon  etatinit = . FALSE .
     79!
     80!   Donc etatinit = .F.  si on veut comparer les valeurs de  grossismx ,
     81!    grossismy,clon,clat, fxyhypb  lues sur  le fichier  start  avec
     82!   celles passees  par run.def ,  au debut du gcm, apres l'appel a
     83!    lectba . 
     84!   Ces parmetres definissant entre autres la grille et doivent etre
     85!   pareils et coherents , sinon il y aura  divergence du gcm .
     86!
     87!-----------------------------------------------------------------------
     88!   initialisations:
     89!   ----------------
    9090
    9191!Config  Key  = lunout
     
    290290       CALL getin('dissip_period',dissip_period)
    291291
    292 ccc  ....   P. Le Van , modif le 29/04/97 .pour la dissipation  ...
    293 ccc
     292!cc  ....   P. Le Van , modif le 29/04/97 .pour la dissipation  ...
     293!cc
    294294
    295295!Config  Key  = lstardis
     
    456456       CALL getin('ok_guide',ok_guide)
    457457
    458 c    ...............................................................
     458!     ...............................................................
    459459
    460460!Config  Key  =  read_start
     
    632632      CALL getin('ok_etat0',ok_etat0)
    633633
    634 !Config  Key  = grilles_gcm_netcdf
    635 !Config  Desc = creation de fichier grilles_gcm.nc dans create_etat0_limit
    636 !Config  Def  = n
    637       grilles_gcm_netcdf = .FALSE.
    638       CALL getin('grilles_gcm_netcdf',grilles_gcm_netcdf)
    639 
    640 c----------------------------------------
    641 c Parameters for zonal averages in the case of Titan
     634!----------------------------------------
     635! Parameters for zonal averages in the case of Titan
    642636      moyzon_mu = .false.
    643637      moyzon_ch = .false.
     
    646640       CALL getin('moyzon_ch', moyzon_ch)
    647641      endif
    648 c----------------------------------------
    649 
    650 c----------------------------------------
    651 ccc  ....   P. Le Van , ajout  le 7/03/95 .pour le zoom ...
    652 c     .........   (  modif  le 17/04/96 )   .........
    653 c
    654 C ZOOM PARAMETERS ... the ones read in start.nc prevail anyway ! (SL, 2012)
    655 c
    656 c----------------------------------------
     642!----------------------------------------
     643
     644!----------------------------------------
     645!cc  ....   P. Le Van , ajout  le 7/03/95 .pour le zoom ...
     646!     .........   (  modif  le 17/04/96 )   .........
     647!
     648! ZOOM PARAMETERS ... the ones read in start.nc prevail anyway ! (SL, 2012)
     649!
     650!----------------------------------------
    657651      IF( etatinit ) then
    658652
     
    707701
    708702      write(lunout,*)'conf_gcm: alphax alphay ',alphax,alphay
    709 c
    710 c    alphax et alphay sont les anciennes formulat. des grossissements
    711 c
    712 c
     703!
     704!    alphax et alphay sont les anciennes formulat. des grossissements
     705!
     706!
    713707
    714708!Config  Key  = fxyhypb
     
    758752       ysinus = .TRUE.
    759753       CALL getin('ysinus',ysinus)
    760 c
    761 c----------------------------------------
     754!
     755!----------------------------------------
    762756       else ! etatinit=false
    763 c----------------------------------------
     757!----------------------------------------
    764758
    765759!Config  Key  = clon
     
    779773       CALL getin('clat',clatt)
    780774
    781 c
    782 c
     775!
     776!
    783777      IF( ABS(clat - clatt).GE. 0.001 )  THEN
    784778        write(lunout,*)'conf_gcm: La valeur de clat passee par run.def',
     
    834828
    835829      write(lunout,*)'conf_gcm: alphax alphay',alphax,alphay
    836 c
    837 c    alphax et alphay sont les anciennes formulat. des grossissements
    838 c
    839 c
     830!
     831!    alphax et alphay sont les anciennes formulat. des grossissements
     832!
     833!
    840834
    841835!Config  Key  = fxyhypb
     
    862856         ENDIF
    863857      ENDIF
    864 c
     858!
    865859!Config  Key  = dzoomx
    866860!Config  Desc = extension en longitude
     
    925919      ENDIF
    926920
    927 cc
     921!c
    928922      IF( .NOT.fxyhypb  )  THEN
    929923
     
    955949
    956950      endif ! etatinit
    957 c----------------------------------------
     951!----------------------------------------
    958952
    959953
     
    10091003      write(lunout,*)' ok_limit = ', ok_limit
    10101004      write(lunout,*)' ok_etat0 = ', ok_etat0
    1011       write(lunout,*)' grilles_gcm_netcdf = ', grilles_gcm_netcdf
    10121005      if (planet_type=="titan") then
    10131006       write(lunout,*)' moyzon_mu = ', moyzon_mu
  • trunk/LMDZ.COMMON/libf/dyn3dpar/exner_hyb_p_m.F90

    r1299 r1302  
    1 !
    2 ! $Id $
    3 !
    4       SUBROUTINE  exner_hyb_p ( ngrid, ps, p,alpha,beta, pks, pk, pkf )
    5 c
    6 c     Auteurs :  P.Le Van  , Fr. Hourdin  .
    7 c    ..........
    8 c
    9 c    ....  ngrid, ps,p             sont des argum.d'entree  au sous-prog ...
    10 c    .... alpha,beta, pks,pk,pkf   sont des argum.de sortie au sous-prog ...
    11 c
    12 c   ************************************************************************
    13 c    Calcule la fonction d'Exner pk = Cp * p ** kappa , aux milieux des
    14 c    couches .   Pk(l) sera calcule aux milieux  des couches l ,entre les
    15 c    pressions p(l) et p(l+1) ,definis aux interfaces des llm couches .
    16 c   ************************************************************************
    17 c  .. N.B : Au sommet de l'atmosphere,  p(llm+1) = 0. , et ps et pks sont
    18 c    la pression et la fonction d'Exner  au  sol  .
    19 c
    20 c                                 -------- z                                   
    21 c    A partir des relations  ( 1 ) p*dz(pk) = kappa *pk*dz(p)      et
    22 c                            ( 2 ) pk(l) = alpha(l)+ beta(l)*pk(l-1)
    23 c    ( voir note de Fr.Hourdin )  ,
    24 c
    25 c    on determine successivement , du haut vers le bas des couches, les
    26 c    coef. alpha(llm),beta(llm) .,.,alpha(l),beta(l),,,alpha(2),beta(2),
    27 c    puis pk(ij,1). Ensuite ,on calcule,du bas vers le haut des couches, 
    28 c     pk(ij,l)  donne  par la relation (2),  pour l = 2 a l = llm .
    29 c
    30 c
    31       USE parallel_lmdz
    32       IMPLICIT NONE
    33 c
    34 #include "dimensions.h"
    35 #include "paramet.h"
    36 #include "comconst.h"
    37 #include "comgeom.h"
    38 #include "comvert.h"
    39 #include "serre.h"
     1module exner_hyb_p_m
    402
    41       INTEGER  ngrid
    42       REAL p(ngrid,llmp1),pk(ngrid,llm),pkf(ngrid,llm)
    43       REAL ps(ngrid),pks(ngrid), alpha(ngrid,llm),beta(ngrid,llm)
     3  IMPLICIT NONE
    444
    45 c    .... variables locales   ...
     5contains
    466
    47       INTEGER l, ij
    48       REAL unpl2k,dellta
     7  SUBROUTINE  exner_hyb_p ( ngrid, ps, p, pks, pk, pkf )
    498
    50       REAL ppn(iim),pps(iim)
    51       REAL xpn, xps
    52       REAL SSUM
    53       EXTERNAL SSUM
    54       INTEGER ije,ijb,jje,jjb
    55       logical,save :: firstcall=.true.
    56 !$OMP THREADPRIVATE(firstcall)
    57       character(len=*),parameter :: modname="exner_hyb_p"
    58 c
     9    !     Auteurs :  P.Le Van  , Fr. Hourdin  .
     10    !    ..........
     11    !
     12    !    ....  ngrid, ps,p             sont des argum.d'entree  au sous-prog ...
     13    !    ....  pks,pk,pkf   sont des argum.de sortie au sous-prog ...
     14    !
     15    !   ************************************************************************
     16    !    Calcule la fonction d'Exner pk = Cp * (p/preff) ** kappa , aux milieux des
     17    !    couches .   Pk(l) sera calcule aux milieux  des couches l ,entre les
     18    !    pressions p(l) et p(l+1) ,definis aux interfaces des llm couches .
     19    !   ************************************************************************
     20    !  .. N.B : Au sommet de l'atmosphere,  p(llm+1) = 0. , et ps et pks sont
     21    !    la pression et la fonction d'Exner  au  sol  .
     22    !
     23    !                                 -------- z
     24    !    A partir des relations  ( 1 ) p*dz(pk) = kappa *pk*dz(p)      et
     25    !                            ( 2 ) pk(l) = alpha(l)+ beta(l)*pk(l-1)
     26    !    ( voir note de Fr.Hourdin )  ,
     27    !
     28    !    on determine successivement , du haut vers le bas des couches, les
     29    !    coef. alpha(llm),beta(llm) .,.,alpha(l),beta(l),,,alpha(2),beta(2),
     30    !    puis pk(ij,1). Ensuite ,on calcule,du bas vers le haut des couches, 
     31    !     pk(ij,l)  donne  par la relation (2),  pour l = 2 a l = llm .
     32    !
     33    !
     34    USE parallel_lmdz
     35    !
     36    include "dimensions.h"
     37    include "paramet.h"
     38    include "comconst.h"
     39    include "comgeom.h"
     40    include "comvert.h"
     41    include "serre.h"
    5942
    60       ! Sanity check
    61       if (firstcall) then
    62         ! sanity checks for Shallow Water case (1 vertical layer)
    63         if (llm.eq.1) then
     43    INTEGER  ngrid
     44    REAL p(ngrid,llmp1),pk(ngrid,llm)
     45    REAL, optional:: pkf(ngrid,llm)
     46    REAL ps(ngrid),pks(ngrid)
     47    REAL alpha(ngrid,llm),beta(ngrid,llm)
     48
     49    !    .... variables locales   ...
     50
     51    INTEGER l, ij
     52    REAL unpl2k,dellta
     53
     54    INTEGER ije,ijb,jje,jjb
     55    logical,save :: firstcall=.true.
     56    !$OMP THREADPRIVATE(firstcall)
     57    character(len=*),parameter :: modname="exner_hyb_p"
     58
     59    ! Sanity check
     60    if (firstcall) then
     61       ! sanity checks for Shallow Water case (1 vertical layer)
     62       if (llm.eq.1) then
    6463          if (kappa.ne.1) then
    65             call abort_gcm(modname,
    66      &      "kappa!=1 , but running in Shallow Water mode!!",42)
     64             call abort_gcm(modname, &
     65                  "kappa!=1 , but running in Shallow Water mode!!",42)
    6766          endif
    6867          if (cpp.ne.r) then
    69             call abort_gcm(modname,
    70      &      "cpp!=r , but running in Shallow Water mode!!",42)
     68             call abort_gcm(modname, &
     69                  "cpp!=r , but running in Shallow Water mode!!",42)
    7170          endif
    72         endif ! of if (llm.eq.1)
     71       endif ! of if (llm.eq.1)
    7372
    74         firstcall=.false.
    75       endif ! of if (firstcall)
     73       firstcall=.false.
     74    endif ! of if (firstcall)
    7675
    77 c$OMP BARRIER
     76    !$OMP BARRIER
    7877
    79 ! Specific behaviour for Shallow Water (1 vertical layer) case
    80       if (llm.eq.1) then
    81      
    82         ! Compute pks(:),pk(:),pkf(:)
    83         ijb=ij_begin
    84         ije=ij_end
    85 !$OMP DO SCHEDULE(STATIC)
    86         DO ij=ijb, ije
    87           pks(ij)=(cpp/preff)*ps(ij)
     78    ! Specific behaviour for Shallow Water (1 vertical layer) case:
     79    if (llm.eq.1) then
     80
     81       ! Compute pks(:),pk(:),pkf(:)
     82       ijb=ij_begin
     83       ije=ij_end
     84       !$OMP DO SCHEDULE(STATIC)
     85       DO ij=ijb, ije
     86          pks(ij) = (cpp/preff) * ps(ij)
    8887          pk(ij,1) = .5*pks(ij)
    89           pkf(ij,1)=pk(ij,1)
    90         ENDDO
    91 !$OMP ENDDO
     88          if (present(pkf)) pkf(ij,1)=pk(ij,1)
     89       ENDDO
     90       !$OMP ENDDO
    9291
    93 !$OMP MASTER
    94       if (pole_nord) then
    95         DO  ij   = 1, iim
    96           ppn(ij) = aire(   ij   ) * pks(  ij     )
    97         ENDDO
    98         xpn      = SSUM(iim,ppn,1) /apoln
    99  
    100         DO ij   = 1, iip1
    101           pks(   ij     )  =  xpn
    102           pk(ij,1) = .5*pks(ij)
    103           pkf(ij,1)=pk(ij,1)
    104         ENDDO
    105       endif
    106      
    107       if (pole_sud) then
    108         DO  ij   = 1, iim
    109           pps(ij) = aire(ij+ip1jm) * pks(ij+ip1jm )
    110         ENDDO
    111         xps      = SSUM(iim,pps,1) /apols
    112  
    113         DO ij   = 1, iip1
    114           pks( ij+ip1jm )  =  xps
    115           pk(ij+ip1jm,1)=.5*pks(ij+ip1jm)
    116           pkf(ij+ip1jm,1)=pk(ij+ip1jm,1)
    117         ENDDO
    118       endif
    119 !$OMP END MASTER
    120 !$OMP BARRIER
    121         jjb=jj_begin
    122         jje=jj_end
    123         CALL filtreg_p ( pkf,jjb,jje, jmp1, llm, 2, 1, .TRUE., 1 )
     92       !$OMP BARRIER
     93       if (present(pkf)) then
     94          jjb=jj_begin
     95          jje=jj_end
     96          CALL filtreg_p ( pkf,jjb,jje, jmp1, llm, 2, 1, .TRUE., 1 )
     97       end if
    12498
    125         ! our work is done, exit routine
    126         return
    127       endif ! of if (llm.eq.1)
     99       ! our work is done, exit routine
     100       return
     101    endif ! of if (llm.eq.1)
    128102
    129 !!!! General case:
     103    ! General case:
    130104
    131       unpl2k    = 1.+ 2.* kappa
    132 c
    133       ijb=ij_begin
    134       ije=ij_end
     105    unpl2k    = 1.+ 2.* kappa
    135106
    136 c$OMP DO SCHEDULE(STATIC)
    137       DO   ij  = ijb, ije
    138         pks(ij) = cpp * ( ps(ij)/preff ) ** kappa
    139       ENDDO
    140 c$OMP ENDDO
    141 c Synchro OPENMP ici
     107    !     -------------
     108    !     Calcul de pks
     109    !     -------------
    142110
    143 c$OMP MASTER
    144       if (pole_nord) then
    145         DO  ij   = 1, iim
    146           ppn(ij) = aire(   ij   ) * pks(  ij     )
    147         ENDDO
    148         xpn      = SSUM(iim,ppn,1) /apoln
    149  
    150         DO ij   = 1, iip1
    151           pks(   ij     )  =  xpn
    152         ENDDO
    153       endif
    154      
    155       if (pole_sud) then
    156         DO  ij   = 1, iim
    157           pps(ij) = aire(ij+ip1jm) * pks(ij+ip1jm )
    158         ENDDO
    159         xps      = SSUM(iim,pps,1) /apols
    160  
    161         DO ij   = 1, iip1
    162           pks( ij+ip1jm )  =  xps
    163         ENDDO
    164       endif
    165 c$OMP END MASTER
    166 c$OMP BARRIER
    167 c
    168 c
    169 c    .... Calcul des coeff. alpha et beta  pour la couche l = llm ..
    170 c
    171 c$OMP DO SCHEDULE(STATIC)
    172       DO     ij      = ijb,ije
     111    ijb=ij_begin
     112    ije=ij_end
     113
     114    !$OMP DO SCHEDULE(STATIC)
     115    DO   ij  = ijb, ije
     116       pks(ij) = cpp * ( ps(ij)/preff ) ** kappa
     117    ENDDO
     118    !$OMP ENDDO
     119    ! Synchro OPENMP ici
     120
     121    !$OMP BARRIER
     122    !
     123    !
     124    !    .... Calcul des coeff. alpha et beta  pour la couche l = llm ..
     125    !
     126    !$OMP DO SCHEDULE(STATIC)
     127    DO     ij      = ijb,ije
    173128       alpha(ij,llm) = 0.
    174129       beta (ij,llm) = 1./ unpl2k
    175       ENDDO
    176 c$OMP ENDDO NOWAIT
    177 c
    178 c     ... Calcul des coeff. alpha et beta  pour l = llm-1  a l = 2 ...
    179 c
    180       DO l = llm -1 , 2 , -1
    181 c
    182 c$OMP DO SCHEDULE(STATIC)
    183         DO ij = ijb, ije
    184         dellta = p(ij,l)* unpl2k + p(ij,l+1)* ( beta(ij,l+1)-unpl2k )
    185         alpha(ij,l)  = - p(ij,l+1) / dellta * alpha(ij,l+1)
    186         beta (ij,l)  =   p(ij,l  ) / dellta   
    187         ENDDO
    188 c$OMP ENDDO NOWAIT
    189 c
    190       ENDDO
     130    ENDDO
     131    !$OMP ENDDO NOWAIT
     132    !
     133    !     ... Calcul des coeff. alpha et beta  pour l = llm-1  a l = 2 ...
     134    !
     135    DO l = llm -1 , 2 , -1
     136       !
     137       !$OMP DO SCHEDULE(STATIC)
     138       DO ij = ijb, ije
     139          dellta = p(ij,l)* unpl2k + p(ij,l+1)* ( beta(ij,l+1)-unpl2k )
     140          alpha(ij,l)  = - p(ij,l+1) / dellta * alpha(ij,l+1)
     141          beta (ij,l)  =   p(ij,l  ) / dellta   
     142       ENDDO
     143       !$OMP ENDDO NOWAIT
     144    ENDDO
    191145
    192 c
    193 c  ***********************************************************************
    194 c     .....  Calcul de pk pour la couche 1 , pres du sol  ....
    195 c
    196 c$OMP DO SCHEDULE(STATIC)
    197       DO   ij   = ijb, ije
    198        pk(ij,1) = ( p(ij,1)*pks(ij) - 0.5*alpha(ij,2)*p(ij,2) )  /
    199      *    (  p(ij,1)* (1.+kappa) + 0.5*( beta(ij,2)-unpl2k )* p(ij,2) )
    200       ENDDO
    201 c$OMP ENDDO NOWAIT
    202 c
    203 c    ..... Calcul de pk(ij,l) , pour l = 2 a l = llm  ........
    204 c
    205       DO l = 2, llm
    206 c$OMP DO SCHEDULE(STATIC)
    207         DO   ij   = ijb, ije
    208          pk(ij,l) = alpha(ij,l) + beta(ij,l) * pk(ij,l-1)
    209         ENDDO
    210 c$OMP ENDDO NOWAIT       
    211       ENDDO
    212 c
    213 c
    214 c      CALL SCOPY   ( ngrid * llm, pk, 1, pkf, 1 )
    215       DO l = 1, llm
    216 c$OMP DO SCHEDULE(STATIC)
    217          DO   ij   = ijb, ije
    218            pkf(ij,l)=pk(ij,l)
    219          ENDDO
    220 c$OMP ENDDO NOWAIT             
    221       ENDDO
     146    !  ***********************************************************************
     147    !     .....  Calcul de pk pour la couche 1 , pres du sol  ....
     148    !
     149    !$OMP DO SCHEDULE(STATIC)
     150    DO   ij   = ijb, ije
     151       pk(ij,1) = ( p(ij,1)*pks(ij) - 0.5*alpha(ij,2)*p(ij,2) )  / &
     152            (  p(ij,1)* (1.+kappa) + 0.5*( beta(ij,2)-unpl2k )* p(ij,2) )
     153    ENDDO
     154    !$OMP ENDDO NOWAIT
     155    !
     156    !    ..... Calcul de pk(ij,l) , pour l = 2 a l = llm  ........
     157    !
     158    DO l = 2, llm
     159       !$OMP DO SCHEDULE(STATIC)
     160       DO   ij   = ijb, ije
     161          pk(ij,l) = alpha(ij,l) + beta(ij,l) * pk(ij,l-1)
     162       ENDDO
     163       !$OMP ENDDO NOWAIT       
     164    ENDDO
    222165
    223 c$OMP BARRIER
    224      
    225       jjb=jj_begin
    226       jje=jj_end
    227       CALL filtreg_p ( pkf,jjb,jje, jmp1, llm, 2, 1, .TRUE., 1 )
    228      
     166    if (present(pkf)) then
     167       !    calcul de pkf
    229168
    230       RETURN
    231       END
     169       DO l = 1, llm
     170          !$OMP DO SCHEDULE(STATIC)
     171          DO   ij   = ijb, ije
     172             pkf(ij,l)=pk(ij,l)
     173          ENDDO
     174          !$OMP ENDDO NOWAIT             
     175       ENDDO
     176
     177       !$OMP BARRIER
     178
     179       jjb=jj_begin
     180       jje=jj_end
     181       CALL filtreg_p ( pkf,jjb,jje, jmp1, llm, 2, 1, .TRUE., 1 )
     182    end if
     183
     184  END SUBROUTINE exner_hyb_p
     185
     186end module exner_hyb_p_m
     187
  • trunk/LMDZ.COMMON/libf/dyn3dpar/exner_milieu_p_m.F90

    r1299 r1302  
    1 !
    2 ! $Id $
    3 !
    4       SUBROUTINE  exner_milieu_p ( ngrid, ps, p,beta, pks, pk, pkf )
    5 c
    6 c     Auteurs :  F. Forget , Y. Wanherdrick
    7 c P.Le Van  , Fr. Hourdin  .
    8 c    ..........
    9 c
    10 c    ....  ngrid, ps,p             sont des argum.d'entree  au sous-prog ...
    11 c    .... beta, pks,pk,pkf   sont des argum.de sortie au sous-prog ...
    12 c
    13 c   ************************************************************************
    14 c    Calcule la fonction d'Exner pk = Cp * (p/preff) ** kappa , aux milieux des
    15 c    couches .   Pk(l) sera calcule aux milieux  des couches l ,entre les
    16 c    pressions p(l) et p(l+1) ,definis aux interfaces des llm couches .
    17 c   ************************************************************************
    18 c    .. N.B : Au sommet de l'atmosphere,  p(llm+1) = 0. , et ps et pks sont
    19 c    la pression et la fonction d'Exner  au  sol  .
    20 c
    21 c     WARNING : CECI est une version speciale de exner_hyb originale
    22 c               Utilise dans la version martienne pour pouvoir
    23 c               tourner avec des coordonnees verticales complexe
    24 c              => Il ne verifie PAS la condition la proportionalite en
    25 c              energie totale/ interne / potentielle (F.Forget 2001)
    26 c    ( voir note de Fr.Hourdin )  ,
    27 c
    28       USE parallel_lmdz
    29       IMPLICIT NONE
    30 c
    31 #include "dimensions.h"
    32 #include "paramet.h"
    33 #include "comconst.h"
    34 #include "comgeom.h"
    35 #include "comvert.h"
    36 #include "serre.h"
     1module exner_milieu_p_m
    372
    38       INTEGER  ngrid
    39       REAL p(ngrid,llmp1),pk(ngrid,llm),pkf(ngrid,llm)
    40       REAL ps(ngrid),pks(ngrid), beta(ngrid,llm)
     3  IMPLICIT NONE
    414
    42 c    .... variables locales   ...
     5contains
    436
    44       INTEGER l, ij
    45       REAL dum1
     7  SUBROUTINE  exner_milieu_p ( ngrid, ps, p, pks, pk, pkf )
     8    !
     9    !     Auteurs :  F. Forget , Y. Wanherdrick
     10    ! P.Le Van  , Fr. Hourdin  .
     11    !    ..........
     12    !
     13    !    ....  ngrid, ps,p             sont des argum.d'entree  au sous-prog ...
     14    !    ....  pks,pk,pkf   sont des argum.de sortie au sous-prog ...
     15    !
     16    !   ************************************************************************
     17    !    Calcule la fonction d'Exner pk = Cp * (p/preff) ** kappa , aux milieux des
     18    !    couches .   Pk(l) sera calcule aux milieux  des couches l ,entre les
     19    !    pressions p(l) et p(l+1) ,definis aux interfaces des llm couches .
     20    !   ************************************************************************
     21    !  .. N.B : Au sommet de l'atmosphere,  p(llm+1) = 0. , et ps et pks sont
     22    !    la pression et la fonction d'Exner  au  sol  .
     23    !
     24    !     WARNING : CECI est une version speciale de exner_hyb originale
     25    !               Utilise dans la version martienne pour pouvoir
     26    !               tourner avec des coordonnees verticales complexe
     27    !              => Il ne verifie PAS la condition la proportionalite en
     28    !              energie totale/ interne / potentielle (F.Forget 2001)
     29    !    ( voir note de Fr.Hourdin )  ,
     30    !
     31    USE parallel_lmdz
     32    !
     33    include "dimensions.h"
     34    include "paramet.h"
     35    include "comconst.h"
     36    include "comgeom.h"
     37    include "comvert.h"
     38    include "serre.h"
    4639
    47       REAL ppn(iim),pps(iim)
    48       REAL xpn, xps
    49       REAL SSUM
    50       EXTERNAL SSUM
    51       INTEGER ije,ijb,jje,jjb
    52       logical,save :: firstcall=.true.
    53 !$OMP THREADPRIVATE(firstcall)
    54       character(len=*),parameter :: modname="exner_milieu_p"
     40    INTEGER  ngrid
     41    REAL p(ngrid,llmp1),pk(ngrid,llm)
     42    REAL, optional:: pkf(ngrid,llm)
     43    REAL ps(ngrid),pks(ngrid)
    5544
    56       ! Sanity check
    57       if (firstcall) then
    58         ! sanity checks for Shallow Water case (1 vertical layer)
    59         if (llm.eq.1) then
     45    !    .... variables locales   ...
     46
     47    INTEGER l, ij,ijb,ije,jjb,jje
     48    REAL dum1
     49
     50    logical,save :: firstcall=.true.
     51    !$OMP THREADPRIVATE(firstcall)
     52    character(len=*),parameter :: modname="exner_milieu_p"
     53
     54    ! Sanity check
     55    if (firstcall) then
     56       ! sanity checks for Shallow Water case (1 vertical layer)
     57       if (llm.eq.1) then
    6058          if (kappa.ne.1) then
    61             call abort_gcm(modname,
    62      &      "kappa!=1 , but running in Shallow Water mode!!",42)
     59             call abort_gcm(modname, &
     60                  "kappa!=1 , but running in Shallow Water mode!!",42)
    6361          endif
    6462          if (cpp.ne.r) then
    65             call abort_gcm(modname,
    66      &      "cpp!=r , but running in Shallow Water mode!!",42)
     63             call abort_gcm(modname, &
     64                  "cpp!=r , but running in Shallow Water mode!!",42)
    6765          endif
    68         endif ! of if (llm.eq.1)
     66       endif ! of if (llm.eq.1)
    6967
    70         firstcall=.false.
    71       endif ! of if (firstcall)
    72      
    73 c$OMP BARRIER
     68       firstcall=.false.
     69    endif ! of if (firstcall)
    7470
    75 ! Specific behaviour for Shallow Water (1 vertical layer) case
    76       if (llm.eq.1) then
    77              
    78         ! Compute pks(:),pk(:),pkf(:)
    79         ijb=ij_begin
    80         ije=ij_end
    81 !$OMP DO SCHEDULE(STATIC)
    82         DO ij=ijb, ije
    83           pks(ij)=(cpp/preff)*ps(ij)
     71    !$OMP BARRIER
     72
     73    ! Specific behaviour for Shallow Water (1 vertical layer) case:
     74    if (llm.eq.1) then
     75
     76       ! Compute pks(:),pk(:),pkf(:)
     77       ijb=ij_begin
     78       ije=ij_end
     79       !$OMP DO SCHEDULE(STATIC)
     80       DO ij=ijb, ije
     81          pks(ij) = (cpp/preff) * ps(ij)
    8482          pk(ij,1) = .5*pks(ij)
    85           pkf(ij,1)=pk(ij,1)
    86         ENDDO
    87 !$OMP ENDDO
     83          if (present(pkf)) pkf(ij,1)=pk(ij,1)
     84       ENDDO
     85       !$OMP ENDDO
    8886
    89 !$OMP MASTER
    90       if (pole_nord) then
    91         DO  ij   = 1, iim
    92           ppn(ij) = aire(   ij   ) * pks(  ij     )
    93         ENDDO
    94         xpn      = SSUM(iim,ppn,1) /apoln
    95  
    96         DO ij   = 1, iip1
    97           pks(   ij     )  =  xpn
    98           pk(ij,1) = .5*pks(ij)
    99           pkf(ij,1)=pk(ij,1)
    100         ENDDO
    101       endif
    102      
    103       if (pole_sud) then
    104         DO  ij   = 1, iim
    105           pps(ij) = aire(ij+ip1jm) * pks(ij+ip1jm )
    106         ENDDO
    107         xps      = SSUM(iim,pps,1) /apols
    108  
    109         DO ij   = 1, iip1
    110           pks( ij+ip1jm )  =  xps
    111           pk(ij+ip1jm,1)=.5*pks(ij+ip1jm)
    112           pkf(ij+ip1jm,1)=pk(ij+ip1jm,1)
    113         ENDDO
    114       endif
    115 !$OMP END MASTER
    116 !$OMP BARRIER
    117         jjb=jj_begin
    118         jje=jj_end
    119         CALL filtreg_p ( pkf,jjb,jje, jmp1, llm, 2, 1, .TRUE., 1 )
     87       !$OMP BARRIER
     88       if (present(pkf)) then
     89          jjb=jj_begin
     90          jje=jj_end
     91          CALL filtreg_p ( pkf,jjb,jje, jmp1, llm, 2, 1, .TRUE., 1 )
     92       end if
    12093
    121         ! our work is done, exit routine
    122         return
    123       endif ! of if (llm.eq.1)
     94       ! our work is done, exit routine
     95       return
     96    endif ! of if (llm.eq.1)
    12497
    125 !!!! General case:
     98    ! General case:
    12699
    127 c     -------------
    128 c     Calcul de pks
    129 c     -------------
    130    
    131       ijb=ij_begin
    132       ije=ij_end
     100    !     -------------
     101    !     Calcul de pks
     102    !     -------------
    133103
    134 c$OMP DO SCHEDULE(STATIC)
    135       DO   ij  = ijb, ije
    136         pks(ij) = cpp * ( ps(ij)/preff ) ** kappa
    137       ENDDO
    138 c$OMP ENDDO
    139 c Synchro OPENMP ici
     104    ijb=ij_begin
     105    ije=ij_end
    140106
    141 c$OMP MASTER
    142       if (pole_nord) then
    143         DO  ij   = 1, iim
    144           ppn(ij) = aire(   ij   ) * pks(  ij     )
    145         ENDDO
    146         xpn      = SSUM(iim,ppn,1) /apoln
    147  
    148         DO ij   = 1, iip1
    149           pks(   ij     )  =  xpn
    150         ENDDO
    151       endif
    152      
    153       if (pole_sud) then
    154         DO  ij   = 1, iim
    155           pps(ij) = aire(ij+ip1jm) * pks(ij+ip1jm )
    156         ENDDO
    157         xps      = SSUM(iim,pps,1) /apols
    158  
    159         DO ij   = 1, iip1
    160           pks( ij+ip1jm )  =  xps
    161         ENDDO
    162       endif
    163 c$OMP END MASTER
    164 c$OMP BARRIER
    165 c
    166 c
    167 c    .... Calcul de pk  pour la couche l
    168 c    --------------------------------------------
    169 c
    170       dum1 = cpp * (2*preff)**(-kappa)
    171       DO l = 1, llm-1
    172 c$OMP DO SCHEDULE(STATIC)
    173         DO   ij   = ijb, ije
    174          pk(ij,l) = dum1 * (p(ij,l) + p(ij,l+1))**kappa
    175         ENDDO
    176 c$OMP ENDDO NOWAIT       
    177       ENDDO
     107    !$OMP DO SCHEDULE(STATIC)
     108    DO   ij  = ijb, ije
     109       pks(ij) = cpp * ( ps(ij)/preff ) ** kappa
     110    ENDDO
     111    !$OMP ENDDO
     112    ! Synchro OPENMP ici
    178113
    179 c    .... Calcul de pk  pour la couche l = llm ..
    180 c    (on met la meme distance (en log pression)  entre Pk(llm)
    181 c    et Pk(llm -1) qu'entre Pk(llm-1) et Pk(llm-2)
     114    !$OMP BARRIER
     115    !
     116    !
     117    !    .... Calcul de pk  pour la couche l
     118    !    --------------------------------------------
     119    !
     120    dum1 = cpp * (2*preff)**(-kappa)
     121    DO l = 1, llm-1
     122       !$OMP DO SCHEDULE(STATIC)
     123       DO   ij   = ijb, ije
     124          pk(ij,l) = dum1 * (p(ij,l) + p(ij,l+1))**kappa
     125       ENDDO
     126       !$OMP ENDDO NOWAIT
     127    ENDDO
    182128
    183 c$OMP DO SCHEDULE(STATIC)
    184       DO   ij   = ijb, ije
    185          pk(ij,llm) = pk(ij,llm-1)**2 / pk(ij,llm-2)
    186       ENDDO
    187 c$OMP ENDDO NOWAIT       
     129    !    .... Calcul de pk  pour la couche l = llm ..
     130    !    (on met la meme distance (en log pression)  entre Pk(llm)
     131    !    et Pk(llm -1) qu'entre Pk(llm-1) et Pk(llm-2)
    188132
     133    !$OMP DO SCHEDULE(STATIC)
     134    DO   ij   = ijb, ije
     135       pk(ij,llm) = pk(ij,llm-1)**2 / pk(ij,llm-2)
     136    ENDDO
     137    !$OMP ENDDO NOWAIT       
    189138
    190 c    calcul de pkf
    191 c    -------------
    192 c      CALL SCOPY   ( ngrid * llm, pk, 1, pkf, 1 )
    193       DO l = 1, llm
    194 c$OMP DO SCHEDULE(STATIC)
    195          DO   ij   = ijb, ije
    196            pkf(ij,l)=pk(ij,l)
    197          ENDDO
    198 c$OMP ENDDO NOWAIT             
    199       ENDDO
     139    if (present(pkf)) then
     140       !    calcul de pkf
    200141
    201 c$OMP BARRIER
    202      
    203       jjb=jj_begin
    204       jje=jj_end
    205       CALL filtreg_p ( pkf,jjb,jje, jmp1, llm, 2, 1, .TRUE., 1 )
    206      
    207 c    EST-CE UTILE ?? : calcul de beta
    208 c    --------------------------------
    209       DO l = 2, llm
    210 c$OMP DO SCHEDULE(STATIC)
    211         DO   ij   = ijb, ije
    212           beta(ij,l) = pk(ij,l) / pk(ij,l-1)   
    213         ENDDO
    214 c$OMP ENDDO NOWAIT             
    215       ENDDO
     142       DO l = 1, llm
     143          !$OMP DO SCHEDULE(STATIC)
     144          DO   ij   = ijb, ije
     145             pkf(ij,l)=pk(ij,l)
     146          ENDDO
     147          !$OMP ENDDO NOWAIT
     148       ENDDO
    216149
    217       RETURN
    218       END
     150       !$OMP BARRIER
     151
     152       jjb=jj_begin
     153       jje=jj_end
     154       CALL filtreg_p ( pkf,jjb,jje, jmp1, llm, 2, 1, .TRUE., 1 )
     155    end if
     156
     157  END SUBROUTINE exner_milieu_p
     158
     159end module exner_milieu_p_m
     160
  • trunk/LMDZ.COMMON/libf/dyn3dpar/gcm.F

    r1300 r1302  
    516516
    517517
    518       day_end = day_ini + nday
     518      if (nday>=0) then ! standard case
     519        day_end=day_ini+nday
     520      else ! special case when nday <0, run -nday dynamical steps
     521        day_end=day_ini-nday/day_step
     522      endif
    519523      if (less1day) then
    520524        day_end=day_ini+floor(time_0+fractday)
  • trunk/LMDZ.COMMON/libf/dyn3dpar/guide_p_mod.F90

    r1300 r1302  
    328328!=======================================================================
    329329  SUBROUTINE guide_main(itau,ucov,vcov,teta,q,masse,ps)
     330    use exner_hyb_p_m, only: exner_hyb_p
     331    use exner_milieu_p_m, only: exner_milieu_p
    330332    USE parallel_lmdz
    331333    USE control_mod
     
    349351    REAL, DIMENSION (ip1jmp1,llm) :: f_add ! var aux: champ de guidage
    350352    ! Variables pour fonction Exner (P milieu couche)
    351     REAL, DIMENSION (iip1,jjp1,llm)    :: pk, pkf
    352     REAL, DIMENSION (iip1,jjp1,llm)    :: alpha, beta
     353    REAL, DIMENSION (iip1,jjp1,llm)    :: pk
    353354    REAL, DIMENSION (iip1,jjp1)        :: pks   
    354355    REAL                               :: unskap
     
    491492    IF (f_out) THEN
    492493!       Calcul niveaux pression milieu de couches
    493         CALL pression_p( ip1jmp1, ap, bp, ps, p )
    494         if (pressure_exner) then
    495           CALL exner_hyb_p(ip1jmp1,ps,p,alpha,beta,pks,pk,pkf)
    496         else
    497           CALL exner_milieu_p(ip1jmp1,ps,p,beta,pks,pk,pkf)
     494        CALL pression_p( ip1jmp1, ap, bp, ps, p )
     495        if (pressure_exner) then
     496          CALL exner_hyb_p(ip1jmp1,ps,p,pks,pk)
     497        else
     498          CALL exner_milieu_p(ip1jmp1,ps,p,pks,pk)
    498499        endif
    499500        unskap=1./kappa
    500         DO l = 1, llm
    501             DO j=jjb_u,jje_u
    502                 DO i =1, iip1
    503                     p(i+(j-1)*iip1,l) = preff * ( pk(i,j,l)/cpp) ** unskap
    504                 ENDDO
    505             ENDDO
    506         ENDDO
    507         CALL guide_out("P",jjp1,llm,p(1:ip1jmp1,1:llm),1.)
     501        DO l = 1, llm
     502           DO j=jjb_u,jje_u
     503              DO i =1, iip1
     504                 p(i+(j-1)*iip1,l) = preff * ( pk(i,j,l)/cpp) ** unskap
     505              ENDDO
     506           ENDDO
     507        ENDDO
     508        CALL guide_out("SP",jjp1,llm,p(1:ip1jmp1,1:llm),1.)
    508509    ENDIF
    509510   
     
    517518        if (guide_zon) CALL guide_zonave(1,jjp1,llm,f_add)
    518519        CALL guide_addfield(ip1jmp1,llm,f_add,alpha_u)
    519         IF (f_out) CALL guide_out("U",jjp1,llm,f_add(:,:),factt)
     520        IF (f_out) CALL guide_out("u",jjp1,llm,ucov,factt)
     521        IF (f_out) CALL guide_out("ua",jjp1,llm,(1.-tau)*ugui1(:,:)+tau*ugui2(:,:),factt)
     522        IF (f_out) CALL guide_out("ucov",jjp1,llm,f_add(:,:)/factt,factt)
    520523        ucov(ijb_u:ije_u,:)=ucov(ijb_u:ije_u,:)+f_add(ijb_u:ije_u,:)
    521524    endif
     
    529532        if (guide_zon) CALL guide_zonave(2,jjp1,llm,f_add)
    530533        CALL guide_addfield(ip1jmp1,llm,f_add,alpha_T)
    531         IF (f_out) CALL guide_out("T",jjp1,llm,f_add(:,:),factt)
     534        IF (f_out) CALL guide_out("teta",jjp1,llm,f_add(:,:)/factt,factt)
    532535        teta(ijb_u:ije_u,:)=teta(ijb_u:ije_u,:)+f_add(ijb_u:ije_u,:)
    533536    endif
     
    541544        if (guide_zon) CALL guide_zonave(2,jjp1,1,f_add(1:ip1jmp1,1))
    542545        CALL guide_addfield(ip1jmp1,1,f_add(1:ip1jmp1,1),alpha_P)
    543         IF (f_out) CALL guide_out("SP",jjp1,1,f_add(1:ip1jmp1,1),factt)
     546        IF (f_out) CALL guide_out("ps",jjp1,1,f_add(1:ip1jmp1,1)/factt,factt)
    544547        ps(ijb_u:ije_u)=ps(ijb_u:ije_u)+f_add(ijb_u:ije_u,1)
    545548        CALL pression_p(ip1jmp1,ap,bp,ps,p)
     
    555558        if (guide_zon) CALL guide_zonave(2,jjp1,llm,f_add)
    556559        CALL guide_addfield(ip1jmp1,llm,f_add,alpha_Q)
    557         IF (f_out) CALL guide_out("Q",jjp1,llm,f_add(:,:),factt)
     560        IF (f_out) CALL guide_out("q",jjp1,llm,f_add(:,:)/factt,factt)
    558561        q(ijb_u:ije_u,:)=q(ijb_u:ije_u,:)+f_add(ijb_u:ije_u,:)
    559562    endif
     
    568571        if (guide_zon) CALL guide_zonave(2,jjm,llm,f_add(1:ip1jm,:))
    569572        CALL guide_addfield(ip1jm,llm,f_add(1:ip1jm,:),alpha_v)
    570         IF (f_out) CALL guide_out("V",jjm,llm,f_add(1:ip1jm,:),factt)
     573        IF (f_out) CALL guide_out("v",jjm,llm,vcov(1:ip1jm,:),factt)
     574        IF (f_out) CALL guide_out("va",jjm,llm,(1.-tau)*vgui1(:,:)+tau*vgui2(:,:),factt)
     575        IF (f_out) CALL guide_out("vcov",jjm,llm,f_add(1:ip1jm,:)/factt,factt)
    571576        vcov(ijb_v:ije_v,:)=vcov(ijb_v:ije_v,:)+f_add(ijb_v:ije_v,:)
    572577    endif
     
    689694!=======================================================================
    690695  SUBROUTINE guide_interp(psi,teta)
     696    use exner_hyb_p_m, only: exner_hyb_p
     697    use exner_milieu_p_m, only: exner_milieu_p
    691698  USE parallel_lmdz
    692699  USE mod_hallo
     
    713720  REAL, DIMENSION (iip1,jjm,llm)     :: pbary
    714721  ! Variables pour fonction Exner (P milieu couche)
    715   REAL, DIMENSION (iip1,jjp1,llm)    :: pk, pkf
    716   REAL, DIMENSION (iip1,jjp1,llm)    :: alpha, beta
     722  REAL, DIMENSION (iip1,jjp1,llm)    :: pk
    717723  REAL, DIMENSION (iip1,jjp1)        :: pks   
    718724  REAL                               :: unskap
     
    784790    IF (guide_plevs.EQ.1) THEN
    785791        DO l=1,llm
    786             DO j=jjb_u,jje_u
    787                 DO i =1, iip1
     792            DO j=jjb_u,jje_u
     793                DO i =1, iip1
    788794                    pls(i,j,l)=(ap(l)+ap(l+1))/2.+psi(i,j)*(bp(l)+bp(l+1))/2.
    789                 ENDDO
    790             ENDDO
     795                ENDDO
     796            ENDDO
    791797        ENDDO
    792798    ELSE
    793         CALL pression_p( ip1jmp1, ap, bp, psi, p )
    794         if (pressure_exner) then
    795           CALL exner_hyb_p(ip1jmp1,psi,p,alpha,beta,pks,pk,pkf)
     799        CALL pression_p( ip1jmp1, ap, bp, psi, p )
     800        if (pressure_exner) then
     801          CALL exner_hyb_p(ip1jmp1,psi,p,pks,pk)
    796802        else
    797           CALL exner_milieu_p(ip1jmp1,psi,p,beta,pks,pk,pkf)
     803          CALL exner_milieu_p(ip1jmp1,psi,p,pks,pk)
    798804        endif
    799         unskap=1./kappa
    800         DO l = 1, llm
    801             DO j=jjb_u,jje_u
    802                 DO i =1, iip1
    803                     pls(i,j,l) = preff * ( pk(i,j,l)/cpp) ** unskap
    804                 ENDDO
    805             ENDDO
    806         ENDDO
     805        unskap=1./kappa
     806        DO l = 1, llm
     807            DO j=jjb_u,jje_u
     808                DO i =1, iip1
     809                    pls(i,j,l) = preff * ( pk(i,j,l)/cpp) ** unskap
     810                ENDDO
     811            ENDDO
     812        ENDDO
    807813    ENDIF
    808814
     
    10241030        ! Calcul des nouvelles valeurs des niveaux de pression du guidage
    10251031        IF (guide_plevs.EQ.1) THEN
    1026         CALL Register_SwapFieldHallo(psnat1,psnat1,ip1jmp1,1,jj_Nb_caldyn,1,2,Req)
    1027         CALL SendRequest(Req)
    1028         CALL WaitRequest(Req)
    1029         CALL Register_SwapFieldHallo(psnat2,psnat2,ip1jmp1,1,jj_Nb_caldyn,1,2,Req)
    1030         CALL SendRequest(Req)
    1031         CALL WaitRequest(Req)
     1032        CALL Register_SwapFieldHallo(psnat1,psnat1,ip1jmp1,1,jj_Nb_caldyn,1,2,Req)
     1033        CALL SendRequest(Req)
     1034        CALL WaitRequest(Req)
     1035        CALL Register_SwapFieldHallo(psnat2,psnat2,ip1jmp1,1,jj_Nb_caldyn,1,2,Req)
     1036        CALL SendRequest(Req)
     1037        CALL WaitRequest(Req)
    10321038            DO l=1,nlevnc
    10331039                DO j=jjb_v,jje_v
     
    10411047            ENDDO
    10421048        ELSE IF (guide_plevs.EQ.2) THEN
    1043         CALL Register_SwapFieldHallo(pnat1,pnat1,ip1jmp1,llm,jj_Nb_caldyn,1,2,Req)
    1044         CALL SendRequest(Req)
    1045         CALL WaitRequest(Req)
    1046         CALL Register_SwapFieldHallo(pnat2,pnat2,ip1jmp1,llm,jj_Nb_caldyn,1,2,Req)
    1047         CALL SendRequest(Req)
    1048         CALL WaitRequest(Req)
     1049        CALL Register_SwapFieldHallo(pnat1,pnat1,ip1jmp1,llm,jj_Nb_caldyn,1,2,Req)
     1050        CALL SendRequest(Req)
     1051        CALL WaitRequest(Req)
     1052        CALL Register_SwapFieldHallo(pnat2,pnat2,ip1jmp1,llm,jj_Nb_caldyn,1,2,Req)
     1053        CALL SendRequest(Req)
     1054        CALL WaitRequest(Req)
    10491055            DO l=1,nlevnc
    10501056                DO j=jjb_v,jje_v
     
    18071813   
    18081814    ! Variables entree
    1809     CHARACTER, INTENT(IN)                          :: varname
     1815    CHARACTER*(*), INTENT(IN)                          :: varname
    18101816    INTEGER,   INTENT (IN)                         :: hsize,vsize
    18111817    REAL, DIMENSION (iip1,hsize,vsize), INTENT(IN) :: field
     
    18171823    INTEGER       :: nid, id_lonu, id_lonv, id_latu, id_latv, id_tim, id_lev
    18181824    INTEGER       :: vid_lonu,vid_lonv,vid_latu,vid_latv,vid_cu,vid_cv,vid_lev
     1825    INTEGER       :: vid_au,vid_av
     1826    INTEGER       :: l
    18191827    INTEGER, DIMENSION (3) :: dim3
    18201828    INTEGER, DIMENSION (4) :: dim4,count,start
    18211829    INTEGER                :: ierr, varid
     1830    REAL, DIMENSION (iip1,hsize,vsize) :: field2
    18221831   
    18231832    CALL gather_field(field,iip1*hsize,vsize,0)
     
    18341843! Definition des dimensions
    18351844        ierr=NF_DEF_DIM(nid,"LONU",iip1,id_lonu)
     1845        print*,'id_lonu 1 ',id_lonu
    18361846        ierr=NF_DEF_DIM(nid,"LONV",iip1,id_lonv)
    18371847        ierr=NF_DEF_DIM(nid,"LATU",jjp1,id_latu)
     
    18421852! Creation des variables dimensions
    18431853        ierr=NF_DEF_VAR(nid,"LONU",NF_FLOAT,1,id_lonu,vid_lonu)
     1854        print*,'id_lonu 2 ',id_lonu
    18441855        ierr=NF_DEF_VAR(nid,"LONV",NF_FLOAT,1,id_lonv,vid_lonv)
    18451856        ierr=NF_DEF_VAR(nid,"LATU",NF_FLOAT,1,id_latu,vid_latu)
     
    18481859        ierr=NF_DEF_VAR(nid,"cu",NF_FLOAT,2,(/id_lonu,id_latu/),vid_cu)
    18491860        ierr=NF_DEF_VAR(nid,"cv",NF_FLOAT,2,(/id_lonv,id_latv/),vid_cv)
     1861        ierr=NF_DEF_VAR(nid,"au",NF_FLOAT,2,(/id_lonu,id_latu/),vid_au)
     1862        ierr=NF_DEF_VAR(nid,"av",NF_FLOAT,2,(/id_lonv,id_latv/),vid_av)
    18501863       
    18511864        ierr=NF_ENDDEF(nid)
     
    18531866! Enregistrement des variables dimensions
    18541867#ifdef NC_DOUBLE
     1868        print*,'id_lonu DOUBLE ',id_lonu,rlonu*180./pi
    18551869        ierr = NF_PUT_VAR_DOUBLE(nid,vid_lonu,rlonu*180./pi)
    18561870        ierr = NF_PUT_VAR_DOUBLE(nid,vid_lonv,rlonv*180./pi)
     
    18601874        ierr = NF_PUT_VAR_DOUBLE(nid,vid_cu,cu)
    18611875        ierr = NF_PUT_VAR_DOUBLE(nid,vid_cv,cv)
     1876        ierr = NF_PUT_VAR_DOUBLE(nid,vid_au,alpha_u)
     1877        ierr = NF_PUT_VAR_DOUBLE(nid,vid_av,alpha_v)
    18621878#else
     1879        print*,'id_lonu 3 ',id_lonu,rlonu*180./pi
    18631880        ierr = NF_PUT_VAR_REAL(nid,vid_lonu,rlonu*180./pi)
    18641881        ierr = NF_PUT_VAR_REAL(nid,vid_lonv,rlonv*180./pi)
     
    18681885        ierr = NF_PUT_VAR_REAL(nid,vid_cu,cu)
    18691886        ierr = NF_PUT_VAR_REAL(nid,vid_cv,cv)
     1887        ierr = NF_PUT_VAR_REAL(nid,vid_au,alpha_u)
     1888        ierr = NF_PUT_VAR_REAL(nid,vid_av,alpha_v)
    18701889#endif
    18711890! --------------------------------------------------------------------
     
    18751894! Pressure (GCM)
    18761895        dim4=(/id_lonv,id_latu,id_lev,id_tim/)
    1877         ierr = NF_DEF_VAR(nid,"P",NF_FLOAT,4,dim4,varid)
     1896        ierr = NF_DEF_VAR(nid,"SP",NF_FLOAT,4,dim4,varid)
    18781897! Surface pressure (guidage)
    18791898        IF (guide_P) THEN
     
    18831902! Zonal wind
    18841903        IF (guide_u) THEN
     1904        print*,'id_lonu 4 ',id_lonu,varname
    18851905            dim4=(/id_lonu,id_latu,id_lev,id_tim/)
     1906            ierr = NF_DEF_VAR(nid,"u",NF_FLOAT,4,dim4,varid)
     1907            ierr = NF_DEF_VAR(nid,"ua",NF_FLOAT,4,dim4,varid)
    18861908            ierr = NF_DEF_VAR(nid,"ucov",NF_FLOAT,4,dim4,varid)
    18871909        ENDIF
     
    18891911        IF (guide_v) THEN
    18901912            dim4=(/id_lonv,id_latv,id_lev,id_tim/)
     1913            ierr = NF_DEF_VAR(nid,"v",NF_FLOAT,4,dim4,varid)
     1914            ierr = NF_DEF_VAR(nid,"va",NF_FLOAT,4,dim4,varid)
    18911915            ierr = NF_DEF_VAR(nid,"vcov",NF_FLOAT,4,dim4,varid)
    18921916        ENDIF
     
    19121936    ierr=NF_OPEN("guide_ins.nc",NF_WRITE,nid)
    19131937
     1938    IF (varname=="SP") timestep=timestep+1
     1939
     1940    IF (varname=="SP") THEN
     1941      print*,'varname=SP=',varname
     1942    ELSE
     1943      print*,'varname diff SP=',varname
     1944    ENDIF
     1945
     1946
     1947    ierr = NF_INQ_VARID(nid,varname,varid)
    19141948    SELECT CASE (varname)
    1915     CASE ("P")
    1916         timestep=timestep+1
    1917         ierr = NF_INQ_VARID(nid,"P",varid)
     1949    CASE ("SP","ps")
    19181950        start=(/1,1,1,timestep/)
    19191951        count=(/iip1,jjp1,llm,1/)
    1920 #ifdef NC_DOUBLE
    1921         ierr = NF_PUT_VARA_DOUBLE(nid,varid,start,count,field)
    1922 #else
    1923         ierr = NF_PUT_VARA_REAL(nid,varid,start,count,field)
    1924 #endif
    1925     CASE ("SP")
    1926         ierr = NF_INQ_VARID(nid,"ps",varid)
    1927         start=(/1,1,timestep,0/)
    1928         count=(/iip1,jjp1,1,0/)
    1929 #ifdef NC_DOUBLE
    1930         ierr = NF_PUT_VARA_DOUBLE(nid,varid,start,count,field/factt)
    1931 #else
    1932         ierr = NF_PUT_VARA_REAL(nid,varid,start,count,field/factt)
    1933 #endif
    1934     CASE ("U")
    1935         ierr = NF_INQ_VARID(nid,"ucov",varid)
     1952    CASE ("v","va","vcov")
     1953        start=(/1,1,1,timestep/)
     1954        count=(/iip1,jjm,llm,1/)
     1955    CASE DEFAULT
    19361956        start=(/1,1,1,timestep/)
    19371957        count=(/iip1,jjp1,llm,1/)
     1958    END SELECT
     1959
     1960    SELECT CASE (varname)
     1961    CASE("u","ua")
     1962        DO l=1,llm ; field2(:,2:jjm,l)=field(:,2:jjm,l)/cu(:,2:jjm) ; ENDDO
     1963        field2(:,1,:)=0. ; field2(:,jjp1,:)=0.
     1964    CASE("v","va")
     1965        DO l=1,llm ; field2(:,:,l)=field(:,:,l)/cv(:,:) ; ENDDO
     1966    CASE DEFAULT
     1967        field2=field
     1968    END SELECT
     1969
    19381970#ifdef NC_DOUBLE
    1939         ierr = NF_PUT_VARA_DOUBLE(nid,varid,start,count,field/factt)
     1971    ierr = NF_PUT_VARA_DOUBLE(nid,varid,start,count,field2)
    19401972#else
    1941         ierr = NF_PUT_VARA_REAL(nid,varid,start,count,field/factt)
     1973    ierr = NF_PUT_VARA_REAL(nid,varid,start,count,field2)
    19421974#endif
    1943     CASE ("V")
    1944         ierr = NF_INQ_VARID(nid,"vcov",varid)
    1945         start=(/1,1,1,timestep/)
    1946         count=(/iip1,jjm,llm,1/)
    1947 #ifdef NC_DOUBLE
    1948         ierr = NF_PUT_VARA_DOUBLE(nid,varid,start,count,field/factt)
    1949 #else
    1950         ierr = NF_PUT_VARA_REAL(nid,varid,start,count,field/factt)
    1951 #endif
    1952     CASE ("T")
    1953         ierr = NF_INQ_VARID(nid,"teta",varid)
    1954         start=(/1,1,1,timestep/)
    1955         count=(/iip1,jjp1,llm,1/)
    1956 #ifdef NC_DOUBLE
    1957         ierr = NF_PUT_VARA_DOUBLE(nid,varid,start,count,field/factt)
    1958 #else
    1959         ierr = NF_PUT_VARA_REAL(nid,varid,start,count,field/factt)
    1960 #endif
    1961     CASE ("Q")
    1962         ierr = NF_INQ_VARID(nid,"q",varid)
    1963         start=(/1,1,1,timestep/)
    1964         count=(/iip1,jjp1,llm,1/)
    1965 #ifdef NC_DOUBLE
    1966         ierr = NF_PUT_VARA_DOUBLE(nid,varid,start,count,field/factt)
    1967 #else
    1968         ierr = NF_PUT_VARA_REAL(nid,varid,start,count,field/factt)
    1969 #endif
    1970     END SELECT
    19711975 
    19721976    ierr = NF_CLOSE(nid)
  • trunk/LMDZ.COMMON/libf/dyn3dpar/leapfrog_p.F

    r1300 r1302  
    88     &                    time_0)
    99
     10      use exner_hyb_m, only: exner_hyb
     11      use exner_milieu_m, only: exner_milieu
     12      use exner_hyb_p_m, only: exner_hyb_p
     13      use exner_milieu_p_m, only: exner_milieu_p
    1014       USE misc_mod
    1115       USE parallel_lmdz
     
    1721       USE vampir
    1822       USE timer_filtre, ONLY : print_filtre_timer
    19        USE infotrac
     23       USE infotrac, ONLY: nqtot
    2024       USE guide_p_mod, ONLY : guide_main
    2125       USE getparam
     
    165169      character*10 string10
    166170
    167       REAL,SAVE :: alpha(ip1jmp1,llm),beta(ip1jmp1,llm)
    168171      REAL,SAVE :: flxw(ip1jmp1,llm) ! flux de masse verticale
    169172
     
    236239      lafin=.false.
    237240     
    238       itaufin   = nday*day_step
     241      if (nday>=0) then
     242         itaufin   = nday*day_step
     243      else
     244         ! to run a given (-nday) number of dynamical steps
     245         itaufin   = -nday
     246      endif
    239247      if (less1day) then
    240248c MODIF VENUS: to run less than one day:
     
    292300      CALL pression ( ip1jmp1, ap, bp, ps, p       )
    293301      if (pressure_exner) then
    294         CALL exner_hyb( ip1jmp1, ps, p,alpha,beta, pks, pk, pkf )
     302        CALL exner_hyb( ip1jmp1, ps, p, pks, pk, pkf )
    295303      else
    296         CALL exner_milieu( ip1jmp1, ps, p, beta, pks, pk, pkf )
     304        CALL exner_milieu( ip1jmp1, ps, p, pks, pk, pkf )
    297305      endif
    298306c$OMP END MASTER
     
    830838c$OMP BARRIER
    831839         if (pressure_exner) then
    832            CALL exner_hyb_p(  ip1jmp1, ps, p,alpha,beta,pks, pk, pkf )
     840           CALL exner_hyb_p(  ip1jmp1, ps, p,pks, pk, pkf )
    833841         else
    834            CALL exner_milieu_p( ip1jmp1, ps, p, beta, pks, pk, pkf )
     842           CALL exner_milieu_p( ip1jmp1, ps, p, pks, pk, pkf )
    835843         endif
     844! Compute geopotential (physics might need it)
     845         CALL geopot  ( ip1jmp1, teta  , pk , pks,  phis  , phi   )
    836846c$OMP BARRIER
    837847           jD_cur = jD_ref + day_ini - day_ref
     
    10401050c$OMP BARRIER
    10411051          if (pressure_exner) then
    1042             CALL exner_hyb_p(ip1jmp1,ps,p,alpha,beta,pks,pk,pkf)
     1052            CALL exner_hyb_p(ip1jmp1,ps,p,pks,pk,pkf)
    10431053          else
    1044             CALL exner_milieu_p(ip1jmp1,ps,p,beta,pks,pk,pkf)
     1054            CALL exner_milieu_p(ip1jmp1,ps,p,pks,pk,pkf)
    10451055          endif
    10461056c$OMP BARRIER
     
    12021212c$OMP BARRIER
    12031213        if (pressure_exner) then
    1204           CALL exner_hyb_p( ip1jmp1, ps, p,alpha,beta, pks, pk, pkf )
     1214          CALL exner_hyb_p( ip1jmp1, ps, p, pks, pk, pkf )
    12051215        else
    1206           CALL exner_milieu_p( ip1jmp1, ps, p, beta, pks, pk, pkf )
     1216          CALL exner_milieu_p( ip1jmp1, ps, p, pks, pk, pkf )
    12071217        endif
    12081218c$OMP BARRIER
  • trunk/LMDZ.COMMON/libf/dyn3dpar/logic.h

    r1056 r1302  
    1111     &  statcl,conser,apdiss,apdelq,saison,ecripar,fxyhypb,ysinus       &
    1212     &  ,read_start,ok_guide,ok_strato,tidal,ok_gradsfile               &
    13      &  ,ok_limit,ok_etat0,grilles_gcm_netcdf,hybrid                    &
     13     &  ,ok_limit,ok_etat0,hybrid                                       &
    1414     &  ,moyzon_mu,moyzon_ch
    1515
     
    1919     & apdiss,apdelq,saison,ecripar,fxyhypb,ysinus                      &
    2020     &  ,read_start,ok_guide,ok_strato,tidal,ok_gradsfile               &
    21      &  ,ok_limit,ok_etat0,grilles_gcm_netcdf
     21     &  ,ok_limit,ok_etat0
    2222      logical hybrid ! vertical coordinate is hybrid if true (sigma otherwise)
    2323                     ! (only used if disvert_type==2)
  • trunk/LMDZ.COMMON/libf/dyn3dpar/mod_const_mpi.F90

    r1300 r1302  
    11!
    2 ! $Id: mod_const_mpi.F90 1700 2012-12-20 14:43:19Z lguez $
     2! $Id: mod_const_mpi.F90 2055 2014-06-04 12:33:27Z acaubel $
    33!
    44MODULE mod_const_mpi
     
    1717    USE ioipsl_getincom, only: getin
    1818#endif
    19 
     19! Use of Oasis-MCT coupler
     20#ifdef CPP_OMCT
     21    USE mod_prism
     22#endif
     23#ifdef CPP_XIOS
     24    USE wxios, only: wxios_init
     25#endif
    2026    IMPLICIT NONE
    2127#ifdef CPP_MPI
     
    3844#ifdef CPP_COUPLE
    3945!$OMP MASTER
    40        CALL prism_init_comp_proto (comp_id, 'lmdz.x', ierr)
     46#ifdef CPP_XIOS
     47      CALL wxios_init("LMDZ", outcom=COMM_LMDZ, type_ocean=type_ocean)
     48#else
     49       CALL prism_init_comp_proto (comp_id, 'LMDZ', ierr)
    4150       CALL prism_get_localcomm_proto(COMM_LMDZ,ierr)
     51#endif
    4252!$OMP END MASTER
    4353#endif
  • trunk/LMDZ.COMMON/libf/dyn3dpar/parallel_lmdz.F90

    r1300 r1302  
    225225#endif
    226226#ifdef CPP_COUPLE
     227! Use of Oasis-MCT coupler
     228#if defined CPP_OMCT
     229    use mod_prism
     230#else
    227231    use mod_prism_proto
    228232#endif
    229 #ifdef CPP_EARTH
    230233! Ehouarn: surface_data module is in 'phylmd' ...
    231234      use surface_data, only : type_ocean
     
    252255
    253256      if (type_ocean == 'couple') then
     257#ifdef CPP_XIOS
     258    !Fermeture propre de XIOS
     259      CALL wxios_close()
     260#else
    254261#ifdef CPP_COUPLE
    255262         call prism_terminate_proto(ierr)
     
    258265         endif
    259266#endif
     267#endif
    260268      else
    261269#ifdef CPP_XIOS
Note: See TracChangeset for help on using the changeset viewer.