diff --git a/src/LIB/SURCOUCHE/src/mode_field.f90 b/src/LIB/SURCOUCHE/src/mode_field.f90 index 4dff86bd3aafd4859ae05cac7c12f0f560436f8e..e025ae83960cd53d6284e71614dea75092f5602b 100644 --- a/src/LIB/SURCOUCHE/src/mode_field.f90 +++ b/src/LIB/SURCOUCHE/src/mode_field.f90 @@ -11,6 +11,7 @@ ! C. Lac 02/2019: add rain fraction as an output field ! S. Bielli 02/2019: sea salt: significant sea wave height influences salt emission; 5 salt modes ! P. Wautelet 06/03/2019: correct ZWS entry +! P. Wautelet 12/04/2019: added pointers for C1D, L1D, N1D, X5D and X6D structures in TFIELDDATA !----------------------------------------------------------------- MODULE MODE_FIELD ! @@ -33,14 +34,26 @@ TYPE TFIELDPTR_C0D CHARACTER(LEN=:), POINTER :: DATA => NULL() END TYPE TFIELDPTR_C0D ! +TYPE TFIELDPTR_C1D + CHARACTER(LEN=:),DIMENSION(:),POINTER :: DATA => NULL() +END TYPE TFIELDPTR_C1D +! TYPE TFIELDPTR_L0D LOGICAL, POINTER :: DATA => NULL() END TYPE TFIELDPTR_L0D ! +TYPE TFIELDPTR_L1D + LOGICAL,DIMENSION(:), POINTER :: DATA => NULL() +END TYPE TFIELDPTR_L1D +! TYPE TFIELDPTR_N0D INTEGER, POINTER :: DATA => NULL() END TYPE TFIELDPTR_N0D ! +TYPE TFIELDPTR_N1D + INTEGER,DIMENSION(:), POINTER :: DATA => NULL() +END TYPE TFIELDPTR_N1D +! TYPE TFIELDPTR_N2D INTEGER,DIMENSION(:,:), POINTER :: DATA => NULL() END TYPE TFIELDPTR_N2D @@ -69,6 +82,14 @@ TYPE TFIELDPTR_X4D REAL,DIMENSION(:,:,:,:),POINTER :: DATA => NULL() END TYPE TFIELDPTR_X4D ! +TYPE TFIELDPTR_X5D + REAL,DIMENSION(:,:,:,:,:),POINTER :: DATA => NULL() +END TYPE TFIELDPTR_X5D +! +TYPE TFIELDPTR_X6D + REAL,DIMENSION(:,:,:,:,:,:),POINTER :: DATA => NULL() +END TYPE TFIELDPTR_X6D +! TYPE TFIELDPTR_T0D TYPE(DATE_TIME), POINTER :: DATA => NULL() END TYPE TFIELDPTR_T0D @@ -103,10 +124,13 @@ TYPE TFIELDDATA REAL :: XVALIDMAX = 1.E36 !Maximum valid value for real fields ! TYPE(TFIELDPTR_C0D),DIMENSION(:),ALLOCATABLE :: TFIELD_C0D !Pointer to the character string fields (one per nested mesh) + TYPE(TFIELDPTR_C1D),DIMENSION(:),ALLOCATABLE :: TFIELD_C1D !Pointer to the character string 1D fields (one per nested mesh) ! TYPE(TFIELDPTR_L0D),DIMENSION(:),ALLOCATABLE :: TFIELD_L0D !Pointer to the scalar logical fields (one per nested mesh) + TYPE(TFIELDPTR_L1D),DIMENSION(:),ALLOCATABLE :: TFIELD_L1D !Pointer to the logical 1D fields (one per nested mesh) ! TYPE(TFIELDPTR_N0D),DIMENSION(:),ALLOCATABLE :: TFIELD_N0D !Pointer to the scalar integer fields (one per nested mesh) + TYPE(TFIELDPTR_N1D),DIMENSION(:),ALLOCATABLE :: TFIELD_N1D !Pointer to the integer 1D fields (one per nested mesh) TYPE(TFIELDPTR_N2D),DIMENSION(:),ALLOCATABLE :: TFIELD_N2D !Pointer to the integer 2D fields (one per nested mesh) TYPE(TFIELDPTR_N3D),DIMENSION(:),ALLOCATABLE :: TFIELD_N3D !Pointer to the integer 3D fields (one per nested mesh) ! @@ -115,6 +139,8 @@ TYPE TFIELDDATA TYPE(TFIELDPTR_X2D),DIMENSION(:),ALLOCATABLE :: TFIELD_X2D !Pointer to the real 2D fields (one per nested mesh) TYPE(TFIELDPTR_X3D),DIMENSION(:),ALLOCATABLE :: TFIELD_X3D !Pointer to the real 3D fields (one per nested mesh) TYPE(TFIELDPTR_X4D),DIMENSION(:),ALLOCATABLE :: TFIELD_X4D !Pointer to the real 4D fields (one per nested mesh) + TYPE(TFIELDPTR_X5D),DIMENSION(:),ALLOCATABLE :: TFIELD_X5D !Pointer to the real 5D fields (one per nested mesh) + TYPE(TFIELDPTR_X6D),DIMENSION(:),ALLOCATABLE :: TFIELD_X6D !Pointer to the real 6D fields (one per nested mesh) ! TYPE(TFIELDPTR_T0D),DIMENSION(:),ALLOCATABLE :: TFIELD_T0D !Pointer to the scalar date/time fields (one per nested mesh) END TYPE TFIELDDATA diff --git a/src/LIB/SURCOUCHE/src/mode_io_field_write.f90 b/src/LIB/SURCOUCHE/src/mode_io_field_write.f90 index 44504116599a419365056964944265dfcbf11104..c865a58065e85bd6f5c15141e4191ad52491ca4d 100644 --- a/src/LIB/SURCOUCHE/src/mode_io_field_write.f90 +++ b/src/LIB/SURCOUCHE/src/mode_io_field_write.f90 @@ -10,6 +10,7 @@ ! P. Wautelet 10/01/2019: write header also for Z-split files ! P. Wautelet 05/03/2019: rename IO subroutines and modules ! P. Wautelet 10/04/2019: replace ABORT and STOP calls by Print_msg +! P. Wautelet 12/04/2019: added pointers for C1D, L1D, N1D, X5D and X6D structures in TFIELDDATA !----------------------------------------------------------------- #define MNH_SCALARS_IN_SPLITFILES 0 @@ -2739,60 +2740,60 @@ DO JI = 1,SIZE(TPOUTPUT%NFIELDLIST) call Print_msg( NVERB_ERROR, 'IO', 'IO_Fieldlist_write', trim(tfieldlist(idx)%cmnhname)// & ': CLBTYPE/=NONE not allowed for 1D real fields' ) END IF -! ! -! !1D integer -! ! -! CASE (TYPEINT) -! IF ( .NOT.ALLOCATED(TFIELDLIST(IDX)%TFIELD_N1D) ) THEN -! call Print_msg( NVERB_ERROR, 'IO', 'IO_Fieldlist_write', trim(tfieldlist(idx)%cmnhname)// & -! ': TFIELD_N1D is NOT allocated ' ) -! END IF -! IF ( .NOT.ASSOCIATED(TFIELDLIST(IDX)%TFIELD_N1D(IMI)%DATA) ) THEN -! call Print_msg( NVERB_ERROR, 'IO', 'IO_Fieldlist_write', trim(tfieldlist(idx)%cmnhname)// & -! ': TFIELD_N1D%DATA is NOT associated' ) -! END IF -! IF ( TFIELDLIST(IDX)%CLBTYPE == 'NONE' ) THEN -! CALL IO_Field_write(TPOUTPUT%TFILE,TFIELDLIST(IDX),TFIELDLIST(IDX)%TFIELD_N1D(IMI)%DATA) -! ELSE -! call Print_msg( NVERB_ERROR, 'IO', 'IO_Fieldlist_write', trim(tfieldlist(idx)%cmnhname)// & -! ': CLBTYPE/=NONE not allowed for 1D integer fields' ) -! END IF -! ! -! !1D logical -! ! -! CASE (TYPELOG) -! IF ( .NOT.ALLOCATED(TFIELDLIST(IDX)%TFIELD_L1D) ) THEN -! call Print_msg( NVERB_ERROR, 'IO', 'IO_Fieldlist_write', trim(tfieldlist(idx)%cmnhname)// & -! ': TFIELD_L1D is NOT allocated ' ) -! END IF -! IF ( .NOT.ASSOCIATED(TFIELDLIST(IDX)%TFIELD_L1D(IMI)%DATA) ) THEN -! call Print_msg( NVERB_ERROR, 'IO', 'IO_Fieldlist_write', trim(tfieldlist(idx)%cmnhname)// & -! ': TFIELD_L1D%DATA is NOT associated' ) -! END IF -! IF ( TFIELDLIST(IDX)%CLBTYPE == 'NONE' ) THEN -! CALL IO_Field_write(TPOUTPUT%TFILE,TFIELDLIST(IDX),TFIELDLIST(IDX)%TFIELD_L1D(IMI)%DATA) -! ELSE -! call Print_msg( NVERB_ERROR, 'IO', 'IO_Fieldlist_write', trim(tfieldlist(idx)%cmnhname)// & -! ': CLBTYPE/=NONE not allowed for 1D logical fields' ) -! END IF -! ! -! !1D string -! ! -! CASE (TYPECHAR) -! IF ( .NOT.ALLOCATED(TFIELDLIST(IDX)%TFIELD_C1D) ) THEN -! call Print_msg( NVERB_ERROR, 'IO', 'IO_Fieldlist_write', trim(tfieldlist(idx)%cmnhname)// & -! ': TFIELD_C1D is NOT allocated ' ) -! END IF -! IF ( .NOT.ASSOCIATED(TFIELDLIST(IDX)%TFIELD_C1D(IMI)%DATA) ) THEN -! call Print_msg( NVERB_ERROR, 'IO', 'IO_Fieldlist_write', trim(tfieldlist(idx)%cmnhname)// & -! ': TFIELD_C1D%DATA is NOT associated' ) -! END IF -! IF ( TFIELDLIST(IDX)%CLBTYPE == 'NONE' ) THEN -! CALL IO_Field_write(TPOUTPUT%TFILE,TFIELDLIST(IDX),TFIELDLIST(IDX)%TFIELD_C1D(IMI)%DATA) -! ELSE -! call Print_msg( NVERB_ERROR, 'IO', 'IO_Fieldlist_write', trim(tfieldlist(idx)%cmnhname)// & -! ': CLBTYPE/=NONE not allowed for 1D character fields' ) -! END IF + ! + !1D integer + ! + CASE (TYPEINT) + IF ( .NOT.ALLOCATED(TFIELDLIST(IDX)%TFIELD_N1D) ) THEN + call Print_msg( NVERB_ERROR, 'IO', 'IO_Fieldlist_write', trim(tfieldlist(idx)%cmnhname)// & + ': TFIELD_N1D is NOT allocated ' ) + END IF + IF ( .NOT.ASSOCIATED(TFIELDLIST(IDX)%TFIELD_N1D(IMI)%DATA) ) THEN + call Print_msg( NVERB_ERROR, 'IO', 'IO_Fieldlist_write', trim(tfieldlist(idx)%cmnhname)// & + ': TFIELD_N1D%DATA is NOT associated' ) + END IF + IF ( TFIELDLIST(IDX)%CLBTYPE == 'NONE' ) THEN + CALL IO_Field_write(TPOUTPUT%TFILE,TFIELDLIST(IDX),TFIELDLIST(IDX)%TFIELD_N1D(IMI)%DATA) + ELSE + call Print_msg( NVERB_ERROR, 'IO', 'IO_Fieldlist_write', trim(tfieldlist(idx)%cmnhname)// & + ': CLBTYPE/=NONE not allowed for 1D integer fields' ) + END IF + ! + !1D logical + ! + CASE (TYPELOG) + IF ( .NOT.ALLOCATED(TFIELDLIST(IDX)%TFIELD_L1D) ) THEN + call Print_msg( NVERB_ERROR, 'IO', 'IO_Fieldlist_write', trim(tfieldlist(idx)%cmnhname)// & + ': TFIELD_L1D is NOT allocated ' ) + END IF + IF ( .NOT.ASSOCIATED(TFIELDLIST(IDX)%TFIELD_L1D(IMI)%DATA) ) THEN + call Print_msg( NVERB_ERROR, 'IO', 'IO_Fieldlist_write', trim(tfieldlist(idx)%cmnhname)// & + ': TFIELD_L1D%DATA is NOT associated' ) + END IF + IF ( TFIELDLIST(IDX)%CLBTYPE == 'NONE' ) THEN + CALL IO_Field_write(TPOUTPUT%TFILE,TFIELDLIST(IDX),TFIELDLIST(IDX)%TFIELD_L1D(IMI)%DATA) + ELSE + call Print_msg( NVERB_ERROR, 'IO', 'IO_Fieldlist_write', trim(tfieldlist(idx)%cmnhname)// & + ': CLBTYPE/=NONE not allowed for 1D logical fields' ) + END IF + ! + !1D string + ! + CASE (TYPECHAR) + IF ( .NOT.ALLOCATED(TFIELDLIST(IDX)%TFIELD_C1D) ) THEN + call Print_msg( NVERB_ERROR, 'IO', 'IO_Fieldlist_write', trim(tfieldlist(idx)%cmnhname)// & + ': TFIELD_C1D is NOT allocated ' ) + END IF + IF ( .NOT.ASSOCIATED(TFIELDLIST(IDX)%TFIELD_C1D(IMI)%DATA) ) THEN + call Print_msg( NVERB_ERROR, 'IO', 'IO_Fieldlist_write', trim(tfieldlist(idx)%cmnhname)// & + ': TFIELD_C1D%DATA is NOT associated' ) + END IF + IF ( TFIELDLIST(IDX)%CLBTYPE == 'NONE' ) THEN + CALL IO_Field_write(TPOUTPUT%TFILE,TFIELDLIST(IDX),TFIELDLIST(IDX)%TFIELD_C1D(IMI)%DATA) + ELSE + call Print_msg( NVERB_ERROR, 'IO', 'IO_Fieldlist_write', trim(tfieldlist(idx)%cmnhname)// & + ': CLBTYPE/=NONE not allowed for 1D character fields' ) + END IF ! !1D other types ! @@ -2932,69 +2933,70 @@ DO JI = 1,SIZE(TPOUTPUT%NFIELDLIST) call Print_msg( NVERB_ERROR, 'IO', 'IO_Fieldlist_write', trim(tfieldlist(idx)%cmnhname)// & ': type not yet supported for 4D output' ) END SELECT NTYPE4D -! ! -! !5D output -! ! -! CASE (5) -! NTYPE5D: SELECT CASE (TFIELDLIST(IDX)%NTYPE) -! ! -! !5D real -! ! -! CASE (TYPEREAL) -! IF ( .NOT.ALLOCATED(TFIELDLIST(IDX)%TFIELD_X5D) ) THEN -! call Print_msg( NVERB_ERROR, 'IO', 'IO_Fieldlist_write', trim(tfieldlist(idx)%cmnhname)// & -! ': TFIELD_X5D is NOT allocated ' ) -! END IF -! IF ( .NOT.ASSOCIATED(TFIELDLIST(IDX)%TFIELD_X5D(IMI)%DATA) ) THEN -! call Print_msg( NVERB_ERROR, 'IO', 'IO_Fieldlist_write', trim(tfieldlist(idx)%cmnhname)// & -! ': TFIELD_X5D%DATA is NOT associated' ) -! END IF -! IF ( TFIELDLIST(IDX)%CLBTYPE == 'NONE' ) THEN -! CALL IO_Field_write(TPOUTPUT%TFILE,TFIELDLIST(IDX),TFIELDLIST(IDX)%TFIELD_X5D(IMI)%DATA) -! ELSE -! call Print_msg( NVERB_ERROR, 'IO', 'IO_Fieldlist_write', trim(tfieldlist(idx)%cmnhname)// & -! ': CLBTYPE/=NONE not (yet) allowed for 5D real fields' ) -! !PW: TODO?: add missing field in TFIELDLIST? -! !CALL IO_Field_write_lb(TPOUTPUT%TFILE,TFIELDLIST(IDX),***,TFIELDLIST(IDX)%TFIELD_X5D(IMI)%DATA) -! END IF -! ! -! !5D other types -! ! -! CASE DEFAULT -! call Print_msg( NVERB_ERROR, 'IO', 'IO_Fieldlist_write', trim(tfieldlist(idx)%cmnhname)// & -! ': type not yet supported for 5D output' ) -! END SELECT NTYPE5D -! ! -! !6D output -! ! -! CASE (6) -! NTYPE6D: SELECT CASE (TFIELDLIST(IDX)%NTYPE) -! ! -! !6D real -! ! -! CASE (TYPEREAL) -! call Print_msg( NVERB_ERROR, 'IO', 'IO_Fieldlist_write', trim(tfieldlist(idx)%cmnhname)// & -! ': TFIELD_X6D is NOT allocated ' ) -! END IF -! IF ( .NOT.ASSOCIATED(TFIELDLIST(IDX)%TFIELD_X6D(IMI)%DATA) ) THEN -! call Print_msg( NVERB_ERROR, 'IO', 'IO_Fieldlist_write', trim(tfieldlist(idx)%cmnhname)// & -! ': TFIELD_X6D%DATA is NOT associated' ) -! END IF -! IF ( TFIELDLIST(IDX)%CLBTYPE == 'NONE' ) THEN -! CALL IO_Field_write(TPOUTPUT%TFILE,TFIELDLIST(IDX),TFIELDLIST(IDX)%TFIELD_X6D(IMI)%DATA) -! ELSE -! call Print_msg( NVERB_ERROR, 'IO', 'IO_Fieldlist_write', trim(tfieldlist(idx)%cmnhname)// & -! ': CLBTYPE/=NONE not (yet) allowed for 6D real fields' ) -! !PW: TODO?: add missing field in TFIELDLIST? -! !CALL IO_Field_write_lb(TPOUTPUT%TFILE,TFIELDLIST(IDX),***,TFIELDLIST(IDX)%TFIELD_X6D(IMI)%DATA) -! END IF -! ! -! !6D other types -! ! -! CASE DEFAULT -! call Print_msg( NVERB_ERROR, 'IO', 'IO_Fieldlist_write', trim(tfieldlist(idx)%cmnhname)// & -! ': type not yet supported for 6D output' ) -! END SELECT NTYPE6D + ! + !5D output + ! + CASE (5) + NTYPE5D: SELECT CASE (TFIELDLIST(IDX)%NTYPE) + ! + !5D real + ! + CASE (TYPEREAL) + IF ( .NOT.ALLOCATED(TFIELDLIST(IDX)%TFIELD_X5D) ) THEN + call Print_msg( NVERB_ERROR, 'IO', 'IO_Fieldlist_write', trim(tfieldlist(idx)%cmnhname)// & + ': TFIELD_X5D is NOT allocated ' ) + END IF + IF ( .NOT.ASSOCIATED(TFIELDLIST(IDX)%TFIELD_X5D(IMI)%DATA) ) THEN + call Print_msg( NVERB_ERROR, 'IO', 'IO_Fieldlist_write', trim(tfieldlist(idx)%cmnhname)// & + ': TFIELD_X5D%DATA is NOT associated' ) + END IF + IF ( TFIELDLIST(IDX)%CLBTYPE == 'NONE' ) THEN + CALL IO_Field_write(TPOUTPUT%TFILE,TFIELDLIST(IDX),TFIELDLIST(IDX)%TFIELD_X5D(IMI)%DATA) + ELSE + call Print_msg( NVERB_ERROR, 'IO', 'IO_Fieldlist_write', trim(tfieldlist(idx)%cmnhname)// & + ': CLBTYPE/=NONE not (yet) allowed for 5D real fields' ) + !PW: TODO?: add missing field in TFIELDLIST? + !CALL IO_Field_write_lb(TPOUTPUT%TFILE,TFIELDLIST(IDX),***,TFIELDLIST(IDX)%TFIELD_X5D(IMI)%DATA) + END IF + ! + !5D other types + ! + CASE DEFAULT + call Print_msg( NVERB_ERROR, 'IO', 'IO_Fieldlist_write', trim(tfieldlist(idx)%cmnhname)// & + ': type not yet supported for 5D output' ) + END SELECT NTYPE5D + ! + !6D output + ! + CASE (6) + NTYPE6D: SELECT CASE (TFIELDLIST(IDX)%NTYPE) + ! + !6D real + ! + CASE (TYPEREAL) + IF ( .NOT.ALLOCATED(TFIELDLIST(IDX)%TFIELD_X6D) ) THEN + call Print_msg( NVERB_ERROR, 'IO', 'IO_Fieldlist_write', trim(tfieldlist(idx)%cmnhname)// & + ': TFIELD_X6D is NOT allocated ' ) + END IF + IF ( .NOT.ASSOCIATED(TFIELDLIST(IDX)%TFIELD_X6D(IMI)%DATA) ) THEN + call Print_msg( NVERB_ERROR, 'IO', 'IO_Fieldlist_write', trim(tfieldlist(idx)%cmnhname)// & + ': TFIELD_X6D%DATA is NOT associated' ) + END IF + IF ( TFIELDLIST(IDX)%CLBTYPE == 'NONE' ) THEN + CALL IO_Field_write(TPOUTPUT%TFILE,TFIELDLIST(IDX),TFIELDLIST(IDX)%TFIELD_X6D(IMI)%DATA) + ELSE + call Print_msg( NVERB_ERROR, 'IO', 'IO_Fieldlist_write', trim(tfieldlist(idx)%cmnhname)// & + ': CLBTYPE/=NONE not (yet) allowed for 6D real fields' ) + !PW: TODO?: add missing field in TFIELDLIST? + !CALL IO_Field_write_lb(TPOUTPUT%TFILE,TFIELDLIST(IDX),***,TFIELDLIST(IDX)%TFIELD_X6D(IMI)%DATA) + END IF + ! + !6D other types + ! + CASE DEFAULT + call Print_msg( NVERB_ERROR, 'IO', 'IO_Fieldlist_write', trim(tfieldlist(idx)%cmnhname)// & + ': type not yet supported for 6D output' ) + END SELECT NTYPE6D ! !Other number of dimensions !