MODULE module_domain USE module_driver_constants USE module_machine USE module_configure USE module_wrf_error USE module_utility USE module_domain_type TYPE(domain) , POINTER :: head_grid , new_grid , next_grid , old_grid TYPE domain_levels TYPE(domain) , POINTER :: first_domain END TYPE domain_levels TYPE(domain_levels) , DIMENSION(max_levels) :: head_for_each_level TYPE(domain), POINTER :: current_grid LOGICAL, SAVE :: current_grid_set = .FALSE. PRIVATE domain_time_test_print PRIVATE test_adjust_io_timestr INTERFACE get_ijk_from_grid MODULE PROCEDURE get_ijk_from_grid1, get_ijk_from_grid2 END INTERFACE INTEGER, PARAMETER :: max_hst_mods = 200 CONTAINS SUBROUTINE adjust_domain_dims_for_move( grid , dx, dy ) IMPLICIT NONE TYPE( domain ), POINTER :: grid INTEGER, INTENT(IN) :: dx, dy data_ordering : SELECT CASE ( model_data_order ) CASE ( DATA_ORDER_XYZ ) grid%sm31 = grid%sm31 + dx grid%em31 = grid%em31 + dx grid%sm32 = grid%sm32 + dy grid%em32 = grid%em32 + dy grid%sp31 = grid%sp31 + dx grid%ep31 = grid%ep31 + dx grid%sp32 = grid%sp32 + dy grid%ep32 = grid%ep32 + dy grid%sd31 = grid%sd31 + dx grid%ed31 = grid%ed31 + dx grid%sd32 = grid%sd32 + dy grid%ed32 = grid%ed32 + dy CASE ( DATA_ORDER_YXZ ) grid%sm31 = grid%sm31 + dy grid%em31 = grid%em31 + dy grid%sm32 = grid%sm32 + dx grid%em32 = grid%em32 + dx grid%sp31 = grid%sp31 + dy grid%ep31 = grid%ep31 + dy grid%sp32 = grid%sp32 + dx grid%ep32 = grid%ep32 + dx grid%sd31 = grid%sd31 + dy grid%ed31 = grid%ed31 + dy grid%sd32 = grid%sd32 + dx grid%ed32 = grid%ed32 + dx CASE ( DATA_ORDER_ZXY ) grid%sm32 = grid%sm32 + dx grid%em32 = grid%em32 + dx grid%sm33 = grid%sm33 + dy grid%em33 = grid%em33 + dy grid%sp32 = grid%sp32 + dx grid%ep32 = grid%ep32 + dx grid%sp33 = grid%sp33 + dy grid%ep33 = grid%ep33 + dy grid%sd32 = grid%sd32 + dx grid%ed32 = grid%ed32 + dx grid%sd33 = grid%sd33 + dy grid%ed33 = grid%ed33 + dy CASE ( DATA_ORDER_ZYX ) grid%sm32 = grid%sm32 + dy grid%em32 = grid%em32 + dy grid%sm33 = grid%sm33 + dx grid%em33 = grid%em33 + dx grid%sp32 = grid%sp32 + dy grid%ep32 = grid%ep32 + dy grid%sp33 = grid%sp33 + dx grid%ep33 = grid%ep33 + dx grid%sd32 = grid%sd32 + dy grid%ed32 = grid%ed32 + dy grid%sd33 = grid%sd33 + dx grid%ed33 = grid%ed33 + dx CASE ( DATA_ORDER_XZY ) grid%sm31 = grid%sm31 + dx grid%em31 = grid%em31 + dx grid%sm33 = grid%sm33 + dy grid%em33 = grid%em33 + dy grid%sp31 = grid%sp31 + dx grid%ep31 = grid%ep31 + dx grid%sp33 = grid%sp33 + dy grid%ep33 = grid%ep33 + dy grid%sd31 = grid%sd31 + dx grid%ed31 = grid%ed31 + dx grid%sd33 = grid%sd33 + dy grid%ed33 = grid%ed33 + dy CASE ( DATA_ORDER_YZX ) grid%sm31 = grid%sm31 + dy grid%em31 = grid%em31 + dy grid%sm33 = grid%sm33 + dx grid%em33 = grid%em33 + dx grid%sp31 = grid%sp31 + dy grid%ep31 = grid%ep31 + dy grid%sp33 = grid%sp33 + dx grid%ep33 = grid%ep33 + dx grid%sd31 = grid%sd31 + dy grid%ed31 = grid%ed31 + dy grid%sd33 = grid%sd33 + dx grid%ed33 = grid%ed33 + dx END SELECT data_ordering RETURN END SUBROUTINE adjust_domain_dims_for_move SUBROUTINE get_ijk_from_grid1 ( grid , & ids, ide, jds, jde, kds, kde, & ims, ime, jms, jme, kms, kme, & ips, ipe, jps, jpe, kps, kpe, & imsx, imex, jmsx, jmex, kmsx, kmex, & ipsx, ipex, jpsx, jpex, kpsx, kpex, & imsy, imey, jmsy, jmey, kmsy, kmey, & ipsy, ipey, jpsy, jpey, kpsy, kpey ) IMPLICIT NONE TYPE( domain ), INTENT (IN) :: grid INTEGER, INTENT(OUT) :: & ids, ide, jds, jde, kds, kde, & ims, ime, jms, jme, kms, kme, & ips, ipe, jps, jpe, kps, kpe, & imsx, imex, jmsx, jmex, kmsx, kmex, & ipsx, ipex, jpsx, jpex, kpsx, kpex, & imsy, imey, jmsy, jmey, kmsy, kmey, & ipsy, ipey, jpsy, jpey, kpsy, kpey CALL get_ijk_from_grid2 ( grid , & ids, ide, jds, jde, kds, kde, & ims, ime, jms, jme, kms, kme, & ips, ipe, jps, jpe, kps, kpe ) data_ordering : SELECT CASE ( model_data_order ) CASE ( DATA_ORDER_XYZ ) imsx = grid%sm31x ; imex = grid%em31x ; jmsx = grid%sm32x ; jmex = grid%em32x ; kmsx = grid%sm33x ; kmex = grid%em33x ; ipsx = grid%sp31x ; ipex = grid%ep31x ; jpsx = grid%sp32x ; jpex = grid%ep32x ; kpsx = grid%sp33x ; kpex = grid%ep33x ; imsy = grid%sm31y ; imey = grid%em31y ; jmsy = grid%sm32y ; jmey = grid%em32y ; kmsy = grid%sm33y ; kmey = grid%em33y ; ipsy = grid%sp31y ; ipey = grid%ep31y ; jpsy = grid%sp32y ; jpey = grid%ep32y ; kpsy = grid%sp33y ; kpey = grid%ep33y ; CASE ( DATA_ORDER_YXZ ) imsx = grid%sm32x ; imex = grid%em32x ; jmsx = grid%sm31x ; jmex = grid%em31x ; kmsx = grid%sm33x ; kmex = grid%em33x ; ipsx = grid%sp32x ; ipex = grid%ep32x ; jpsx = grid%sp31x ; jpex = grid%ep31x ; kpsx = grid%sp33x ; kpex = grid%ep33x ; imsy = grid%sm32y ; imey = grid%em32y ; jmsy = grid%sm31y ; jmey = grid%em31y ; kmsy = grid%sm33y ; kmey = grid%em33y ; ipsy = grid%sp32y ; ipey = grid%ep32y ; jpsy = grid%sp31y ; jpey = grid%ep31y ; kpsy = grid%sp33y ; kpey = grid%ep33y ; CASE ( DATA_ORDER_ZXY ) imsx = grid%sm32x ; imex = grid%em32x ; jmsx = grid%sm33x ; jmex = grid%em33x ; kmsx = grid%sm31x ; kmex = grid%em31x ; ipsx = grid%sp32x ; ipex = grid%ep32x ; jpsx = grid%sp33x ; jpex = grid%ep33x ; kpsx = grid%sp31x ; kpex = grid%ep31x ; imsy = grid%sm32y ; imey = grid%em32y ; jmsy = grid%sm33y ; jmey = grid%em33y ; kmsy = grid%sm31y ; kmey = grid%em31y ; ipsy = grid%sp32y ; ipey = grid%ep32y ; jpsy = grid%sp33y ; jpey = grid%ep33y ; kpsy = grid%sp31y ; kpey = grid%ep31y ; CASE ( DATA_ORDER_ZYX ) imsx = grid%sm33x ; imex = grid%em33x ; jmsx = grid%sm32x ; jmex = grid%em32x ; kmsx = grid%sm31x ; kmex = grid%em31x ; ipsx = grid%sp33x ; ipex = grid%ep33x ; jpsx = grid%sp32x ; jpex = grid%ep32x ; kpsx = grid%sp31x ; kpex = grid%ep31x ; imsy = grid%sm33y ; imey = grid%em33y ; jmsy = grid%sm32y ; jmey = grid%em32y ; kmsy = grid%sm31y ; kmey = grid%em31y ; ipsy = grid%sp33y ; ipey = grid%ep33y ; jpsy = grid%sp32y ; jpey = grid%ep32y ; kpsy = grid%sp31y ; kpey = grid%ep31y ; CASE ( DATA_ORDER_XZY ) imsx = grid%sm31x ; imex = grid%em31x ; jmsx = grid%sm33x ; jmex = grid%em33x ; kmsx = grid%sm32x ; kmex = grid%em32x ; ipsx = grid%sp31x ; ipex = grid%ep31x ; jpsx = grid%sp33x ; jpex = grid%ep33x ; kpsx = grid%sp32x ; kpex = grid%ep32x ; imsy = grid%sm31y ; imey = grid%em31y ; jmsy = grid%sm33y ; jmey = grid%em33y ; kmsy = grid%sm32y ; kmey = grid%em32y ; ipsy = grid%sp31y ; ipey = grid%ep31y ; jpsy = grid%sp33y ; jpey = grid%ep33y ; kpsy = grid%sp32y ; kpey = grid%ep32y ; CASE ( DATA_ORDER_YZX ) imsx = grid%sm33x ; imex = grid%em33x ; jmsx = grid%sm31x ; jmex = grid%em31x ; kmsx = grid%sm32x ; kmex = grid%em32x ; ipsx = grid%sp33x ; ipex = grid%ep33x ; jpsx = grid%sp31x ; jpex = grid%ep31x ; kpsx = grid%sp32x ; kpex = grid%ep32x ; imsy = grid%sm33y ; imey = grid%em33y ; jmsy = grid%sm31y ; jmey = grid%em31y ; kmsy = grid%sm32y ; kmey = grid%em32y ; ipsy = grid%sp33y ; ipey = grid%ep33y ; jpsy = grid%sp31y ; jpey = grid%ep31y ; kpsy = grid%sp32y ; kpey = grid%ep32y ; END SELECT data_ordering END SUBROUTINE get_ijk_from_grid1 SUBROUTINE get_ijk_from_grid2 ( grid , & ids, ide, jds, jde, kds, kde, & ims, ime, jms, jme, kms, kme, & ips, ipe, jps, jpe, kps, kpe ) IMPLICIT NONE TYPE( domain ), INTENT (IN) :: grid INTEGER, INTENT(OUT) :: & ids, ide, jds, jde, kds, kde, & ims, ime, jms, jme, kms, kme, & ips, ipe, jps, jpe, kps, kpe data_ordering : SELECT CASE ( model_data_order ) CASE ( DATA_ORDER_XYZ ) ids = grid%sd31 ; ide = grid%ed31 ; jds = grid%sd32 ; jde = grid%ed32 ; kds = grid%sd33 ; kde = grid%ed33 ; ims = grid%sm31 ; ime = grid%em31 ; jms = grid%sm32 ; jme = grid%em32 ; kms = grid%sm33 ; kme = grid%em33 ; ips = grid%sp31 ; ipe = grid%ep31 ; jps = grid%sp32 ; jpe = grid%ep32 ; kps = grid%sp33 ; kpe = grid%ep33 ; CASE ( DATA_ORDER_YXZ ) ids = grid%sd32 ; ide = grid%ed32 ; jds = grid%sd31 ; jde = grid%ed31 ; kds = grid%sd33 ; kde = grid%ed33 ; ims = grid%sm32 ; ime = grid%em32 ; jms = grid%sm31 ; jme = grid%em31 ; kms = grid%sm33 ; kme = grid%em33 ; ips = grid%sp32 ; ipe = grid%ep32 ; jps = grid%sp31 ; jpe = grid%ep31 ; kps = grid%sp33 ; kpe = grid%ep33 ; CASE ( DATA_ORDER_ZXY ) ids = grid%sd32 ; ide = grid%ed32 ; jds = grid%sd33 ; jde = grid%ed33 ; kds = grid%sd31 ; kde = grid%ed31 ; ims = grid%sm32 ; ime = grid%em32 ; jms = grid%sm33 ; jme = grid%em33 ; kms = grid%sm31 ; kme = grid%em31 ; ips = grid%sp32 ; ipe = grid%ep32 ; jps = grid%sp33 ; jpe = grid%ep33 ; kps = grid%sp31 ; kpe = grid%ep31 ; CASE ( DATA_ORDER_ZYX ) ids = grid%sd33 ; ide = grid%ed33 ; jds = grid%sd32 ; jde = grid%ed32 ; kds = grid%sd31 ; kde = grid%ed31 ; ims = grid%sm33 ; ime = grid%em33 ; jms = grid%sm32 ; jme = grid%em32 ; kms = grid%sm31 ; kme = grid%em31 ; ips = grid%sp33 ; ipe = grid%ep33 ; jps = grid%sp32 ; jpe = grid%ep32 ; kps = grid%sp31 ; kpe = grid%ep31 ; CASE ( DATA_ORDER_XZY ) ids = grid%sd31 ; ide = grid%ed31 ; jds = grid%sd33 ; jde = grid%ed33 ; kds = grid%sd32 ; kde = grid%ed32 ; ims = grid%sm31 ; ime = grid%em31 ; jms = grid%sm33 ; jme = grid%em33 ; kms = grid%sm32 ; kme = grid%em32 ; ips = grid%sp31 ; ipe = grid%ep31 ; jps = grid%sp33 ; jpe = grid%ep33 ; kps = grid%sp32 ; kpe = grid%ep32 ; CASE ( DATA_ORDER_YZX ) ids = grid%sd33 ; ide = grid%ed33 ; jds = grid%sd31 ; jde = grid%ed31 ; kds = grid%sd32 ; kde = grid%ed32 ; ims = grid%sm33 ; ime = grid%em33 ; jms = grid%sm31 ; jme = grid%em31 ; kms = grid%sm32 ; kme = grid%em32 ; ips = grid%sp33 ; ipe = grid%ep33 ; jps = grid%sp31 ; jpe = grid%ep31 ; kps = grid%sp32 ; kpe = grid%ep32 ; END SELECT data_ordering END SUBROUTINE get_ijk_from_grid2 SUBROUTINE get_ijk_from_subgrid ( grid , & ids0, ide0, jds0, jde0, kds0, kde0, & ims0, ime0, jms0, jme0, kms0, kme0, & ips0, ipe0, jps0, jpe0, kps0, kpe0 ) TYPE( domain ), INTENT (IN) :: grid INTEGER, INTENT(OUT) :: & ids0, ide0, jds0, jde0, kds0, kde0, & ims0, ime0, jms0, jme0, kms0, kme0, & ips0, ipe0, jps0, jpe0, kps0, kpe0 INTEGER :: & ids, ide, jds, jde, kds, kde, & ims, ime, jms, jme, kms, kme, & ips, ipe, jps, jpe, kps, kpe CALL get_ijk_from_grid ( grid , & ids, ide, jds, jde, kds, kde, & ims, ime, jms, jme, kms, kme, & ips, ipe, jps, jpe, kps, kpe ) ids0 = ids ide0 = ide * grid%sr_x ims0 = (ims-1)*grid%sr_x+1 ime0 = ime * grid%sr_x ips0 = (ips-1)*grid%sr_x+1 ipe0 = ipe * grid%sr_x jds0 = jds jde0 = jde * grid%sr_y jms0 = (jms-1)*grid%sr_y+1 jme0 = jme * grid%sr_y jps0 = (jps-1)*grid%sr_y+1 jpe0 = jpe * grid%sr_y kds0 = kds kde0 = kde kms0 = kms kme0 = kme kps0 = kps kpe0 = kpe RETURN END SUBROUTINE get_ijk_from_subgrid SUBROUTINE wrf_patch_domain( id , domdesc , parent, parent_id , parent_domdesc , & sd1 , ed1 , sp1 , ep1 , sm1 , em1 , & sd2 , ed2 , sp2 , ep2 , sm2 , em2 , & sd3 , ed3 , sp3 , ep3 , sm3 , em3 , & sp1x , ep1x , sm1x , em1x , & sp2x , ep2x , sm2x , em2x , & sp3x , ep3x , sm3x , em3x , & sp1y , ep1y , sm1y , em1y , & sp2y , ep2y , sm2y , em2y , & sp3y , ep3y , sm3y , em3y , & bdx , bdy , bdy_mask ) USE module_machine IMPLICIT NONE LOGICAL, DIMENSION(4), INTENT(OUT) :: bdy_mask INTEGER, INTENT(IN) :: sd1 , ed1 , sd2 , ed2 , sd3 , ed3 , bdx , bdy INTEGER, INTENT(OUT) :: sp1 , ep1 , sp2 , ep2 , sp3 , ep3 , & sm1 , em1 , sm2 , em2 , sm3 , em3 INTEGER, INTENT(OUT) :: sp1x , ep1x , sp2x , ep2x , sp3x , ep3x , & sm1x , em1x , sm2x , em2x , sm3x , em3x INTEGER, INTENT(OUT) :: sp1y , ep1y , sp2y , ep2y , sp3y , ep3y , & sm1y , em1y , sm2y , em2y , sm3y , em3y INTEGER, INTENT(IN) :: id , parent_id , parent_domdesc INTEGER, INTENT(INOUT) :: domdesc TYPE(domain), POINTER :: parent INTEGER spec_bdy_width CALL nl_get_spec_bdy_width( 1, spec_bdy_width ) CALL wrf_dm_patch_domain( id , domdesc , parent_id , parent_domdesc , & sd1 , ed1 , sp1 , ep1 , sm1 , em1 , & sd2 , ed2 , sp2 , ep2 , sm2 , em2 , & sd3 , ed3 , sp3 , ep3 , sm3 , em3 , & sp1x , ep1x , sm1x , em1x , & sp2x , ep2x , sm2x , em2x , & sp3x , ep3x , sm3x , em3x , & sp1y , ep1y , sm1y , em1y , & sp2y , ep2y , sm2y , em2y , & sp3y , ep3y , sm3y , em3y , & bdx , bdy ) SELECT CASE ( model_data_order ) CASE ( DATA_ORDER_XYZ ) bdy_mask( P_XSB ) = ( sd1 <= sp1 .AND. sp1 <= sd1+spec_bdy_width-1 ) bdy_mask( P_YSB ) = ( sd2 <= sp2 .AND. sp2 <= sd2+spec_bdy_width-1 ) bdy_mask( P_XEB ) = ( ed1-spec_bdy_width-1 <= ep1 .AND. ep1 <= ed1 ) bdy_mask( P_YEB ) = ( ed2-spec_bdy_width-1 <= ep2 .AND. ep2 <= ed2 ) CASE ( DATA_ORDER_YXZ ) bdy_mask( P_XSB ) = ( sd2 <= sp2 .AND. sp2 <= sd2+spec_bdy_width-1 ) bdy_mask( P_YSB ) = ( sd1 <= sp1 .AND. sp1 <= sd1+spec_bdy_width-1 ) bdy_mask( P_XEB ) = ( ed2-spec_bdy_width-1 <= ep2 .AND. ep2 <= ed2 ) bdy_mask( P_YEB ) = ( ed1-spec_bdy_width-1 <= ep1 .AND. ep1 <= ed1 ) CASE ( DATA_ORDER_ZXY ) bdy_mask( P_XSB ) = ( sd2 <= sp2 .AND. sp2 <= sd2+spec_bdy_width-1 ) bdy_mask( P_YSB ) = ( sd3 <= sp3 .AND. sp3 <= sd3+spec_bdy_width-1 ) bdy_mask( P_XEB ) = ( ed2-spec_bdy_width-1 <= ep2 .AND. ep2 <= ed2 ) bdy_mask( P_YEB ) = ( ed3-spec_bdy_width-1 <= ep3 .AND. ep3 <= ed3 ) CASE ( DATA_ORDER_ZYX ) bdy_mask( P_XSB ) = ( sd3 <= sp3 .AND. sp3 <= sd3+spec_bdy_width-1 ) bdy_mask( P_YSB ) = ( sd2 <= sp2 .AND. sp2 <= sd2+spec_bdy_width-1 ) bdy_mask( P_XEB ) = ( ed3-spec_bdy_width-1 <= ep3 .AND. ep3 <= ed3 ) bdy_mask( P_YEB ) = ( ed2-spec_bdy_width-1 <= ep2 .AND. ep2 <= ed2 ) CASE ( DATA_ORDER_XZY ) bdy_mask( P_XSB ) = ( sd1 <= sp1 .AND. sp1 <= sd1+spec_bdy_width-1 ) bdy_mask( P_YSB ) = ( sd3 <= sp3 .AND. sp3 <= sd3+spec_bdy_width-1 ) bdy_mask( P_XEB ) = ( ed1-spec_bdy_width-1 <= ep1 .AND. ep1 <= ed1 ) bdy_mask( P_YEB ) = ( ed3-spec_bdy_width-1 <= ep3 .AND. ep3 <= ed3 ) CASE ( DATA_ORDER_YZX ) bdy_mask( P_XSB ) = ( sd3 <= sp3 .AND. sp3 <= sd3+spec_bdy_width-1 ) bdy_mask( P_YSB ) = ( sd1 <= sp1 .AND. sp1 <= sd1+spec_bdy_width-1 ) bdy_mask( P_XEB ) = ( ed3-spec_bdy_width-1 <= ep3 .AND. ep3 <= ed3 ) bdy_mask( P_YEB ) = ( ed1-spec_bdy_width-1 <= ep1 .AND. ep1 <= ed1 ) END SELECT RETURN END SUBROUTINE wrf_patch_domain SUBROUTINE alloc_and_configure_domain ( domain_id , grid , parent, kid ) IMPLICIT NONE INTEGER , INTENT(IN) :: domain_id TYPE( domain ) , POINTER :: grid TYPE( domain ) , POINTER :: parent INTEGER , INTENT(IN) :: kid INTEGER :: sd1 , ed1 , sp1 , ep1 , sm1 , em1 INTEGER :: sd2 , ed2 , sp2 , ep2 , sm2 , em2 INTEGER :: sd3 , ed3 , sp3 , ep3 , sm3 , em3 INTEGER :: sd1x , ed1x , sp1x , ep1x , sm1x , em1x INTEGER :: sd2x , ed2x , sp2x , ep2x , sm2x , em2x INTEGER :: sd3x , ed3x , sp3x , ep3x , sm3x , em3x INTEGER :: sd1y , ed1y , sp1y , ep1y , sm1y , em1y INTEGER :: sd2y , ed2y , sp2y , ep2y , sm2y , em2y INTEGER :: sd3y , ed3y , sp3y , ep3y , sm3y , em3y TYPE(domain) , POINTER :: new_grid INTEGER :: i INTEGER :: parent_id , parent_domdesc , new_domdesc INTEGER :: bdyzone_x , bdyzone_y INTEGER :: nx, ny data_ordering : SELECT CASE ( model_data_order ) CASE ( DATA_ORDER_XYZ ) CALL nl_get_s_we( domain_id , sd1 ) CALL nl_get_e_we( domain_id , ed1 ) CALL nl_get_s_sn( domain_id , sd2 ) CALL nl_get_e_sn( domain_id , ed2 ) CALL nl_get_s_vert( domain_id , sd3 ) CALL nl_get_e_vert( domain_id , ed3 ) nx = ed1-sd1+1 ny = ed2-sd2+1 CASE ( DATA_ORDER_YXZ ) CALL nl_get_s_sn( domain_id , sd1 ) CALL nl_get_e_sn( domain_id , ed1 ) CALL nl_get_s_we( domain_id , sd2 ) CALL nl_get_e_we( domain_id , ed2 ) CALL nl_get_s_vert( domain_id , sd3 ) CALL nl_get_e_vert( domain_id , ed3 ) nx = ed2-sd2+1 ny = ed1-sd1+1 CASE ( DATA_ORDER_ZXY ) CALL nl_get_s_vert( domain_id , sd1 ) CALL nl_get_e_vert( domain_id , ed1 ) CALL nl_get_s_we( domain_id , sd2 ) CALL nl_get_e_we( domain_id , ed2 ) CALL nl_get_s_sn( domain_id , sd3 ) CALL nl_get_e_sn( domain_id , ed3 ) nx = ed2-sd2+1 ny = ed3-sd3+1 CASE ( DATA_ORDER_ZYX ) CALL nl_get_s_vert( domain_id , sd1 ) CALL nl_get_e_vert( domain_id , ed1 ) CALL nl_get_s_sn( domain_id , sd2 ) CALL nl_get_e_sn( domain_id , ed2 ) CALL nl_get_s_we( domain_id , sd3 ) CALL nl_get_e_we( domain_id , ed3 ) nx = ed3-sd3+1 ny = ed2-sd2+1 CASE ( DATA_ORDER_XZY ) CALL nl_get_s_we( domain_id , sd1 ) CALL nl_get_e_we( domain_id , ed1 ) CALL nl_get_s_vert( domain_id , sd2 ) CALL nl_get_e_vert( domain_id , ed2 ) CALL nl_get_s_sn( domain_id , sd3 ) CALL nl_get_e_sn( domain_id , ed3 ) nx = ed1-sd1+1 ny = ed3-sd3+1 CASE ( DATA_ORDER_YZX ) CALL nl_get_s_sn( domain_id , sd1 ) CALL nl_get_e_sn( domain_id , ed1 ) CALL nl_get_s_vert( domain_id , sd2 ) CALL nl_get_e_vert( domain_id , ed2 ) CALL nl_get_s_we( domain_id , sd3 ) CALL nl_get_e_we( domain_id , ed3 ) nx = ed3-sd3+1 ny = ed1-sd1+1 END SELECT data_ordering IF ( num_time_levels > 3 ) THEN WRITE ( wrf_err_message , * ) 'alloc_and_configure_domain: ', & 'Incorrect value for num_time_levels ', num_time_levels CALL wrf_error_fatal3("",618,& TRIM ( wrf_err_message ) ) ENDIF IF (ASSOCIATED(parent)) THEN parent_id = parent%id parent_domdesc = parent%domdesc ELSE parent_id = -1 parent_domdesc = -1 ENDIF CALL get_bdyzone_x( bdyzone_x ) CALL get_bdyzone_y( bdyzone_y ) ALLOCATE ( new_grid ) ALLOCATE( new_grid%head_statevars ) NULLIFY( new_grid%head_statevars%next) new_grid%tail_statevars => new_grid%head_statevars ALLOCATE ( new_grid%parents( max_parents ) ) ALLOCATE ( new_grid%nests( max_nests ) ) NULLIFY( new_grid%sibling ) DO i = 1, max_nests NULLIFY( new_grid%nests(i)%ptr ) ENDDO NULLIFY (new_grid%next) NULLIFY (new_grid%same_level) NULLIFY (new_grid%i_start) NULLIFY (new_grid%j_start) NULLIFY (new_grid%i_end) NULLIFY (new_grid%j_end) ALLOCATE( new_grid%domain_clock ) new_grid%domain_clock_created = .FALSE. ALLOCATE( new_grid%alarms( MAX_WRF_ALARMS ) ) ALLOCATE( new_grid%alarms_created( MAX_WRF_ALARMS ) ) DO i = 1, MAX_WRF_ALARMS new_grid%alarms_created( i ) = .FALSE. ENDDO new_grid%time_set = .FALSE. new_grid%is_intermediate = .FALSE. new_grid%have_displayed_alloc_stats = .FALSE. IF ( domain_id .NE. 1 ) THEN new_grid%parents(1)%ptr => parent new_grid%num_parents = 1 parent%nests(kid)%ptr => new_grid new_grid%child_of_parent(1) = kid parent%num_nests = parent%num_nests + 1 END IF new_grid%id = domain_id CALL wrf_patch_domain( domain_id , new_domdesc , parent, parent_id, parent_domdesc , & sd1 , ed1 , sp1 , ep1 , sm1 , em1 , & sd2 , ed2 , sp2 , ep2 , sm2 , em2 , & sd3 , ed3 , sp3 , ep3 , sm3 , em3 , & sp1x , ep1x , sm1x , em1x , & sp2x , ep2x , sm2x , em2x , & sp3x , ep3x , sm3x , em3x , & sp1y , ep1y , sm1y , em1y , & sp2y , ep2y , sm2y , em2y , & sp3y , ep3y , sm3y , em3y , & bdyzone_x , bdyzone_y , new_grid%bdy_mask & ) new_grid%domdesc = new_domdesc new_grid%num_nests = 0 new_grid%num_siblings = 0 new_grid%num_parents = 0 new_grid%max_tiles = 0 new_grid%num_tiles_spec = 0 new_grid%nframes = 0 CALL alloc_space_field ( new_grid, domain_id , 3 , 3 , .FALSE. , & sd1, ed1, sd2, ed2, sd3, ed3, & sm1, em1, sm2, em2, sm3, em3, & sp1, ep1, sp2, ep2, sp3, ep3, & sp1x, ep1x, sp2x, ep2x, sp3x, ep3x, & sp1y, ep1y, sp2y, ep2y, sp3y, ep3y, & sm1x, em1x, sm2x, em2x, sm3x, em3x, & sm1y, em1y, sm2y, em2y, sm3y, em3y & ) new_grid%sd31 = sd1 new_grid%ed31 = ed1 new_grid%sp31 = sp1 new_grid%ep31 = ep1 new_grid%sm31 = sm1 new_grid%em31 = em1 new_grid%sd32 = sd2 new_grid%ed32 = ed2 new_grid%sp32 = sp2 new_grid%ep32 = ep2 new_grid%sm32 = sm2 new_grid%em32 = em2 new_grid%sd33 = sd3 new_grid%ed33 = ed3 new_grid%sp33 = sp3 new_grid%ep33 = ep3 new_grid%sm33 = sm3 new_grid%em33 = em3 new_grid%sp31x = sp1x new_grid%ep31x = ep1x new_grid%sm31x = sm1x new_grid%em31x = em1x new_grid%sp32x = sp2x new_grid%ep32x = ep2x new_grid%sm32x = sm2x new_grid%em32x = em2x new_grid%sp33x = sp3x new_grid%ep33x = ep3x new_grid%sm33x = sm3x new_grid%em33x = em3x new_grid%sp31y = sp1y new_grid%ep31y = ep1y new_grid%sm31y = sm1y new_grid%em31y = em1y new_grid%sp32y = sp2y new_grid%ep32y = ep2y new_grid%sm32y = sm2y new_grid%em32y = em2y new_grid%sp33y = sp3y new_grid%ep33y = ep3y new_grid%sm33y = sm3y new_grid%em33y = em3y SELECT CASE ( model_data_order ) CASE ( DATA_ORDER_XYZ ) new_grid%sd21 = sd1 ; new_grid%sd22 = sd2 ; new_grid%ed21 = ed1 ; new_grid%ed22 = ed2 ; new_grid%sp21 = sp1 ; new_grid%sp22 = sp2 ; new_grid%ep21 = ep1 ; new_grid%ep22 = ep2 ; new_grid%sm21 = sm1 ; new_grid%sm22 = sm2 ; new_grid%em21 = em1 ; new_grid%em22 = em2 ; new_grid%sd11 = sd1 new_grid%ed11 = ed1 new_grid%sp11 = sp1 new_grid%ep11 = ep1 new_grid%sm11 = sm1 new_grid%em11 = em1 CASE ( DATA_ORDER_YXZ ) new_grid%sd21 = sd1 ; new_grid%sd22 = sd2 ; new_grid%ed21 = ed1 ; new_grid%ed22 = ed2 ; new_grid%sp21 = sp1 ; new_grid%sp22 = sp2 ; new_grid%ep21 = ep1 ; new_grid%ep22 = ep2 ; new_grid%sm21 = sm1 ; new_grid%sm22 = sm2 ; new_grid%em21 = em1 ; new_grid%em22 = em2 ; new_grid%sd11 = sd1 new_grid%ed11 = ed1 new_grid%sp11 = sp1 new_grid%ep11 = ep1 new_grid%sm11 = sm1 new_grid%em11 = em1 CASE ( DATA_ORDER_ZXY ) new_grid%sd21 = sd2 ; new_grid%sd22 = sd3 ; new_grid%ed21 = ed2 ; new_grid%ed22 = ed3 ; new_grid%sp21 = sp2 ; new_grid%sp22 = sp3 ; new_grid%ep21 = ep2 ; new_grid%ep22 = ep3 ; new_grid%sm21 = sm2 ; new_grid%sm22 = sm3 ; new_grid%em21 = em2 ; new_grid%em22 = em3 ; new_grid%sd11 = sd2 new_grid%ed11 = ed2 new_grid%sp11 = sp2 new_grid%ep11 = ep2 new_grid%sm11 = sm2 new_grid%em11 = em2 CASE ( DATA_ORDER_ZYX ) new_grid%sd21 = sd2 ; new_grid%sd22 = sd3 ; new_grid%ed21 = ed2 ; new_grid%ed22 = ed3 ; new_grid%sp21 = sp2 ; new_grid%sp22 = sp3 ; new_grid%ep21 = ep2 ; new_grid%ep22 = ep3 ; new_grid%sm21 = sm2 ; new_grid%sm22 = sm3 ; new_grid%em21 = em2 ; new_grid%em22 = em3 ; new_grid%sd11 = sd2 new_grid%ed11 = ed2 new_grid%sp11 = sp2 new_grid%ep11 = ep2 new_grid%sm11 = sm2 new_grid%em11 = em2 CASE ( DATA_ORDER_XZY ) new_grid%sd21 = sd1 ; new_grid%sd22 = sd3 ; new_grid%ed21 = ed1 ; new_grid%ed22 = ed3 ; new_grid%sp21 = sp1 ; new_grid%sp22 = sp3 ; new_grid%ep21 = ep1 ; new_grid%ep22 = ep3 ; new_grid%sm21 = sm1 ; new_grid%sm22 = sm3 ; new_grid%em21 = em1 ; new_grid%em22 = em3 ; new_grid%sd11 = sd1 new_grid%ed11 = ed1 new_grid%sp11 = sp1 new_grid%ep11 = ep1 new_grid%sm11 = sm1 new_grid%em11 = em1 CASE ( DATA_ORDER_YZX ) new_grid%sd21 = sd1 ; new_grid%sd22 = sd3 ; new_grid%ed21 = ed1 ; new_grid%ed22 = ed3 ; new_grid%sp21 = sp1 ; new_grid%sp22 = sp3 ; new_grid%ep21 = ep1 ; new_grid%ep22 = ep3 ; new_grid%sm21 = sm1 ; new_grid%sm22 = sm3 ; new_grid%em21 = em1 ; new_grid%em22 = em3 ; new_grid%sd11 = sd1 new_grid%ed11 = ed1 new_grid%sp11 = sp1 new_grid%ep11 = ep1 new_grid%sm11 = sm1 new_grid%em11 = em1 END SELECT CALL med_add_config_info_to_grid ( new_grid ) new_grid%tiled = .false. new_grid%patched = .false. NULLIFY(new_grid%mapping) grid => new_grid ALLOCATE( grid%lattsloc( grid%max_ts_locs ) ) ALLOCATE( grid%lontsloc( grid%max_ts_locs ) ) ALLOCATE( grid%nametsloc( grid%max_ts_locs ) ) ALLOCATE( grid%desctsloc( grid%max_ts_locs ) ) ALLOCATE( grid%itsloc( grid%max_ts_locs ) ) ALLOCATE( grid%jtsloc( grid%max_ts_locs ) ) ALLOCATE( grid%id_tsloc( grid%max_ts_locs ) ) ALLOCATE( grid%ts_filename( grid%max_ts_locs ) ) grid%ntsloc = 0 grid%ntsloc_domain = 0 CALL wrf_get_dm_communicator ( grid%communicator ) CALL wrf_dm_define_comms( grid ) END SUBROUTINE alloc_and_configure_domain SUBROUTINE get_fieldstr(ix,c,instr,outstr,noutstr,noerr) IMPLICIT NONE INTEGER, INTENT(IN) :: ix CHARACTER*(*), INTENT(IN) :: c CHARACTER*(*), INTENT(IN) :: instr CHARACTER*(*), INTENT(OUT) :: outstr INTEGER, INTENT(IN) :: noutstr LOGICAL, INTENT(INOUT) :: noerr INTEGER, PARAMETER :: MAX_DEXES = 100 INTEGER I, PREV, IDEX INTEGER DEXES(MAX_DEXES) outstr = "" prev = 1 dexes(1) = 1 DO i = 2,MAX_DEXES idex = INDEX(instr(prev:LEN(TRIM(instr))),c) IF ( idex .GT. 0 ) THEN dexes(i) = idex+prev prev = dexes(i)+1 ELSE dexes(i) = LEN(TRIM(instr))+2 ENDIF ENDDO IF ( (dexes(ix+1)-2)-(dexes(ix)) .GT. noutstr ) THEN noerr = .FALSE. ELSE IF( dexes(ix) .EQ. dexes(ix+1) ) THEN noerr = .FALSE. ELSE outstr = instr(dexes(ix):(dexes(ix+1)-2)) noerr = noerr .AND. .TRUE. ENDIF END SUBROUTINE get_fieldstr SUBROUTINE change_to_lower_case(instr,outstr) CHARACTER*(*) ,INTENT(IN) :: instr CHARACTER*(*) ,INTENT(OUT) :: outstr CHARACTER*1 :: c INTEGER ,PARAMETER :: upper_to_lower =IACHAR('a')-IACHAR('A') INTEGER :: i,n,n1 outstr = ' ' N = len(instr) N1 = len(outstr) N = MIN(N,N1) outstr(1:N) = instr(1:N) DO i=1,N c = instr(i:i) if('A'<=c .and. c <='Z') outstr(i:i)=achar(iachar(c)+upper_to_lower) ENDDO RETURN END SUBROUTINE change_to_lower_case SUBROUTINE modify_io_masks1 ( grid , id ) IMPLICIT NONE INTEGER , INTENT(IN ) :: id TYPE(domain), POINTER :: grid TYPE(fieldlist), POINTER :: p, q INTEGER, PARAMETER :: read_unit = 10 LOGICAL, EXTERNAL :: wrf_dm_on_monitor CHARACTER*256 :: fname, inln, mess, dname, t1, lookee CHARACTER*256 :: fieldlst CHARACTER*1 :: op, strmtyp CHARACTER*3 :: strmid CHARACTER*10 :: strmtyp_name INTEGER :: io_status INTEGER :: strmtyp_int, count_em INTEGER :: lineno, fieldno, istrm, retval, itrace LOGICAL :: keepgoing, noerr, gavewarning, ignorewarning, found LOGICAL, SAVE :: you_warned_me = .FALSE. LOGICAL, SAVE :: you_warned_me2(max_hst_mods,max_domains) = .FALSE. gavewarning = .FALSE. CALL nl_get_iofields_filename( id, fname ) IF ( grid%is_intermediate ) RETURN IF ( TRIM(fname) .EQ. "NONE_SPECIFIED" ) RETURN IF ( wrf_dm_on_monitor() ) THEN OPEN ( UNIT = read_unit , & FILE = TRIM(fname) , & FORM = "FORMATTED" , & STATUS = "OLD" , & IOSTAT = io_status ) IF ( io_status .EQ. 0 ) THEN keepgoing = .TRUE. lineno = 0 count_em = 0 DO WHILE ( keepgoing ) READ(UNIT=read_unit,FMT='(A)',IOSTAT=io_status) inln keepgoing = (io_status .EQ. 0) .AND. (LEN(TRIM(inln)) .GT. 0) IF ( keepgoing ) THEN lineno = lineno + 1 IF ( .NOT. LEN(TRIM(inln)) .LT. LEN(inln) ) THEN WRITE(mess,*)'W A R N I N G : Line ',lineno,' of ',TRIM(fname),' is too long. Limit is ',LEN(inln),' characters.' gavewarning = .TRUE. ENDIF IF ( INDEX(inln,'#') .EQ. 0 ) THEN IF ( keepgoing ) THEN noerr = .TRUE. CALL get_fieldstr(1,':',inln,op,1,noerr) IF ( TRIM(op) .NE. '+' .AND. TRIM(op) .NE. '-' ) THEN WRITE(mess,*)'W A R N I N G : unknown operation ',TRIM(op),' (should be + or -). Line ',lineno gavewarning = .TRUE. ENDIF CALL get_fieldstr(2,':',inln,t1,1,noerr) CALL change_to_lower_case(t1,strmtyp) SELECT CASE (TRIM(strmtyp)) CASE ('h') strmtyp_name = 'history' strmtyp_int = first_history CASE ('i') strmtyp_name = 'input' strmtyp_int = first_input CASE DEFAULT WRITE(mess,*)'W A R N I N G : unknown stream type ',TRIM(strmtyp),'. Line ',lineno gavewarning = .TRUE. END SELECT CALL get_fieldstr(3,':',inln,strmid,3,noerr) READ(strmid,'(I3)') istrm IF ( istrm .LT. 0 .OR. istrm .GT. last_history ) THEN WRITE(mess,*)'W A R N I N G : invalid stream id ',istrm,' (should be 0 <= id <= ',last_history,'). Line ',lineno gavewarning = .TRUE. ENDIF CALL get_fieldstr(4,':',inln,fieldlst,1024,noerr) IF ( noerr ) THEN fieldno = 1 CALL get_fieldstr(fieldno,',',fieldlst,t1,256,noerr) CALL change_to_lower_case(t1,lookee) DO WHILE ( noerr ) p => grid%head_statevars found = .FALSE. count_em = count_em + 1 DO WHILE ( ASSOCIATED( p ) ) IF ( p%Ndim .EQ. 4 .AND. p%scalar_array ) THEN DO itrace = PARAM_FIRST_SCALAR , p%num_table(grid%id) CALL change_to_lower_case( p%dname_table( grid%id, itrace ) , dname ) IF ( TRIM(dname) .EQ. TRIM(lookee) ) & CALL warn_me_or_set_mask (id, istrm, lineno, strmtyp_int, count_em, op, & strmtyp_name, dname, fname, lookee, & p%streams_table(grid%id,itrace)%stream, & mess, found, you_warned_me2) ENDDO ELSE IF ( p%Ntl .GT. 0 ) THEN CALL change_to_lower_case(p%DataName(1:LEN(TRIM(p%DataName))-2),dname) ELSE CALL change_to_lower_case(p%DataName,dname) ENDIF IF ( TRIM(dname) .EQ. TRIM(lookee) ) & CALL warn_me_or_set_mask (id, istrm, lineno, strmtyp_int, count_em, op, & strmtyp_name, dname, fname, lookee, & p%streams, mess, found, you_warned_me2) ENDIF p => p%next ENDDO IF ( .NOT. found ) THEN WRITE(mess,*)'W A R N I N G : Unable to modify mask for ',TRIM(lookee),& '. Variable not found. File: ',TRIM(fname),' at line ',lineno CALL wrf_message(mess) gavewarning = .TRUE. ENDIF fieldno = fieldno + 1 CALL get_fieldstr(fieldno,',',fieldlst,t1,256,noerr) CALL change_to_lower_case(t1,lookee) ENDDO ELSE WRITE(mess,*)'W A R N I N G : Problem reading ',TRIM(fname),' at line ',lineno CALL wrf_message(mess) gavewarning = .TRUE. ENDIF ENDIF ENDIF ENDIF ENDDO ELSE WRITE(mess,*)'W A R N I N G : Problem opening ',TRIM(fname) CALL wrf_message(mess) gavewarning = .TRUE. ENDIF CLOSE( read_unit ) IF ( gavewarning ) THEN CALL nl_get_ignore_iofields_warning(1,ignorewarning) IF ( .NOT. ignorewarning ) THEN CALL wrf_message(mess) WRITE(mess,*)'modify_io_masks: problems reading ',TRIM(fname) CALL wrf_message(mess) CALL wrf_error_fatal3("",1069,& 'Set ignore_iofields_warn to true in namelist to ignore') ELSE IF ( .NOT. you_warned_me ) THEN if ( .NOT. you_warned_me2(count_em,id) ) CALL wrf_message(mess) WRITE(mess,*)'Ignoring problems reading ',TRIM(fname) CALL wrf_message(mess) CALL wrf_message('Continuing. To make this a fatal error, set ignore_iofields_warn to false in namelist' ) CALL wrf_message(' ') you_warned_me = .TRUE. ENDIF ENDIF ENDIF ENDIF p => grid%head_statevars DO WHILE ( ASSOCIATED( p ) ) IF ( p%Ndim .EQ. 4 .AND. p%scalar_array ) THEN DO itrace = PARAM_FIRST_SCALAR , p%num_table(grid%id) CALL wrf_dm_bcast_integer( p%streams_table(grid%id,itrace)%stream, (((2*(25)+2))/(4*8)+1) ) ENDDO ELSE CALL wrf_dm_bcast_integer( p%streams, (((2*(25)+2))/(4*8)+1) ) ENDIF p => p%next ENDDO END SUBROUTINE modify_io_masks1 SUBROUTINE warn_me_or_set_mask (id, istrm, lineno, strmtyp_int, count_em, op, & strmtyp_name, dname, fname, lookee, & p_stream, mess, found, you_warned_me2) IMPLICIT NONE INTEGER, INTENT(IN ) :: id, istrm, lineno, strmtyp_int INTEGER, INTENT(IN ) :: p_stream(*), count_em CHARACTER*1, INTENT(IN ) :: op CHARACTER*10, INTENT(IN ) :: strmtyp_name CHARACTER*256, INTENT(IN ) :: dname, fname, lookee CHARACTER*256, INTENT(OUT) :: mess LOGICAL, INTENT(OUT) :: found LOGICAL, INTENT(INOUT) :: you_warned_me2(max_hst_mods,max_domains) INTEGER :: retval found = .TRUE. IF ( TRIM(op) .EQ. '+' ) THEN CALL get_mask( p_stream, strmtyp_int + istrm - 1, retval ) IF ( retval .NE. 0 ) THEN WRITE(mess,*) 'Domain ',id, ' W A R N I N G : Variable ',TRIM(lookee),' already on ', & TRIM(strmtyp_name), ' stream ',istrm, '. File: ', TRIM(fname),' at line ',lineno ELSE WRITE(mess,*) 'Domain ', id, ' Setting ', TRIM(strmtyp_name), ' stream ',istrm,' for ', & TRIM(DNAME) ; CALL wrf_debug(1,mess) CALL set_mask( p_stream, strmtyp_int + istrm - 1 ) ENDIF ELSE IF ( TRIM(op) .EQ. '-' ) THEN CALL get_mask( p_stream, strmtyp_int + istrm - 1, retval ) IF ( retval .EQ. 0 ) THEN WRITE(mess,*) 'Domain ',id, ' W A R N I N G : Variable ',TRIM(lookee),' already off ', & TRIM(strmtyp_name), ' stream ',istrm, '. File: ',TRIM(fname),' at line ',lineno ELSE WRITE(mess,*) 'Domain ', id, ' Resetting ', TRIM(strmtyp_name), ' stream ',istrm,' for ', & TRIM(DNAME) ; CALL wrf_debug(1,mess) CALL reset_mask( p_stream, strmtyp_int + istrm - 1) ENDIF ENDIF IF ( count_em > max_hst_mods ) THEN WRITE(mess,*)'ERROR module_domain: Array size for you_warned_me2 is fixed at ',max_hst_mods CALL wrf_message(mess) CALL wrf_error_fatal3("",1148,& 'Did you really type > max_hst_mods fields into ', TRIM(fname) ,' ?') ELSE IF ( .NOT. you_warned_me2(count_em,id) ) THEN CALL wrf_message(mess) you_warned_me2(count_em,id) = .TRUE. ENDIF ENDIF END SUBROUTINE warn_me_or_set_mask SUBROUTINE alloc_space_field ( grid, id, setinitval_in , tl_in , inter_domain_in , & sd31, ed31, sd32, ed32, sd33, ed33, & sm31 , em31 , sm32 , em32 , sm33 , em33 , & sp31 , ep31 , sp32 , ep32 , sp33 , ep33 , & sp31x, ep31x, sp32x, ep32x, sp33x, ep33x, & sp31y, ep31y, sp32y, ep32y, sp33y, ep33y, & sm31x, em31x, sm32x, em32x, sm33x, em33x, & sm31y, em31y, sm32y, em32y, sm33y, em33y ) USE module_alloc_space_0, ONLY : alloc_space_field_core_0 USE module_alloc_space_1, ONLY : alloc_space_field_core_1 USE module_alloc_space_2, ONLY : alloc_space_field_core_2 USE module_alloc_space_3, ONLY : alloc_space_field_core_3 USE module_alloc_space_4, ONLY : alloc_space_field_core_4 USE module_alloc_space_5, ONLY : alloc_space_field_core_5 USE module_alloc_space_6, ONLY : alloc_space_field_core_6 USE module_alloc_space_7, ONLY : alloc_space_field_core_7 USE module_alloc_space_8, ONLY : alloc_space_field_core_8 USE module_alloc_space_9, ONLY : alloc_space_field_core_9 IMPLICIT NONE TYPE(domain) , POINTER :: grid INTEGER , INTENT(IN) :: id INTEGER , INTENT(IN) :: setinitval_in INTEGER , INTENT(IN) :: sd31, ed31, sd32, ed32, sd33, ed33 INTEGER , INTENT(IN) :: sm31, em31, sm32, em32, sm33, em33 INTEGER , INTENT(IN) :: sp31, ep31, sp32, ep32, sp33, ep33 INTEGER , INTENT(IN) :: sp31x, ep31x, sp32x, ep32x, sp33x, ep33x INTEGER , INTENT(IN) :: sp31y, ep31y, sp32y, ep32y, sp33y, ep33y INTEGER , INTENT(IN) :: sm31x, em31x, sm32x, em32x, sm33x, em33x INTEGER , INTENT(IN) :: sm31y, em31y, sm32y, em32y, sm33y, em33y INTEGER , INTENT(IN) :: tl_in LOGICAL , INTENT(IN) :: inter_domain_in INTEGER(KIND=8) num_bytes_allocated INTEGER idum1, idum2 IF ( grid%id .EQ. 1 ) & CALL wrf_message ( 'DYNAMICS OPTION: nmm dyncore' ) CALL set_scalar_indices_from_config( id , idum1 , idum2 ) num_bytes_allocated = 0 CALL alloc_space_field_core_0 ( grid, id, setinitval_in , tl_in , inter_domain_in , num_bytes_allocated , & sd31, ed31, sd32, ed32, sd33, ed33, & sm31 , em31 , sm32 , em32 , sm33 , em33 , & sp31 , ep31 , sp32 , ep32 , sp33 , ep33 , & sp31x, ep31x, sp32x, ep32x, sp33x, ep33x, & sp31y, ep31y, sp32y, ep32y, sp33y, ep33y, & sm31x, em31x, sm32x, em32x, sm33x, em33x, & sm31y, em31y, sm32y, em32y, sm33y, em33y ) CALL alloc_space_field_core_1 ( grid, id, setinitval_in , tl_in , inter_domain_in , num_bytes_allocated , & sd31, ed31, sd32, ed32, sd33, ed33, & sm31 , em31 , sm32 , em32 , sm33 , em33 , & sp31 , ep31 , sp32 , ep32 , sp33 , ep33 , & sp31x, ep31x, sp32x, ep32x, sp33x, ep33x, & sp31y, ep31y, sp32y, ep32y, sp33y, ep33y, & sm31x, em31x, sm32x, em32x, sm33x, em33x, & sm31y, em31y, sm32y, em32y, sm33y, em33y ) CALL alloc_space_field_core_2 ( grid, id, setinitval_in , tl_in , inter_domain_in , num_bytes_allocated , & sd31, ed31, sd32, ed32, sd33, ed33, & sm31 , em31 , sm32 , em32 , sm33 , em33 , & sp31 , ep31 , sp32 , ep32 , sp33 , ep33 , & sp31x, ep31x, sp32x, ep32x, sp33x, ep33x, & sp31y, ep31y, sp32y, ep32y, sp33y, ep33y, & sm31x, em31x, sm32x, em32x, sm33x, em33x, & sm31y, em31y, sm32y, em32y, sm33y, em33y ) CALL alloc_space_field_core_3 ( grid, id, setinitval_in , tl_in , inter_domain_in , num_bytes_allocated , & sd31, ed31, sd32, ed32, sd33, ed33, & sm31 , em31 , sm32 , em32 , sm33 , em33 , & sp31 , ep31 , sp32 , ep32 , sp33 , ep33 , & sp31x, ep31x, sp32x, ep32x, sp33x, ep33x, & sp31y, ep31y, sp32y, ep32y, sp33y, ep33y, & sm31x, em31x, sm32x, em32x, sm33x, em33x, & sm31y, em31y, sm32y, em32y, sm33y, em33y ) CALL alloc_space_field_core_4 ( grid, id, setinitval_in , tl_in , inter_domain_in , num_bytes_allocated , & sd31, ed31, sd32, ed32, sd33, ed33, & sm31 , em31 , sm32 , em32 , sm33 , em33 , & sp31 , ep31 , sp32 , ep32 , sp33 , ep33 , & sp31x, ep31x, sp32x, ep32x, sp33x, ep33x, & sp31y, ep31y, sp32y, ep32y, sp33y, ep33y, & sm31x, em31x, sm32x, em32x, sm33x, em33x, & sm31y, em31y, sm32y, em32y, sm33y, em33y ) CALL alloc_space_field_core_5 ( grid, id, setinitval_in , tl_in , inter_domain_in , num_bytes_allocated , & sd31, ed31, sd32, ed32, sd33, ed33, & sm31 , em31 , sm32 , em32 , sm33 , em33 , & sp31 , ep31 , sp32 , ep32 , sp33 , ep33 , & sp31x, ep31x, sp32x, ep32x, sp33x, ep33x, & sp31y, ep31y, sp32y, ep32y, sp33y, ep33y, & sm31x, em31x, sm32x, em32x, sm33x, em33x, & sm31y, em31y, sm32y, em32y, sm33y, em33y ) CALL alloc_space_field_core_6 ( grid, id, setinitval_in , tl_in , inter_domain_in , num_bytes_allocated , & sd31, ed31, sd32, ed32, sd33, ed33, & sm31 , em31 , sm32 , em32 , sm33 , em33 , & sp31 , ep31 , sp32 , ep32 , sp33 , ep33 , & sp31x, ep31x, sp32x, ep32x, sp33x, ep33x, & sp31y, ep31y, sp32y, ep32y, sp33y, ep33y, & sm31x, em31x, sm32x, em32x, sm33x, em33x, & sm31y, em31y, sm32y, em32y, sm33y, em33y ) CALL alloc_space_field_core_7 ( grid, id, setinitval_in , tl_in , inter_domain_in , num_bytes_allocated , & sd31, ed31, sd32, ed32, sd33, ed33, & sm31 , em31 , sm32 , em32 , sm33 , em33 , & sp31 , ep31 , sp32 , ep32 , sp33 , ep33 , & sp31x, ep31x, sp32x, ep32x, sp33x, ep33x, & sp31y, ep31y, sp32y, ep32y, sp33y, ep33y, & sm31x, em31x, sm32x, em32x, sm33x, em33x, & sm31y, em31y, sm32y, em32y, sm33y, em33y ) CALL alloc_space_field_core_8 ( grid, id, setinitval_in , tl_in , inter_domain_in , num_bytes_allocated , & sd31, ed31, sd32, ed32, sd33, ed33, & sm31 , em31 , sm32 , em32 , sm33 , em33 , & sp31 , ep31 , sp32 , ep32 , sp33 , ep33 , & sp31x, ep31x, sp32x, ep32x, sp33x, ep33x, & sp31y, ep31y, sp32y, ep32y, sp33y, ep33y, & sm31x, em31x, sm32x, em32x, sm33x, em33x, & sm31y, em31y, sm32y, em32y, sm33y, em33y ) CALL alloc_space_field_core_9 ( grid, id, setinitval_in , tl_in , inter_domain_in , num_bytes_allocated , & sd31, ed31, sd32, ed32, sd33, ed33, & sm31 , em31 , sm32 , em32 , sm33 , em33 , & sp31 , ep31 , sp32 , ep32 , sp33 , ep33 , & sp31x, ep31x, sp32x, ep32x, sp33x, ep33x, & sp31y, ep31y, sp32y, ep32y, sp33y, ep33y, & sm31x, em31x, sm32x, em32x, sm33x, em33x, & sm31y, em31y, sm32y, em32y, sm33y, em33y ) IF ( .NOT. grid%have_displayed_alloc_stats ) THEN WRITE(wrf_err_message,*)& 'alloc_space_field: domain ',id,', ',num_bytes_allocated,' bytes allocated' CALL wrf_debug( 0, wrf_err_message ) grid%have_displayed_alloc_stats = .TRUE. ENDIF grid%alloced_sd31=sd31 grid%alloced_ed31=ed31 grid%alloced_sd32=sd32 grid%alloced_ed32=ed32 grid%alloced_sd33=sd33 grid%alloced_ed33=ed33 grid%alloced_sm31=sm31 grid%alloced_em31=em31 grid%alloced_sm32=sm32 grid%alloced_em32=em32 grid%alloced_sm33=sm33 grid%alloced_em33=em33 grid%alloced_sm31x=sm31x grid%alloced_em31x=em31x grid%alloced_sm32x=sm32x grid%alloced_em32x=em32x grid%alloced_sm33x=sm33x grid%alloced_em33x=em33x grid%alloced_sm31y=sm31y grid%alloced_em31y=em31y grid%alloced_sm32y=sm32y grid%alloced_em32y=em32y grid%alloced_sm33y=sm33y grid%alloced_em33y=em33y grid%allocated=.TRUE. END SUBROUTINE alloc_space_field SUBROUTINE ensure_space_field ( grid, id, setinitval_in , tl_in , inter_domain_in , & sd31, ed31, sd32, ed32, sd33, ed33, & sm31 , em31 , sm32 , em32 , sm33 , em33 , & sp31 , ep31 , sp32 , ep32 , sp33 , ep33 , & sp31x, ep31x, sp32x, ep32x, sp33x, ep33x, & sp31y, ep31y, sp32y, ep32y, sp33y, ep33y, & sm31x, em31x, sm32x, em32x, sm33x, em33x, & sm31y, em31y, sm32y, em32y, sm33y, em33y ) IMPLICIT NONE TYPE(domain) , POINTER :: grid INTEGER , INTENT(IN) :: id INTEGER , INTENT(IN) :: setinitval_in INTEGER , INTENT(IN) :: sd31, ed31, sd32, ed32, sd33, ed33 INTEGER , INTENT(IN) :: sm31, em31, sm32, em32, sm33, em33 INTEGER , INTENT(IN) :: sp31, ep31, sp32, ep32, sp33, ep33 INTEGER , INTENT(IN) :: sp31x, ep31x, sp32x, ep32x, sp33x, ep33x INTEGER , INTENT(IN) :: sp31y, ep31y, sp32y, ep32y, sp33y, ep33y INTEGER , INTENT(IN) :: sm31x, em31x, sm32x, em32x, sm33x, em33x INTEGER , INTENT(IN) :: sm31y, em31y, sm32y, em32y, sm33y, em33y INTEGER , INTENT(IN) :: tl_in LOGICAL , INTENT(IN) :: inter_domain_in LOGICAL :: size_changed size_changed= .not. ( & grid%alloced_sd31 .eq. sd31 .and. grid%alloced_ed31 .eq. ed31 .and. & grid%alloced_sd32 .eq. sd32 .and. grid%alloced_ed32 .eq. ed32 .and. & grid%alloced_sd33 .eq. sd33 .and. grid%alloced_ed33 .eq. ed33 .and. & grid%alloced_sm31 .eq. sm31 .and. grid%alloced_em31 .eq. em31 .and. & grid%alloced_sm32 .eq. sm32 .and. grid%alloced_em32 .eq. em32 .and. & grid%alloced_sm33 .eq. sm33 .and. grid%alloced_em33 .eq. em33 .and. & grid%alloced_sm31x .eq. sm31x .and. grid%alloced_em31x .eq. em31x .and. & grid%alloced_sm32x .eq. sm32x .and. grid%alloced_em32x .eq. em32x .and. & grid%alloced_sm33x .eq. sm33x .and. grid%alloced_em33x .eq. em33x .and. & grid%alloced_sm31y .eq. sm31y .and. grid%alloced_em31y .eq. em31y .and. & grid%alloced_sm32y .eq. sm32y .and. grid%alloced_em32y .eq. em32y .and. & grid%alloced_sm33y .eq. sm33y .and. grid%alloced_em33y .eq. em33y & ) if(.not. grid%allocated .or. size_changed) then if(.not. grid%allocated) then call wrf_debug(1,'ensure_space_field: calling alloc_space_field because a grid was not allocated.') else if(size_changed) & call wrf_debug(1,'ensure_space_field: deallocating and reallocating a grid because grid size changed.') end if if(grid%allocated) & call dealloc_space_field( grid ) call alloc_space_field ( grid, id, setinitval_in , tl_in , inter_domain_in , & sd31, ed31, sd32, ed32, sd33, ed33, & sm31 , em31 , sm32 , em32 , sm33 , em33 , & sp31 , ep31 , sp32 , ep32 , sp33 , ep33 , & sp31x, ep31x, sp32x, ep32x, sp33x, ep33x, & sp31y, ep31y, sp32y, ep32y, sp33y, ep33y, & sm31x, em31x, sm32x, em32x, sm33x, em33x, & sm31y, em31y, sm32y, em32y, sm33y, em33y ) end if END SUBROUTINE ensure_space_field SUBROUTINE dealloc_space_domain ( id ) IMPLICIT NONE INTEGER , INTENT(IN) :: id TYPE(domain) , POINTER :: grid LOGICAL :: found grid => head_grid old_grid => head_grid found = .FALSE. find_grid : DO WHILE ( ASSOCIATED(grid) ) IF ( grid%id == id ) THEN found = .TRUE. old_grid%next => grid%next CALL domain_destroy( grid ) EXIT find_grid END IF old_grid => grid grid => grid%next END DO find_grid IF ( .NOT. found ) THEN WRITE ( wrf_err_message , * ) 'module_domain: ', & 'dealloc_space_domain: Could not de-allocate grid id ',id CALL wrf_error_fatal3("",1460,& TRIM( wrf_err_message ) ) END IF END SUBROUTINE dealloc_space_domain SUBROUTINE domain_destroy ( grid ) IMPLICIT NONE TYPE(domain) , POINTER :: grid CALL dealloc_space_field ( grid ) CALL dealloc_linked_lists( grid ) DEALLOCATE( grid%parents ) DEALLOCATE( grid%nests ) CALL domain_clock_destroy( grid ) CALL domain_alarms_destroy( grid ) IF ( ASSOCIATED( grid%i_start ) ) THEN DEALLOCATE( grid%i_start ) ENDIF IF ( ASSOCIATED( grid%i_end ) ) THEN DEALLOCATE( grid%i_end ) ENDIF IF ( ASSOCIATED( grid%j_start ) ) THEN DEALLOCATE( grid%j_start ) ENDIF IF ( ASSOCIATED( grid%j_end ) ) THEN DEALLOCATE( grid%j_end ) ENDIF IF ( ASSOCIATED( grid%itsloc ) ) THEN DEALLOCATE( grid%itsloc ) ENDIF IF ( ASSOCIATED( grid%jtsloc ) ) THEN DEALLOCATE( grid%jtsloc ) ENDIF IF ( ASSOCIATED( grid%id_tsloc ) ) THEN DEALLOCATE( grid%id_tsloc ) ENDIF IF ( ASSOCIATED( grid%lattsloc ) ) THEN DEALLOCATE( grid%lattsloc ) ENDIF IF ( ASSOCIATED( grid%lontsloc ) ) THEN DEALLOCATE( grid%lontsloc ) ENDIF IF ( ASSOCIATED( grid%nametsloc ) ) THEN DEALLOCATE( grid%nametsloc ) ENDIF IF ( ASSOCIATED( grid%desctsloc ) ) THEN DEALLOCATE( grid%desctsloc ) ENDIF IF ( ASSOCIATED( grid%ts_filename ) ) THEN DEALLOCATE( grid%ts_filename ) ENDIF DEALLOCATE( grid ) NULLIFY( grid ) END SUBROUTINE domain_destroy SUBROUTINE dealloc_linked_lists ( grid ) IMPLICIT NONE TYPE(domain), POINTER :: grid TYPE(fieldlist), POINTER :: p, q p => grid%head_statevars DO WHILE ( ASSOCIATED( p ) ) q => p ; p => p%next ; DEALLOCATE(q) ENDDO NULLIFY(grid%head_statevars) ; NULLIFY( grid%tail_statevars) IF ( .NOT. grid%is_intermediate ) THEN ALLOCATE( grid%head_statevars ) NULLIFY( grid%head_statevars%next) grid%tail_statevars => grid%head_statevars ENDIF END SUBROUTINE dealloc_linked_lists RECURSIVE SUBROUTINE show_nest_subtree ( grid ) TYPE(domain), POINTER :: grid INTEGER myid INTEGER kid IF ( .NOT. ASSOCIATED( grid ) ) RETURN myid = grid%id write(0,*)'show_nest_subtree ',myid DO kid = 1, max_nests IF ( ASSOCIATED( grid%nests(kid)%ptr ) ) THEN IF ( grid%nests(kid)%ptr%id .EQ. myid ) THEN CALL wrf_error_fatal3("",1555,& 'show_nest_subtree: nest hierarchy corrupted' ) ENDIF CALL show_nest_subtree( grid%nests(kid)%ptr ) ENDIF ENDDO END SUBROUTINE show_nest_subtree SUBROUTINE dealloc_space_field ( grid ) IMPLICIT NONE TYPE(domain) , POINTER :: grid INTEGER :: ierr IF ( ASSOCIATED( grid%x_1 ) ) THEN DEALLOCATE(grid%x_1,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",1591,& 'frame/module_domain.f: Failed to deallocate grid%x_1. ') endif ENDIF IF ( ASSOCIATED( grid%x_2 ) ) THEN DEALLOCATE(grid%x_2,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",1598,& 'frame/module_domain.f: Failed to deallocate grid%x_2. ') endif ENDIF IF ( ASSOCIATED( grid%szj ) ) THEN DEALLOCATE(grid%szj,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",1605,& 'frame/module_domain.f: Failed to deallocate grid%szj. ') endif ENDIF IF ( ASSOCIATED( grid%s1z ) ) THEN DEALLOCATE(grid%s1z,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",1612,& 'frame/module_domain.f: Failed to deallocate grid%s1z. ') endif ENDIF IF ( ASSOCIATED( grid%spz ) ) THEN DEALLOCATE(grid%spz,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",1619,& 'frame/module_domain.f: Failed to deallocate grid%spz. ') endif ENDIF IF ( ASSOCIATED( grid%tcs ) ) THEN DEALLOCATE(grid%tcs,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",1626,& 'frame/module_domain.f: Failed to deallocate grid%tcs. ') endif ENDIF IF ( ASSOCIATED( grid%lu_index ) ) THEN DEALLOCATE(grid%lu_index,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",1633,& 'frame/module_domain.f: Failed to deallocate grid%lu_index. ') endif ENDIF IF ( ASSOCIATED( grid%lu_mask ) ) THEN DEALLOCATE(grid%lu_mask,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",1640,& 'frame/module_domain.f: Failed to deallocate grid%lu_mask. ') endif ENDIF IF ( ASSOCIATED( grid%p_gc ) ) THEN DEALLOCATE(grid%p_gc,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",1647,& 'frame/module_domain.f: Failed to deallocate grid%p_gc. ') endif ENDIF IF ( ASSOCIATED( grid%vegcat ) ) THEN DEALLOCATE(grid%vegcat,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",1654,& 'frame/module_domain.f: Failed to deallocate grid%vegcat. ') endif ENDIF IF ( ASSOCIATED( grid%soilcat ) ) THEN DEALLOCATE(grid%soilcat,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",1661,& 'frame/module_domain.f: Failed to deallocate grid%soilcat. ') endif ENDIF IF ( ASSOCIATED( grid%input_soil_cat ) ) THEN DEALLOCATE(grid%input_soil_cat,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",1668,& 'frame/module_domain.f: Failed to deallocate grid%input_soil_cat. ') endif ENDIF IF ( ASSOCIATED( grid%tsk_gc ) ) THEN DEALLOCATE(grid%tsk_gc,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",1675,& 'frame/module_domain.f: Failed to deallocate grid%tsk_gc. ') endif ENDIF IF ( ASSOCIATED( grid%xice_gc ) ) THEN DEALLOCATE(grid%xice_gc,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",1682,& 'frame/module_domain.f: Failed to deallocate grid%xice_gc. ') endif ENDIF IF ( ASSOCIATED( grid%ght_gc ) ) THEN DEALLOCATE(grid%ght_gc,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",1689,& 'frame/module_domain.f: Failed to deallocate grid%ght_gc. ') endif ENDIF IF ( ASSOCIATED( grid%rh_gc ) ) THEN DEALLOCATE(grid%rh_gc,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",1696,& 'frame/module_domain.f: Failed to deallocate grid%rh_gc. ') endif ENDIF IF ( ASSOCIATED( grid%v_gc ) ) THEN DEALLOCATE(grid%v_gc,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",1703,& 'frame/module_domain.f: Failed to deallocate grid%v_gc. ') endif ENDIF IF ( ASSOCIATED( grid%u_gc ) ) THEN DEALLOCATE(grid%u_gc,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",1710,& 'frame/module_domain.f: Failed to deallocate grid%u_gc. ') endif ENDIF IF ( ASSOCIATED( grid%t_gc ) ) THEN DEALLOCATE(grid%t_gc,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",1717,& 'frame/module_domain.f: Failed to deallocate grid%t_gc. ') endif ENDIF IF ( ASSOCIATED( grid%snoalb ) ) THEN DEALLOCATE(grid%snoalb,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",1724,& 'frame/module_domain.f: Failed to deallocate grid%snoalb. ') endif ENDIF IF ( ASSOCIATED( grid%greenfrac_gc ) ) THEN DEALLOCATE(grid%greenfrac_gc,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",1731,& 'frame/module_domain.f: Failed to deallocate grid%greenfrac_gc. ') endif ENDIF IF ( ASSOCIATED( grid%albedo12m_gc ) ) THEN DEALLOCATE(grid%albedo12m_gc,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",1738,& 'frame/module_domain.f: Failed to deallocate grid%albedo12m_gc. ') endif ENDIF IF ( ASSOCIATED( grid%soilcbot_gc ) ) THEN DEALLOCATE(grid%soilcbot_gc,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",1745,& 'frame/module_domain.f: Failed to deallocate grid%soilcbot_gc. ') endif ENDIF IF ( ASSOCIATED( grid%soilctop_gc ) ) THEN DEALLOCATE(grid%soilctop_gc,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",1752,& 'frame/module_domain.f: Failed to deallocate grid%soilctop_gc. ') endif ENDIF IF ( ASSOCIATED( grid%tmn_gc ) ) THEN DEALLOCATE(grid%tmn_gc,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",1759,& 'frame/module_domain.f: Failed to deallocate grid%tmn_gc. ') endif ENDIF IF ( ASSOCIATED( grid%htv_gc ) ) THEN DEALLOCATE(grid%htv_gc,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",1766,& 'frame/module_domain.f: Failed to deallocate grid%htv_gc. ') endif ENDIF IF ( ASSOCIATED( grid%ht_gc ) ) THEN DEALLOCATE(grid%ht_gc,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",1773,& 'frame/module_domain.f: Failed to deallocate grid%ht_gc. ') endif ENDIF IF ( ASSOCIATED( grid%landusef_gc ) ) THEN DEALLOCATE(grid%landusef_gc,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",1780,& 'frame/module_domain.f: Failed to deallocate grid%landusef_gc. ') endif ENDIF IF ( ASSOCIATED( grid%vlon_gc ) ) THEN DEALLOCATE(grid%vlon_gc,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",1787,& 'frame/module_domain.f: Failed to deallocate grid%vlon_gc. ') endif ENDIF IF ( ASSOCIATED( grid%vlat_gc ) ) THEN DEALLOCATE(grid%vlat_gc,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",1794,& 'frame/module_domain.f: Failed to deallocate grid%vlat_gc. ') endif ENDIF IF ( ASSOCIATED( grid%hlon_gc ) ) THEN DEALLOCATE(grid%hlon_gc,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",1801,& 'frame/module_domain.f: Failed to deallocate grid%hlon_gc. ') endif ENDIF IF ( ASSOCIATED( grid%hlat_gc ) ) THEN DEALLOCATE(grid%hlat_gc,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",1808,& 'frame/module_domain.f: Failed to deallocate grid%hlat_gc. ') endif ENDIF IF ( ASSOCIATED( grid%ducudt ) ) THEN DEALLOCATE(grid%ducudt,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",1815,& 'frame/module_domain.f: Failed to deallocate grid%ducudt. ') endif ENDIF IF ( ASSOCIATED( grid%dvcudt ) ) THEN DEALLOCATE(grid%dvcudt,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",1822,& 'frame/module_domain.f: Failed to deallocate grid%dvcudt. ') endif ENDIF IF ( ASSOCIATED( grid%randstate1 ) ) THEN DEALLOCATE(grid%randstate1,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",1829,& 'frame/module_domain.f: Failed to deallocate grid%randstate1. ') endif ENDIF IF ( ASSOCIATED( grid%randstate2 ) ) THEN DEALLOCATE(grid%randstate2,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",1836,& 'frame/module_domain.f: Failed to deallocate grid%randstate2. ') endif ENDIF IF ( ASSOCIATED( grid%randstate3 ) ) THEN DEALLOCATE(grid%randstate3,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",1843,& 'frame/module_domain.f: Failed to deallocate grid%randstate3. ') endif ENDIF IF ( ASSOCIATED( grid%randstate4 ) ) THEN DEALLOCATE(grid%randstate4,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",1850,& 'frame/module_domain.f: Failed to deallocate grid%randstate4. ') endif ENDIF IF ( ASSOCIATED( grid%random ) ) THEN DEALLOCATE(grid%random,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",1857,& 'frame/module_domain.f: Failed to deallocate grid%random. ') endif ENDIF IF ( ASSOCIATED( grid%hbm2 ) ) THEN DEALLOCATE(grid%hbm2,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",1864,& 'frame/module_domain.f: Failed to deallocate grid%hbm2. ') endif ENDIF IF ( ASSOCIATED( grid%hbm3 ) ) THEN DEALLOCATE(grid%hbm3,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",1871,& 'frame/module_domain.f: Failed to deallocate grid%hbm3. ') endif ENDIF IF ( ASSOCIATED( grid%vbm2 ) ) THEN DEALLOCATE(grid%vbm2,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",1878,& 'frame/module_domain.f: Failed to deallocate grid%vbm2. ') endif ENDIF IF ( ASSOCIATED( grid%vbm3 ) ) THEN DEALLOCATE(grid%vbm3,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",1885,& 'frame/module_domain.f: Failed to deallocate grid%vbm3. ') endif ENDIF IF ( ASSOCIATED( grid%sm ) ) THEN DEALLOCATE(grid%sm,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",1892,& 'frame/module_domain.f: Failed to deallocate grid%sm. ') endif ENDIF IF ( ASSOCIATED( grid%sice ) ) THEN DEALLOCATE(grid%sice,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",1899,& 'frame/module_domain.f: Failed to deallocate grid%sice. ') endif ENDIF IF ( ASSOCIATED( grid%pd ) ) THEN DEALLOCATE(grid%pd,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",1906,& 'frame/module_domain.f: Failed to deallocate grid%pd. ') endif ENDIF IF ( ASSOCIATED( grid%pd_bxs ) ) THEN DEALLOCATE(grid%pd_bxs,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",1913,& 'frame/module_domain.f: Failed to deallocate grid%pd_bxs. ') endif NULLIFY(grid%pd_bxs) ENDIF IF ( ASSOCIATED( grid%pd_bxe ) ) THEN DEALLOCATE(grid%pd_bxe,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",1921,& 'frame/module_domain.f: Failed to deallocate grid%pd_bxe. ') endif NULLIFY(grid%pd_bxe) ENDIF IF ( ASSOCIATED( grid%pd_bys ) ) THEN DEALLOCATE(grid%pd_bys,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",1929,& 'frame/module_domain.f: Failed to deallocate grid%pd_bys. ') endif NULLIFY(grid%pd_bys) ENDIF IF ( ASSOCIATED( grid%pd_bye ) ) THEN DEALLOCATE(grid%pd_bye,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",1937,& 'frame/module_domain.f: Failed to deallocate grid%pd_bye. ') endif NULLIFY(grid%pd_bye) ENDIF IF ( ASSOCIATED( grid%pd_btxs ) ) THEN DEALLOCATE(grid%pd_btxs,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",1945,& 'frame/module_domain.f: Failed to deallocate grid%pd_btxs. ') endif NULLIFY(grid%pd_btxs) ENDIF IF ( ASSOCIATED( grid%pd_btxe ) ) THEN DEALLOCATE(grid%pd_btxe,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",1953,& 'frame/module_domain.f: Failed to deallocate grid%pd_btxe. ') endif NULLIFY(grid%pd_btxe) ENDIF IF ( ASSOCIATED( grid%pd_btys ) ) THEN DEALLOCATE(grid%pd_btys,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",1961,& 'frame/module_domain.f: Failed to deallocate grid%pd_btys. ') endif NULLIFY(grid%pd_btys) ENDIF IF ( ASSOCIATED( grid%pd_btye ) ) THEN DEALLOCATE(grid%pd_btye,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",1969,& 'frame/module_domain.f: Failed to deallocate grid%pd_btye. ') endif NULLIFY(grid%pd_btye) ENDIF IF ( ASSOCIATED( grid%fis ) ) THEN DEALLOCATE(grid%fis,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",1977,& 'frame/module_domain.f: Failed to deallocate grid%fis. ') endif ENDIF IF ( ASSOCIATED( grid%res ) ) THEN DEALLOCATE(grid%res,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",1984,& 'frame/module_domain.f: Failed to deallocate grid%res. ') endif ENDIF IF ( ASSOCIATED( grid%t ) ) THEN DEALLOCATE(grid%t,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",1991,& 'frame/module_domain.f: Failed to deallocate grid%t. ') endif ENDIF IF ( ASSOCIATED( grid%t_bxs ) ) THEN DEALLOCATE(grid%t_bxs,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",1998,& 'frame/module_domain.f: Failed to deallocate grid%t_bxs. ') endif NULLIFY(grid%t_bxs) ENDIF IF ( ASSOCIATED( grid%t_bxe ) ) THEN DEALLOCATE(grid%t_bxe,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",2006,& 'frame/module_domain.f: Failed to deallocate grid%t_bxe. ') endif NULLIFY(grid%t_bxe) ENDIF IF ( ASSOCIATED( grid%t_bys ) ) THEN DEALLOCATE(grid%t_bys,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",2014,& 'frame/module_domain.f: Failed to deallocate grid%t_bys. ') endif NULLIFY(grid%t_bys) ENDIF IF ( ASSOCIATED( grid%t_bye ) ) THEN DEALLOCATE(grid%t_bye,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",2022,& 'frame/module_domain.f: Failed to deallocate grid%t_bye. ') endif NULLIFY(grid%t_bye) ENDIF IF ( ASSOCIATED( grid%t_btxs ) ) THEN DEALLOCATE(grid%t_btxs,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",2030,& 'frame/module_domain.f: Failed to deallocate grid%t_btxs. ') endif NULLIFY(grid%t_btxs) ENDIF IF ( ASSOCIATED( grid%t_btxe ) ) THEN DEALLOCATE(grid%t_btxe,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",2038,& 'frame/module_domain.f: Failed to deallocate grid%t_btxe. ') endif NULLIFY(grid%t_btxe) ENDIF IF ( ASSOCIATED( grid%t_btys ) ) THEN DEALLOCATE(grid%t_btys,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",2046,& 'frame/module_domain.f: Failed to deallocate grid%t_btys. ') endif NULLIFY(grid%t_btys) ENDIF IF ( ASSOCIATED( grid%t_btye ) ) THEN DEALLOCATE(grid%t_btye,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",2054,& 'frame/module_domain.f: Failed to deallocate grid%t_btye. ') endif NULLIFY(grid%t_btye) ENDIF IF ( ASSOCIATED( grid%q ) ) THEN DEALLOCATE(grid%q,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",2062,& 'frame/module_domain.f: Failed to deallocate grid%q. ') endif ENDIF IF ( ASSOCIATED( grid%q_bxs ) ) THEN DEALLOCATE(grid%q_bxs,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",2069,& 'frame/module_domain.f: Failed to deallocate grid%q_bxs. ') endif NULLIFY(grid%q_bxs) ENDIF IF ( ASSOCIATED( grid%q_bxe ) ) THEN DEALLOCATE(grid%q_bxe,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",2077,& 'frame/module_domain.f: Failed to deallocate grid%q_bxe. ') endif NULLIFY(grid%q_bxe) ENDIF IF ( ASSOCIATED( grid%q_bys ) ) THEN DEALLOCATE(grid%q_bys,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",2085,& 'frame/module_domain.f: Failed to deallocate grid%q_bys. ') endif NULLIFY(grid%q_bys) ENDIF IF ( ASSOCIATED( grid%q_bye ) ) THEN DEALLOCATE(grid%q_bye,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",2093,& 'frame/module_domain.f: Failed to deallocate grid%q_bye. ') endif NULLIFY(grid%q_bye) ENDIF IF ( ASSOCIATED( grid%q_btxs ) ) THEN DEALLOCATE(grid%q_btxs,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",2101,& 'frame/module_domain.f: Failed to deallocate grid%q_btxs. ') endif NULLIFY(grid%q_btxs) ENDIF IF ( ASSOCIATED( grid%q_btxe ) ) THEN DEALLOCATE(grid%q_btxe,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",2109,& 'frame/module_domain.f: Failed to deallocate grid%q_btxe. ') endif NULLIFY(grid%q_btxe) ENDIF IF ( ASSOCIATED( grid%q_btys ) ) THEN DEALLOCATE(grid%q_btys,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",2117,& 'frame/module_domain.f: Failed to deallocate grid%q_btys. ') endif NULLIFY(grid%q_btys) ENDIF IF ( ASSOCIATED( grid%q_btye ) ) THEN DEALLOCATE(grid%q_btye,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",2125,& 'frame/module_domain.f: Failed to deallocate grid%q_btye. ') endif NULLIFY(grid%q_btye) ENDIF IF ( ASSOCIATED( grid%u ) ) THEN DEALLOCATE(grid%u,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",2133,& 'frame/module_domain.f: Failed to deallocate grid%u. ') endif ENDIF IF ( ASSOCIATED( grid%u_bxs ) ) THEN DEALLOCATE(grid%u_bxs,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",2140,& 'frame/module_domain.f: Failed to deallocate grid%u_bxs. ') endif NULLIFY(grid%u_bxs) ENDIF IF ( ASSOCIATED( grid%u_bxe ) ) THEN DEALLOCATE(grid%u_bxe,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",2148,& 'frame/module_domain.f: Failed to deallocate grid%u_bxe. ') endif NULLIFY(grid%u_bxe) ENDIF IF ( ASSOCIATED( grid%u_bys ) ) THEN DEALLOCATE(grid%u_bys,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",2156,& 'frame/module_domain.f: Failed to deallocate grid%u_bys. ') endif NULLIFY(grid%u_bys) ENDIF IF ( ASSOCIATED( grid%u_bye ) ) THEN DEALLOCATE(grid%u_bye,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",2164,& 'frame/module_domain.f: Failed to deallocate grid%u_bye. ') endif NULLIFY(grid%u_bye) ENDIF IF ( ASSOCIATED( grid%u_btxs ) ) THEN DEALLOCATE(grid%u_btxs,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",2172,& 'frame/module_domain.f: Failed to deallocate grid%u_btxs. ') endif NULLIFY(grid%u_btxs) ENDIF IF ( ASSOCIATED( grid%u_btxe ) ) THEN DEALLOCATE(grid%u_btxe,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",2180,& 'frame/module_domain.f: Failed to deallocate grid%u_btxe. ') endif NULLIFY(grid%u_btxe) ENDIF IF ( ASSOCIATED( grid%u_btys ) ) THEN DEALLOCATE(grid%u_btys,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",2188,& 'frame/module_domain.f: Failed to deallocate grid%u_btys. ') endif NULLIFY(grid%u_btys) ENDIF IF ( ASSOCIATED( grid%u_btye ) ) THEN DEALLOCATE(grid%u_btye,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",2196,& 'frame/module_domain.f: Failed to deallocate grid%u_btye. ') endif NULLIFY(grid%u_btye) ENDIF IF ( ASSOCIATED( grid%v ) ) THEN DEALLOCATE(grid%v,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",2204,& 'frame/module_domain.f: Failed to deallocate grid%v. ') endif ENDIF IF ( ASSOCIATED( grid%v_bxs ) ) THEN DEALLOCATE(grid%v_bxs,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",2211,& 'frame/module_domain.f: Failed to deallocate grid%v_bxs. ') endif NULLIFY(grid%v_bxs) ENDIF IF ( ASSOCIATED( grid%v_bxe ) ) THEN DEALLOCATE(grid%v_bxe,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",2219,& 'frame/module_domain.f: Failed to deallocate grid%v_bxe. ') endif NULLIFY(grid%v_bxe) ENDIF IF ( ASSOCIATED( grid%v_bys ) ) THEN DEALLOCATE(grid%v_bys,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",2227,& 'frame/module_domain.f: Failed to deallocate grid%v_bys. ') endif NULLIFY(grid%v_bys) ENDIF IF ( ASSOCIATED( grid%v_bye ) ) THEN DEALLOCATE(grid%v_bye,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",2235,& 'frame/module_domain.f: Failed to deallocate grid%v_bye. ') endif NULLIFY(grid%v_bye) ENDIF IF ( ASSOCIATED( grid%v_btxs ) ) THEN DEALLOCATE(grid%v_btxs,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",2243,& 'frame/module_domain.f: Failed to deallocate grid%v_btxs. ') endif NULLIFY(grid%v_btxs) ENDIF IF ( ASSOCIATED( grid%v_btxe ) ) THEN DEALLOCATE(grid%v_btxe,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",2251,& 'frame/module_domain.f: Failed to deallocate grid%v_btxe. ') endif NULLIFY(grid%v_btxe) ENDIF IF ( ASSOCIATED( grid%v_btys ) ) THEN DEALLOCATE(grid%v_btys,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",2259,& 'frame/module_domain.f: Failed to deallocate grid%v_btys. ') endif NULLIFY(grid%v_btys) ENDIF IF ( ASSOCIATED( grid%v_btye ) ) THEN DEALLOCATE(grid%v_btye,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",2267,& 'frame/module_domain.f: Failed to deallocate grid%v_btye. ') endif NULLIFY(grid%v_btye) ENDIF IF ( ASSOCIATED( grid%told ) ) THEN DEALLOCATE(grid%told,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",2275,& 'frame/module_domain.f: Failed to deallocate grid%told. ') endif ENDIF IF ( ASSOCIATED( grid%uold ) ) THEN DEALLOCATE(grid%uold,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",2282,& 'frame/module_domain.f: Failed to deallocate grid%uold. ') endif ENDIF IF ( ASSOCIATED( grid%vold ) ) THEN DEALLOCATE(grid%vold,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",2289,& 'frame/module_domain.f: Failed to deallocate grid%vold. ') endif ENDIF IF ( ASSOCIATED( grid%dfi_pd ) ) THEN DEALLOCATE(grid%dfi_pd,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",2296,& 'frame/module_domain.f: Failed to deallocate grid%dfi_pd. ') endif ENDIF IF ( ASSOCIATED( grid%dfi_pint ) ) THEN DEALLOCATE(grid%dfi_pint,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",2303,& 'frame/module_domain.f: Failed to deallocate grid%dfi_pint. ') endif ENDIF IF ( ASSOCIATED( grid%dfi_dwdt ) ) THEN DEALLOCATE(grid%dfi_dwdt,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",2310,& 'frame/module_domain.f: Failed to deallocate grid%dfi_dwdt. ') endif ENDIF IF ( ASSOCIATED( grid%dfi_t ) ) THEN DEALLOCATE(grid%dfi_t,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",2317,& 'frame/module_domain.f: Failed to deallocate grid%dfi_t. ') endif ENDIF IF ( ASSOCIATED( grid%dfi_q ) ) THEN DEALLOCATE(grid%dfi_q,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",2324,& 'frame/module_domain.f: Failed to deallocate grid%dfi_q. ') endif ENDIF IF ( ASSOCIATED( grid%dfi_u ) ) THEN DEALLOCATE(grid%dfi_u,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",2331,& 'frame/module_domain.f: Failed to deallocate grid%dfi_u. ') endif ENDIF IF ( ASSOCIATED( grid%dfi_v ) ) THEN DEALLOCATE(grid%dfi_v,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",2338,& 'frame/module_domain.f: Failed to deallocate grid%dfi_v. ') endif ENDIF IF ( ASSOCIATED( grid%dfi_q2 ) ) THEN DEALLOCATE(grid%dfi_q2,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",2345,& 'frame/module_domain.f: Failed to deallocate grid%dfi_q2. ') endif ENDIF IF ( ASSOCIATED( grid%dfi_cwm ) ) THEN DEALLOCATE(grid%dfi_cwm,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",2352,& 'frame/module_domain.f: Failed to deallocate grid%dfi_cwm. ') endif ENDIF IF ( ASSOCIATED( grid%dfi_rrw ) ) THEN DEALLOCATE(grid%dfi_rrw,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",2359,& 'frame/module_domain.f: Failed to deallocate grid%dfi_rrw. ') endif ENDIF IF ( ASSOCIATED( grid%dfi_stc ) ) THEN DEALLOCATE(grid%dfi_stc,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",2366,& 'frame/module_domain.f: Failed to deallocate grid%dfi_stc. ') endif ENDIF IF ( ASSOCIATED( grid%dfi_smc ) ) THEN DEALLOCATE(grid%dfi_smc,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",2373,& 'frame/module_domain.f: Failed to deallocate grid%dfi_smc. ') endif ENDIF IF ( ASSOCIATED( grid%dfi_sh2o ) ) THEN DEALLOCATE(grid%dfi_sh2o,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",2380,& 'frame/module_domain.f: Failed to deallocate grid%dfi_sh2o. ') endif ENDIF IF ( ASSOCIATED( grid%dfi_snow ) ) THEN DEALLOCATE(grid%dfi_snow,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",2387,& 'frame/module_domain.f: Failed to deallocate grid%dfi_snow. ') endif ENDIF IF ( ASSOCIATED( grid%dfi_snowh ) ) THEN DEALLOCATE(grid%dfi_snowh,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",2394,& 'frame/module_domain.f: Failed to deallocate grid%dfi_snowh. ') endif ENDIF IF ( ASSOCIATED( grid%dfi_canwat ) ) THEN DEALLOCATE(grid%dfi_canwat,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",2401,& 'frame/module_domain.f: Failed to deallocate grid%dfi_canwat. ') endif ENDIF IF ( ASSOCIATED( grid%dfi_nmm_tsk ) ) THEN DEALLOCATE(grid%dfi_nmm_tsk,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",2408,& 'frame/module_domain.f: Failed to deallocate grid%dfi_nmm_tsk. ') endif ENDIF IF ( ASSOCIATED( grid%dfi_snowc ) ) THEN DEALLOCATE(grid%dfi_snowc,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",2415,& 'frame/module_domain.f: Failed to deallocate grid%dfi_snowc. ') endif ENDIF IF ( ASSOCIATED( grid%dx_nmm ) ) THEN DEALLOCATE(grid%dx_nmm,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",2422,& 'frame/module_domain.f: Failed to deallocate grid%dx_nmm. ') endif ENDIF IF ( ASSOCIATED( grid%wpdar ) ) THEN DEALLOCATE(grid%wpdar,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",2429,& 'frame/module_domain.f: Failed to deallocate grid%wpdar. ') endif ENDIF IF ( ASSOCIATED( grid%cpgfu ) ) THEN DEALLOCATE(grid%cpgfu,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",2436,& 'frame/module_domain.f: Failed to deallocate grid%cpgfu. ') endif ENDIF IF ( ASSOCIATED( grid%curv ) ) THEN DEALLOCATE(grid%curv,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",2443,& 'frame/module_domain.f: Failed to deallocate grid%curv. ') endif ENDIF IF ( ASSOCIATED( grid%fcp ) ) THEN DEALLOCATE(grid%fcp,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",2450,& 'frame/module_domain.f: Failed to deallocate grid%fcp. ') endif ENDIF IF ( ASSOCIATED( grid%fdiv ) ) THEN DEALLOCATE(grid%fdiv,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",2457,& 'frame/module_domain.f: Failed to deallocate grid%fdiv. ') endif ENDIF IF ( ASSOCIATED( grid%f ) ) THEN DEALLOCATE(grid%f,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",2464,& 'frame/module_domain.f: Failed to deallocate grid%f. ') endif ENDIF IF ( ASSOCIATED( grid%fad ) ) THEN DEALLOCATE(grid%fad,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",2471,& 'frame/module_domain.f: Failed to deallocate grid%fad. ') endif ENDIF IF ( ASSOCIATED( grid%ddmpu ) ) THEN DEALLOCATE(grid%ddmpu,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",2478,& 'frame/module_domain.f: Failed to deallocate grid%ddmpu. ') endif ENDIF IF ( ASSOCIATED( grid%ddmpv ) ) THEN DEALLOCATE(grid%ddmpv,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",2485,& 'frame/module_domain.f: Failed to deallocate grid%ddmpv. ') endif ENDIF IF ( ASSOCIATED( grid%deta ) ) THEN DEALLOCATE(grid%deta,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",2492,& 'frame/module_domain.f: Failed to deallocate grid%deta. ') endif ENDIF IF ( ASSOCIATED( grid%rdeta ) ) THEN DEALLOCATE(grid%rdeta,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",2499,& 'frame/module_domain.f: Failed to deallocate grid%rdeta. ') endif ENDIF IF ( ASSOCIATED( grid%aeta ) ) THEN DEALLOCATE(grid%aeta,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",2506,& 'frame/module_domain.f: Failed to deallocate grid%aeta. ') endif ENDIF IF ( ASSOCIATED( grid%f4q2 ) ) THEN DEALLOCATE(grid%f4q2,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",2513,& 'frame/module_domain.f: Failed to deallocate grid%f4q2. ') endif ENDIF IF ( ASSOCIATED( grid%etax ) ) THEN DEALLOCATE(grid%etax,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",2520,& 'frame/module_domain.f: Failed to deallocate grid%etax. ') endif ENDIF IF ( ASSOCIATED( grid%dfl ) ) THEN DEALLOCATE(grid%dfl,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",2527,& 'frame/module_domain.f: Failed to deallocate grid%dfl. ') endif ENDIF IF ( ASSOCIATED( grid%deta1 ) ) THEN DEALLOCATE(grid%deta1,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",2534,& 'frame/module_domain.f: Failed to deallocate grid%deta1. ') endif ENDIF IF ( ASSOCIATED( grid%aeta1 ) ) THEN DEALLOCATE(grid%aeta1,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",2541,& 'frame/module_domain.f: Failed to deallocate grid%aeta1. ') endif ENDIF IF ( ASSOCIATED( grid%eta1 ) ) THEN DEALLOCATE(grid%eta1,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",2548,& 'frame/module_domain.f: Failed to deallocate grid%eta1. ') endif ENDIF IF ( ASSOCIATED( grid%deta2 ) ) THEN DEALLOCATE(grid%deta2,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",2555,& 'frame/module_domain.f: Failed to deallocate grid%deta2. ') endif ENDIF IF ( ASSOCIATED( grid%aeta2 ) ) THEN DEALLOCATE(grid%aeta2,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",2562,& 'frame/module_domain.f: Failed to deallocate grid%aeta2. ') endif ENDIF IF ( ASSOCIATED( grid%eta2 ) ) THEN DEALLOCATE(grid%eta2,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",2569,& 'frame/module_domain.f: Failed to deallocate grid%eta2. ') endif ENDIF IF ( ASSOCIATED( grid%em ) ) THEN DEALLOCATE(grid%em,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",2576,& 'frame/module_domain.f: Failed to deallocate grid%em. ') endif ENDIF IF ( ASSOCIATED( grid%emt ) ) THEN DEALLOCATE(grid%emt,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",2583,& 'frame/module_domain.f: Failed to deallocate grid%emt. ') endif ENDIF IF ( ASSOCIATED( grid%adt ) ) THEN DEALLOCATE(grid%adt,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",2590,& 'frame/module_domain.f: Failed to deallocate grid%adt. ') endif ENDIF IF ( ASSOCIATED( grid%adu ) ) THEN DEALLOCATE(grid%adu,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",2597,& 'frame/module_domain.f: Failed to deallocate grid%adu. ') endif ENDIF IF ( ASSOCIATED( grid%adv ) ) THEN DEALLOCATE(grid%adv,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",2604,& 'frame/module_domain.f: Failed to deallocate grid%adv. ') endif ENDIF IF ( ASSOCIATED( grid%em_loc ) ) THEN DEALLOCATE(grid%em_loc,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",2611,& 'frame/module_domain.f: Failed to deallocate grid%em_loc. ') endif ENDIF IF ( ASSOCIATED( grid%emt_loc ) ) THEN DEALLOCATE(grid%emt_loc,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",2618,& 'frame/module_domain.f: Failed to deallocate grid%emt_loc. ') endif ENDIF IF ( ASSOCIATED( grid%pdsl ) ) THEN DEALLOCATE(grid%pdsl,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",2625,& 'frame/module_domain.f: Failed to deallocate grid%pdsl. ') endif ENDIF IF ( ASSOCIATED( grid%pdslo ) ) THEN DEALLOCATE(grid%pdslo,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",2632,& 'frame/module_domain.f: Failed to deallocate grid%pdslo. ') endif ENDIF IF ( ASSOCIATED( grid%psdt ) ) THEN DEALLOCATE(grid%psdt,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",2639,& 'frame/module_domain.f: Failed to deallocate grid%psdt. ') endif ENDIF IF ( ASSOCIATED( grid%div ) ) THEN DEALLOCATE(grid%div,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",2646,& 'frame/module_domain.f: Failed to deallocate grid%div. ') endif ENDIF IF ( ASSOCIATED( grid%few ) ) THEN DEALLOCATE(grid%few,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",2653,& 'frame/module_domain.f: Failed to deallocate grid%few. ') endif ENDIF IF ( ASSOCIATED( grid%fne ) ) THEN DEALLOCATE(grid%fne,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",2660,& 'frame/module_domain.f: Failed to deallocate grid%fne. ') endif ENDIF IF ( ASSOCIATED( grid%fns ) ) THEN DEALLOCATE(grid%fns,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",2667,& 'frame/module_domain.f: Failed to deallocate grid%fns. ') endif ENDIF IF ( ASSOCIATED( grid%fse ) ) THEN DEALLOCATE(grid%fse,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",2674,& 'frame/module_domain.f: Failed to deallocate grid%fse. ') endif ENDIF IF ( ASSOCIATED( grid%omgalf ) ) THEN DEALLOCATE(grid%omgalf,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",2681,& 'frame/module_domain.f: Failed to deallocate grid%omgalf. ') endif ENDIF IF ( ASSOCIATED( grid%petdt ) ) THEN DEALLOCATE(grid%petdt,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",2688,& 'frame/module_domain.f: Failed to deallocate grid%petdt. ') endif ENDIF IF ( ASSOCIATED( grid%rtop ) ) THEN DEALLOCATE(grid%rtop,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",2695,& 'frame/module_domain.f: Failed to deallocate grid%rtop. ') endif ENDIF IF ( ASSOCIATED( grid%pblh ) ) THEN DEALLOCATE(grid%pblh,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",2702,& 'frame/module_domain.f: Failed to deallocate grid%pblh. ') endif ENDIF IF ( ASSOCIATED( grid%lpbl ) ) THEN DEALLOCATE(grid%lpbl,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",2709,& 'frame/module_domain.f: Failed to deallocate grid%lpbl. ') endif ENDIF IF ( ASSOCIATED( grid%mixht ) ) THEN DEALLOCATE(grid%mixht,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",2716,& 'frame/module_domain.f: Failed to deallocate grid%mixht. ') endif ENDIF IF ( ASSOCIATED( grid%ustar ) ) THEN DEALLOCATE(grid%ustar,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",2723,& 'frame/module_domain.f: Failed to deallocate grid%ustar. ') endif ENDIF IF ( ASSOCIATED( grid%z0 ) ) THEN DEALLOCATE(grid%z0,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",2730,& 'frame/module_domain.f: Failed to deallocate grid%z0. ') endif ENDIF IF ( ASSOCIATED( grid%hpbl2d ) ) THEN DEALLOCATE(grid%hpbl2d,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",2737,& 'frame/module_domain.f: Failed to deallocate grid%hpbl2d. ') endif ENDIF IF ( ASSOCIATED( grid%heat2d ) ) THEN DEALLOCATE(grid%heat2d,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",2744,& 'frame/module_domain.f: Failed to deallocate grid%heat2d. ') endif ENDIF IF ( ASSOCIATED( grid%evap2d ) ) THEN DEALLOCATE(grid%evap2d,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",2751,& 'frame/module_domain.f: Failed to deallocate grid%evap2d. ') endif ENDIF IF ( ASSOCIATED( grid%z0base ) ) THEN DEALLOCATE(grid%z0base,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",2758,& 'frame/module_domain.f: Failed to deallocate grid%z0base. ') endif ENDIF IF ( ASSOCIATED( grid%ths ) ) THEN DEALLOCATE(grid%ths,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",2765,& 'frame/module_domain.f: Failed to deallocate grid%ths. ') endif ENDIF IF ( ASSOCIATED( grid%mavail ) ) THEN DEALLOCATE(grid%mavail,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",2772,& 'frame/module_domain.f: Failed to deallocate grid%mavail. ') endif ENDIF IF ( ASSOCIATED( grid%qsh ) ) THEN DEALLOCATE(grid%qsh,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",2779,& 'frame/module_domain.f: Failed to deallocate grid%qsh. ') endif ENDIF IF ( ASSOCIATED( grid%twbs ) ) THEN DEALLOCATE(grid%twbs,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",2786,& 'frame/module_domain.f: Failed to deallocate grid%twbs. ') endif ENDIF IF ( ASSOCIATED( grid%qwbs ) ) THEN DEALLOCATE(grid%qwbs,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",2793,& 'frame/module_domain.f: Failed to deallocate grid%qwbs. ') endif ENDIF IF ( ASSOCIATED( grid%taux ) ) THEN DEALLOCATE(grid%taux,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",2800,& 'frame/module_domain.f: Failed to deallocate grid%taux. ') endif ENDIF IF ( ASSOCIATED( grid%tauy ) ) THEN DEALLOCATE(grid%tauy,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",2807,& 'frame/module_domain.f: Failed to deallocate grid%tauy. ') endif ENDIF IF ( ASSOCIATED( grid%prec ) ) THEN DEALLOCATE(grid%prec,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",2814,& 'frame/module_domain.f: Failed to deallocate grid%prec. ') endif ENDIF IF ( ASSOCIATED( grid%aprec ) ) THEN DEALLOCATE(grid%aprec,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",2821,& 'frame/module_domain.f: Failed to deallocate grid%aprec. ') endif ENDIF IF ( ASSOCIATED( grid%acprec ) ) THEN DEALLOCATE(grid%acprec,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",2828,& 'frame/module_domain.f: Failed to deallocate grid%acprec. ') endif ENDIF IF ( ASSOCIATED( grid%cuprec ) ) THEN DEALLOCATE(grid%cuprec,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",2835,& 'frame/module_domain.f: Failed to deallocate grid%cuprec. ') endif ENDIF IF ( ASSOCIATED( grid%lspa ) ) THEN DEALLOCATE(grid%lspa,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",2842,& 'frame/module_domain.f: Failed to deallocate grid%lspa. ') endif ENDIF IF ( ASSOCIATED( grid%ddata ) ) THEN DEALLOCATE(grid%ddata,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",2849,& 'frame/module_domain.f: Failed to deallocate grid%ddata. ') endif ENDIF IF ( ASSOCIATED( grid%accliq ) ) THEN DEALLOCATE(grid%accliq,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",2856,& 'frame/module_domain.f: Failed to deallocate grid%accliq. ') endif ENDIF IF ( ASSOCIATED( grid%sno ) ) THEN DEALLOCATE(grid%sno,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",2863,& 'frame/module_domain.f: Failed to deallocate grid%sno. ') endif ENDIF IF ( ASSOCIATED( grid%si ) ) THEN DEALLOCATE(grid%si,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",2870,& 'frame/module_domain.f: Failed to deallocate grid%si. ') endif ENDIF IF ( ASSOCIATED( grid%cldefi ) ) THEN DEALLOCATE(grid%cldefi,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",2877,& 'frame/module_domain.f: Failed to deallocate grid%cldefi. ') endif ENDIF IF ( ASSOCIATED( grid%deep ) ) THEN DEALLOCATE(grid%deep,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",2884,& 'frame/module_domain.f: Failed to deallocate grid%deep. ') endif ENDIF IF ( ASSOCIATED( grid%rf ) ) THEN DEALLOCATE(grid%rf,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",2891,& 'frame/module_domain.f: Failed to deallocate grid%rf. ') endif ENDIF IF ( ASSOCIATED( grid%th10 ) ) THEN DEALLOCATE(grid%th10,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",2898,& 'frame/module_domain.f: Failed to deallocate grid%th10. ') endif ENDIF IF ( ASSOCIATED( grid%q10 ) ) THEN DEALLOCATE(grid%q10,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",2905,& 'frame/module_domain.f: Failed to deallocate grid%q10. ') endif ENDIF IF ( ASSOCIATED( grid%pshltr ) ) THEN DEALLOCATE(grid%pshltr,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",2912,& 'frame/module_domain.f: Failed to deallocate grid%pshltr. ') endif ENDIF IF ( ASSOCIATED( grid%tshltr ) ) THEN DEALLOCATE(grid%tshltr,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",2919,& 'frame/module_domain.f: Failed to deallocate grid%tshltr. ') endif ENDIF IF ( ASSOCIATED( grid%qshltr ) ) THEN DEALLOCATE(grid%qshltr,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",2926,& 'frame/module_domain.f: Failed to deallocate grid%qshltr. ') endif ENDIF IF ( ASSOCIATED( grid%q2 ) ) THEN DEALLOCATE(grid%q2,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",2933,& 'frame/module_domain.f: Failed to deallocate grid%q2. ') endif ENDIF IF ( ASSOCIATED( grid%q2_bxs ) ) THEN DEALLOCATE(grid%q2_bxs,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",2940,& 'frame/module_domain.f: Failed to deallocate grid%q2_bxs. ') endif NULLIFY(grid%q2_bxs) ENDIF IF ( ASSOCIATED( grid%q2_bxe ) ) THEN DEALLOCATE(grid%q2_bxe,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",2948,& 'frame/module_domain.f: Failed to deallocate grid%q2_bxe. ') endif NULLIFY(grid%q2_bxe) ENDIF IF ( ASSOCIATED( grid%q2_bys ) ) THEN DEALLOCATE(grid%q2_bys,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",2956,& 'frame/module_domain.f: Failed to deallocate grid%q2_bys. ') endif NULLIFY(grid%q2_bys) ENDIF IF ( ASSOCIATED( grid%q2_bye ) ) THEN DEALLOCATE(grid%q2_bye,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",2964,& 'frame/module_domain.f: Failed to deallocate grid%q2_bye. ') endif NULLIFY(grid%q2_bye) ENDIF IF ( ASSOCIATED( grid%q2_btxs ) ) THEN DEALLOCATE(grid%q2_btxs,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",2972,& 'frame/module_domain.f: Failed to deallocate grid%q2_btxs. ') endif NULLIFY(grid%q2_btxs) ENDIF IF ( ASSOCIATED( grid%q2_btxe ) ) THEN DEALLOCATE(grid%q2_btxe,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",2980,& 'frame/module_domain.f: Failed to deallocate grid%q2_btxe. ') endif NULLIFY(grid%q2_btxe) ENDIF IF ( ASSOCIATED( grid%q2_btys ) ) THEN DEALLOCATE(grid%q2_btys,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",2988,& 'frame/module_domain.f: Failed to deallocate grid%q2_btys. ') endif NULLIFY(grid%q2_btys) ENDIF IF ( ASSOCIATED( grid%q2_btye ) ) THEN DEALLOCATE(grid%q2_btye,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",2996,& 'frame/module_domain.f: Failed to deallocate grid%q2_btye. ') endif NULLIFY(grid%q2_btye) ENDIF IF ( ASSOCIATED( grid%t_adj ) ) THEN DEALLOCATE(grid%t_adj,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",3004,& 'frame/module_domain.f: Failed to deallocate grid%t_adj. ') endif ENDIF IF ( ASSOCIATED( grid%t_old ) ) THEN DEALLOCATE(grid%t_old,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",3011,& 'frame/module_domain.f: Failed to deallocate grid%t_old. ') endif ENDIF IF ( ASSOCIATED( grid%zero_3d ) ) THEN DEALLOCATE(grid%zero_3d,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",3018,& 'frame/module_domain.f: Failed to deallocate grid%zero_3d. ') endif ENDIF IF ( ASSOCIATED( grid%w0avg ) ) THEN DEALLOCATE(grid%w0avg,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",3025,& 'frame/module_domain.f: Failed to deallocate grid%w0avg. ') endif ENDIF IF ( ASSOCIATED( grid%akhs_out ) ) THEN DEALLOCATE(grid%akhs_out,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",3032,& 'frame/module_domain.f: Failed to deallocate grid%akhs_out. ') endif ENDIF IF ( ASSOCIATED( grid%akms_out ) ) THEN DEALLOCATE(grid%akms_out,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",3039,& 'frame/module_domain.f: Failed to deallocate grid%akms_out. ') endif ENDIF IF ( ASSOCIATED( grid%albase ) ) THEN DEALLOCATE(grid%albase,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",3046,& 'frame/module_domain.f: Failed to deallocate grid%albase. ') endif ENDIF IF ( ASSOCIATED( grid%albedo ) ) THEN DEALLOCATE(grid%albedo,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",3053,& 'frame/module_domain.f: Failed to deallocate grid%albedo. ') endif ENDIF IF ( ASSOCIATED( grid%cnvbot ) ) THEN DEALLOCATE(grid%cnvbot,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",3060,& 'frame/module_domain.f: Failed to deallocate grid%cnvbot. ') endif ENDIF IF ( ASSOCIATED( grid%cnvtop ) ) THEN DEALLOCATE(grid%cnvtop,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",3067,& 'frame/module_domain.f: Failed to deallocate grid%cnvtop. ') endif ENDIF IF ( ASSOCIATED( grid%czen ) ) THEN DEALLOCATE(grid%czen,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",3074,& 'frame/module_domain.f: Failed to deallocate grid%czen. ') endif ENDIF IF ( ASSOCIATED( grid%czmean ) ) THEN DEALLOCATE(grid%czmean,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",3081,& 'frame/module_domain.f: Failed to deallocate grid%czmean. ') endif ENDIF IF ( ASSOCIATED( grid%embck ) ) THEN DEALLOCATE(grid%embck,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",3088,& 'frame/module_domain.f: Failed to deallocate grid%embck. ') endif ENDIF IF ( ASSOCIATED( grid%epsr ) ) THEN DEALLOCATE(grid%epsr,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",3095,& 'frame/module_domain.f: Failed to deallocate grid%epsr. ') endif ENDIF IF ( ASSOCIATED( grid%gffc ) ) THEN DEALLOCATE(grid%gffc,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",3102,& 'frame/module_domain.f: Failed to deallocate grid%gffc. ') endif ENDIF IF ( ASSOCIATED( grid%glat ) ) THEN DEALLOCATE(grid%glat,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",3109,& 'frame/module_domain.f: Failed to deallocate grid%glat. ') endif ENDIF IF ( ASSOCIATED( grid%glon ) ) THEN DEALLOCATE(grid%glon,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",3116,& 'frame/module_domain.f: Failed to deallocate grid%glon. ') endif ENDIF IF ( ASSOCIATED( grid%nmm_tsk ) ) THEN DEALLOCATE(grid%nmm_tsk,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",3123,& 'frame/module_domain.f: Failed to deallocate grid%nmm_tsk. ') endif ENDIF IF ( ASSOCIATED( grid%def3d ) ) THEN DEALLOCATE(grid%def3d,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",3130,& 'frame/module_domain.f: Failed to deallocate grid%def3d. ') endif ENDIF IF ( ASSOCIATED( grid%hdac ) ) THEN DEALLOCATE(grid%hdac,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",3137,& 'frame/module_domain.f: Failed to deallocate grid%hdac. ') endif ENDIF IF ( ASSOCIATED( grid%hdacv ) ) THEN DEALLOCATE(grid%hdacv,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",3144,& 'frame/module_domain.f: Failed to deallocate grid%hdacv. ') endif ENDIF IF ( ASSOCIATED( grid%mxsnal ) ) THEN DEALLOCATE(grid%mxsnal,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",3151,& 'frame/module_domain.f: Failed to deallocate grid%mxsnal. ') endif ENDIF IF ( ASSOCIATED( grid%radin ) ) THEN DEALLOCATE(grid%radin,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",3158,& 'frame/module_domain.f: Failed to deallocate grid%radin. ') endif ENDIF IF ( ASSOCIATED( grid%radot ) ) THEN DEALLOCATE(grid%radot,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",3165,& 'frame/module_domain.f: Failed to deallocate grid%radot. ') endif ENDIF IF ( ASSOCIATED( grid%sigt4 ) ) THEN DEALLOCATE(grid%sigt4,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",3172,& 'frame/module_domain.f: Failed to deallocate grid%sigt4. ') endif ENDIF IF ( ASSOCIATED( grid%tg ) ) THEN DEALLOCATE(grid%tg,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",3179,& 'frame/module_domain.f: Failed to deallocate grid%tg. ') endif ENDIF IF ( ASSOCIATED( grid%dfrlg ) ) THEN DEALLOCATE(grid%dfrlg,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",3186,& 'frame/module_domain.f: Failed to deallocate grid%dfrlg. ') endif ENDIF IF ( ASSOCIATED( grid%lvl ) ) THEN DEALLOCATE(grid%lvl,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",3193,& 'frame/module_domain.f: Failed to deallocate grid%lvl. ') endif ENDIF IF ( ASSOCIATED( grid%k22_deep ) ) THEN DEALLOCATE(grid%k22_deep,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",3200,& 'frame/module_domain.f: Failed to deallocate grid%k22_deep. ') endif ENDIF IF ( ASSOCIATED( grid%kbcon_deep ) ) THEN DEALLOCATE(grid%kbcon_deep,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",3207,& 'frame/module_domain.f: Failed to deallocate grid%kbcon_deep. ') endif ENDIF IF ( ASSOCIATED( grid%ktop_deep ) ) THEN DEALLOCATE(grid%ktop_deep,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",3214,& 'frame/module_domain.f: Failed to deallocate grid%ktop_deep. ') endif ENDIF IF ( ASSOCIATED( grid%raincv_a ) ) THEN DEALLOCATE(grid%raincv_a,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",3221,& 'frame/module_domain.f: Failed to deallocate grid%raincv_a. ') endif ENDIF IF ( ASSOCIATED( grid%raincv_b ) ) THEN DEALLOCATE(grid%raincv_b,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",3228,& 'frame/module_domain.f: Failed to deallocate grid%raincv_b. ') endif ENDIF IF ( ASSOCIATED( grid%gd_cloud ) ) THEN DEALLOCATE(grid%gd_cloud,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",3235,& 'frame/module_domain.f: Failed to deallocate grid%gd_cloud. ') endif ENDIF IF ( ASSOCIATED( grid%gd_cloud2 ) ) THEN DEALLOCATE(grid%gd_cloud2,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",3242,& 'frame/module_domain.f: Failed to deallocate grid%gd_cloud2. ') endif ENDIF IF ( ASSOCIATED( grid%gd_cloud_a ) ) THEN DEALLOCATE(grid%gd_cloud_a,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",3249,& 'frame/module_domain.f: Failed to deallocate grid%gd_cloud_a. ') endif ENDIF IF ( ASSOCIATED( grid%gd_cloud2_a ) ) THEN DEALLOCATE(grid%gd_cloud2_a,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",3256,& 'frame/module_domain.f: Failed to deallocate grid%gd_cloud2_a. ') endif ENDIF IF ( ASSOCIATED( grid%gd_cloud_b ) ) THEN DEALLOCATE(grid%gd_cloud_b,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",3263,& 'frame/module_domain.f: Failed to deallocate grid%gd_cloud_b. ') endif ENDIF IF ( ASSOCIATED( grid%gd_cloud2_b ) ) THEN DEALLOCATE(grid%gd_cloud2_b,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",3270,& 'frame/module_domain.f: Failed to deallocate grid%gd_cloud2_b. ') endif ENDIF IF ( ASSOCIATED( grid%gd_cldfr ) ) THEN DEALLOCATE(grid%gd_cldfr,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",3277,& 'frame/module_domain.f: Failed to deallocate grid%gd_cldfr. ') endif ENDIF IF ( ASSOCIATED( grid%cwm ) ) THEN DEALLOCATE(grid%cwm,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",3284,& 'frame/module_domain.f: Failed to deallocate grid%cwm. ') endif ENDIF IF ( ASSOCIATED( grid%cwm_bxs ) ) THEN DEALLOCATE(grid%cwm_bxs,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",3291,& 'frame/module_domain.f: Failed to deallocate grid%cwm_bxs. ') endif NULLIFY(grid%cwm_bxs) ENDIF IF ( ASSOCIATED( grid%cwm_bxe ) ) THEN DEALLOCATE(grid%cwm_bxe,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",3299,& 'frame/module_domain.f: Failed to deallocate grid%cwm_bxe. ') endif NULLIFY(grid%cwm_bxe) ENDIF IF ( ASSOCIATED( grid%cwm_bys ) ) THEN DEALLOCATE(grid%cwm_bys,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",3307,& 'frame/module_domain.f: Failed to deallocate grid%cwm_bys. ') endif NULLIFY(grid%cwm_bys) ENDIF IF ( ASSOCIATED( grid%cwm_bye ) ) THEN DEALLOCATE(grid%cwm_bye,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",3315,& 'frame/module_domain.f: Failed to deallocate grid%cwm_bye. ') endif NULLIFY(grid%cwm_bye) ENDIF IF ( ASSOCIATED( grid%cwm_btxs ) ) THEN DEALLOCATE(grid%cwm_btxs,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",3323,& 'frame/module_domain.f: Failed to deallocate grid%cwm_btxs. ') endif NULLIFY(grid%cwm_btxs) ENDIF IF ( ASSOCIATED( grid%cwm_btxe ) ) THEN DEALLOCATE(grid%cwm_btxe,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",3331,& 'frame/module_domain.f: Failed to deallocate grid%cwm_btxe. ') endif NULLIFY(grid%cwm_btxe) ENDIF IF ( ASSOCIATED( grid%cwm_btys ) ) THEN DEALLOCATE(grid%cwm_btys,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",3339,& 'frame/module_domain.f: Failed to deallocate grid%cwm_btys. ') endif NULLIFY(grid%cwm_btys) ENDIF IF ( ASSOCIATED( grid%cwm_btye ) ) THEN DEALLOCATE(grid%cwm_btye,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",3347,& 'frame/module_domain.f: Failed to deallocate grid%cwm_btye. ') endif NULLIFY(grid%cwm_btye) ENDIF IF ( ASSOCIATED( grid%rrw ) ) THEN DEALLOCATE(grid%rrw,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",3355,& 'frame/module_domain.f: Failed to deallocate grid%rrw. ') endif ENDIF IF ( ASSOCIATED( grid%rrw_bxs ) ) THEN DEALLOCATE(grid%rrw_bxs,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",3362,& 'frame/module_domain.f: Failed to deallocate grid%rrw_bxs. ') endif NULLIFY(grid%rrw_bxs) ENDIF IF ( ASSOCIATED( grid%rrw_bxe ) ) THEN DEALLOCATE(grid%rrw_bxe,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",3370,& 'frame/module_domain.f: Failed to deallocate grid%rrw_bxe. ') endif NULLIFY(grid%rrw_bxe) ENDIF IF ( ASSOCIATED( grid%rrw_bys ) ) THEN DEALLOCATE(grid%rrw_bys,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",3378,& 'frame/module_domain.f: Failed to deallocate grid%rrw_bys. ') endif NULLIFY(grid%rrw_bys) ENDIF IF ( ASSOCIATED( grid%rrw_bye ) ) THEN DEALLOCATE(grid%rrw_bye,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",3386,& 'frame/module_domain.f: Failed to deallocate grid%rrw_bye. ') endif NULLIFY(grid%rrw_bye) ENDIF IF ( ASSOCIATED( grid%rrw_btxs ) ) THEN DEALLOCATE(grid%rrw_btxs,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",3394,& 'frame/module_domain.f: Failed to deallocate grid%rrw_btxs. ') endif NULLIFY(grid%rrw_btxs) ENDIF IF ( ASSOCIATED( grid%rrw_btxe ) ) THEN DEALLOCATE(grid%rrw_btxe,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",3402,& 'frame/module_domain.f: Failed to deallocate grid%rrw_btxe. ') endif NULLIFY(grid%rrw_btxe) ENDIF IF ( ASSOCIATED( grid%rrw_btys ) ) THEN DEALLOCATE(grid%rrw_btys,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",3410,& 'frame/module_domain.f: Failed to deallocate grid%rrw_btys. ') endif NULLIFY(grid%rrw_btys) ENDIF IF ( ASSOCIATED( grid%rrw_btye ) ) THEN DEALLOCATE(grid%rrw_btye,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",3418,& 'frame/module_domain.f: Failed to deallocate grid%rrw_btye. ') endif NULLIFY(grid%rrw_btye) ENDIF IF ( ASSOCIATED( grid%f_ice ) ) THEN DEALLOCATE(grid%f_ice,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",3426,& 'frame/module_domain.f: Failed to deallocate grid%f_ice. ') endif ENDIF IF ( ASSOCIATED( grid%f_rain ) ) THEN DEALLOCATE(grid%f_rain,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",3433,& 'frame/module_domain.f: Failed to deallocate grid%f_rain. ') endif ENDIF IF ( ASSOCIATED( grid%f_rimef ) ) THEN DEALLOCATE(grid%f_rimef,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",3440,& 'frame/module_domain.f: Failed to deallocate grid%f_rimef. ') endif ENDIF IF ( ASSOCIATED( grid%cldfra ) ) THEN DEALLOCATE(grid%cldfra,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",3447,& 'frame/module_domain.f: Failed to deallocate grid%cldfra. ') endif ENDIF IF ( ASSOCIATED( grid%sr ) ) THEN DEALLOCATE(grid%sr,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",3454,& 'frame/module_domain.f: Failed to deallocate grid%sr. ') endif ENDIF IF ( ASSOCIATED( grid%cfrach ) ) THEN DEALLOCATE(grid%cfrach,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",3461,& 'frame/module_domain.f: Failed to deallocate grid%cfrach. ') endif ENDIF IF ( ASSOCIATED( grid%cfracl ) ) THEN DEALLOCATE(grid%cfracl,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",3468,& 'frame/module_domain.f: Failed to deallocate grid%cfracl. ') endif ENDIF IF ( ASSOCIATED( grid%cfracm ) ) THEN DEALLOCATE(grid%cfracm,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",3475,& 'frame/module_domain.f: Failed to deallocate grid%cfracm. ') endif ENDIF IF ( ASSOCIATED( grid%islope ) ) THEN DEALLOCATE(grid%islope,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",3482,& 'frame/module_domain.f: Failed to deallocate grid%islope. ') endif ENDIF IF ( ASSOCIATED( grid%dzsoil ) ) THEN DEALLOCATE(grid%dzsoil,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",3489,& 'frame/module_domain.f: Failed to deallocate grid%dzsoil. ') endif ENDIF IF ( ASSOCIATED( grid%rtdpth ) ) THEN DEALLOCATE(grid%rtdpth,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",3496,& 'frame/module_domain.f: Failed to deallocate grid%rtdpth. ') endif ENDIF IF ( ASSOCIATED( grid%sldpth ) ) THEN DEALLOCATE(grid%sldpth,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",3503,& 'frame/module_domain.f: Failed to deallocate grid%sldpth. ') endif ENDIF IF ( ASSOCIATED( grid%cmc ) ) THEN DEALLOCATE(grid%cmc,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",3510,& 'frame/module_domain.f: Failed to deallocate grid%cmc. ') endif ENDIF IF ( ASSOCIATED( grid%grnflx ) ) THEN DEALLOCATE(grid%grnflx,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",3517,& 'frame/module_domain.f: Failed to deallocate grid%grnflx. ') endif ENDIF IF ( ASSOCIATED( grid%pctsno ) ) THEN DEALLOCATE(grid%pctsno,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",3524,& 'frame/module_domain.f: Failed to deallocate grid%pctsno. ') endif ENDIF IF ( ASSOCIATED( grid%soiltb ) ) THEN DEALLOCATE(grid%soiltb,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",3531,& 'frame/module_domain.f: Failed to deallocate grid%soiltb. ') endif ENDIF IF ( ASSOCIATED( grid%vegfrc ) ) THEN DEALLOCATE(grid%vegfrc,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",3538,& 'frame/module_domain.f: Failed to deallocate grid%vegfrc. ') endif ENDIF IF ( ASSOCIATED( grid%shdmin ) ) THEN DEALLOCATE(grid%shdmin,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",3545,& 'frame/module_domain.f: Failed to deallocate grid%shdmin. ') endif ENDIF IF ( ASSOCIATED( grid%shdmax ) ) THEN DEALLOCATE(grid%shdmax,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",3552,& 'frame/module_domain.f: Failed to deallocate grid%shdmax. ') endif ENDIF IF ( ASSOCIATED( grid%sh2o ) ) THEN DEALLOCATE(grid%sh2o,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",3559,& 'frame/module_domain.f: Failed to deallocate grid%sh2o. ') endif ENDIF IF ( ASSOCIATED( grid%smc ) ) THEN DEALLOCATE(grid%smc,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",3566,& 'frame/module_domain.f: Failed to deallocate grid%smc. ') endif ENDIF IF ( ASSOCIATED( grid%stc ) ) THEN DEALLOCATE(grid%stc,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",3573,& 'frame/module_domain.f: Failed to deallocate grid%stc. ') endif ENDIF IF ( ASSOCIATED( grid%hstdv ) ) THEN DEALLOCATE(grid%hstdv,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",3580,& 'frame/module_domain.f: Failed to deallocate grid%hstdv. ') endif ENDIF IF ( ASSOCIATED( grid%hcnvx ) ) THEN DEALLOCATE(grid%hcnvx,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",3587,& 'frame/module_domain.f: Failed to deallocate grid%hcnvx. ') endif ENDIF IF ( ASSOCIATED( grid%hasyw ) ) THEN DEALLOCATE(grid%hasyw,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",3594,& 'frame/module_domain.f: Failed to deallocate grid%hasyw. ') endif ENDIF IF ( ASSOCIATED( grid%hasys ) ) THEN DEALLOCATE(grid%hasys,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",3601,& 'frame/module_domain.f: Failed to deallocate grid%hasys. ') endif ENDIF IF ( ASSOCIATED( grid%hasysw ) ) THEN DEALLOCATE(grid%hasysw,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",3608,& 'frame/module_domain.f: Failed to deallocate grid%hasysw. ') endif ENDIF IF ( ASSOCIATED( grid%hasynw ) ) THEN DEALLOCATE(grid%hasynw,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",3615,& 'frame/module_domain.f: Failed to deallocate grid%hasynw. ') endif ENDIF IF ( ASSOCIATED( grid%hlenw ) ) THEN DEALLOCATE(grid%hlenw,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",3622,& 'frame/module_domain.f: Failed to deallocate grid%hlenw. ') endif ENDIF IF ( ASSOCIATED( grid%hlens ) ) THEN DEALLOCATE(grid%hlens,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",3629,& 'frame/module_domain.f: Failed to deallocate grid%hlens. ') endif ENDIF IF ( ASSOCIATED( grid%hlensw ) ) THEN DEALLOCATE(grid%hlensw,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",3636,& 'frame/module_domain.f: Failed to deallocate grid%hlensw. ') endif ENDIF IF ( ASSOCIATED( grid%hlennw ) ) THEN DEALLOCATE(grid%hlennw,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",3643,& 'frame/module_domain.f: Failed to deallocate grid%hlennw. ') endif ENDIF IF ( ASSOCIATED( grid%hangl ) ) THEN DEALLOCATE(grid%hangl,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",3650,& 'frame/module_domain.f: Failed to deallocate grid%hangl. ') endif ENDIF IF ( ASSOCIATED( grid%hanis ) ) THEN DEALLOCATE(grid%hanis,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",3657,& 'frame/module_domain.f: Failed to deallocate grid%hanis. ') endif ENDIF IF ( ASSOCIATED( grid%hslop ) ) THEN DEALLOCATE(grid%hslop,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",3664,& 'frame/module_domain.f: Failed to deallocate grid%hslop. ') endif ENDIF IF ( ASSOCIATED( grid%hzmax ) ) THEN DEALLOCATE(grid%hzmax,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",3671,& 'frame/module_domain.f: Failed to deallocate grid%hzmax. ') endif ENDIF IF ( ASSOCIATED( grid%crot ) ) THEN DEALLOCATE(grid%crot,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",3678,& 'frame/module_domain.f: Failed to deallocate grid%crot. ') endif ENDIF IF ( ASSOCIATED( grid%srot ) ) THEN DEALLOCATE(grid%srot,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",3685,& 'frame/module_domain.f: Failed to deallocate grid%srot. ') endif ENDIF IF ( ASSOCIATED( grid%ugwdsfc ) ) THEN DEALLOCATE(grid%ugwdsfc,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",3692,& 'frame/module_domain.f: Failed to deallocate grid%ugwdsfc. ') endif ENDIF IF ( ASSOCIATED( grid%vgwdsfc ) ) THEN DEALLOCATE(grid%vgwdsfc,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",3699,& 'frame/module_domain.f: Failed to deallocate grid%vgwdsfc. ') endif ENDIF IF ( ASSOCIATED( grid%dwdtmn ) ) THEN DEALLOCATE(grid%dwdtmn,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",3706,& 'frame/module_domain.f: Failed to deallocate grid%dwdtmn. ') endif ENDIF IF ( ASSOCIATED( grid%dwdtmx ) ) THEN DEALLOCATE(grid%dwdtmx,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",3713,& 'frame/module_domain.f: Failed to deallocate grid%dwdtmx. ') endif ENDIF IF ( ASSOCIATED( grid%baro ) ) THEN DEALLOCATE(grid%baro,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",3720,& 'frame/module_domain.f: Failed to deallocate grid%baro. ') endif ENDIF IF ( ASSOCIATED( grid%dwdt ) ) THEN DEALLOCATE(grid%dwdt,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",3727,& 'frame/module_domain.f: Failed to deallocate grid%dwdt. ') endif ENDIF IF ( ASSOCIATED( grid%pdwdt ) ) THEN DEALLOCATE(grid%pdwdt,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",3734,& 'frame/module_domain.f: Failed to deallocate grid%pdwdt. ') endif ENDIF IF ( ASSOCIATED( grid%pint ) ) THEN DEALLOCATE(grid%pint,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",3741,& 'frame/module_domain.f: Failed to deallocate grid%pint. ') endif ENDIF IF ( ASSOCIATED( grid%w ) ) THEN DEALLOCATE(grid%w,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",3748,& 'frame/module_domain.f: Failed to deallocate grid%w. ') endif ENDIF IF ( ASSOCIATED( grid%w_tot ) ) THEN DEALLOCATE(grid%w_tot,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",3755,& 'frame/module_domain.f: Failed to deallocate grid%w_tot. ') endif ENDIF IF ( ASSOCIATED( grid%z ) ) THEN DEALLOCATE(grid%z,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",3762,& 'frame/module_domain.f: Failed to deallocate grid%z. ') endif ENDIF IF ( ASSOCIATED( grid%acfrcv ) ) THEN DEALLOCATE(grid%acfrcv,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",3769,& 'frame/module_domain.f: Failed to deallocate grid%acfrcv. ') endif ENDIF IF ( ASSOCIATED( grid%acfrst ) ) THEN DEALLOCATE(grid%acfrst,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",3776,& 'frame/module_domain.f: Failed to deallocate grid%acfrst. ') endif ENDIF IF ( ASSOCIATED( grid%ssroff ) ) THEN DEALLOCATE(grid%ssroff,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",3783,& 'frame/module_domain.f: Failed to deallocate grid%ssroff. ') endif ENDIF IF ( ASSOCIATED( grid%bgroff ) ) THEN DEALLOCATE(grid%bgroff,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",3790,& 'frame/module_domain.f: Failed to deallocate grid%bgroff. ') endif ENDIF IF ( ASSOCIATED( grid%rlwin ) ) THEN DEALLOCATE(grid%rlwin,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",3797,& 'frame/module_domain.f: Failed to deallocate grid%rlwin. ') endif ENDIF IF ( ASSOCIATED( grid%rlwout ) ) THEN DEALLOCATE(grid%rlwout,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",3804,& 'frame/module_domain.f: Failed to deallocate grid%rlwout. ') endif ENDIF IF ( ASSOCIATED( grid%rlwtoa ) ) THEN DEALLOCATE(grid%rlwtoa,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",3811,& 'frame/module_domain.f: Failed to deallocate grid%rlwtoa. ') endif ENDIF IF ( ASSOCIATED( grid%alwin ) ) THEN DEALLOCATE(grid%alwin,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",3818,& 'frame/module_domain.f: Failed to deallocate grid%alwin. ') endif ENDIF IF ( ASSOCIATED( grid%alwout ) ) THEN DEALLOCATE(grid%alwout,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",3825,& 'frame/module_domain.f: Failed to deallocate grid%alwout. ') endif ENDIF IF ( ASSOCIATED( grid%alwtoa ) ) THEN DEALLOCATE(grid%alwtoa,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",3832,& 'frame/module_domain.f: Failed to deallocate grid%alwtoa. ') endif ENDIF IF ( ASSOCIATED( grid%rswin ) ) THEN DEALLOCATE(grid%rswin,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",3839,& 'frame/module_domain.f: Failed to deallocate grid%rswin. ') endif ENDIF IF ( ASSOCIATED( grid%rswinc ) ) THEN DEALLOCATE(grid%rswinc,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",3846,& 'frame/module_domain.f: Failed to deallocate grid%rswinc. ') endif ENDIF IF ( ASSOCIATED( grid%rswout ) ) THEN DEALLOCATE(grid%rswout,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",3853,& 'frame/module_domain.f: Failed to deallocate grid%rswout. ') endif ENDIF IF ( ASSOCIATED( grid%rswtoa ) ) THEN DEALLOCATE(grid%rswtoa,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",3860,& 'frame/module_domain.f: Failed to deallocate grid%rswtoa. ') endif ENDIF IF ( ASSOCIATED( grid%aswin ) ) THEN DEALLOCATE(grid%aswin,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",3867,& 'frame/module_domain.f: Failed to deallocate grid%aswin. ') endif ENDIF IF ( ASSOCIATED( grid%aswout ) ) THEN DEALLOCATE(grid%aswout,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",3874,& 'frame/module_domain.f: Failed to deallocate grid%aswout. ') endif ENDIF IF ( ASSOCIATED( grid%aswtoa ) ) THEN DEALLOCATE(grid%aswtoa,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",3881,& 'frame/module_domain.f: Failed to deallocate grid%aswtoa. ') endif ENDIF IF ( ASSOCIATED( grid%sfcshx ) ) THEN DEALLOCATE(grid%sfcshx,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",3888,& 'frame/module_domain.f: Failed to deallocate grid%sfcshx. ') endif ENDIF IF ( ASSOCIATED( grid%sfclhx ) ) THEN DEALLOCATE(grid%sfclhx,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",3895,& 'frame/module_domain.f: Failed to deallocate grid%sfclhx. ') endif ENDIF IF ( ASSOCIATED( grid%subshx ) ) THEN DEALLOCATE(grid%subshx,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",3902,& 'frame/module_domain.f: Failed to deallocate grid%subshx. ') endif ENDIF IF ( ASSOCIATED( grid%snopcx ) ) THEN DEALLOCATE(grid%snopcx,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",3909,& 'frame/module_domain.f: Failed to deallocate grid%snopcx. ') endif ENDIF IF ( ASSOCIATED( grid%sfcuvx ) ) THEN DEALLOCATE(grid%sfcuvx,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",3916,& 'frame/module_domain.f: Failed to deallocate grid%sfcuvx. ') endif ENDIF IF ( ASSOCIATED( grid%potevp ) ) THEN DEALLOCATE(grid%potevp,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",3923,& 'frame/module_domain.f: Failed to deallocate grid%potevp. ') endif ENDIF IF ( ASSOCIATED( grid%potflx ) ) THEN DEALLOCATE(grid%potflx,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",3930,& 'frame/module_domain.f: Failed to deallocate grid%potflx. ') endif ENDIF IF ( ASSOCIATED( grid%tlmin ) ) THEN DEALLOCATE(grid%tlmin,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",3937,& 'frame/module_domain.f: Failed to deallocate grid%tlmin. ') endif ENDIF IF ( ASSOCIATED( grid%tlmax ) ) THEN DEALLOCATE(grid%tlmax,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",3944,& 'frame/module_domain.f: Failed to deallocate grid%tlmax. ') endif ENDIF IF ( ASSOCIATED( grid%t02_min ) ) THEN DEALLOCATE(grid%t02_min,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",3951,& 'frame/module_domain.f: Failed to deallocate grid%t02_min. ') endif ENDIF IF ( ASSOCIATED( grid%t02_max ) ) THEN DEALLOCATE(grid%t02_max,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",3958,& 'frame/module_domain.f: Failed to deallocate grid%t02_max. ') endif ENDIF IF ( ASSOCIATED( grid%rh02_min ) ) THEN DEALLOCATE(grid%rh02_min,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",3965,& 'frame/module_domain.f: Failed to deallocate grid%rh02_min. ') endif ENDIF IF ( ASSOCIATED( grid%rh02_max ) ) THEN DEALLOCATE(grid%rh02_max,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",3972,& 'frame/module_domain.f: Failed to deallocate grid%rh02_max. ') endif ENDIF IF ( ASSOCIATED( grid%rlwtt ) ) THEN DEALLOCATE(grid%rlwtt,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",3979,& 'frame/module_domain.f: Failed to deallocate grid%rlwtt. ') endif ENDIF IF ( ASSOCIATED( grid%rswtt ) ) THEN DEALLOCATE(grid%rswtt,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",3986,& 'frame/module_domain.f: Failed to deallocate grid%rswtt. ') endif ENDIF IF ( ASSOCIATED( grid%tcucn ) ) THEN DEALLOCATE(grid%tcucn,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",3993,& 'frame/module_domain.f: Failed to deallocate grid%tcucn. ') endif ENDIF IF ( ASSOCIATED( grid%train ) ) THEN DEALLOCATE(grid%train,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",4000,& 'frame/module_domain.f: Failed to deallocate grid%train. ') endif ENDIF IF ( ASSOCIATED( grid%ncfrcv ) ) THEN DEALLOCATE(grid%ncfrcv,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",4007,& 'frame/module_domain.f: Failed to deallocate grid%ncfrcv. ') endif ENDIF IF ( ASSOCIATED( grid%ncfrst ) ) THEN DEALLOCATE(grid%ncfrst,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",4014,& 'frame/module_domain.f: Failed to deallocate grid%ncfrst. ') endif ENDIF IF ( ASSOCIATED( grid%ihe ) ) THEN DEALLOCATE(grid%ihe,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",4021,& 'frame/module_domain.f: Failed to deallocate grid%ihe. ') endif ENDIF IF ( ASSOCIATED( grid%ihw ) ) THEN DEALLOCATE(grid%ihw,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",4028,& 'frame/module_domain.f: Failed to deallocate grid%ihw. ') endif ENDIF IF ( ASSOCIATED( grid%ive ) ) THEN DEALLOCATE(grid%ive,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",4035,& 'frame/module_domain.f: Failed to deallocate grid%ive. ') endif ENDIF IF ( ASSOCIATED( grid%ivw ) ) THEN DEALLOCATE(grid%ivw,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",4042,& 'frame/module_domain.f: Failed to deallocate grid%ivw. ') endif ENDIF IF ( ASSOCIATED( grid%irad ) ) THEN DEALLOCATE(grid%irad,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",4049,& 'frame/module_domain.f: Failed to deallocate grid%irad. ') endif ENDIF IF ( ASSOCIATED( grid%iheg ) ) THEN DEALLOCATE(grid%iheg,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",4056,& 'frame/module_domain.f: Failed to deallocate grid%iheg. ') endif ENDIF IF ( ASSOCIATED( grid%ihwg ) ) THEN DEALLOCATE(grid%ihwg,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",4063,& 'frame/module_domain.f: Failed to deallocate grid%ihwg. ') endif ENDIF IF ( ASSOCIATED( grid%iveg ) ) THEN DEALLOCATE(grid%iveg,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",4070,& 'frame/module_domain.f: Failed to deallocate grid%iveg. ') endif ENDIF IF ( ASSOCIATED( grid%ivwg ) ) THEN DEALLOCATE(grid%ivwg,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",4077,& 'frame/module_domain.f: Failed to deallocate grid%ivwg. ') endif ENDIF IF ( ASSOCIATED( grid%iradg ) ) THEN DEALLOCATE(grid%iradg,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",4084,& 'frame/module_domain.f: Failed to deallocate grid%iradg. ') endif ENDIF IF ( ASSOCIATED( grid%n_iup_h ) ) THEN DEALLOCATE(grid%n_iup_h,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",4091,& 'frame/module_domain.f: Failed to deallocate grid%n_iup_h. ') endif ENDIF IF ( ASSOCIATED( grid%n_iup_v ) ) THEN DEALLOCATE(grid%n_iup_v,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",4098,& 'frame/module_domain.f: Failed to deallocate grid%n_iup_v. ') endif ENDIF IF ( ASSOCIATED( grid%n_iup_adh ) ) THEN DEALLOCATE(grid%n_iup_adh,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",4105,& 'frame/module_domain.f: Failed to deallocate grid%n_iup_adh. ') endif ENDIF IF ( ASSOCIATED( grid%n_iup_adv ) ) THEN DEALLOCATE(grid%n_iup_adv,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",4112,& 'frame/module_domain.f: Failed to deallocate grid%n_iup_adv. ') endif ENDIF IF ( ASSOCIATED( grid%iup_h ) ) THEN DEALLOCATE(grid%iup_h,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",4119,& 'frame/module_domain.f: Failed to deallocate grid%iup_h. ') endif ENDIF IF ( ASSOCIATED( grid%iup_v ) ) THEN DEALLOCATE(grid%iup_v,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",4126,& 'frame/module_domain.f: Failed to deallocate grid%iup_v. ') endif ENDIF IF ( ASSOCIATED( grid%iup_adh ) ) THEN DEALLOCATE(grid%iup_adh,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",4133,& 'frame/module_domain.f: Failed to deallocate grid%iup_adh. ') endif ENDIF IF ( ASSOCIATED( grid%iup_adv ) ) THEN DEALLOCATE(grid%iup_adv,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",4140,& 'frame/module_domain.f: Failed to deallocate grid%iup_adv. ') endif ENDIF IF ( ASSOCIATED( grid%imask_nostag ) ) THEN DEALLOCATE(grid%imask_nostag,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",4147,& 'frame/module_domain.f: Failed to deallocate grid%imask_nostag. ') endif ENDIF IF ( ASSOCIATED( grid%imask_xstag ) ) THEN DEALLOCATE(grid%imask_xstag,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",4154,& 'frame/module_domain.f: Failed to deallocate grid%imask_xstag. ') endif ENDIF IF ( ASSOCIATED( grid%imask_ystag ) ) THEN DEALLOCATE(grid%imask_ystag,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",4161,& 'frame/module_domain.f: Failed to deallocate grid%imask_ystag. ') endif ENDIF IF ( ASSOCIATED( grid%imask_xystag ) ) THEN DEALLOCATE(grid%imask_xystag,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",4168,& 'frame/module_domain.f: Failed to deallocate grid%imask_xystag. ') endif ENDIF IF ( ASSOCIATED( grid%sm000007 ) ) THEN DEALLOCATE(grid%sm000007,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",4175,& 'frame/module_domain.f: Failed to deallocate grid%sm000007. ') endif ENDIF IF ( ASSOCIATED( grid%sm007028 ) ) THEN DEALLOCATE(grid%sm007028,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",4182,& 'frame/module_domain.f: Failed to deallocate grid%sm007028. ') endif ENDIF IF ( ASSOCIATED( grid%sm028100 ) ) THEN DEALLOCATE(grid%sm028100,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",4189,& 'frame/module_domain.f: Failed to deallocate grid%sm028100. ') endif ENDIF IF ( ASSOCIATED( grid%sm100255 ) ) THEN DEALLOCATE(grid%sm100255,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",4196,& 'frame/module_domain.f: Failed to deallocate grid%sm100255. ') endif ENDIF IF ( ASSOCIATED( grid%st000007 ) ) THEN DEALLOCATE(grid%st000007,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",4203,& 'frame/module_domain.f: Failed to deallocate grid%st000007. ') endif ENDIF IF ( ASSOCIATED( grid%st007028 ) ) THEN DEALLOCATE(grid%st007028,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",4210,& 'frame/module_domain.f: Failed to deallocate grid%st007028. ') endif ENDIF IF ( ASSOCIATED( grid%st028100 ) ) THEN DEALLOCATE(grid%st028100,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",4217,& 'frame/module_domain.f: Failed to deallocate grid%st028100. ') endif ENDIF IF ( ASSOCIATED( grid%st100255 ) ) THEN DEALLOCATE(grid%st100255,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",4224,& 'frame/module_domain.f: Failed to deallocate grid%st100255. ') endif ENDIF IF ( ASSOCIATED( grid%sm000010 ) ) THEN DEALLOCATE(grid%sm000010,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",4231,& 'frame/module_domain.f: Failed to deallocate grid%sm000010. ') endif ENDIF IF ( ASSOCIATED( grid%sm010040 ) ) THEN DEALLOCATE(grid%sm010040,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",4238,& 'frame/module_domain.f: Failed to deallocate grid%sm010040. ') endif ENDIF IF ( ASSOCIATED( grid%sm040100 ) ) THEN DEALLOCATE(grid%sm040100,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",4245,& 'frame/module_domain.f: Failed to deallocate grid%sm040100. ') endif ENDIF IF ( ASSOCIATED( grid%sm100200 ) ) THEN DEALLOCATE(grid%sm100200,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",4252,& 'frame/module_domain.f: Failed to deallocate grid%sm100200. ') endif ENDIF IF ( ASSOCIATED( grid%sm010200 ) ) THEN DEALLOCATE(grid%sm010200,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",4259,& 'frame/module_domain.f: Failed to deallocate grid%sm010200. ') endif ENDIF IF ( ASSOCIATED( grid%soilm000 ) ) THEN DEALLOCATE(grid%soilm000,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",4266,& 'frame/module_domain.f: Failed to deallocate grid%soilm000. ') endif ENDIF IF ( ASSOCIATED( grid%soilm005 ) ) THEN DEALLOCATE(grid%soilm005,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",4273,& 'frame/module_domain.f: Failed to deallocate grid%soilm005. ') endif ENDIF IF ( ASSOCIATED( grid%soilm020 ) ) THEN DEALLOCATE(grid%soilm020,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",4280,& 'frame/module_domain.f: Failed to deallocate grid%soilm020. ') endif ENDIF IF ( ASSOCIATED( grid%soilm040 ) ) THEN DEALLOCATE(grid%soilm040,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",4287,& 'frame/module_domain.f: Failed to deallocate grid%soilm040. ') endif ENDIF IF ( ASSOCIATED( grid%soilm160 ) ) THEN DEALLOCATE(grid%soilm160,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",4294,& 'frame/module_domain.f: Failed to deallocate grid%soilm160. ') endif ENDIF IF ( ASSOCIATED( grid%soilm300 ) ) THEN DEALLOCATE(grid%soilm300,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",4301,& 'frame/module_domain.f: Failed to deallocate grid%soilm300. ') endif ENDIF IF ( ASSOCIATED( grid%sw000010 ) ) THEN DEALLOCATE(grid%sw000010,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",4308,& 'frame/module_domain.f: Failed to deallocate grid%sw000010. ') endif ENDIF IF ( ASSOCIATED( grid%sw010040 ) ) THEN DEALLOCATE(grid%sw010040,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",4315,& 'frame/module_domain.f: Failed to deallocate grid%sw010040. ') endif ENDIF IF ( ASSOCIATED( grid%sw040100 ) ) THEN DEALLOCATE(grid%sw040100,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",4322,& 'frame/module_domain.f: Failed to deallocate grid%sw040100. ') endif ENDIF IF ( ASSOCIATED( grid%sw100200 ) ) THEN DEALLOCATE(grid%sw100200,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",4329,& 'frame/module_domain.f: Failed to deallocate grid%sw100200. ') endif ENDIF IF ( ASSOCIATED( grid%sw010200 ) ) THEN DEALLOCATE(grid%sw010200,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",4336,& 'frame/module_domain.f: Failed to deallocate grid%sw010200. ') endif ENDIF IF ( ASSOCIATED( grid%soilw000 ) ) THEN DEALLOCATE(grid%soilw000,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",4343,& 'frame/module_domain.f: Failed to deallocate grid%soilw000. ') endif ENDIF IF ( ASSOCIATED( grid%soilw005 ) ) THEN DEALLOCATE(grid%soilw005,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",4350,& 'frame/module_domain.f: Failed to deallocate grid%soilw005. ') endif ENDIF IF ( ASSOCIATED( grid%soilw020 ) ) THEN DEALLOCATE(grid%soilw020,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",4357,& 'frame/module_domain.f: Failed to deallocate grid%soilw020. ') endif ENDIF IF ( ASSOCIATED( grid%soilw040 ) ) THEN DEALLOCATE(grid%soilw040,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",4364,& 'frame/module_domain.f: Failed to deallocate grid%soilw040. ') endif ENDIF IF ( ASSOCIATED( grid%soilw160 ) ) THEN DEALLOCATE(grid%soilw160,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",4371,& 'frame/module_domain.f: Failed to deallocate grid%soilw160. ') endif ENDIF IF ( ASSOCIATED( grid%soilw300 ) ) THEN DEALLOCATE(grid%soilw300,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",4378,& 'frame/module_domain.f: Failed to deallocate grid%soilw300. ') endif ENDIF IF ( ASSOCIATED( grid%st000010 ) ) THEN DEALLOCATE(grid%st000010,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",4385,& 'frame/module_domain.f: Failed to deallocate grid%st000010. ') endif ENDIF IF ( ASSOCIATED( grid%st010040 ) ) THEN DEALLOCATE(grid%st010040,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",4392,& 'frame/module_domain.f: Failed to deallocate grid%st010040. ') endif ENDIF IF ( ASSOCIATED( grid%st040100 ) ) THEN DEALLOCATE(grid%st040100,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",4399,& 'frame/module_domain.f: Failed to deallocate grid%st040100. ') endif ENDIF IF ( ASSOCIATED( grid%st100200 ) ) THEN DEALLOCATE(grid%st100200,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",4406,& 'frame/module_domain.f: Failed to deallocate grid%st100200. ') endif ENDIF IF ( ASSOCIATED( grid%st010200 ) ) THEN DEALLOCATE(grid%st010200,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",4413,& 'frame/module_domain.f: Failed to deallocate grid%st010200. ') endif ENDIF IF ( ASSOCIATED( grid%soilt000 ) ) THEN DEALLOCATE(grid%soilt000,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",4420,& 'frame/module_domain.f: Failed to deallocate grid%soilt000. ') endif ENDIF IF ( ASSOCIATED( grid%soilt005 ) ) THEN DEALLOCATE(grid%soilt005,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",4427,& 'frame/module_domain.f: Failed to deallocate grid%soilt005. ') endif ENDIF IF ( ASSOCIATED( grid%soilt020 ) ) THEN DEALLOCATE(grid%soilt020,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",4434,& 'frame/module_domain.f: Failed to deallocate grid%soilt020. ') endif ENDIF IF ( ASSOCIATED( grid%soilt040 ) ) THEN DEALLOCATE(grid%soilt040,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",4441,& 'frame/module_domain.f: Failed to deallocate grid%soilt040. ') endif ENDIF IF ( ASSOCIATED( grid%soilt160 ) ) THEN DEALLOCATE(grid%soilt160,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",4448,& 'frame/module_domain.f: Failed to deallocate grid%soilt160. ') endif ENDIF IF ( ASSOCIATED( grid%soilt300 ) ) THEN DEALLOCATE(grid%soilt300,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",4455,& 'frame/module_domain.f: Failed to deallocate grid%soilt300. ') endif ENDIF IF ( ASSOCIATED( grid%landmask ) ) THEN DEALLOCATE(grid%landmask,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",4462,& 'frame/module_domain.f: Failed to deallocate grid%landmask. ') endif ENDIF IF ( ASSOCIATED( grid%topostdv ) ) THEN DEALLOCATE(grid%topostdv,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",4469,& 'frame/module_domain.f: Failed to deallocate grid%topostdv. ') endif ENDIF IF ( ASSOCIATED( grid%toposlpx ) ) THEN DEALLOCATE(grid%toposlpx,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",4476,& 'frame/module_domain.f: Failed to deallocate grid%toposlpx. ') endif ENDIF IF ( ASSOCIATED( grid%toposlpy ) ) THEN DEALLOCATE(grid%toposlpy,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",4483,& 'frame/module_domain.f: Failed to deallocate grid%toposlpy. ') endif ENDIF IF ( ASSOCIATED( grid%greenmax ) ) THEN DEALLOCATE(grid%greenmax,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",4490,& 'frame/module_domain.f: Failed to deallocate grid%greenmax. ') endif ENDIF IF ( ASSOCIATED( grid%greenmin ) ) THEN DEALLOCATE(grid%greenmin,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",4497,& 'frame/module_domain.f: Failed to deallocate grid%greenmin. ') endif ENDIF IF ( ASSOCIATED( grid%albedomx ) ) THEN DEALLOCATE(grid%albedomx,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",4504,& 'frame/module_domain.f: Failed to deallocate grid%albedomx. ') endif ENDIF IF ( ASSOCIATED( grid%slopecat ) ) THEN DEALLOCATE(grid%slopecat,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",4511,& 'frame/module_domain.f: Failed to deallocate grid%slopecat. ') endif ENDIF IF ( ASSOCIATED( grid%toposoil ) ) THEN DEALLOCATE(grid%toposoil,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",4518,& 'frame/module_domain.f: Failed to deallocate grid%toposoil. ') endif ENDIF IF ( ASSOCIATED( grid%landusef ) ) THEN DEALLOCATE(grid%landusef,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",4525,& 'frame/module_domain.f: Failed to deallocate grid%landusef. ') endif ENDIF IF ( ASSOCIATED( grid%soilctop ) ) THEN DEALLOCATE(grid%soilctop,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",4532,& 'frame/module_domain.f: Failed to deallocate grid%soilctop. ') endif ENDIF IF ( ASSOCIATED( grid%soilcbot ) ) THEN DEALLOCATE(grid%soilcbot,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",4539,& 'frame/module_domain.f: Failed to deallocate grid%soilcbot. ') endif ENDIF IF ( ASSOCIATED( grid%ts_hour ) ) THEN DEALLOCATE(grid%ts_hour,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",4546,& 'frame/module_domain.f: Failed to deallocate grid%ts_hour. ') endif ENDIF IF ( ASSOCIATED( grid%ts_u ) ) THEN DEALLOCATE(grid%ts_u,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",4553,& 'frame/module_domain.f: Failed to deallocate grid%ts_u. ') endif ENDIF IF ( ASSOCIATED( grid%ts_v ) ) THEN DEALLOCATE(grid%ts_v,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",4560,& 'frame/module_domain.f: Failed to deallocate grid%ts_v. ') endif ENDIF IF ( ASSOCIATED( grid%ts_q ) ) THEN DEALLOCATE(grid%ts_q,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",4567,& 'frame/module_domain.f: Failed to deallocate grid%ts_q. ') endif ENDIF IF ( ASSOCIATED( grid%ts_t ) ) THEN DEALLOCATE(grid%ts_t,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",4574,& 'frame/module_domain.f: Failed to deallocate grid%ts_t. ') endif ENDIF IF ( ASSOCIATED( grid%ts_psfc ) ) THEN DEALLOCATE(grid%ts_psfc,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",4581,& 'frame/module_domain.f: Failed to deallocate grid%ts_psfc. ') endif ENDIF IF ( ASSOCIATED( grid%ts_tsk ) ) THEN DEALLOCATE(grid%ts_tsk,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",4588,& 'frame/module_domain.f: Failed to deallocate grid%ts_tsk. ') endif ENDIF IF ( ASSOCIATED( grid%ts_tslb ) ) THEN DEALLOCATE(grid%ts_tslb,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",4595,& 'frame/module_domain.f: Failed to deallocate grid%ts_tslb. ') endif ENDIF IF ( ASSOCIATED( grid%ts_clw ) ) THEN DEALLOCATE(grid%ts_clw,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",4602,& 'frame/module_domain.f: Failed to deallocate grid%ts_clw. ') endif ENDIF IF ( ASSOCIATED( grid%moist ) ) THEN DEALLOCATE(grid%moist,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",4609,& 'frame/module_domain.f: Failed to deallocate grid%moist. ') endif ENDIF IF ( ASSOCIATED( grid%dfi_moist ) ) THEN DEALLOCATE(grid%dfi_moist,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",4616,& 'frame/module_domain.f: Failed to deallocate grid%dfi_moist. ') endif ENDIF IF ( ASSOCIATED( grid%scalar ) ) THEN DEALLOCATE(grid%scalar,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",4623,& 'frame/module_domain.f: Failed to deallocate grid%scalar. ') endif ENDIF IF ( ASSOCIATED( grid%scalar_bxs ) ) THEN DEALLOCATE(grid%scalar_bxs,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",4630,& 'frame/module_domain.f: Failed to deallocate grid%scalar_bxs. ') endif NULLIFY(grid%scalar_bxs) ENDIF IF ( ASSOCIATED( grid%scalar_bxe ) ) THEN DEALLOCATE(grid%scalar_bxe,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",4638,& 'frame/module_domain.f: Failed to deallocate grid%scalar_bxe. ') endif NULLIFY(grid%scalar_bxe) ENDIF IF ( ASSOCIATED( grid%scalar_bys ) ) THEN DEALLOCATE(grid%scalar_bys,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",4646,& 'frame/module_domain.f: Failed to deallocate grid%scalar_bys. ') endif NULLIFY(grid%scalar_bys) ENDIF IF ( ASSOCIATED( grid%scalar_bye ) ) THEN DEALLOCATE(grid%scalar_bye,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",4654,& 'frame/module_domain.f: Failed to deallocate grid%scalar_bye. ') endif NULLIFY(grid%scalar_bye) ENDIF IF ( ASSOCIATED( grid%scalar_btxs ) ) THEN DEALLOCATE(grid%scalar_btxs,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",4662,& 'frame/module_domain.f: Failed to deallocate grid%scalar_btxs. ') endif NULLIFY(grid%scalar_btxs) ENDIF IF ( ASSOCIATED( grid%scalar_btxe ) ) THEN DEALLOCATE(grid%scalar_btxe,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",4670,& 'frame/module_domain.f: Failed to deallocate grid%scalar_btxe. ') endif NULLIFY(grid%scalar_btxe) ENDIF IF ( ASSOCIATED( grid%scalar_btys ) ) THEN DEALLOCATE(grid%scalar_btys,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",4678,& 'frame/module_domain.f: Failed to deallocate grid%scalar_btys. ') endif NULLIFY(grid%scalar_btys) ENDIF IF ( ASSOCIATED( grid%scalar_btye ) ) THEN DEALLOCATE(grid%scalar_btye,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",4686,& 'frame/module_domain.f: Failed to deallocate grid%scalar_btye. ') endif NULLIFY(grid%scalar_btye) ENDIF IF ( ASSOCIATED( grid%dfi_scalar ) ) THEN DEALLOCATE(grid%dfi_scalar,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",4694,& 'frame/module_domain.f: Failed to deallocate grid%dfi_scalar. ') endif ENDIF IF ( ASSOCIATED( grid%dfi_scalar_bxs ) ) THEN DEALLOCATE(grid%dfi_scalar_bxs,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",4701,& 'frame/module_domain.f: Failed to deallocate grid%dfi_scalar_bxs. ') endif NULLIFY(grid%dfi_scalar_bxs) ENDIF IF ( ASSOCIATED( grid%dfi_scalar_bxe ) ) THEN DEALLOCATE(grid%dfi_scalar_bxe,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",4709,& 'frame/module_domain.f: Failed to deallocate grid%dfi_scalar_bxe. ') endif NULLIFY(grid%dfi_scalar_bxe) ENDIF IF ( ASSOCIATED( grid%dfi_scalar_bys ) ) THEN DEALLOCATE(grid%dfi_scalar_bys,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",4717,& 'frame/module_domain.f: Failed to deallocate grid%dfi_scalar_bys. ') endif NULLIFY(grid%dfi_scalar_bys) ENDIF IF ( ASSOCIATED( grid%dfi_scalar_bye ) ) THEN DEALLOCATE(grid%dfi_scalar_bye,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",4725,& 'frame/module_domain.f: Failed to deallocate grid%dfi_scalar_bye. ') endif NULLIFY(grid%dfi_scalar_bye) ENDIF IF ( ASSOCIATED( grid%dfi_scalar_btxs ) ) THEN DEALLOCATE(grid%dfi_scalar_btxs,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",4733,& 'frame/module_domain.f: Failed to deallocate grid%dfi_scalar_btxs. ') endif NULLIFY(grid%dfi_scalar_btxs) ENDIF IF ( ASSOCIATED( grid%dfi_scalar_btxe ) ) THEN DEALLOCATE(grid%dfi_scalar_btxe,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",4741,& 'frame/module_domain.f: Failed to deallocate grid%dfi_scalar_btxe. ') endif NULLIFY(grid%dfi_scalar_btxe) ENDIF IF ( ASSOCIATED( grid%dfi_scalar_btys ) ) THEN DEALLOCATE(grid%dfi_scalar_btys,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",4749,& 'frame/module_domain.f: Failed to deallocate grid%dfi_scalar_btys. ') endif NULLIFY(grid%dfi_scalar_btys) ENDIF IF ( ASSOCIATED( grid%dfi_scalar_btye ) ) THEN DEALLOCATE(grid%dfi_scalar_btye,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",4757,& 'frame/module_domain.f: Failed to deallocate grid%dfi_scalar_btye. ') endif NULLIFY(grid%dfi_scalar_btye) ENDIF IF ( ASSOCIATED( grid%chem ) ) THEN DEALLOCATE(grid%chem,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",4765,& 'frame/module_domain.f: Failed to deallocate grid%chem. ') endif ENDIF IF ( ASSOCIATED( grid%smois ) ) THEN DEALLOCATE(grid%smois,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",4772,& 'frame/module_domain.f: Failed to deallocate grid%smois. ') endif ENDIF IF ( ASSOCIATED( grid%smcrel ) ) THEN DEALLOCATE(grid%smcrel,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",4779,& 'frame/module_domain.f: Failed to deallocate grid%smcrel. ') endif ENDIF IF ( ASSOCIATED( grid%tslb ) ) THEN DEALLOCATE(grid%tslb,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",4786,& 'frame/module_domain.f: Failed to deallocate grid%tslb. ') endif ENDIF IF ( ASSOCIATED( grid%gsw ) ) THEN DEALLOCATE(grid%gsw,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",4793,& 'frame/module_domain.f: Failed to deallocate grid%gsw. ') endif ENDIF IF ( ASSOCIATED( grid%xlat ) ) THEN DEALLOCATE(grid%xlat,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",4800,& 'frame/module_domain.f: Failed to deallocate grid%xlat. ') endif ENDIF IF ( ASSOCIATED( grid%xlong ) ) THEN DEALLOCATE(grid%xlong,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",4807,& 'frame/module_domain.f: Failed to deallocate grid%xlong. ') endif ENDIF IF ( ASSOCIATED( grid%xland ) ) THEN DEALLOCATE(grid%xland,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",4814,& 'frame/module_domain.f: Failed to deallocate grid%xland. ') endif ENDIF IF ( ASSOCIATED( grid%raincv ) ) THEN DEALLOCATE(grid%raincv,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",4821,& 'frame/module_domain.f: Failed to deallocate grid%raincv. ') endif ENDIF IF ( ASSOCIATED( grid%psfc ) ) THEN DEALLOCATE(grid%psfc,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",4828,& 'frame/module_domain.f: Failed to deallocate grid%psfc. ') endif ENDIF IF ( ASSOCIATED( grid%th2 ) ) THEN DEALLOCATE(grid%th2,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",4835,& 'frame/module_domain.f: Failed to deallocate grid%th2. ') endif ENDIF IF ( ASSOCIATED( grid%t2 ) ) THEN DEALLOCATE(grid%t2,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",4842,& 'frame/module_domain.f: Failed to deallocate grid%t2. ') endif ENDIF IF ( ASSOCIATED( grid%u10 ) ) THEN DEALLOCATE(grid%u10,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",4849,& 'frame/module_domain.f: Failed to deallocate grid%u10. ') endif ENDIF IF ( ASSOCIATED( grid%v10 ) ) THEN DEALLOCATE(grid%v10,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",4856,& 'frame/module_domain.f: Failed to deallocate grid%v10. ') endif ENDIF IF ( ASSOCIATED( grid%xice ) ) THEN DEALLOCATE(grid%xice,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",4863,& 'frame/module_domain.f: Failed to deallocate grid%xice. ') endif ENDIF IF ( ASSOCIATED( grid%lai ) ) THEN DEALLOCATE(grid%lai,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",4870,& 'frame/module_domain.f: Failed to deallocate grid%lai. ') endif ENDIF IF ( ASSOCIATED( grid%smstav ) ) THEN DEALLOCATE(grid%smstav,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",4877,& 'frame/module_domain.f: Failed to deallocate grid%smstav. ') endif ENDIF IF ( ASSOCIATED( grid%smstot ) ) THEN DEALLOCATE(grid%smstot,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",4884,& 'frame/module_domain.f: Failed to deallocate grid%smstot. ') endif ENDIF IF ( ASSOCIATED( grid%sfcrunoff ) ) THEN DEALLOCATE(grid%sfcrunoff,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",4891,& 'frame/module_domain.f: Failed to deallocate grid%sfcrunoff. ') endif ENDIF IF ( ASSOCIATED( grid%udrunoff ) ) THEN DEALLOCATE(grid%udrunoff,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",4898,& 'frame/module_domain.f: Failed to deallocate grid%udrunoff. ') endif ENDIF IF ( ASSOCIATED( grid%ivgtyp ) ) THEN DEALLOCATE(grid%ivgtyp,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",4905,& 'frame/module_domain.f: Failed to deallocate grid%ivgtyp. ') endif ENDIF IF ( ASSOCIATED( grid%isltyp ) ) THEN DEALLOCATE(grid%isltyp,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",4912,& 'frame/module_domain.f: Failed to deallocate grid%isltyp. ') endif ENDIF IF ( ASSOCIATED( grid%vegfra ) ) THEN DEALLOCATE(grid%vegfra,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",4919,& 'frame/module_domain.f: Failed to deallocate grid%vegfra. ') endif ENDIF IF ( ASSOCIATED( grid%sfcevp ) ) THEN DEALLOCATE(grid%sfcevp,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",4926,& 'frame/module_domain.f: Failed to deallocate grid%sfcevp. ') endif ENDIF IF ( ASSOCIATED( grid%grdflx ) ) THEN DEALLOCATE(grid%grdflx,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",4933,& 'frame/module_domain.f: Failed to deallocate grid%grdflx. ') endif ENDIF IF ( ASSOCIATED( grid%albbck ) ) THEN DEALLOCATE(grid%albbck,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",4940,& 'frame/module_domain.f: Failed to deallocate grid%albbck. ') endif ENDIF IF ( ASSOCIATED( grid%sfcexc ) ) THEN DEALLOCATE(grid%sfcexc,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",4947,& 'frame/module_domain.f: Failed to deallocate grid%sfcexc. ') endif ENDIF IF ( ASSOCIATED( grid%snotime ) ) THEN DEALLOCATE(grid%snotime,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",4954,& 'frame/module_domain.f: Failed to deallocate grid%snotime. ') endif ENDIF IF ( ASSOCIATED( grid%acsnow ) ) THEN DEALLOCATE(grid%acsnow,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",4961,& 'frame/module_domain.f: Failed to deallocate grid%acsnow. ') endif ENDIF IF ( ASSOCIATED( grid%acsnom ) ) THEN DEALLOCATE(grid%acsnom,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",4968,& 'frame/module_domain.f: Failed to deallocate grid%acsnom. ') endif ENDIF IF ( ASSOCIATED( grid%rmol ) ) THEN DEALLOCATE(grid%rmol,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",4975,& 'frame/module_domain.f: Failed to deallocate grid%rmol. ') endif ENDIF IF ( ASSOCIATED( grid%snow ) ) THEN DEALLOCATE(grid%snow,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",4982,& 'frame/module_domain.f: Failed to deallocate grid%snow. ') endif ENDIF IF ( ASSOCIATED( grid%canwat ) ) THEN DEALLOCATE(grid%canwat,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",4989,& 'frame/module_domain.f: Failed to deallocate grid%canwat. ') endif ENDIF IF ( ASSOCIATED( grid%sst ) ) THEN DEALLOCATE(grid%sst,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",4996,& 'frame/module_domain.f: Failed to deallocate grid%sst. ') endif ENDIF IF ( ASSOCIATED( grid%weasd ) ) THEN DEALLOCATE(grid%weasd,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",5003,& 'frame/module_domain.f: Failed to deallocate grid%weasd. ') endif ENDIF IF ( ASSOCIATED( grid%znt ) ) THEN DEALLOCATE(grid%znt,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",5010,& 'frame/module_domain.f: Failed to deallocate grid%znt. ') endif ENDIF IF ( ASSOCIATED( grid%mol ) ) THEN DEALLOCATE(grid%mol,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",5017,& 'frame/module_domain.f: Failed to deallocate grid%mol. ') endif ENDIF IF ( ASSOCIATED( grid%noahres ) ) THEN DEALLOCATE(grid%noahres,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",5024,& 'frame/module_domain.f: Failed to deallocate grid%noahres. ') endif ENDIF IF ( ASSOCIATED( grid%tke_pbl ) ) THEN DEALLOCATE(grid%tke_pbl,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",5031,& 'frame/module_domain.f: Failed to deallocate grid%tke_pbl. ') endif ENDIF IF ( ASSOCIATED( grid%el_pbl ) ) THEN DEALLOCATE(grid%el_pbl,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",5038,& 'frame/module_domain.f: Failed to deallocate grid%el_pbl. ') endif ENDIF IF ( ASSOCIATED( grid%exch_h ) ) THEN DEALLOCATE(grid%exch_h,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",5045,& 'frame/module_domain.f: Failed to deallocate grid%exch_h. ') endif ENDIF IF ( ASSOCIATED( grid%exch_m ) ) THEN DEALLOCATE(grid%exch_m,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",5052,& 'frame/module_domain.f: Failed to deallocate grid%exch_m. ') endif ENDIF IF ( ASSOCIATED( grid%thz0 ) ) THEN DEALLOCATE(grid%thz0,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",5059,& 'frame/module_domain.f: Failed to deallocate grid%thz0. ') endif ENDIF IF ( ASSOCIATED( grid%qz0 ) ) THEN DEALLOCATE(grid%qz0,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",5066,& 'frame/module_domain.f: Failed to deallocate grid%qz0. ') endif ENDIF IF ( ASSOCIATED( grid%uz0 ) ) THEN DEALLOCATE(grid%uz0,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",5073,& 'frame/module_domain.f: Failed to deallocate grid%uz0. ') endif ENDIF IF ( ASSOCIATED( grid%vz0 ) ) THEN DEALLOCATE(grid%vz0,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",5080,& 'frame/module_domain.f: Failed to deallocate grid%vz0. ') endif ENDIF IF ( ASSOCIATED( grid%flhc ) ) THEN DEALLOCATE(grid%flhc,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",5087,& 'frame/module_domain.f: Failed to deallocate grid%flhc. ') endif ENDIF IF ( ASSOCIATED( grid%flqc ) ) THEN DEALLOCATE(grid%flqc,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",5094,& 'frame/module_domain.f: Failed to deallocate grid%flqc. ') endif ENDIF IF ( ASSOCIATED( grid%qsg ) ) THEN DEALLOCATE(grid%qsg,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",5101,& 'frame/module_domain.f: Failed to deallocate grid%qsg. ') endif ENDIF IF ( ASSOCIATED( grid%qvg ) ) THEN DEALLOCATE(grid%qvg,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",5108,& 'frame/module_domain.f: Failed to deallocate grid%qvg. ') endif ENDIF IF ( ASSOCIATED( grid%qcg ) ) THEN DEALLOCATE(grid%qcg,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",5115,& 'frame/module_domain.f: Failed to deallocate grid%qcg. ') endif ENDIF IF ( ASSOCIATED( grid%dew ) ) THEN DEALLOCATE(grid%dew,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",5122,& 'frame/module_domain.f: Failed to deallocate grid%dew. ') endif ENDIF IF ( ASSOCIATED( grid%soilt1 ) ) THEN DEALLOCATE(grid%soilt1,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",5129,& 'frame/module_domain.f: Failed to deallocate grid%soilt1. ') endif ENDIF IF ( ASSOCIATED( grid%tsnav ) ) THEN DEALLOCATE(grid%tsnav,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",5136,& 'frame/module_domain.f: Failed to deallocate grid%tsnav. ') endif ENDIF IF ( ASSOCIATED( grid%psfc_out ) ) THEN DEALLOCATE(grid%psfc_out,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",5143,& 'frame/module_domain.f: Failed to deallocate grid%psfc_out. ') endif ENDIF IF ( ASSOCIATED( grid%uz0h ) ) THEN DEALLOCATE(grid%uz0h,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",5150,& 'frame/module_domain.f: Failed to deallocate grid%uz0h. ') endif ENDIF IF ( ASSOCIATED( grid%vz0h ) ) THEN DEALLOCATE(grid%vz0h,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",5157,& 'frame/module_domain.f: Failed to deallocate grid%vz0h. ') endif ENDIF IF ( ASSOCIATED( grid%dudt ) ) THEN DEALLOCATE(grid%dudt,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",5164,& 'frame/module_domain.f: Failed to deallocate grid%dudt. ') endif ENDIF IF ( ASSOCIATED( grid%dvdt ) ) THEN DEALLOCATE(grid%dvdt,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",5171,& 'frame/module_domain.f: Failed to deallocate grid%dvdt. ') endif ENDIF IF ( ASSOCIATED( grid%qsfc ) ) THEN DEALLOCATE(grid%qsfc,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",5178,& 'frame/module_domain.f: Failed to deallocate grid%qsfc. ') endif ENDIF IF ( ASSOCIATED( grid%akhs ) ) THEN DEALLOCATE(grid%akhs,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",5185,& 'frame/module_domain.f: Failed to deallocate grid%akhs. ') endif ENDIF IF ( ASSOCIATED( grid%akms ) ) THEN DEALLOCATE(grid%akms,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",5192,& 'frame/module_domain.f: Failed to deallocate grid%akms. ') endif ENDIF IF ( ASSOCIATED( grid%htop ) ) THEN DEALLOCATE(grid%htop,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",5199,& 'frame/module_domain.f: Failed to deallocate grid%htop. ') endif ENDIF IF ( ASSOCIATED( grid%hbot ) ) THEN DEALLOCATE(grid%hbot,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",5206,& 'frame/module_domain.f: Failed to deallocate grid%hbot. ') endif ENDIF IF ( ASSOCIATED( grid%htopr ) ) THEN DEALLOCATE(grid%htopr,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",5213,& 'frame/module_domain.f: Failed to deallocate grid%htopr. ') endif ENDIF IF ( ASSOCIATED( grid%hbotr ) ) THEN DEALLOCATE(grid%hbotr,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",5220,& 'frame/module_domain.f: Failed to deallocate grid%hbotr. ') endif ENDIF IF ( ASSOCIATED( grid%htopd ) ) THEN DEALLOCATE(grid%htopd,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",5227,& 'frame/module_domain.f: Failed to deallocate grid%htopd. ') endif ENDIF IF ( ASSOCIATED( grid%hbotd ) ) THEN DEALLOCATE(grid%hbotd,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",5234,& 'frame/module_domain.f: Failed to deallocate grid%hbotd. ') endif ENDIF IF ( ASSOCIATED( grid%htops ) ) THEN DEALLOCATE(grid%htops,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",5241,& 'frame/module_domain.f: Failed to deallocate grid%htops. ') endif ENDIF IF ( ASSOCIATED( grid%hbots ) ) THEN DEALLOCATE(grid%hbots,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",5248,& 'frame/module_domain.f: Failed to deallocate grid%hbots. ') endif ENDIF IF ( ASSOCIATED( grid%cuppt ) ) THEN DEALLOCATE(grid%cuppt,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",5255,& 'frame/module_domain.f: Failed to deallocate grid%cuppt. ') endif ENDIF IF ( ASSOCIATED( grid%cprate ) ) THEN DEALLOCATE(grid%cprate,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",5262,& 'frame/module_domain.f: Failed to deallocate grid%cprate. ') endif ENDIF IF ( ASSOCIATED( grid%f_ice_phy ) ) THEN DEALLOCATE(grid%f_ice_phy,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",5269,& 'frame/module_domain.f: Failed to deallocate grid%f_ice_phy. ') endif ENDIF IF ( ASSOCIATED( grid%f_rain_phy ) ) THEN DEALLOCATE(grid%f_rain_phy,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",5276,& 'frame/module_domain.f: Failed to deallocate grid%f_rain_phy. ') endif ENDIF IF ( ASSOCIATED( grid%f_rimef_phy ) ) THEN DEALLOCATE(grid%f_rimef_phy,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",5283,& 'frame/module_domain.f: Failed to deallocate grid%f_rimef_phy. ') endif ENDIF IF ( ASSOCIATED( grid%mass_flux ) ) THEN DEALLOCATE(grid%mass_flux,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",5290,& 'frame/module_domain.f: Failed to deallocate grid%mass_flux. ') endif ENDIF IF ( ASSOCIATED( grid%apr_gr ) ) THEN DEALLOCATE(grid%apr_gr,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",5297,& 'frame/module_domain.f: Failed to deallocate grid%apr_gr. ') endif ENDIF IF ( ASSOCIATED( grid%apr_w ) ) THEN DEALLOCATE(grid%apr_w,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",5304,& 'frame/module_domain.f: Failed to deallocate grid%apr_w. ') endif ENDIF IF ( ASSOCIATED( grid%apr_mc ) ) THEN DEALLOCATE(grid%apr_mc,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",5311,& 'frame/module_domain.f: Failed to deallocate grid%apr_mc. ') endif ENDIF IF ( ASSOCIATED( grid%apr_st ) ) THEN DEALLOCATE(grid%apr_st,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",5318,& 'frame/module_domain.f: Failed to deallocate grid%apr_st. ') endif ENDIF IF ( ASSOCIATED( grid%apr_as ) ) THEN DEALLOCATE(grid%apr_as,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",5325,& 'frame/module_domain.f: Failed to deallocate grid%apr_as. ') endif ENDIF IF ( ASSOCIATED( grid%apr_capma ) ) THEN DEALLOCATE(grid%apr_capma,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",5332,& 'frame/module_domain.f: Failed to deallocate grid%apr_capma. ') endif ENDIF IF ( ASSOCIATED( grid%apr_capme ) ) THEN DEALLOCATE(grid%apr_capme,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",5339,& 'frame/module_domain.f: Failed to deallocate grid%apr_capme. ') endif ENDIF IF ( ASSOCIATED( grid%apr_capmi ) ) THEN DEALLOCATE(grid%apr_capmi,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",5346,& 'frame/module_domain.f: Failed to deallocate grid%apr_capmi. ') endif ENDIF IF ( ASSOCIATED( grid%xf_ens ) ) THEN DEALLOCATE(grid%xf_ens,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",5353,& 'frame/module_domain.f: Failed to deallocate grid%xf_ens. ') endif ENDIF IF ( ASSOCIATED( grid%pr_ens ) ) THEN DEALLOCATE(grid%pr_ens,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",5360,& 'frame/module_domain.f: Failed to deallocate grid%pr_ens. ') endif ENDIF IF ( ASSOCIATED( grid%rthften ) ) THEN DEALLOCATE(grid%rthften,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",5367,& 'frame/module_domain.f: Failed to deallocate grid%rthften. ') endif ENDIF IF ( ASSOCIATED( grid%rqvften ) ) THEN DEALLOCATE(grid%rqvften,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",5374,& 'frame/module_domain.f: Failed to deallocate grid%rqvften. ') endif ENDIF IF ( ASSOCIATED( grid%snowh ) ) THEN DEALLOCATE(grid%snowh,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",5381,& 'frame/module_domain.f: Failed to deallocate grid%snowh. ') endif ENDIF IF ( ASSOCIATED( grid%rhosn ) ) THEN DEALLOCATE(grid%rhosn,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",5388,& 'frame/module_domain.f: Failed to deallocate grid%rhosn. ') endif ENDIF IF ( ASSOCIATED( grid%smfr3d ) ) THEN DEALLOCATE(grid%smfr3d,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",5395,& 'frame/module_domain.f: Failed to deallocate grid%smfr3d. ') endif ENDIF IF ( ASSOCIATED( grid%keepfr3dflag ) ) THEN DEALLOCATE(grid%keepfr3dflag,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",5402,& 'frame/module_domain.f: Failed to deallocate grid%keepfr3dflag. ') endif ENDIF IF ( ASSOCIATED( grid%rc_mf ) ) THEN DEALLOCATE(grid%rc_mf,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",5409,& 'frame/module_domain.f: Failed to deallocate grid%rc_mf. ') endif ENDIF IF ( ASSOCIATED( grid%isnowxy ) ) THEN DEALLOCATE(grid%isnowxy,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",5416,& 'frame/module_domain.f: Failed to deallocate grid%isnowxy. ') endif ENDIF IF ( ASSOCIATED( grid%tvxy ) ) THEN DEALLOCATE(grid%tvxy,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",5423,& 'frame/module_domain.f: Failed to deallocate grid%tvxy. ') endif ENDIF IF ( ASSOCIATED( grid%tgxy ) ) THEN DEALLOCATE(grid%tgxy,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",5430,& 'frame/module_domain.f: Failed to deallocate grid%tgxy. ') endif ENDIF IF ( ASSOCIATED( grid%canliqxy ) ) THEN DEALLOCATE(grid%canliqxy,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",5437,& 'frame/module_domain.f: Failed to deallocate grid%canliqxy. ') endif ENDIF IF ( ASSOCIATED( grid%canicexy ) ) THEN DEALLOCATE(grid%canicexy,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",5444,& 'frame/module_domain.f: Failed to deallocate grid%canicexy. ') endif ENDIF IF ( ASSOCIATED( grid%eahxy ) ) THEN DEALLOCATE(grid%eahxy,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",5451,& 'frame/module_domain.f: Failed to deallocate grid%eahxy. ') endif ENDIF IF ( ASSOCIATED( grid%tahxy ) ) THEN DEALLOCATE(grid%tahxy,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",5458,& 'frame/module_domain.f: Failed to deallocate grid%tahxy. ') endif ENDIF IF ( ASSOCIATED( grid%cmxy ) ) THEN DEALLOCATE(grid%cmxy,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",5465,& 'frame/module_domain.f: Failed to deallocate grid%cmxy. ') endif ENDIF IF ( ASSOCIATED( grid%chxy ) ) THEN DEALLOCATE(grid%chxy,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",5472,& 'frame/module_domain.f: Failed to deallocate grid%chxy. ') endif ENDIF IF ( ASSOCIATED( grid%fwetxy ) ) THEN DEALLOCATE(grid%fwetxy,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",5479,& 'frame/module_domain.f: Failed to deallocate grid%fwetxy. ') endif ENDIF IF ( ASSOCIATED( grid%sneqvoxy ) ) THEN DEALLOCATE(grid%sneqvoxy,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",5486,& 'frame/module_domain.f: Failed to deallocate grid%sneqvoxy. ') endif ENDIF IF ( ASSOCIATED( grid%alboldxy ) ) THEN DEALLOCATE(grid%alboldxy,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",5493,& 'frame/module_domain.f: Failed to deallocate grid%alboldxy. ') endif ENDIF IF ( ASSOCIATED( grid%qsnowxy ) ) THEN DEALLOCATE(grid%qsnowxy,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",5500,& 'frame/module_domain.f: Failed to deallocate grid%qsnowxy. ') endif ENDIF IF ( ASSOCIATED( grid%wslakexy ) ) THEN DEALLOCATE(grid%wslakexy,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",5507,& 'frame/module_domain.f: Failed to deallocate grid%wslakexy. ') endif ENDIF IF ( ASSOCIATED( grid%zwtxy ) ) THEN DEALLOCATE(grid%zwtxy,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",5514,& 'frame/module_domain.f: Failed to deallocate grid%zwtxy. ') endif ENDIF IF ( ASSOCIATED( grid%waxy ) ) THEN DEALLOCATE(grid%waxy,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",5521,& 'frame/module_domain.f: Failed to deallocate grid%waxy. ') endif ENDIF IF ( ASSOCIATED( grid%wtxy ) ) THEN DEALLOCATE(grid%wtxy,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",5528,& 'frame/module_domain.f: Failed to deallocate grid%wtxy. ') endif ENDIF IF ( ASSOCIATED( grid%zsnsoxy ) ) THEN DEALLOCATE(grid%zsnsoxy,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",5535,& 'frame/module_domain.f: Failed to deallocate grid%zsnsoxy. ') endif ENDIF IF ( ASSOCIATED( grid%tsnoxy ) ) THEN DEALLOCATE(grid%tsnoxy,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",5542,& 'frame/module_domain.f: Failed to deallocate grid%tsnoxy. ') endif ENDIF IF ( ASSOCIATED( grid%snicexy ) ) THEN DEALLOCATE(grid%snicexy,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",5549,& 'frame/module_domain.f: Failed to deallocate grid%snicexy. ') endif ENDIF IF ( ASSOCIATED( grid%snliqxy ) ) THEN DEALLOCATE(grid%snliqxy,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",5556,& 'frame/module_domain.f: Failed to deallocate grid%snliqxy. ') endif ENDIF IF ( ASSOCIATED( grid%lfmassxy ) ) THEN DEALLOCATE(grid%lfmassxy,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",5563,& 'frame/module_domain.f: Failed to deallocate grid%lfmassxy. ') endif ENDIF IF ( ASSOCIATED( grid%rtmassxy ) ) THEN DEALLOCATE(grid%rtmassxy,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",5570,& 'frame/module_domain.f: Failed to deallocate grid%rtmassxy. ') endif ENDIF IF ( ASSOCIATED( grid%stmassxy ) ) THEN DEALLOCATE(grid%stmassxy,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",5577,& 'frame/module_domain.f: Failed to deallocate grid%stmassxy. ') endif ENDIF IF ( ASSOCIATED( grid%woodxy ) ) THEN DEALLOCATE(grid%woodxy,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",5584,& 'frame/module_domain.f: Failed to deallocate grid%woodxy. ') endif ENDIF IF ( ASSOCIATED( grid%stblcpxy ) ) THEN DEALLOCATE(grid%stblcpxy,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",5591,& 'frame/module_domain.f: Failed to deallocate grid%stblcpxy. ') endif ENDIF IF ( ASSOCIATED( grid%fastcpxy ) ) THEN DEALLOCATE(grid%fastcpxy,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",5598,& 'frame/module_domain.f: Failed to deallocate grid%fastcpxy. ') endif ENDIF IF ( ASSOCIATED( grid%xsaixy ) ) THEN DEALLOCATE(grid%xsaixy,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",5605,& 'frame/module_domain.f: Failed to deallocate grid%xsaixy. ') endif ENDIF IF ( ASSOCIATED( grid%tradxy ) ) THEN DEALLOCATE(grid%tradxy,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",5612,& 'frame/module_domain.f: Failed to deallocate grid%tradxy. ') endif ENDIF IF ( ASSOCIATED( grid%tsxy ) ) THEN DEALLOCATE(grid%tsxy,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",5619,& 'frame/module_domain.f: Failed to deallocate grid%tsxy. ') endif ENDIF IF ( ASSOCIATED( grid%neexy ) ) THEN DEALLOCATE(grid%neexy,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",5626,& 'frame/module_domain.f: Failed to deallocate grid%neexy. ') endif ENDIF IF ( ASSOCIATED( grid%gppxy ) ) THEN DEALLOCATE(grid%gppxy,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",5633,& 'frame/module_domain.f: Failed to deallocate grid%gppxy. ') endif ENDIF IF ( ASSOCIATED( grid%nppxy ) ) THEN DEALLOCATE(grid%nppxy,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",5640,& 'frame/module_domain.f: Failed to deallocate grid%nppxy. ') endif ENDIF IF ( ASSOCIATED( grid%fvegxy ) ) THEN DEALLOCATE(grid%fvegxy,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",5647,& 'frame/module_domain.f: Failed to deallocate grid%fvegxy. ') endif ENDIF IF ( ASSOCIATED( grid%qinxy ) ) THEN DEALLOCATE(grid%qinxy,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",5654,& 'frame/module_domain.f: Failed to deallocate grid%qinxy. ') endif ENDIF IF ( ASSOCIATED( grid%runsfxy ) ) THEN DEALLOCATE(grid%runsfxy,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",5661,& 'frame/module_domain.f: Failed to deallocate grid%runsfxy. ') endif ENDIF IF ( ASSOCIATED( grid%runsbxy ) ) THEN DEALLOCATE(grid%runsbxy,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",5668,& 'frame/module_domain.f: Failed to deallocate grid%runsbxy. ') endif ENDIF IF ( ASSOCIATED( grid%ecanxy ) ) THEN DEALLOCATE(grid%ecanxy,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",5675,& 'frame/module_domain.f: Failed to deallocate grid%ecanxy. ') endif ENDIF IF ( ASSOCIATED( grid%edirxy ) ) THEN DEALLOCATE(grid%edirxy,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",5682,& 'frame/module_domain.f: Failed to deallocate grid%edirxy. ') endif ENDIF IF ( ASSOCIATED( grid%etranxy ) ) THEN DEALLOCATE(grid%etranxy,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",5689,& 'frame/module_domain.f: Failed to deallocate grid%etranxy. ') endif ENDIF IF ( ASSOCIATED( grid%fsaxy ) ) THEN DEALLOCATE(grid%fsaxy,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",5696,& 'frame/module_domain.f: Failed to deallocate grid%fsaxy. ') endif ENDIF IF ( ASSOCIATED( grid%firaxy ) ) THEN DEALLOCATE(grid%firaxy,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",5703,& 'frame/module_domain.f: Failed to deallocate grid%firaxy. ') endif ENDIF IF ( ASSOCIATED( grid%aparxy ) ) THEN DEALLOCATE(grid%aparxy,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",5710,& 'frame/module_domain.f: Failed to deallocate grid%aparxy. ') endif ENDIF IF ( ASSOCIATED( grid%psnxy ) ) THEN DEALLOCATE(grid%psnxy,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",5717,& 'frame/module_domain.f: Failed to deallocate grid%psnxy. ') endif ENDIF IF ( ASSOCIATED( grid%savxy ) ) THEN DEALLOCATE(grid%savxy,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",5724,& 'frame/module_domain.f: Failed to deallocate grid%savxy. ') endif ENDIF IF ( ASSOCIATED( grid%sagxy ) ) THEN DEALLOCATE(grid%sagxy,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",5731,& 'frame/module_domain.f: Failed to deallocate grid%sagxy. ') endif ENDIF IF ( ASSOCIATED( grid%fsnoxy ) ) THEN DEALLOCATE(grid%fsnoxy,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",5738,& 'frame/module_domain.f: Failed to deallocate grid%fsnoxy. ') endif ENDIF IF ( ASSOCIATED( grid%t2mvxy ) ) THEN DEALLOCATE(grid%t2mvxy,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",5745,& 'frame/module_domain.f: Failed to deallocate grid%t2mvxy. ') endif ENDIF IF ( ASSOCIATED( grid%t2mbxy ) ) THEN DEALLOCATE(grid%t2mbxy,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",5752,& 'frame/module_domain.f: Failed to deallocate grid%t2mbxy. ') endif ENDIF IF ( ASSOCIATED( grid%q2mvxy ) ) THEN DEALLOCATE(grid%q2mvxy,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",5759,& 'frame/module_domain.f: Failed to deallocate grid%q2mvxy. ') endif ENDIF IF ( ASSOCIATED( grid%q2mbxy ) ) THEN DEALLOCATE(grid%q2mbxy,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",5766,& 'frame/module_domain.f: Failed to deallocate grid%q2mbxy. ') endif ENDIF IF ( ASSOCIATED( grid%chstarxy ) ) THEN DEALLOCATE(grid%chstarxy,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",5773,& 'frame/module_domain.f: Failed to deallocate grid%chstarxy. ') endif ENDIF IF ( ASSOCIATED( grid%rssunxy ) ) THEN DEALLOCATE(grid%rssunxy,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",5780,& 'frame/module_domain.f: Failed to deallocate grid%rssunxy. ') endif ENDIF IF ( ASSOCIATED( grid%rsshaxy ) ) THEN DEALLOCATE(grid%rsshaxy,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",5787,& 'frame/module_domain.f: Failed to deallocate grid%rsshaxy. ') endif ENDIF IF ( ASSOCIATED( grid%bgapxy ) ) THEN DEALLOCATE(grid%bgapxy,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",5794,& 'frame/module_domain.f: Failed to deallocate grid%bgapxy. ') endif ENDIF IF ( ASSOCIATED( grid%wgapxy ) ) THEN DEALLOCATE(grid%wgapxy,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",5801,& 'frame/module_domain.f: Failed to deallocate grid%wgapxy. ') endif ENDIF IF ( ASSOCIATED( grid%gapxy ) ) THEN DEALLOCATE(grid%gapxy,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",5808,& 'frame/module_domain.f: Failed to deallocate grid%gapxy. ') endif ENDIF IF ( ASSOCIATED( grid%tgvxy ) ) THEN DEALLOCATE(grid%tgvxy,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",5815,& 'frame/module_domain.f: Failed to deallocate grid%tgvxy. ') endif ENDIF IF ( ASSOCIATED( grid%tgbxy ) ) THEN DEALLOCATE(grid%tgbxy,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",5822,& 'frame/module_domain.f: Failed to deallocate grid%tgbxy. ') endif ENDIF IF ( ASSOCIATED( grid%chvxy ) ) THEN DEALLOCATE(grid%chvxy,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",5829,& 'frame/module_domain.f: Failed to deallocate grid%chvxy. ') endif ENDIF IF ( ASSOCIATED( grid%chbxy ) ) THEN DEALLOCATE(grid%chbxy,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",5836,& 'frame/module_domain.f: Failed to deallocate grid%chbxy. ') endif ENDIF IF ( ASSOCIATED( grid%mp_restart_state ) ) THEN DEALLOCATE(grid%mp_restart_state,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",5843,& 'frame/module_domain.f: Failed to deallocate grid%mp_restart_state. ') endif ENDIF IF ( ASSOCIATED( grid%tbpvs_state ) ) THEN DEALLOCATE(grid%tbpvs_state,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",5850,& 'frame/module_domain.f: Failed to deallocate grid%tbpvs_state. ') endif ENDIF IF ( ASSOCIATED( grid%tbpvs0_state ) ) THEN DEALLOCATE(grid%tbpvs0_state,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",5857,& 'frame/module_domain.f: Failed to deallocate grid%tbpvs0_state. ') endif ENDIF IF ( ASSOCIATED( grid%lu_state ) ) THEN DEALLOCATE(grid%lu_state,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",5864,& 'frame/module_domain.f: Failed to deallocate grid%lu_state. ') endif ENDIF IF ( ASSOCIATED( grid%hcoeff ) ) THEN DEALLOCATE(grid%hcoeff,STAT=ierr) if (ierr.ne.0) then CALL wrf_error_fatal3("",5871,& 'frame/module_domain.f: Failed to deallocate grid%hcoeff. ') endif ENDIF END SUBROUTINE dealloc_space_field RECURSIVE SUBROUTINE find_grid_by_id ( id, in_grid, result_grid ) IMPLICIT NONE INTEGER, INTENT(IN) :: id TYPE(domain), POINTER :: in_grid TYPE(domain), POINTER :: result_grid TYPE(domain), POINTER :: grid_ptr INTEGER :: kid LOGICAL :: found found = .FALSE. NULLIFY(result_grid) IF ( ASSOCIATED( in_grid ) ) THEN IF ( in_grid%id .EQ. id ) THEN result_grid => in_grid ELSE grid_ptr => in_grid DO WHILE ( ASSOCIATED( grid_ptr ) .AND. .NOT. found ) DO kid = 1, max_nests IF ( ASSOCIATED( grid_ptr%nests(kid)%ptr ) .AND. .NOT. found ) THEN CALL find_grid_by_id ( id, grid_ptr%nests(kid)%ptr, result_grid ) IF ( ASSOCIATED( result_grid ) ) THEN IF ( result_grid%id .EQ. id ) found = .TRUE. ENDIF ENDIF ENDDO IF ( .NOT. found ) grid_ptr => grid_ptr%sibling ENDDO ENDIF ENDIF RETURN END SUBROUTINE find_grid_by_id FUNCTION first_loc_integer ( array , search ) RESULT ( loc ) IMPLICIT NONE INTEGER , INTENT(IN) , DIMENSION(:) :: array INTEGER , INTENT(IN) :: search INTEGER :: loc INTEGER :: loop loc = -1 find : DO loop = 1 , SIZE(array) IF ( search == array(loop) ) THEN loc = loop EXIT find END IF END DO find END FUNCTION first_loc_integer SUBROUTINE init_module_domain END SUBROUTINE init_module_domain FUNCTION domain_get_current_time ( grid ) RESULT ( current_time ) IMPLICIT NONE TYPE(domain), INTENT(IN) :: grid TYPE(WRFU_Time) :: current_time INTEGER :: rc CALL WRFU_ClockGet( grid%domain_clock, CurrTime=current_time, & rc=rc ) IF ( rc /= WRFU_SUCCESS ) THEN CALL wrf_error_fatal3("",5978,& 'domain_get_current_time: WRFU_ClockGet failed' ) ENDIF END FUNCTION domain_get_current_time FUNCTION domain_get_start_time ( grid ) RESULT ( start_time ) IMPLICIT NONE TYPE(domain), INTENT(IN) :: grid TYPE(WRFU_Time) :: start_time INTEGER :: rc CALL WRFU_ClockGet( grid%domain_clock, StartTime=start_time, & rc=rc ) IF ( rc /= WRFU_SUCCESS ) THEN CALL wrf_error_fatal3("",5998,& 'domain_get_start_time: WRFU_ClockGet failed' ) ENDIF END FUNCTION domain_get_start_time FUNCTION domain_get_stop_time ( grid ) RESULT ( stop_time ) IMPLICIT NONE TYPE(domain), INTENT(IN) :: grid TYPE(WRFU_Time) :: stop_time INTEGER :: rc CALL WRFU_ClockGet( grid%domain_clock, StopTime=stop_time, & rc=rc ) IF ( rc /= WRFU_SUCCESS ) THEN CALL wrf_error_fatal3("",6018,& 'domain_get_stop_time: WRFU_ClockGet failed' ) ENDIF END FUNCTION domain_get_stop_time FUNCTION domain_get_time_step ( grid ) RESULT ( time_step ) IMPLICIT NONE TYPE(domain), INTENT(IN) :: grid TYPE(WRFU_TimeInterval) :: time_step INTEGER :: rc CALL WRFU_ClockGet( grid%domain_clock, timeStep=time_step, & rc=rc ) IF ( rc /= WRFU_SUCCESS ) THEN CALL wrf_error_fatal3("",6038,& 'domain_get_time_step: WRFU_ClockGet failed' ) ENDIF END FUNCTION domain_get_time_step FUNCTION domain_get_advanceCount ( grid ) RESULT ( advanceCount ) IMPLICIT NONE TYPE(domain), INTENT(IN) :: grid INTEGER :: advanceCount INTEGER(WRFU_KIND_I8) :: advanceCountLcl INTEGER :: rc CALL WRFU_ClockGet( grid%domain_clock, & advanceCount=advanceCountLcl, & rc=rc ) IF ( rc /= WRFU_SUCCESS ) THEN CALL wrf_error_fatal3("",6061,& 'domain_get_advanceCount: WRFU_ClockGet failed' ) ENDIF advanceCount = advanceCountLcl END FUNCTION domain_get_advanceCount SUBROUTINE domain_alarms_destroy ( grid ) IMPLICIT NONE TYPE(domain), INTENT(INOUT) :: grid INTEGER :: alarmid IF ( ASSOCIATED( grid%alarms ) .AND. & ASSOCIATED( grid%alarms_created ) ) THEN DO alarmid = 1, MAX_WRF_ALARMS IF ( grid%alarms_created( alarmid ) ) THEN CALL WRFU_AlarmDestroy( grid%alarms( alarmid ) ) grid%alarms_created( alarmid ) = .FALSE. ENDIF ENDDO DEALLOCATE( grid%alarms ) NULLIFY( grid%alarms ) DEALLOCATE( grid%alarms_created ) NULLIFY( grid%alarms_created ) ENDIF END SUBROUTINE domain_alarms_destroy SUBROUTINE domain_clock_destroy ( grid ) IMPLICIT NONE TYPE(domain), INTENT(INOUT) :: grid IF ( ASSOCIATED( grid%domain_clock ) ) THEN IF ( grid%domain_clock_created ) THEN CALL WRFU_ClockDestroy( grid%domain_clock ) grid%domain_clock_created = .FALSE. ENDIF DEALLOCATE( grid%domain_clock ) NULLIFY( grid%domain_clock ) ENDIF END SUBROUTINE domain_clock_destroy FUNCTION domain_last_time_step ( grid ) RESULT ( LAST_TIME ) IMPLICIT NONE TYPE(domain), INTENT(IN) :: grid LOGICAL :: LAST_TIME LAST_TIME = domain_get_stop_time( grid ) .EQ. & ( domain_get_current_time( grid ) + & domain_get_time_step( grid ) ) END FUNCTION domain_last_time_step FUNCTION domain_clockisstoptime ( grid ) RESULT ( is_stop_time ) IMPLICIT NONE TYPE(domain), INTENT(IN) :: grid LOGICAL :: is_stop_time INTEGER :: rc is_stop_time = WRFU_ClockIsStopTime( grid%domain_clock , rc=rc ) IF ( rc /= WRFU_SUCCESS ) THEN CALL wrf_error_fatal3("",6143,& 'domain_clockisstoptime: WRFU_ClockIsStopTime() failed' ) ENDIF END FUNCTION domain_clockisstoptime FUNCTION domain_clockisstopsubtime ( grid ) RESULT ( is_stop_subtime ) IMPLICIT NONE TYPE(domain), INTENT(IN) :: grid LOGICAL :: is_stop_subtime INTEGER :: rc TYPE(WRFU_TimeInterval) :: timeStep TYPE(WRFU_Time) :: currentTime LOGICAL :: positive_timestep is_stop_subtime = .FALSE. CALL domain_clock_get( grid, time_step=timeStep, & current_time=currentTime ) positive_timestep = ESMF_TimeIntervalIsPositive( timeStep ) IF ( positive_timestep ) THEN IF ( ESMF_TimeGE( currentTime, grid%stop_subtime ) ) THEN is_stop_subtime = .TRUE. ENDIF ELSE IF ( ESMF_TimeLE( currentTime, grid%stop_subtime ) ) THEN is_stop_subtime = .TRUE. ENDIF ENDIF END FUNCTION domain_clockisstopsubtime FUNCTION domain_get_sim_start_time ( grid ) RESULT ( simulationStartTime ) IMPLICIT NONE TYPE(domain), INTENT(IN) :: grid TYPE(WRFU_Time) :: simulationStartTime INTEGER :: rc INTEGER :: simulation_start_year, simulation_start_month, & simulation_start_day, simulation_start_hour , & simulation_start_minute, simulation_start_second CALL nl_get_simulation_start_year ( 1, simulation_start_year ) CALL nl_get_simulation_start_month ( 1, simulation_start_month ) CALL nl_get_simulation_start_day ( 1, simulation_start_day ) CALL nl_get_simulation_start_hour ( 1, simulation_start_hour ) CALL nl_get_simulation_start_minute ( 1, simulation_start_minute ) CALL nl_get_simulation_start_second ( 1, simulation_start_second ) CALL WRFU_TimeSet( simulationStartTime, & YY=simulation_start_year, & MM=simulation_start_month, & DD=simulation_start_day, & H=simulation_start_hour, & M=simulation_start_minute, & S=simulation_start_second, & rc=rc ) IF ( rc /= WRFU_SUCCESS ) THEN CALL nl_get_start_year ( 1, simulation_start_year ) CALL nl_get_start_month ( 1, simulation_start_month ) CALL nl_get_start_day ( 1, simulation_start_day ) CALL nl_get_start_hour ( 1, simulation_start_hour ) CALL nl_get_start_minute ( 1, simulation_start_minute ) CALL nl_get_start_second ( 1, simulation_start_second ) CALL wrf_debug( 150, "WARNING: domain_get_sim_start_time using head_grid start time from namelist" ) CALL WRFU_TimeSet( simulationStartTime, & YY=simulation_start_year, & MM=simulation_start_month, & DD=simulation_start_day, & H=simulation_start_hour, & M=simulation_start_minute, & S=simulation_start_second, & rc=rc ) ENDIF RETURN END FUNCTION domain_get_sim_start_time FUNCTION domain_get_time_since_sim_start ( grid ) RESULT ( time_since_sim_start ) IMPLICIT NONE TYPE(domain), INTENT(IN) :: grid TYPE(WRFU_TimeInterval) :: time_since_sim_start TYPE(WRFU_Time) :: lcl_currtime, lcl_simstarttime lcl_simstarttime = domain_get_sim_start_time( grid ) lcl_currtime = domain_get_current_time ( grid ) time_since_sim_start = lcl_currtime - lcl_simstarttime END FUNCTION domain_get_time_since_sim_start SUBROUTINE domain_clock_get( grid, current_time, & current_timestr, & current_timestr_frac, & start_time, start_timestr, & stop_time, stop_timestr, & time_step, time_stepstr, & time_stepstr_frac, & advanceCount, & currentDayOfYearReal, & minutesSinceSimulationStart, & timeSinceSimulationStart, & simulationStartTime, & simulationStartTimeStr ) IMPLICIT NONE TYPE(domain), INTENT(IN) :: grid TYPE(WRFU_Time), INTENT( OUT), OPTIONAL :: current_time CHARACTER (LEN=*), INTENT( OUT), OPTIONAL :: current_timestr CHARACTER (LEN=*), INTENT( OUT), OPTIONAL :: current_timestr_frac TYPE(WRFU_Time), INTENT( OUT), OPTIONAL :: start_time CHARACTER (LEN=*), INTENT( OUT), OPTIONAL :: start_timestr TYPE(WRFU_Time), INTENT( OUT), OPTIONAL :: stop_time CHARACTER (LEN=*), INTENT( OUT), OPTIONAL :: stop_timestr TYPE(WRFU_TimeInterval), INTENT( OUT), OPTIONAL :: time_step CHARACTER (LEN=*), INTENT( OUT), OPTIONAL :: time_stepstr CHARACTER (LEN=*), INTENT( OUT), OPTIONAL :: time_stepstr_frac INTEGER, INTENT( OUT), OPTIONAL :: advanceCount REAL, INTENT( OUT), OPTIONAL :: currentDayOfYearReal TYPE(WRFU_Time), INTENT( OUT), OPTIONAL :: simulationStartTime CHARACTER (LEN=*), INTENT( OUT), OPTIONAL :: simulationStartTimeStr TYPE(WRFU_TimeInterval), INTENT( OUT), OPTIONAL :: timeSinceSimulationStart REAL, INTENT( OUT), OPTIONAL :: minutesSinceSimulationStart TYPE(WRFU_Time) :: lcl_currtime, lcl_stoptime, lcl_starttime TYPE(WRFU_Time) :: lcl_simulationStartTime TYPE(WRFU_TimeInterval) :: lcl_time_step, lcl_timeSinceSimulationStart INTEGER :: days, seconds, Sn, Sd, rc CHARACTER (LEN=256) :: tmp_str CHARACTER (LEN=256) :: frac_str REAL(WRFU_KIND_R8) :: currentDayOfYearR8 IF ( PRESENT( start_time ) ) THEN start_time = domain_get_start_time ( grid ) ENDIF IF ( PRESENT( start_timestr ) ) THEN lcl_starttime = domain_get_start_time ( grid ) CALL wrf_timetoa ( lcl_starttime, start_timestr ) ENDIF IF ( PRESENT( time_step ) ) THEN time_step = domain_get_time_step ( grid ) ENDIF IF ( PRESENT( time_stepstr ) ) THEN lcl_time_step = domain_get_time_step ( grid ) CALL WRFU_TimeIntervalGet( lcl_time_step, & timeString=time_stepstr, rc=rc ) IF ( rc /= WRFU_SUCCESS ) THEN CALL wrf_error_fatal3("",6333,& 'domain_clock_get: WRFU_TimeIntervalGet() failed' ) ENDIF ENDIF IF ( PRESENT( time_stepstr_frac ) ) THEN lcl_time_step = domain_get_time_step ( grid ) CALL WRFU_TimeIntervalGet( lcl_time_step, timeString=tmp_str, & Sn=Sn, Sd=Sd, rc=rc ) IF ( rc /= WRFU_SUCCESS ) THEN CALL wrf_error_fatal3("",6342,& 'domain_clock_get: WRFU_TimeIntervalGet() failed' ) ENDIF CALL fraction_to_string( Sn, Sd, frac_str ) time_stepstr_frac = TRIM(tmp_str) ENDIF IF ( PRESENT( advanceCount ) ) THEN advanceCount = domain_get_advanceCount ( grid ) ENDIF IF ( PRESENT( current_time ) ) THEN current_time = domain_get_current_time ( grid ) ENDIF IF ( PRESENT( current_timestr ) ) THEN lcl_currtime = domain_get_current_time ( grid ) CALL wrf_timetoa ( lcl_currtime, current_timestr ) ENDIF IF ( PRESENT( current_timestr_frac ) ) THEN lcl_currtime = domain_get_current_time ( grid ) CALL wrf_timetoa ( lcl_currtime, tmp_str ) CALL WRFU_TimeGet( lcl_currtime, Sn=Sn, Sd=Sd, rc=rc ) IF ( rc /= WRFU_SUCCESS ) THEN CALL wrf_error_fatal3("",6370,& 'domain_clock_get: WRFU_TimeGet() failed' ) ENDIF CALL fraction_to_string( Sn, Sd, frac_str ) current_timestr_frac = TRIM(tmp_str) ENDIF IF ( PRESENT( stop_time ) ) THEN stop_time = domain_get_stop_time ( grid ) ENDIF IF ( PRESENT( stop_timestr ) ) THEN lcl_stoptime = domain_get_stop_time ( grid ) CALL wrf_timetoa ( lcl_stoptime, stop_timestr ) ENDIF IF ( PRESENT( currentDayOfYearReal ) ) THEN lcl_currtime = domain_get_current_time ( grid ) CALL WRFU_TimeGet( lcl_currtime, dayOfYear_r8=currentDayOfYearR8, & rc=rc ) IF ( rc /= WRFU_SUCCESS ) THEN CALL wrf_error_fatal3("",6388,& 'domain_clock_get: WRFU_TimeGet(dayOfYear_r8) failed' ) ENDIF currentDayOfYearReal = REAL( currentDayOfYearR8 ) - 1.0 ENDIF IF ( PRESENT( simulationStartTime ) ) THEN simulationStartTime = domain_get_sim_start_time( grid ) ENDIF IF ( PRESENT( simulationStartTimeStr ) ) THEN lcl_simulationStartTime = domain_get_sim_start_time( grid ) CALL wrf_timetoa ( lcl_simulationStartTime, simulationStartTimeStr ) ENDIF IF ( PRESENT( timeSinceSimulationStart ) ) THEN timeSinceSimulationStart = domain_get_time_since_sim_start( grid ) ENDIF IF ( PRESENT( minutesSinceSimulationStart ) ) THEN lcl_timeSinceSimulationStart = domain_get_time_since_sim_start( grid ) CALL WRFU_TimeIntervalGet( lcl_timeSinceSimulationStart, & D=days, S=seconds, Sn=Sn, Sd=Sd, rc=rc ) IF ( rc /= WRFU_SUCCESS ) THEN CALL wrf_error_fatal3("",6408,& 'domain_clock_get: WRFU_TimeIntervalGet() failed' ) ENDIF minutesSinceSimulationStart = ( REAL( days ) * 24. * 60. ) + & ( REAL( seconds ) / 60. ) IF ( Sd /= 0 ) THEN minutesSinceSimulationStart = minutesSinceSimulationStart + & ( ( REAL( Sn ) / REAL( Sd ) ) / 60. ) ENDIF ENDIF RETURN END SUBROUTINE domain_clock_get FUNCTION domain_clockisstarttime ( grid ) RESULT ( is_start_time ) IMPLICIT NONE TYPE(domain), INTENT(IN) :: grid LOGICAL :: is_start_time TYPE(WRFU_Time) :: start_time, current_time CALL domain_clock_get( grid, current_time=current_time, & start_time=start_time ) is_start_time = ( current_time == start_time ) END FUNCTION domain_clockisstarttime FUNCTION domain_clockissimstarttime ( grid ) RESULT ( is_sim_start_time ) IMPLICIT NONE TYPE(domain), INTENT(IN) :: grid LOGICAL :: is_sim_start_time TYPE(WRFU_Time) :: simulationStartTime, current_time CALL domain_clock_get( grid, current_time=current_time, & simulationStartTime=simulationStartTime ) is_sim_start_time = ( current_time == simulationStartTime ) END FUNCTION domain_clockissimstarttime SUBROUTINE domain_clock_create( grid, StartTime, & StopTime, & TimeStep ) IMPLICIT NONE TYPE(domain), INTENT(INOUT) :: grid TYPE(WRFU_Time), INTENT(IN ) :: StartTime TYPE(WRFU_Time), INTENT(IN ) :: StopTime TYPE(WRFU_TimeInterval), INTENT(IN ) :: TimeStep INTEGER :: rc grid%domain_clock = WRFU_ClockCreate( TimeStep= TimeStep, & StartTime=StartTime, & StopTime= StopTime, & rc=rc ) IF ( rc /= WRFU_SUCCESS ) THEN CALL wrf_error_fatal3("",6477,& 'domain_clock_create: WRFU_ClockCreate() failed' ) ENDIF grid%domain_clock_created = .TRUE. RETURN END SUBROUTINE domain_clock_create SUBROUTINE domain_alarm_create( grid, alarm_id, interval, & begin_time, end_time ) USE module_utility IMPLICIT NONE TYPE(domain), POINTER :: grid INTEGER, INTENT(IN) :: alarm_id TYPE(WRFU_TimeInterval), INTENT(IN), OPTIONAL :: interval TYPE(WRFU_TimeInterval), INTENT(IN), OPTIONAL :: begin_time TYPE(WRFU_TimeInterval), INTENT(IN), OPTIONAL :: end_time INTEGER :: rc LOGICAL :: interval_only, all_args, no_args TYPE(WRFU_Time) :: startTime interval_only = .FALSE. all_args = .FALSE. no_args = .FALSE. IF ( ( .NOT. PRESENT( begin_time ) ) .AND. & ( .NOT. PRESENT( end_time ) ) .AND. & ( PRESENT( interval ) ) ) THEN interval_only = .TRUE. ELSE IF ( ( .NOT. PRESENT( begin_time ) ) .AND. & ( .NOT. PRESENT( end_time ) ) .AND. & ( .NOT. PRESENT( interval ) ) ) THEN no_args = .TRUE. ELSE IF ( ( PRESENT( begin_time ) ) .AND. & ( PRESENT( end_time ) ) .AND. & ( PRESENT( interval ) ) ) THEN all_args = .TRUE. ELSE CALL wrf_error_fatal3("",6524,& 'ERROR in domain_alarm_create: bad argument list' ) ENDIF CALL domain_clock_get( grid, start_time=startTime ) IF ( interval_only ) THEN grid%io_intervals( alarm_id ) = interval grid%alarms( alarm_id ) = & WRFU_AlarmCreate( clock=grid%domain_clock, & RingInterval=interval, & rc=rc ) ELSE IF ( no_args ) THEN grid%alarms( alarm_id ) = & WRFU_AlarmCreate( clock=grid%domain_clock, & RingTime=startTime, & rc=rc ) ELSE IF ( all_args ) THEN grid%io_intervals( alarm_id ) = interval grid%alarms( alarm_id ) = & WRFU_AlarmCreate( clock=grid%domain_clock, & RingTime=startTime + begin_time, & RingInterval=interval, & StopTime=startTime + end_time, & rc=rc ) ENDIF IF ( rc /= WRFU_SUCCESS ) THEN CALL wrf_error_fatal3("",6549,& 'domain_alarm_create: WRFU_AlarmCreate() failed' ) ENDIF CALL WRFU_AlarmRingerOff( grid%alarms( alarm_id ) , rc=rc ) IF ( rc /= WRFU_SUCCESS ) THEN CALL wrf_error_fatal3("",6554,& 'domain_alarm_create: WRFU_AlarmRingerOff() failed' ) ENDIF grid%alarms_created( alarm_id ) = .TRUE. END SUBROUTINE domain_alarm_create SUBROUTINE domain_clock_set( grid, current_timestr, & stop_timestr, & time_step_seconds ) IMPLICIT NONE TYPE(domain), INTENT(INOUT) :: grid CHARACTER (LEN=*), INTENT(IN ), OPTIONAL :: current_timestr CHARACTER (LEN=*), INTENT(IN ), OPTIONAL :: stop_timestr INTEGER, INTENT(IN ), OPTIONAL :: time_step_seconds TYPE(WRFU_Time) :: lcl_currtime, lcl_stoptime TYPE(WRFU_TimeInterval) :: tmpTimeInterval INTEGER :: rc IF ( PRESENT( current_timestr ) ) THEN CALL wrf_atotime( current_timestr(1:19), lcl_currtime ) CALL WRFU_ClockSet( grid%domain_clock, currTime=lcl_currtime, & rc=rc ) IF ( rc /= WRFU_SUCCESS ) THEN CALL wrf_error_fatal3("",6585,& 'domain_clock_set: WRFU_ClockSet(CurrTime) failed' ) ENDIF ENDIF IF ( PRESENT( stop_timestr ) ) THEN CALL wrf_atotime( stop_timestr(1:19), lcl_stoptime ) CALL WRFU_ClockSet( grid%domain_clock, stopTime=lcl_stoptime, & rc=rc ) IF ( rc /= WRFU_SUCCESS ) THEN CALL wrf_error_fatal3("",6594,& 'domain_clock_set: WRFU_ClockSet(StopTime) failed' ) ENDIF ENDIF IF ( PRESENT( time_step_seconds ) ) THEN CALL WRFU_TimeIntervalSet( tmpTimeInterval, & S=time_step_seconds, rc=rc ) IF ( rc /= WRFU_SUCCESS ) THEN CALL wrf_error_fatal3("",6602,& 'domain_clock_set: WRFU_TimeIntervalSet failed' ) ENDIF CALL WRFU_ClockSet ( grid%domain_clock, & timeStep=tmpTimeInterval, & rc=rc ) IF ( rc /= WRFU_SUCCESS ) THEN CALL wrf_error_fatal3("",6609,& 'domain_clock_set: WRFU_ClockSet(TimeStep) failed' ) ENDIF ENDIF RETURN END SUBROUTINE domain_clock_set SUBROUTINE domain_clockprint ( level, grid, pre_str ) IMPLICIT NONE INTEGER, INTENT( IN) :: level TYPE(domain), INTENT( IN) :: grid CHARACTER (LEN=*), INTENT( IN) :: pre_str CALL wrf_clockprint ( level, grid%domain_clock, pre_str ) RETURN END SUBROUTINE domain_clockprint SUBROUTINE domain_clockadvance ( grid ) IMPLICIT NONE TYPE(domain), INTENT(INOUT) :: grid INTEGER :: rc CALL domain_clockprint ( 250, grid, & 'DEBUG domain_clockadvance(): before WRFU_ClockAdvance,' ) CALL WRFU_ClockAdvance( grid%domain_clock, rc=rc ) IF ( rc /= WRFU_SUCCESS ) THEN CALL wrf_error_fatal3("",6639,& 'domain_clockadvance: WRFU_ClockAdvance() failed' ) ENDIF CALL domain_clockprint ( 250, grid, & 'DEBUG domain_clockadvance(): after WRFU_ClockAdvance,' ) CALL domain_clock_get( grid, minutesSinceSimulationStart=grid%xtime ) CALL domain_clock_get( grid, currentDayOfYearReal=grid%julian ) RETURN END SUBROUTINE domain_clockadvance SUBROUTINE domain_setgmtetc ( grid, start_of_simulation ) IMPLICIT NONE TYPE (domain), INTENT(INOUT) :: grid LOGICAL, INTENT( OUT) :: start_of_simulation CHARACTER (LEN=132) :: message TYPE(WRFU_Time) :: simStartTime INTEGER :: hr, mn, sec, ms, rc CALL domain_clockprint(150, grid, & 'DEBUG domain_setgmtetc(): get simStartTime from clock,') CALL domain_clock_get( grid, simulationStartTime=simStartTime, & simulationStartTimeStr=message ) CALL WRFU_TimeGet( simStartTime, YY=grid%julyr, dayOfYear=grid%julday, & H=hr, M=mn, S=sec, MS=ms, rc=rc) IF ( rc /= WRFU_SUCCESS ) THEN CALL wrf_error_fatal3("",6670,& 'domain_setgmtetc: WRFU_TimeGet() failed' ) ENDIF WRITE( wrf_err_message , * ) 'DEBUG domain_setgmtetc(): simulation start time = [',TRIM( message ),']' CALL wrf_debug( 150, TRIM(wrf_err_message) ) grid%gmt=hr+real(mn)/60.+real(sec)/3600.+real(ms)/(1000*3600) WRITE( wrf_err_message , * ) 'DEBUG domain_setgmtetc(): julyr,hr,mn,sec,ms,julday = ', & grid%julyr,hr,mn,sec,ms,grid%julday CALL wrf_debug( 150, TRIM(wrf_err_message) ) WRITE( wrf_err_message , * ) 'DEBUG domain_setgmtetc(): gmt = ',grid%gmt CALL wrf_debug( 150, TRIM(wrf_err_message) ) start_of_simulation = domain_ClockIsSimStartTime(grid) RETURN END SUBROUTINE domain_setgmtetc SUBROUTINE set_current_grid_ptr( grid_ptr ) IMPLICIT NONE TYPE(domain), POINTER :: grid_ptr current_grid_set = .TRUE. current_grid => grid_ptr END SUBROUTINE set_current_grid_ptr SUBROUTINE domain_time_test_print ( pre_str, name_str, res_str ) IMPLICIT NONE CHARACTER (LEN=*), INTENT(IN) :: pre_str CHARACTER (LEN=*), INTENT(IN) :: name_str CHARACTER (LEN=*), INTENT(IN) :: res_str CHARACTER (LEN=512) :: out_str WRITE (out_str, & FMT="('DOMAIN_TIME_TEST ',A,': ',A,' = ',A)") & TRIM(pre_str), TRIM(name_str), TRIM(res_str) CALL wrf_debug( 0, TRIM(out_str) ) END SUBROUTINE domain_time_test_print SUBROUTINE test_adjust_io_timestr( TI_h, TI_m, TI_s, & CT_yy, CT_mm, CT_dd, CT_h, CT_m, CT_s, & ST_yy, ST_mm, ST_dd, ST_h, ST_m, ST_s, & res_str, testname ) INTEGER, INTENT(IN) :: TI_H INTEGER, INTENT(IN) :: TI_M INTEGER, INTENT(IN) :: TI_S INTEGER, INTENT(IN) :: CT_YY INTEGER, INTENT(IN) :: CT_MM INTEGER, INTENT(IN) :: CT_DD INTEGER, INTENT(IN) :: CT_H INTEGER, INTENT(IN) :: CT_M INTEGER, INTENT(IN) :: CT_S INTEGER, INTENT(IN) :: ST_YY INTEGER, INTENT(IN) :: ST_MM INTEGER, INTENT(IN) :: ST_DD INTEGER, INTENT(IN) :: ST_H INTEGER, INTENT(IN) :: ST_M INTEGER, INTENT(IN) :: ST_S CHARACTER (LEN=*), INTENT(IN) :: res_str CHARACTER (LEN=*), INTENT(IN) :: testname TYPE(WRFU_TimeInterval) :: TI TYPE(WRFU_Time) :: CT, ST LOGICAL :: test_passed INTEGER :: rc CHARACTER(LEN=WRFU_MAXSTR) :: TI_str, CT_str, ST_str, computed_str CALL WRFU_TimeIntervalSet( TI, H=TI_H, M=TI_M, S=TI_S, rc=rc ) CALL wrf_check_error( WRFU_SUCCESS, rc, & 'FAIL: ' "../frame/module_domain.F" , & 2585 ) CALL WRFU_TimeIntervalGet( TI, timeString=TI_str, rc=rc ) CALL wrf_check_error( WRFU_SUCCESS, rc, & 'FAIL: ' "../frame/module_domain.F" , & 2590 ) CALL WRFU_TimeSet( CT, YY=CT_YY, MM=CT_MM, DD=CT_DD , & H=CT_H, M=CT_M, S=CT_S, rc=rc ) CALL wrf_check_error( WRFU_SUCCESS, rc, & 'FAIL: ' "../frame/module_domain.F" , & 2597 ) CALL WRFU_TimeGet( CT, timeString=CT_str, rc=rc ) CALL wrf_check_error( WRFU_SUCCESS, rc, & 'FAIL: ' "../frame/module_domain.F" , & 2602 ) CALL WRFU_TimeSet( ST, YY=ST_YY, MM=ST_MM, DD=ST_DD , & H=ST_H, M=ST_M, S=ST_S, rc=rc ) CALL wrf_check_error( WRFU_SUCCESS, rc, & 'FAIL: ' "../frame/module_domain.F" , & 2609 ) CALL WRFU_TimeGet( ST, timeString=ST_str, rc=rc ) CALL wrf_check_error( WRFU_SUCCESS, rc, & 'FAIL: ' "../frame/module_domain.F" , & 2614 ) CALL adjust_io_timestr ( TI, CT, ST, computed_str ) test_passed = .FALSE. IF ( LEN_TRIM(res_str) == LEN_TRIM(computed_str) ) THEN IF ( res_str(1:LEN_TRIM(res_str)) == computed_str(1:LEN_TRIM(computed_str)) ) THEN test_passed = .TRUE. ENDIF ENDIF IF ( test_passed ) THEN WRITE(*,FMT='(A)') 'PASS: ' ELSE WRITE(*,*) 'FAIL: ',TRIM(testname),': adjust_io_timestr(', & TRIM(TI_str),',',TRIM(CT_str),',',TRIM(ST_str),') expected <', & TRIM(res_str),'> but computed <',TRIM(computed_str),'>' ENDIF END SUBROUTINE test_adjust_io_timestr SUBROUTINE domain_time_test ( grid, pre_str ) IMPLICIT NONE TYPE(domain), INTENT(IN) :: grid CHARACTER (LEN=*), INTENT(IN) :: pre_str LOGICAL, SAVE :: one_time_tests_done = .FALSE. REAL :: minutesSinceSimulationStart INTEGER :: advance_count, rc REAL :: currentDayOfYearReal TYPE(WRFU_TimeInterval) :: timeSinceSimulationStart TYPE(WRFU_Time) :: simulationStartTime CHARACTER (LEN=512) :: res_str LOGICAL :: self_test_domain CALL nl_get_self_test_domain( 1, self_test_domain ) IF ( self_test_domain ) THEN CALL domain_clock_get( grid, advanceCount=advance_count ) WRITE ( res_str, FMT="(I8.8)" ) advance_count CALL domain_time_test_print( pre_str, 'advanceCount', res_str ) CALL domain_clock_get( grid, currentDayOfYearReal=currentDayOfYearReal ) WRITE ( res_str, FMT='(F10.6)' ) currentDayOfYearReal CALL domain_time_test_print( pre_str, 'currentDayOfYearReal', res_str ) CALL domain_clock_get( grid, minutesSinceSimulationStart=minutesSinceSimulationStart ) WRITE ( res_str, FMT='(F10.6)' ) minutesSinceSimulationStart CALL domain_time_test_print( pre_str, 'minutesSinceSimulationStart', res_str ) CALL domain_clock_get( grid, current_timestr=res_str ) CALL domain_time_test_print( pre_str, 'current_timestr', res_str ) CALL domain_clock_get( grid, current_timestr_frac=res_str ) CALL domain_time_test_print( pre_str, 'current_timestr_frac', res_str ) CALL domain_clock_get( grid, timeSinceSimulationStart=timeSinceSimulationStart ) CALL WRFU_TimeIntervalGet( timeSinceSimulationStart, timeString=res_str, rc=rc ) IF ( rc /= WRFU_SUCCESS ) THEN CALL wrf_error_fatal3("",6846,& 'domain_time_test: WRFU_TimeIntervalGet() failed' ) ENDIF CALL domain_time_test_print( pre_str, 'timeSinceSimulationStart', res_str ) IF ( .NOT. one_time_tests_done ) THEN one_time_tests_done = .TRUE. CALL domain_clock_get( grid, simulationStartTimeStr=res_str ) CALL domain_time_test_print( pre_str, 'simulationStartTime', res_str ) CALL domain_clock_get( grid, start_timestr=res_str ) CALL domain_time_test_print( pre_str, 'start_timestr', res_str ) CALL domain_clock_get( grid, stop_timestr=res_str ) CALL domain_time_test_print( pre_str, 'stop_timestr', res_str ) CALL domain_clock_get( grid, time_stepstr=res_str ) CALL domain_time_test_print( pre_str, 'time_stepstr', res_str ) CALL domain_clock_get( grid, time_stepstr_frac=res_str ) CALL domain_time_test_print( pre_str, 'time_stepstr_frac', res_str ) CALL test_adjust_io_timestr( TI_h=3, TI_m=0, TI_s=0, & CT_yy=2000, CT_mm=1, CT_dd=26, CT_h=0, CT_m=0, CT_s=0, & ST_yy=2000, ST_mm=1, ST_dd=24, ST_h=12, ST_m=0, ST_s=0, & res_str='2000-01-26_00:00:00', testname='adjust_io_timestr_1' ) ENDIF ENDIF RETURN END SUBROUTINE domain_time_test END MODULE module_domain SUBROUTINE get_current_time_string( time_str ) USE module_domain IMPLICIT NONE CHARACTER (LEN=*), INTENT(OUT) :: time_str INTEGER :: debug_level_lcl time_str = '' IF ( current_grid_set ) THEN IF ( current_grid%time_set ) THEN CALL get_wrf_debug_level( debug_level_lcl ) CALL set_wrf_debug_level ( 0 ) current_grid_set = .FALSE. CALL domain_clock_get( current_grid, current_timestr_frac=time_str ) CALL set_wrf_debug_level ( debug_level_lcl ) current_grid_set = .TRUE. ENDIF ENDIF END SUBROUTINE get_current_time_string SUBROUTINE get_current_grid_name( grid_str ) USE module_domain IMPLICIT NONE CHARACTER (LEN=*), INTENT(OUT) :: grid_str grid_str = '' IF ( current_grid_set ) THEN WRITE(grid_str,FMT="('d',I2.2)") current_grid%id ENDIF END SUBROUTINE get_current_grid_name SUBROUTINE get_ijk_from_grid_ext ( grid , & ids, ide, jds, jde, kds, kde, & ims, ime, jms, jme, kms, kme, & ips, ipe, jps, jpe, kps, kpe, & imsx, imex, jmsx, jmex, kmsx, kmex, & ipsx, ipex, jpsx, jpex, kpsx, kpex, & imsy, imey, jmsy, jmey, kmsy, kmey, & ipsy, ipey, jpsy, jpey, kpsy, kpey ) USE module_domain IMPLICIT NONE TYPE( domain ), INTENT (IN) :: grid INTEGER, INTENT(OUT) :: & ids, ide, jds, jde, kds, kde, & ims, ime, jms, jme, kms, kme, & ips, ipe, jps, jpe, kps, kpe, & imsx, imex, jmsx, jmex, kmsx, kmex, & ipsx, ipex, jpsx, jpex, kpsx, kpex, & imsy, imey, jmsy, jmey, kmsy, kmey, & ipsy, ipey, jpsy, jpey, kpsy, kpey CALL get_ijk_from_grid2 ( grid , & ids, ide, jds, jde, kds, kde, & ims, ime, jms, jme, kms, kme, & ips, ipe, jps, jpe, kps, kpe ) data_ordering : SELECT CASE ( model_data_order ) CASE ( DATA_ORDER_XYZ ) imsx = grid%sm31x ; imex = grid%em31x ; jmsx = grid%sm32x ; jmex = grid%em32x ; kmsx = grid%sm33x ; kmex = grid%em33x ; ipsx = grid%sp31x ; ipex = grid%ep31x ; jpsx = grid%sp32x ; jpex = grid%ep32x ; kpsx = grid%sp33x ; kpex = grid%ep33x ; imsy = grid%sm31y ; imey = grid%em31y ; jmsy = grid%sm32y ; jmey = grid%em32y ; kmsy = grid%sm33y ; kmey = grid%em33y ; ipsy = grid%sp31y ; ipey = grid%ep31y ; jpsy = grid%sp32y ; jpey = grid%ep32y ; kpsy = grid%sp33y ; kpey = grid%ep33y ; CASE ( DATA_ORDER_YXZ ) imsx = grid%sm32x ; imex = grid%em32x ; jmsx = grid%sm31x ; jmex = grid%em31x ; kmsx = grid%sm33x ; kmex = grid%em33x ; ipsx = grid%sp32x ; ipex = grid%ep32x ; jpsx = grid%sp31x ; jpex = grid%ep31x ; kpsx = grid%sp33x ; kpex = grid%ep33x ; imsy = grid%sm32y ; imey = grid%em32y ; jmsy = grid%sm31y ; jmey = grid%em31y ; kmsy = grid%sm33y ; kmey = grid%em33y ; ipsy = grid%sp32y ; ipey = grid%ep32y ; jpsy = grid%sp31y ; jpey = grid%ep31y ; kpsy = grid%sp33y ; kpey = grid%ep33y ; CASE ( DATA_ORDER_ZXY ) imsx = grid%sm32x ; imex = grid%em32x ; jmsx = grid%sm33x ; jmex = grid%em33x ; kmsx = grid%sm31x ; kmex = grid%em31x ; ipsx = grid%sp32x ; ipex = grid%ep32x ; jpsx = grid%sp33x ; jpex = grid%ep33x ; kpsx = grid%sp31x ; kpex = grid%ep31x ; imsy = grid%sm32y ; imey = grid%em32y ; jmsy = grid%sm33y ; jmey = grid%em33y ; kmsy = grid%sm31y ; kmey = grid%em31y ; ipsy = grid%sp32y ; ipey = grid%ep32y ; jpsy = grid%sp33y ; jpey = grid%ep33y ; kpsy = grid%sp31y ; kpey = grid%ep31y ; CASE ( DATA_ORDER_ZYX ) imsx = grid%sm33x ; imex = grid%em33x ; jmsx = grid%sm32x ; jmex = grid%em32x ; kmsx = grid%sm31x ; kmex = grid%em31x ; ipsx = grid%sp33x ; ipex = grid%ep33x ; jpsx = grid%sp32x ; jpex = grid%ep32x ; kpsx = grid%sp31x ; kpex = grid%ep31x ; imsy = grid%sm33y ; imey = grid%em33y ; jmsy = grid%sm32y ; jmey = grid%em32y ; kmsy = grid%sm31y ; kmey = grid%em31y ; ipsy = grid%sp33y ; ipey = grid%ep33y ; jpsy = grid%sp32y ; jpey = grid%ep32y ; kpsy = grid%sp31y ; kpey = grid%ep31y ; CASE ( DATA_ORDER_XZY ) imsx = grid%sm31x ; imex = grid%em31x ; jmsx = grid%sm33x ; jmex = grid%em33x ; kmsx = grid%sm32x ; kmex = grid%em32x ; ipsx = grid%sp31x ; ipex = grid%ep31x ; jpsx = grid%sp33x ; jpex = grid%ep33x ; kpsx = grid%sp32x ; kpex = grid%ep32x ; imsy = grid%sm31y ; imey = grid%em31y ; jmsy = grid%sm33y ; jmey = grid%em33y ; kmsy = grid%sm32y ; kmey = grid%em32y ; ipsy = grid%sp31y ; ipey = grid%ep31y ; jpsy = grid%sp33y ; jpey = grid%ep33y ; kpsy = grid%sp32y ; kpey = grid%ep32y ; CASE ( DATA_ORDER_YZX ) imsx = grid%sm33x ; imex = grid%em33x ; jmsx = grid%sm31x ; jmex = grid%em31x ; kmsx = grid%sm32x ; kmex = grid%em32x ; ipsx = grid%sp33x ; ipex = grid%ep33x ; jpsx = grid%sp31x ; jpex = grid%ep31x ; kpsx = grid%sp32x ; kpex = grid%ep32x ; imsy = grid%sm33y ; imey = grid%em33y ; jmsy = grid%sm31y ; jmey = grid%em31y ; kmsy = grid%sm32y ; kmey = grid%em32y ; ipsy = grid%sp33y ; ipey = grid%ep33y ; jpsy = grid%sp31y ; jpey = grid%ep31y ; kpsy = grid%sp32y ; kpey = grid%ep32y ; END SELECT data_ordering END SUBROUTINE get_ijk_from_grid_ext SUBROUTINE get_ijk_from_subgrid_ext ( grid , & ids0, ide0, jds0, jde0, kds0, kde0, & ims0, ime0, jms0, jme0, kms0, kme0, & ips0, ipe0, jps0, jpe0, kps0, kpe0 ) USE module_domain IMPLICIT NONE TYPE( domain ), INTENT (IN) :: grid INTEGER, INTENT(OUT) :: & ids0, ide0, jds0, jde0, kds0, kde0, & ims0, ime0, jms0, jme0, kms0, kme0, & ips0, ipe0, jps0, jpe0, kps0, kpe0 INTEGER :: & ids, ide, jds, jde, kds, kde, & ims, ime, jms, jme, kms, kme, & ips, ipe, jps, jpe, kps, kpe CALL get_ijk_from_grid ( grid , & ids, ide, jds, jde, kds, kde, & ims, ime, jms, jme, kms, kme, & ips, ipe, jps, jpe, kps, kpe ) ids0 = ids ide0 = ide * grid%sr_x ims0 = (ims-1)*grid%sr_x+1 ime0 = ime * grid%sr_x ips0 = (ips-1)*grid%sr_x+1 ipe0 = ipe * grid%sr_x jds0 = jds jde0 = jde * grid%sr_y jms0 = (jms-1)*grid%sr_y+1 jme0 = jme * grid%sr_y jps0 = (jps-1)*grid%sr_y+1 jpe0 = jpe * grid%sr_y kds0 = kds kde0 = kde kms0 = kms kme0 = kme kps0 = kps kpe0 = kpe RETURN END SUBROUTINE get_ijk_from_subgrid_ext SUBROUTINE get_dims_from_grid_id ( id & ,ds, de & ,ms, me & ,ps, pe & ,mxs, mxe & ,pxs, pxe & ,mys, mye & ,pys, pye ) USE module_domain, ONLY : domain, head_grid, find_grid_by_id IMPLICIT NONE TYPE( domain ), POINTER :: grid INTEGER, INTENT(IN ) :: id INTEGER, DIMENSION(3), INTENT(INOUT) :: & ds, de & ,ms, me & ,ps, pe & ,mxs, mxe & ,pxs, pxe & ,mys, mye & ,pys, pye CHARACTER*256 mess NULLIFY( grid ) CALL find_grid_by_id ( id, head_grid, grid ) IF ( ASSOCIATED(grid) ) THEN ds(1) = grid%sd31 ; de(1) = grid%ed31 ; ds(2) = grid%sd32 ; de(2) = grid%ed32 ; ds(3) = grid%sd33 ; de(3) = grid%ed33 ; ms(1) = grid%sm31 ; me(1) = grid%em31 ; ms(2) = grid%sm32 ; me(2) = grid%em32 ; ms(3) = grid%sm33 ; me(3) = grid%em33 ; ps(1) = grid%sp31 ; pe(1) = grid%ep31 ; ps(2) = grid%sp32 ; pe(2) = grid%ep32 ; ps(3) = grid%sp33 ; pe(3) = grid%ep33 ; mxs(1) = grid%sm31x ; mxe(1) = grid%em31x mxs(2) = grid%sm32x ; mxe(2) = grid%em32x mxs(3) = grid%sm33x ; mxe(3) = grid%em33x pxs(1) = grid%sp31x ; pxe(1) = grid%ep31x pxs(2) = grid%sp32x ; pxe(2) = grid%ep32x pxs(3) = grid%sp33x ; pxe(3) = grid%ep33x mys(1) = grid%sm31y ; mye(1) = grid%em31y mys(2) = grid%sm32y ; mye(2) = grid%em32y mys(3) = grid%sm33y ; mye(3) = grid%em33y pys(1) = grid%sp31y ; pye(1) = grid%ep31y pys(2) = grid%sp32y ; pye(2) = grid%ep32y pys(3) = grid%sp33y ; pye(3) = grid%ep33y ELSE WRITE(mess,*)'internal error: get_ijk_from_grid_id: no such grid id:',id CALL wrf_error_fatal3("",7100,& TRIM(mess)) ENDIF END SUBROUTINE get_dims_from_grid_id SUBROUTINE get_ijk_from_grid_id ( id , & ids, ide, jds, jde, kds, kde, & ims, ime, jms, jme, kms, kme, & ips, ipe, jps, jpe, kps, kpe, & imsx, imex, jmsx, jmex, kmsx, kmex, & ipsx, ipex, jpsx, jpex, kpsx, kpex, & imsy, imey, jmsy, jmey, kmsy, kmey, & ipsy, ipey, jpsy, jpey, kpsy, kpey ) USE module_domain, ONLY : domain, head_grid, find_grid_by_id, get_ijk_from_grid IMPLICIT NONE TYPE( domain ), POINTER :: grid INTEGER, INTENT(IN ) :: id INTEGER, INTENT(OUT) :: & ids, ide, jds, jde, kds, kde, & ims, ime, jms, jme, kms, kme, & ips, ipe, jps, jpe, kps, kpe, & imsx, imex, jmsx, jmex, kmsx, kmex, & ipsx, ipex, jpsx, jpex, kpsx, kpex, & imsy, imey, jmsy, jmey, kmsy, kmey, & ipsy, ipey, jpsy, jpey, kpsy, kpey CHARACTER*256 mess NULLIFY( grid ) CALL find_grid_by_id ( id, head_grid, grid ) IF ( ASSOCIATED(grid) ) THEN CALL get_ijk_from_grid ( grid , & ids, ide, jds, jde, kds, kde, & ims, ime, jms, jme, kms, kme, & ips, ipe, jps, jpe, kps, kpe, & imsx, imex, jmsx, jmex, kmsx, kmex, & ipsx, ipex, jpsx, jpex, kpsx, kpex, & imsy, imey, jmsy, jmey, kmsy, kmey, & ipsy, ipey, jpsy, jpey, kpsy, kpey ) ELSE WRITE(mess,*)'internal error: get_ijk_from_grid_id: no such grid id:',id CALL wrf_error_fatal3("",7144,& TRIM(mess)) ENDIF END SUBROUTINE get_ijk_from_grid_id SUBROUTINE modify_io_masks ( id ) USE module_domain, ONLY : domain, modify_io_masks1, head_grid, find_grid_by_id IMPLICIT NONE INTEGER, INTENT(IN) :: id TYPE(domain), POINTER :: grid CALL find_grid_by_id( id, head_grid, grid ) IF ( ASSOCIATED( grid ) ) CALL modify_io_masks1( grid, id ) RETURN END SUBROUTINE modify_io_masks