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.
isfrst.F90 in NEMO/branches/2020/dev_12905_xios_restart/src/OCE/ISF – NEMO

source: NEMO/branches/2020/dev_12905_xios_restart/src/OCE/ISF/isfrst.F90 @ 12977

Last change on this file since 12977 was 12969, checked in by andmirek, 4 years ago

ticket #2462: read restart with XIOS independently for each component

File size: 4.7 KB
Line 
1MODULE isfrst
2   !!======================================================================
3   !!                       ***  MODULE  isfrst  ***
4   !! iceshelf restart module :read/write iceshelf variables from/in restart
5   !!======================================================================
6   !! History :  4.1  !  2019-07  (P. Mathiot) Original code
7   !!----------------------------------------------------------------------
8
9   !!----------------------------------------------------------------------
10   !!   isfrst : read/write iceshelf variables in/from restart
11   !!----------------------------------------------------------------------
12   !
13   USE par_oce, ONLY: jpi,jpj,jpk,jpts ! time and space domain
14   !
15   USE in_out_manager ! I/O manager
16   USE iom            ! I/O library
17   !
18   IMPLICIT NONE
19
20   PRIVATE
21
22   PUBLIC isfrst_read, isfrst_write ! iceshelf restart read and write
23
24   !!----------------------------------------------------------------------
25   !! NEMO/OCE 4.0 , NEMO Consortium (2018)
26   !! $Id: sbcisf.F90 10536 2019-01-16 19:21:09Z mathiot $
27   !! Software governed by the CeCILL license (see ./LICENSE)
28   !!----------------------------------------------------------------------
29CONTAINS
30   !
31   SUBROUTINE isfrst_read(cdisf, ptsc, pfwf, ptsc_b, pfwf_b )
32      !!---------------------------------------------------------------------
33      !!
34      !!   isfrst_read : read iceshelf variables from restart
35      !!
36      !!-------------------------- OUT --------------------------------------
37      REAL(wp), DIMENSION(jpi,jpj)     , INTENT(  out) :: pfwf_b
38      REAL(wp), DIMENSION(jpi,jpj,jpts), INTENT(  out) :: ptsc_b
39      !!-------------------------- IN  --------------------------------------
40      CHARACTER(LEN=3)                 , INTENT(in   ) :: cdisf
41      REAL(wp), DIMENSION(jpi,jpj)     , INTENT(in   ) :: pfwf
42      REAL(wp), DIMENSION(jpi,jpj,jpts), INTENT(in   ) :: ptsc
43      !!----------------------------------------------------------------------
44      CHARACTER(LEN=256) :: cfwf_b, chc_b, csc_b
45      !!----------------------------------------------------------------------
46      !
47      ! define variable name
48      cfwf_b = 'fwfisf_'//TRIM(cdisf)//'_b'
49      chc_b  = 'isf_hc_'//TRIM(cdisf)//'_b'
50      csc_b  = 'isf_sc_'//TRIM(cdisf)//'_b'
51      !
52      ! read restart
53      IF( iom_varid( numror, cfwf_b, ldstop = .FALSE. ) > 0 ) THEN
54         IF(lwp) WRITE(numout,*) '          nit000-1 isf tracer content forcing fields read in the restart file'
55         IF( lroxios ) CALL iom_swap( TRIM(crxios_context) )
56         CALL iom_get( numror, jpdom_autoglo, cfwf_b, pfwf_b(:,:)        , ldxios = lroxios )   ! before ice shelf melt
57         CALL iom_get( numror, jpdom_autoglo, chc_b , ptsc_b (:,:,jp_tem), ldxios = lroxios )   ! before ice shelf heat flux
58         CALL iom_get( numror, jpdom_autoglo, csc_b , ptsc_b (:,:,jp_sal), ldxios = lroxios )   ! before ice shelf heat flux
59         IF( lroxios ) CALL iom_swap( TRIM(cxios_context) )
60      ELSE
61         pfwf_b(:,:)   = pfwf(:,:)
62         ptsc_b(:,:,:) = ptsc(:,:,:)
63      ENDIF
64      !
65   END SUBROUTINE isfrst_read
66   !
67   SUBROUTINE isfrst_write(kt, cdisf, ptsc, pfwf )
68      !!---------------------------------------------------------------------
69      !!
70      !!   isfrst_write : write iceshelf variables in restart
71      !!
72      !!-------------------------- IN  --------------------------------------
73      INTEGER                          , INTENT(in   ) :: kt
74      CHARACTER(LEN=3)                 , INTENT(in   ) :: cdisf
75      REAL(wp), DIMENSION(jpi,jpj)     , INTENT(in   ) :: pfwf
76      REAL(wp), DIMENSION(jpi,jpj,jpts), INTENT(in   ) :: ptsc
77      !!---------------------------------------------------------------------
78      CHARACTER(LEN=256) :: cfwf_b, chc_b, csc_b
79      !!---------------------------------------------------------------------
80      !
81      ! ocean output print
82      IF(lwp) WRITE(numout,*)
83      IF(lwp) WRITE(numout,*) 'isf : isf fwf and heat fluxes written in ocean restart file ',   &
84         &                    'at it= ', kt,' date= ', ndastp
85      IF(lwp) WRITE(numout,*) '~~~~'
86      !
87      ! define variable name
88      cfwf_b = 'fwfisf_'//TRIM(cdisf)//'_b'
89      chc_b  = 'isf_hc_'//TRIM(cdisf)//'_b'
90      csc_b  = 'isf_sc_'//TRIM(cdisf)//'_b'
91      !
92      ! write restart variable
93      IF( lwxios ) CALL iom_swap( cwxios_context )
94      CALL iom_rstput( kt, nitrst, numrow, cfwf_b, pfwf(:,:)       , ldxios = lwxios )
95      CALL iom_rstput( kt, nitrst, numrow, chc_b , ptsc(:,:,jp_tem), ldxios = lwxios )
96      CALL iom_rstput( kt, nitrst, numrow, csc_b , ptsc(:,:,jp_sal), ldxios = lwxios )
97      IF( lwxios ) CALL iom_swap( cxios_context )
98      !
99   END SUBROUTINE isfrst_write
100   !
101END MODULE isfrst
Note: See TracBrowser for help on using the repository browser.