diff --git a/src/MNH/ini_modeln.f90 b/src/MNH/ini_modeln.f90 index a3de7b35a14b3b5c4ac30d3999d57c32a64ae7c2..9a4aed5cdd41343e418c2e6cdf4f3852461af647 100644 --- a/src/MNH/ini_modeln.f90 +++ b/src/MNH/ini_modeln.f90 @@ -1013,8 +1013,6 @@ ALLOCATE(XDIRCOSXW(IIU,IJU)) ALLOCATE(XDIRCOSYW(IIU,IJU)) ALLOCATE(XCOSSLOPE(IIU,IJU)) ALLOCATE(XSINSLOPE(IIU,IJU)) -ALLOCATE(XHAT_BOUND (NHAT_BOUND_SIZE)) -ALLOCATE(XHATM_BOUND(NHAT_BOUND_SIZE)) ! ALLOCATE(XDXX(IIU,IJU,IKU)) ALLOCATE(XDYY(IIU,IJU,IKU)) diff --git a/src/MNH/ini_spectren.f90 b/src/MNH/ini_spectren.f90 index a98810782ef1e36442b8fd4bfb6e60150676cbcd..29b2679f0e43ad596068d667f860777bb06a4a99 100644 --- a/src/MNH/ini_spectren.f90 +++ b/src/MNH/ini_spectren.f90 @@ -269,8 +269,6 @@ ALLOCATE(XZSMT(IIU,IJU)) ALLOCATE(XZZ(IIU,IJU,IKU)) ALLOCATE(XZHAT(IKU)) ALLOCATE(XZHATM(IKU)) -ALLOCATE(XHAT_BOUND (NHAT_BOUND_SIZE)) -ALLOCATE(XHATM_BOUND(NHAT_BOUND_SIZE)) ! ALLOCATE(XDXX(IIU,IJU,IKU)) ALLOCATE(XDYY(IIU,IJU,IKU)) diff --git a/src/MNH/prep_ideal_case.f90 b/src/MNH/prep_ideal_case.f90 index 2a892ab013f3262684cfc57c35eaec8bbdc5082d..b4faa5ac14c94e3d388a62ddba51465102bbbabe 100644 --- a/src/MNH/prep_ideal_case.f90 +++ b/src/MNH/prep_ideal_case.f90 @@ -904,7 +904,6 @@ IF(.NOT. L1D) LHORELAX_SV(1:NSV)=.TRUE. ! !* 4.1 Vertical Spatial grid ! -ALLOCATE( XHAT_BOUND(NHAT_BOUND_SIZE), XHATM_BOUND(NHAT_BOUND_SIZE) ) CALL READ_VER_GRID(TZEXPREFILE) ! !* 4.2 Initialize parallel variables and compute array's dimensions diff --git a/src/MNH/read_hgridn.f90 b/src/MNH/read_hgridn.f90 index 4afe7ed323b17c776bcaa1e72555dc7535dde234..cfccf88ba098cf5b27997bd2f231a88aba447161 100644 --- a/src/MNH/read_hgridn.f90 +++ b/src/MNH/read_hgridn.f90 @@ -254,8 +254,6 @@ CALL IO_Field_read(TPFMFILE,'YHAT',XYHAT) IF ( .NOT. ASSOCIATED(XXHATM) ) ALLOCATE( XXHATM(SIZE( XXHAT )) ) IF ( .NOT. ASSOCIATED(XYHATM) ) ALLOCATE( XYHATM(SIZE( XYHAT )) ) -IF ( .NOT. ASSOCIATED(XHAT_BOUND) ) ALLOCATE( XHAT_BOUND (NHAT_BOUND_SIZE) ) -IF ( .NOT. ASSOCIATED(XHATM_BOUND) ) ALLOCATE( XHATM_BOUND(NHAT_BOUND_SIZE) ) ! Interpolations of positions to mass points CALL INTERP_HORGRID_TO_MASSPOINTS( XXHAT, XYHAT, XXHATM, XYHATM ) diff --git a/src/MNH/set_grid.f90 b/src/MNH/set_grid.f90 index e2cb21e464aae02d30198b902b13584ff71e34b1..e2d28d064d4e46e58c635d41ebc00f83fbaf5196 100644 --- a/src/MNH/set_grid.f90 +++ b/src/MNH/set_grid.f90 @@ -207,8 +207,8 @@ REAL, DIMENSION(:), INTENT(OUT) :: PDXHAT ! horizontal stretching in x REAL, DIMENSION(:), INTENT(OUT) :: PDYHAT ! horizontal stretching in y REAL, DIMENSION(:), INTENT(OUT) :: PXHATM ! Position x in the conformal plane or on the cartesian plane at mass points REAL, DIMENSION(:), INTENT(OUT) :: PYHATM ! Position y in the conformal plane or on the cartesian plane at mass points -REAL, DIMENSION(:), INTENT(INOUT) :: PHAT_BOUND ! Boundaries of global domain in the conformal or cartesian plane -REAL, DIMENSION(:), INTENT(INOUT) :: PHATM_BOUND ! Boundaries of global domain in the conformal or cartesian plane at mass pts +REAL, DIMENSION(:), POINTER, INTENT(INOUT) :: PHAT_BOUND ! Boundaries of global domain in the conformal or cartesian plane +REAL, DIMENSION(:), POINTER, INTENT(INOUT) :: PHATM_BOUND ! idem at mass points REAL, DIMENSION(:,:), INTENT(OUT) :: PMAP ! Map factor ! REAL, DIMENSION(:,:), INTENT(OUT) :: PZS ! orography @@ -284,7 +284,8 @@ IF (.NOT.LCARTESIAN) THEN CALL IO_Field_read(TPINIFILE,'LONORI',PLONORI) CALL IO_Field_read(TPINIFILE,'LATORI',PLATORI) ! - ELSE + ELSE + ! If file comes from MesoNH < 4.6.0 CALL FIND_FIELD_ID_FROM_MNHNAME('LONORI',IID,IRESP) TZFIELD = TFIELDMETADATA( TFIELDLIST(IID) ) TZFIELD%CMNHNAME = 'LONOR' @@ -519,7 +520,7 @@ END SUBROUTINE INTERP_VERGRID_TO_MASSPOINTS SUBROUTINE STORE_GRID_1DIR_BOUNDS( HDIR, PHAT, PHATM, PHAT_BOUND, PHATM_BOUND ) USE MODD_GRID_n - USE MODD_PARAMETERS, ONLY: JPHEXT, JPVEXT + USE MODD_PARAMETERS, ONLY: JPHEXT, JPVEXT, XNEGUNDEF USE MODE_ALLOCBUFFER_ll, ONLY: ALLOCBUFFER_ll USE MODE_GATHER_ll, ONLY: GATHERALL_FIELD_ll @@ -527,11 +528,11 @@ SUBROUTINE STORE_GRID_1DIR_BOUNDS( HDIR, PHAT, PHATM, PHAT_BOUND, PHATM_BOUND ) IMPLICIT NONE - CHARACTER(LEN=1), INTENT(IN) :: HDIR ! Direction ('X', 'Y' or 'Z') - REAL, DIMENSION(:), TARGET, INTENT(IN) :: PHAT ! Position x, y or z in the conformal or cartesian plane - REAL, DIMENSION(:), TARGET, INTENT(IN) :: PHATM ! id at mass points - REAL, DIMENSION(NHAT_BOUND_SIZE), INTENT(INOUT) :: PHAT_BOUND ! Boundaries of global domain in the conformal or cartesian plane - REAL, DIMENSION(NHAT_BOUND_SIZE), INTENT(INOUT) :: PHATM_BOUND ! id at mass points + CHARACTER(LEN=1), INTENT(IN) :: HDIR ! Direction ('X', 'Y' or 'Z') + REAL, DIMENSION(:), TARGET, INTENT(IN) :: PHAT ! Position x, y or z in the conformal or cartesian plane + REAL, DIMENSION(:), TARGET, INTENT(IN) :: PHATM ! id at mass points + REAL, DIMENSION(:), POINTER, INTENT(INOUT) :: PHAT_BOUND ! Boundaries of global domain in the conformal or cartesian plane + REAL, DIMENSION(:), POINTER, INTENT(INOUT) :: PHATM_BOUND ! idem at mass points INTEGER :: IERR LOGICAL :: GALLOC, GALLOCM @@ -540,9 +541,20 @@ SUBROUTINE STORE_GRID_1DIR_BOUNDS( HDIR, PHAT, PHATM, PHAT_BOUND, PHATM_BOUND ) GALLOC = .FALSE. GALLOCM = .FALSE. + ZHAT_GLOB => NULL() ZHATM_GLOB => NULL() + IF ( .NOT. ASSOCIATED( PHAT_BOUND ) ) THEN + ALLOCATE( PHAT_BOUND(NHAT_BOUND_SIZE) ) + PHAT_BOUND(:) = XNEGUNDEF + END IF + + IF ( .NOT. ASSOCIATED( PHATM_BOUND ) ) THEN + ALLOCATE( PHATM_BOUND(NHAT_BOUND_SIZE) ) + PHATM_BOUND(:) = XNEGUNDEF + END IF + SELECT CASE (HDIR) CASE ( 'X' ) CALL ALLOCBUFFER_ll( ZHAT_GLOB, PHAT, 'XX', GALLOC ) @@ -613,14 +625,14 @@ SUBROUTINE STORE_GRID_BOUNDS( PXHAT, PYHAT, PZHAT, PXHATM, PYHATM, PZHATM, PHAT_ IMPLICIT NONE - REAL, DIMENSION(:), INTENT(IN) :: PXHAT ! Position x in the conformal or cartesian plane - REAL, DIMENSION(:), INTENT(IN) :: PYHAT ! Position y in the conformal or cartesian plane - REAL, DIMENSION(:), INTENT(IN) :: PZHAT ! Position y in the conformal or cartesian plane - REAL, DIMENSION(:), INTENT(IN) :: PXHATM ! id at mass points - REAL, DIMENSION(:), INTENT(IN) :: PYHATM ! id at mass points - REAL, DIMENSION(:), INTENT(IN) :: PZHATM ! id at mass points - REAL, DIMENSION(:), INTENT(INOUT) :: PHAT_BOUND ! Boundaries of global domain in the conformal or cartesian plane - REAL, DIMENSION(:), INTENT(INOUT) :: PHATM_BOUND ! id at mass points + REAL, DIMENSION(:), INTENT(IN) :: PXHAT ! Position x in the conformal or cartesian plane + REAL, DIMENSION(:), INTENT(IN) :: PYHAT ! Position y in the conformal or cartesian plane + REAL, DIMENSION(:), INTENT(IN) :: PZHAT ! Position y in the conformal or cartesian plane + REAL, DIMENSION(:), INTENT(IN) :: PXHATM ! idem at mass points + REAL, DIMENSION(:), INTENT(IN) :: PYHATM ! idem at mass points + REAL, DIMENSION(:), INTENT(IN) :: PZHATM ! idem at mass points + REAL, DIMENSION(:), POINTER, INTENT(INOUT) :: PHAT_BOUND ! Boundaries of global domain in the conformal or cartesian plane + REAL, DIMENSION(:), POINTER, INTENT(INOUT) :: PHATM_BOUND ! idem at mass points CALL STORE_GRID_1DIR_BOUNDS( 'X', PXHAT, PXHATM, PHAT_BOUND, PHATM_BOUND ) CALL STORE_GRID_1DIR_BOUNDS( 'Y', PYHAT, PYHATM, PHAT_BOUND, PHATM_BOUND ) @@ -635,12 +647,12 @@ SUBROUTINE STORE_HORGRID_BOUNDS( PXHAT, PYHAT, PXHATM, PYHATM, PHAT_BOUND, PHATM IMPLICIT NONE - REAL, DIMENSION(:), INTENT(IN) :: PXHAT ! Position x in the conformal or cartesian plane - REAL, DIMENSION(:), INTENT(IN) :: PYHAT ! Position y in the conformal or cartesian plane - REAL, DIMENSION(:), INTENT(IN) :: PXHATM ! id at mass points - REAL, DIMENSION(:), INTENT(IN) :: PYHATM ! id at mass points - REAL, DIMENSION(:), INTENT(INOUT) :: PHAT_BOUND ! Boundaries of global domain in the conformal or cartesian plane - REAL, DIMENSION(:), INTENT(INOUT) :: PHATM_BOUND ! id at mass points + REAL, DIMENSION(:), INTENT(IN) :: PXHAT ! Position x in the conformal or cartesian plane + REAL, DIMENSION(:), INTENT(IN) :: PYHAT ! Position y in the conformal or cartesian plane + REAL, DIMENSION(:), INTENT(IN) :: PXHATM ! idem at mass points + REAL, DIMENSION(:), INTENT(IN) :: PYHATM ! idem at mass points + REAL, DIMENSION(:), POINTER, INTENT(INOUT) :: PHAT_BOUND ! Boundaries of global domain in the conformal or cartesian plane + REAL, DIMENSION(:), POINTER, INTENT(INOUT) :: PHATM_BOUND ! idem at mass points CALL STORE_GRID_1DIR_BOUNDS( 'X', PXHAT, PXHATM, PHAT_BOUND, PHATM_BOUND ) CALL STORE_GRID_1DIR_BOUNDS( 'Y', PYHAT, PYHATM, PHAT_BOUND, PHATM_BOUND ) @@ -654,10 +666,10 @@ SUBROUTINE STORE_VERGRID_BOUNDS( PZHAT, PZHATM, PHAT_BOUND, PHATM_BOUND ) IMPLICIT NONE - REAL, DIMENSION(:), INTENT(IN) :: PZHAT ! Position y in the conformal or cartesian plane - REAL, DIMENSION(:), INTENT(IN) :: PZHATM ! id at mass points - REAL, DIMENSION(:), INTENT(INOUT) :: PHAT_BOUND ! Boundaries of global domain in the conformal or cartesian plane - REAL, DIMENSION(:), INTENT(INOUT) :: PHATM_BOUND ! id at mass points + REAL, DIMENSION(:), INTENT(IN) :: PZHAT ! Position z in the conformal or cartesian plane + REAL, DIMENSION(:), INTENT(IN) :: PZHATM ! idem at mass points + REAL, DIMENSION(:), POINTER, INTENT(INOUT) :: PHAT_BOUND ! Boundaries of global domain in the conformal or cartesian plane + REAL, DIMENSION(:), POINTER, INTENT(INOUT) :: PHATM_BOUND ! idem at mass points CALL STORE_GRID_1DIR_BOUNDS( 'Z', PZHAT, PZHATM, PHAT_BOUND, PHATM_BOUND ) diff --git a/src/MNH/spawn_grid2.f90 b/src/MNH/spawn_grid2.f90 index 2bbc35dd8b8287a9ca26b931ecf5a5fd63296f7b..332519faad59397a6cc2fc570229c7982eefa2c8 100644 --- a/src/MNH/spawn_grid2.f90 +++ b/src/MNH/spawn_grid2.f90 @@ -30,8 +30,8 @@ REAL, DIMENSION(:), INTENT(OUT) :: PXHAT,PYHAT,PZHAT ! positions x,y,z in the ! conformal plane or on the cartesian plane REAL, DIMENSION(:), INTENT(OUT) :: PXHATM, PYHATM, PZHATM ! positions x,y in the ! conformal plane or on the cartesian plane at mass points -REAL, DIMENSION(:), INTENT(INOUT) :: PHAT_BOUND ! Boundaries of global domain in the conformal or cartesian plane -REAL, DIMENSION(:), INTENT(INOUT) :: PHATM_BOUND ! Boundaries of global domain in the conformal or cartesian plane at mass points +REAL, DIMENSION(:), POINTER, INTENT(INOUT) :: PHAT_BOUND ! Boundaries of global domain in the conformal or cartesian plane +REAL, DIMENSION(:), POINTER, INTENT(INOUT) :: PHATM_BOUND ! idem at mass points REAL, INTENT(OUT) :: PZTOP ! model top (m) LOGICAL, INTENT(OUT) :: OSLEVE ! flag for SLEVE coordinate REAL, INTENT(OUT) :: PLEN1 ! Decay scale for smooth topography @@ -196,8 +196,8 @@ REAL, DIMENSION(:), INTENT(OUT) :: PXHAT,PYHAT,PZHAT ! positions x,y,z in the ! conformal plane or on the cartesian plane REAL, DIMENSION(:), INTENT(OUT) :: PXHATM, PYHATM, PZHATM ! positions x,y in the ! conformal plane or on the cartesian plane at mass points -REAL, DIMENSION(:), INTENT(INOUT) :: PHAT_BOUND ! Boundaries of global domain in the conformal or cartesian plane -REAL, DIMENSION(:), INTENT(INOUT) :: PHATM_BOUND ! Boundaries of global domain in the conformal or cartesian plane at mass points +REAL, DIMENSION(:), POINTER, INTENT(INOUT) :: PHAT_BOUND ! Boundaries of global domain in the conformal or cartesian plane +REAL, DIMENSION(:), POINTER, INTENT(INOUT) :: PHATM_BOUND ! idem at mass points REAL, INTENT(OUT) :: PZTOP ! model top (m) LOGICAL, INTENT(OUT) :: OSLEVE ! flag for SLEVE coordinate REAL, INTENT(OUT) :: PLEN1 ! Decay scale for smooth topography diff --git a/src/MNH/spawn_model2.f90 b/src/MNH/spawn_model2.f90 index a824c074b9c2042cada031c2d87887068071d243..fe3baed67dcc2429daf16cc13f5109b6a5d1205a 100644 --- a/src/MNH/spawn_model2.f90 +++ b/src/MNH/spawn_model2.f90 @@ -736,7 +736,6 @@ END IF ! ALLOCATE(XXHAT(IIU),XYHAT(IJU),XZHAT(IKU)) ALLOCATE(XXHATM(IIU),XYHATM(IJU),XZHATM(IKU)) -ALLOCATE( XHAT_BOUND(NHAT_BOUND_SIZE), XHATM_BOUND(NHAT_BOUND_SIZE) ) ALLOCATE(XZTOP) ALLOCATE(XMAP(IIU,IJU)) ALLOCATE(XLAT(IIU,IJU))