New URL for NEMO forge!   http://forge.nemo-ocean.eu

Since March 2022 along with NEMO 4.2 release, the code development moved to a self-hosted GitLab.
This present forge is now archived and remained online for history.
Changeset 4152 for branches/2013/dev_LOCEAN_2013/NEMOGCM/NEMO/OPA_SRC/IOM/iom.F90 – NEMO

Ignore:
Timestamp:
2013-11-05T12:59:53+01:00 (10 years ago)
Author:
cetlod
Message:

merge in dev_LOCEAN_2013 the 2nd development branch dev_r3940_CNRS4_IOCRS, see ticket #1169

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/2013/dev_LOCEAN_2013/NEMOGCM/NEMO/OPA_SRC/IOM/iom.F90

    r4148 r4152  
    3737# endif 
    3838   USE ioipsl, ONLY :  ju2ymds    ! for calendar 
     39   USE crs             ! Grid coarsening 
    3940 
    4041   IMPLICIT NONE 
     
    4748#endif 
    4849   PUBLIC iom_init, iom_swap, iom_open, iom_close, iom_setkt, iom_varid, iom_get, iom_gettime, iom_rstput, iom_put 
    49    PUBLIC iom_getatt 
     50   PUBLIC iom_getatt, iom_context_finalize 
    5051 
    5152   PRIVATE iom_rp0d, iom_rp1d, iom_rp2d, iom_rp3d 
     
    6970     MODULE PROCEDURE iom_p0d, iom_p1d, iom_p2d, iom_p3d 
    7071  END INTERFACE 
    71 #if defined key_iomput 
    72    INTERFACE iom_setkt 
    73       MODULE PROCEDURE xios_update_calendar 
    74    END INTERFACE 
    75 # endif 
    7672 
    7773   !!---------------------------------------------------------------------- 
     
    8379CONTAINS 
    8480 
    85    SUBROUTINE iom_init 
     81   SUBROUTINE iom_init( cdname )  
    8682      !!---------------------------------------------------------------------- 
    8783      !!                     ***  ROUTINE   *** 
     
    9086      !! 
    9187      !!---------------------------------------------------------------------- 
     88      CHARACTER(len=*), INTENT(in)  :: cdname 
    9289#if defined key_iomput 
    9390      TYPE(xios_time)   :: dtime    = xios_time(0, 0, 0, 0, 0, 0) 
     
    9794      !!---------------------------------------------------------------------- 
    9895 
    99       clname = "nemo" 
    100       IF( TRIM(Agrif_CFixed()) /= '0' )   clname = TRIM(Agrif_CFixed())//"_"//TRIM(clname) 
     96      clname = cdname 
     97      IF( TRIM(Agrif_CFixed()) /= '0' )   clname = TRIM(Agrif_CFixed())//"_"//TRIM(cdname) 
    10198      CALL xios_context_initialize(TRIM(clname), mpi_comm_opa) 
    102       CALL iom_swap 
     99      CALL iom_swap( cdname ) 
    103100 
    104101      ! calendar parameters 
     
    113110      ! horizontal grid definition 
    114111      CALL set_scalar 
    115       CALL set_grid( "T", glamt, gphit )  
    116       CALL set_grid( "U", glamu, gphiu ) 
    117       CALL set_grid( "V", glamv, gphiv ) 
    118       CALL set_grid( "W", glamt, gphit ) 
     112 
     113      IF( TRIM(cdname) == "nemo" ) THEN   
     114         CALL set_grid( "T", glamt, gphit )  
     115         CALL set_grid( "U", glamu, gphiu ) 
     116         CALL set_grid( "V", glamv, gphiv ) 
     117         CALL set_grid( "W", glamt, gphit ) 
     118      ENDIF 
     119 
     120      IF( TRIM(cdname) == "nemo_crs" ) THEN   
     121         CALL dom_grid_crs   ! Save the parent grid information  & Switch to coarse grid domain 
     122         ! 
     123         CALL set_grid( "T", glamt_crs, gphit_crs )  
     124         CALL set_grid( "U", glamu_crs, gphiu_crs )  
     125         CALL set_grid( "V", glamv_crs, gphiv_crs )  
     126         CALL set_grid( "W", glamt_crs, gphit_crs )  
     127          ! 
     128         CALL dom_grid_glo   ! Return to parent grid domain 
     129      ENDIF 
     130 
    119131 
    120132      ! vertical grid definition 
     
    141153 
    142154 
    143    SUBROUTINE iom_swap 
     155   SUBROUTINE iom_swap( cdname ) 
    144156      !!--------------------------------------------------------------------- 
    145157      !!                   ***  SUBROUTINE  iom_swap  *** 
     
    147159      !! ** Purpose :  swap context between different agrif grid for xmlio_server 
    148160      !!--------------------------------------------------------------------- 
     161      CHARACTER(len=*), INTENT(in) :: cdname 
    149162#if defined key_iomput 
    150163      TYPE(xios_context) :: nemo_hdl 
    151164 
    152      IF( TRIM(Agrif_CFixed()) == '0' ) THEN 
    153         CALL xios_get_handle("nemo",nemo_hdl) 
    154      ELSE 
    155         CALL xios_get_handle(TRIM(Agrif_CFixed())//"_nemo",nemo_hdl) 
    156      ENDIF 
    157      CALL xios_set_current_context(nemo_hdl) 
    158  
     165      IF( TRIM(Agrif_CFixed()) == '0' ) THEN 
     166        CALL xios_get_handle(TRIM(cdname),nemo_hdl) 
     167      ELSE 
     168        CALL xios_get_handle(TRIM(Agrif_CFixed())//"_"//TRIM(cdname),nemo_hdl) 
     169      ENDIF 
     170      ! 
     171      CALL xios_set_current_context(nemo_hdl) 
    159172#endif 
     173      ! 
    160174   END SUBROUTINE iom_swap 
    161175 
     
    11001114      CALL xios_solve_inheritance() 
    11011115   END SUBROUTINE iom_set_grid_attr 
     1116 
     1117   SUBROUTINE iom_setkt( kt, cdname ) 
     1118      INTEGER         , INTENT(in) ::   kt  
     1119      CHARACTER(LEN=*), INTENT(in) ::   cdname 
     1120      !      
     1121      CALL iom_swap( cdname )   ! swap to cdname context 
     1122      CALL xios_update_calendar(kt) 
     1123      IF( cdname /= "nemo" ) CALL iom_swap( "nemo" )   ! return back to nemo context 
     1124      ! 
     1125   END SUBROUTINE iom_setkt 
     1126 
     1127   SUBROUTINE iom_context_finalize( cdname ) 
     1128      CHARACTER(LEN=*), INTENT(in) :: cdname 
     1129      !      
     1130      CALL iom_swap( cdname )   ! swap to cdname context 
     1131      CALL xios_context_finalize() ! finalize the context 
     1132      IF( cdname /= "nemo" ) CALL iom_swap( "nemo" )   ! return back to nemo context 
     1133      ! 
     1134   END SUBROUTINE iom_context_finalize 
    11021135 
    11031136 
     
    14241457#else 
    14251458 
    1426    SUBROUTINE iom_setkt( kt ) 
    1427       INTEGER, INTENT(in   )::   kt  
    1428       IF( .FALSE. )   WRITE(numout,*) kt   ! useless test to avoid compilation warnings 
     1459 
     1460   SUBROUTINE iom_setkt( kt, cdname ) 
     1461      INTEGER         , INTENT(in)::   kt  
     1462      CHARACTER(LEN=*), INTENT(in) ::   cdname 
     1463      IF( .FALSE. )   WRITE(numout,*) kt, cdname   ! useless test to avoid compilation warnings 
    14291464   END SUBROUTINE iom_setkt 
     1465 
     1466   SUBROUTINE iom_context_finalize( cdname ) 
     1467      CHARACTER(LEN=*), INTENT(in) ::   cdname 
     1468      IF( .FALSE. )   WRITE(numout,*)  cdname   ! useless test to avoid compilation warnings 
     1469   END SUBROUTINE iom_context_finalize 
    14301470 
    14311471#endif 
Note: See TracChangeset for help on using the changeset viewer.