Changeset 3556


Ignore:
Timestamp:
Nov 22, 2018 2:11:57 PM (5 years ago)
Author:
suehring
Message:

restart mechanism for surface elements commented, some formatting

Location:
palm/trunk/SOURCE
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • palm/trunk/SOURCE/netcdf_data_input_mod.f90

    r3553 r3556  
    2020! Current revisions:
    2121! -----------------
    22 !
     22! Some formatting adjustment
    2323!
    2424! Former revisions:
     
    946946                           input_file_atts%rotation_angle, .TRUE. )
    947947
    948        CALL get_attribute( id_mod, input_file_atts%author_char,         input_file_atts%author,         .TRUE., no_abort=.FALSE. )
    949        CALL get_attribute( id_mod, input_file_atts%contact_person_char, input_file_atts%contact_person, .TRUE., no_abort=.FALSE. )
    950        CALL get_attribute( id_mod, input_file_atts%institution_char,    input_file_atts%institution,    .TRUE., no_abort=.FALSE. )
    951        CALL get_attribute( id_mod, input_file_atts%acronym_char,        input_file_atts%acronym,        .TRUE., no_abort=.FALSE. )
    952 
    953        CALL get_attribute( id_mod, input_file_atts%campaign_char, input_file_atts%campaign, .TRUE., no_abort=.FALSE. )
    954        CALL get_attribute( id_mod, input_file_atts%location_char, input_file_atts%location, .TRUE., no_abort=.FALSE. )
    955        CALL get_attribute( id_mod, input_file_atts%site_char,     input_file_atts%site,     .TRUE., no_abort=.FALSE. )
    956 
    957        CALL get_attribute( id_mod, input_file_atts%source_char,     input_file_atts%source,     .TRUE., no_abort=.FALSE. )
    958        CALL get_attribute( id_mod, input_file_atts%references_char, input_file_atts%references, .TRUE., no_abort=.FALSE. )
    959        CALL get_attribute( id_mod, input_file_atts%keywords_char,   input_file_atts%keywords,   .TRUE., no_abort=.FALSE. )
    960        CALL get_attribute( id_mod, input_file_atts%licence_char,    input_file_atts%licence,    .TRUE., no_abort=.FALSE. )
    961        CALL get_attribute( id_mod, input_file_atts%comment_char,    input_file_atts%comment,    .TRUE., no_abort=.FALSE. )
     948       CALL get_attribute( id_mod, input_file_atts%author_char,                &
     949                           input_file_atts%author, .TRUE., no_abort=.FALSE. )
     950       CALL get_attribute( id_mod, input_file_atts%contact_person_char,        &
     951                           input_file_atts%contact_person, .TRUE., no_abort=.FALSE. )
     952       CALL get_attribute( id_mod, input_file_atts%institution_char,           &
     953                           input_file_atts%institution,    .TRUE., no_abort=.FALSE. )
     954       CALL get_attribute( id_mod, input_file_atts%acronym_char,               &
     955                           input_file_atts%acronym,        .TRUE., no_abort=.FALSE. )
     956
     957       CALL get_attribute( id_mod, input_file_atts%campaign_char,              &
     958                           input_file_atts%campaign, .TRUE., no_abort=.FALSE. )
     959       CALL get_attribute( id_mod, input_file_atts%location_char,              &
     960                           input_file_atts%location, .TRUE., no_abort=.FALSE. )
     961       CALL get_attribute( id_mod, input_file_atts%site_char,                  &
     962                           input_file_atts%site,     .TRUE., no_abort=.FALSE. )
     963
     964       CALL get_attribute( id_mod, input_file_atts%source_char,                &
     965                           input_file_atts%source,     .TRUE., no_abort=.FALSE. )
     966       CALL get_attribute( id_mod, input_file_atts%references_char,            &
     967                           input_file_atts%references, .TRUE., no_abort=.FALSE. )
     968       CALL get_attribute( id_mod, input_file_atts%keywords_char,              &
     969                           input_file_atts%keywords,   .TRUE., no_abort=.FALSE. )
     970       CALL get_attribute( id_mod, input_file_atts%licence_char,               &
     971                           input_file_atts%licence,    .TRUE., no_abort=.FALSE. )
     972       CALL get_attribute( id_mod, input_file_atts%comment_char,               &
     973                           input_file_atts%comment,    .TRUE., no_abort=.FALSE. )
    962974!
    963975!--    Read coordinate reference system if available
  • palm/trunk/SOURCE/surface_mod.f90

    r3547 r3556  
    2121! Current revisions:
    2222! ------------------
    23 !
     23! Surface restoring in restarts commented. Some formatting.
    2424!
    2525! Former revisions:
     
    566566                                                    !< in the domain (required to activiate RTM)
    567567
    568     LOGICAL ::  surf_bulk_cloud_model = .FALSE.                          !< use cloud microphysics
    569     LOGICAL ::  surf_microphysics_morrison = .FALSE.                  !< use 2-moment Morrison (add. prog. eq. for nc and qc)
    570     LOGICAL ::  surf_microphysics_seifert = .FALSE.                   !< use 2-moment Seifert and Beheng scheme
     568    LOGICAL ::  surf_bulk_cloud_model = .FALSE.        !< use cloud microphysics
     569    LOGICAL ::  surf_microphysics_morrison = .FALSE.   !< use 2-moment Morrison (add. prog. eq. for nc and qc)
     570    LOGICAL ::  surf_microphysics_seifert = .FALSE.    !< use 2-moment Seifert and Beheng scheme
    571571
    572572
     
    613613!-- Public subroutines and functions
    614614    PUBLIC get_topography_top_index, get_topography_top_index_ji, init_bc,     &
    615            init_surfaces,                                                      &
    616            init_surface_arrays, surface_rrd_local,                     &
    617            surface_restore_elements, surface_wrd_local,               &
    618            surface_last_actions
     615           init_surfaces, init_surface_arrays, surface_rrd_local,              &
     616           surface_restore_elements, surface_wrd_local, surface_last_actions
    619617
    620618
     
    845843                      terrain  = BTEST( wall_flags_0(k,j-1,i), 5 )  .OR.       &
    846844                                 topo_no_distinct
    847                       building = BTEST( wall_flags_0(k,j-1,i), 6 )   .OR.       &
     845                      building = BTEST( wall_flags_0(k,j-1,i), 6 )   .OR.      &
    848846                                 topo_no_distinct
    849847                      IF (  land_surface  .AND.  terrain )  THEN
     
    859857!--                   Unclassifified surface-grid point. Give error message.
    860858                      ELSE
    861                          WRITE( message_string, * )                           &
    862                                           'Unclassified northward-facing ' // &
    863                                           'surface element at '//             &
     859                         WRITE( message_string, * )                            &
     860                                          'Unclassified northward-facing ' //  &
     861                                          'surface element at '//              &
    864862                                          'grid point (k,j,i) = ', k, j, i
    865863                         CALL message( 'surface_mod', 'PA0999', 1, 2, 0, 6, 0 )
     
    888886!--                   Unclassifified surface-grid point. Give error message.
    889887                      ELSE
    890                          WRITE( message_string, * )                           &
    891                                           'Unclassified southward-facing ' // &
    892                                           'surface element at '//             &
     888                         WRITE( message_string, * )                            &
     889                                          'Unclassified southward-facing ' //  &
     890                                          'surface element at '//              &
    893891                                          'grid point (k,j,i) = ', k, j, i
    894892                         CALL message( 'surface_mod', 'PA0999', 1, 2, 0, 6, 0 )
     
    917915!--                   Unclassifified surface-grid point. Give error message.
    918916                      ELSE
    919                          WRITE( message_string, * )                           &
    920                                           'Unclassified eastward-facing ' //  &
    921                                           'surface element at '//             &
     917                         WRITE( message_string, * )                            &
     918                                          'Unclassified eastward-facing ' //   &
     919                                          'surface element at '//              &
    922920                                          'grid point (k,j,i) = ', k, j, i
    923921                         CALL message( 'surface_mod', 'PA0999', 1, 2, 0, 6, 0 )
     
    946944!--                   Unclassifified surface-grid point. Give error message.
    947945                      ELSE
    948                          WRITE( message_string, * )                           &
    949                                           'Unclassified westward-facing ' //  &
    950                                           'surface element at '//             &
     946                         WRITE( message_string, * )                            &
     947                                          'Unclassified westward-facing ' //   &
     948                                          'surface element at '//              &
    951949                                          'grid point (k,j,i) = ', k, j, i
    952950                         CALL message( 'surface_mod', 'PA0999', 1, 2, 0, 6, 0 )
     
    10561054
    10571055#if defined( __parallel )
    1058        CALL MPI_ALLREDUCE( num_surf_v_l, num_surf_v, 1, MPI_INTEGER, MPI_SUM, comm2d, ierr)
     1056       CALL MPI_ALLREDUCE( num_surf_v_l, num_surf_v, 1, MPI_INTEGER,           &
     1057                           MPI_SUM, comm2d, ierr)
    10591058#else
    10601059       num_surf_v = num_surf_v_l
    10611060#endif
    1062        IF ( num_surf_v > 0 ) vertical_surfaces_exist = .TRUE.
     1061       IF ( num_surf_v > 0 )  vertical_surfaces_exist = .TRUE.
    10631062       
    10641063
     
    29002899          ENDDO
    29012900!
    2902 !--       Gather start- and end indices
     2901!--       Recalculate start- and end indices for gathered surface type.
    29032902          start_index_h(l) = 1                                       
    29042903          DO  i = nxl, nxr
     
    29062905
    29072906                surf_h(l)%start_index(j,i) = start_index_h(l)
    2908                 surf_h(l)%end_index(j,i)   = surf_h(l)%start_index(j,i) -1
     2907                surf_h(l)%end_index(j,i)   = surf_h(l)%start_index(j,i) - 1
    29092908
    29102909                DO  m = surf_def_h(l)%start_index(j,i),                        &
     
    29282927          ENDDO
    29292928       ENDDO
    2930 
    2931 
     2929!
     2930!--    Treat vertically orientated surface. Again, gather data from different
     2931!--    surfaces types but identical orientation (e.g. northward-facing) onto
     2932!--    one surface type which is output afterwards.
    29322933       mm(0:3) = 1
    29332934       DO  l = 0, 3
     
    31373138          ENDDO
    31383139!
    3139 !--       Gather start- and end indices
     3140!--       Recalculate start- and end-indices for gathered surface type
    31403141          start_index_v(l) = 1                                       
    31413142          DO  i = nxl, nxr
     
    31633164
    31643165       ENDDO
    3165 
    3166 
     3166!
     3167!--    Output strings for the total number of upward / downward-facing surfaces
     3168!--    on subdomain.
    31673169       CALL wrd_write_string( 'ns_h_on_file' )
    31683170       WRITE ( 14 )  ns_h_on_file
    3169 
     3171!
     3172!--    Output strings for the total number of north/south/east/westward-facing surfaces
     3173!--    on subdomain.
    31703174       CALL wrd_write_string( 'ns_v_on_file' )
    31713175       WRITE ( 14 )  ns_v_on_file
     
    31733177!
    31743178!--    Write required restart data.
    3175 !--    Start with horizontal surfaces (upward-, downward-facing, and model top)
     3179!--    Start with horizontal surfaces (upward-, downward-facing, and model top).
     3180!--    Always start with %start_index followed by %end_index
    31763181       DO  l = 0, 2
    31773182          WRITE( dum, '(I1)')  l
     
    33103315       ENDDO
    33113316!
    3312 !--    Write vertical surfaces
     3317!--    Write vertical surfaces.
     3318!--    Always start with %start_index followed by %end_index.
    33133319       DO  l = 0, 3
    33143320          WRITE( dum, '(I1)')  l
     
    34803486       INTEGER(iwp)       ::  m           !< running index for surface elements, refers to gathered array encompassing all surface types
    34813487       INTEGER(iwp)       ::  mm          !< running index for surface elements, refers to individual surface types
    3482        INTEGER(iwp)       ::  ii               !< running index over input files
    3483        INTEGER(iwp)       ::  kk               !< running index over previous input files covering current local domain
    3484        INTEGER(iwp)       ::  nxlc             !< index of left boundary on current subdomain
    3485        INTEGER(iwp)       ::  nxlf             !< index of left boundary on former subdomain
    3486        INTEGER(iwp)       ::  nxl_on_file      !< index of left boundary on former local domain
    3487        INTEGER(iwp)       ::  nxrc             !< index of right boundary on current subdomain
    3488        INTEGER(iwp)       ::  nxrf             !< index of right boundary on former subdomain
    3489        INTEGER(iwp)       ::  nxr_on_file      !< index of right boundary on former local domain 
    3490        INTEGER(iwp)       ::  nync             !< index of north boundary on current subdomain
    3491        INTEGER(iwp)       ::  nynf             !< index of north boundary on former subdomain
    3492        INTEGER(iwp)       ::  nyn_on_file      !< index of norht boundary on former local domain 
    3493        INTEGER(iwp)       ::  nysc             !< index of south boundary on current subdomain
    3494        INTEGER(iwp)       ::  nysf             !< index of south boundary on former subdomain
    3495        INTEGER(iwp)       ::  nys_on_file      !< index of south boundary on former local domain 
    3496 
    3497        INTEGER(iwp), SAVE  ::  l           !< index variable for surface type
    3498 
    3499        LOGICAL                         ::  surf_match_def     !< flag indicating that surface element is of default type
    3500        LOGICAL                         ::  surf_match_lsm     !< flag indicating that surface element is of natural type
    3501        LOGICAL                         ::  surf_match_usm     !< flag indicating that surface element is of urban type
     3488       INTEGER(iwp)       ::  ii          !< running index over input files
     3489       INTEGER(iwp)       ::  kk          !< running index over previous input files covering current local domain
     3490       INTEGER(iwp)       ::  nxlc        !< index of left boundary on current subdomain
     3491       INTEGER(iwp)       ::  nxlf        !< index of left boundary on former subdomain
     3492       INTEGER(iwp)       ::  nxl_on_file !< index of left boundary on former local domain
     3493       INTEGER(iwp)       ::  nxrc        !< index of right boundary on current subdomain
     3494       INTEGER(iwp)       ::  nxrf        !< index of right boundary on former subdomain
     3495       INTEGER(iwp)       ::  nxr_on_file !< index of right boundary on former local domain 
     3496       INTEGER(iwp)       ::  nync        !< index of north boundary on current subdomain
     3497       INTEGER(iwp)       ::  nynf        !< index of north boundary on former subdomain
     3498       INTEGER(iwp)       ::  nyn_on_file !< index of norht boundary on former local domain 
     3499       INTEGER(iwp)       ::  nysc        !< index of south boundary on current subdomain
     3500       INTEGER(iwp)       ::  nysf        !< index of south boundary on former subdomain
     3501       INTEGER(iwp)       ::  nys_on_file !< index of south boundary on former local domain 
     3502
     3503       INTEGER(iwp), SAVE ::  l           !< index variable for surface type
     3504
     3505       LOGICAL            ::  surf_match_def     !< flag indicating that surface element is of default type
     3506       LOGICAL            ::  surf_match_lsm     !< flag indicating that surface element is of natural type
     3507       LOGICAL            ::  surf_match_usm     !< flag indicating that surface element is of urban type
    35023508
    35033509       LOGICAL, INTENT(OUT) ::  found
     
    35063512       LOGICAL, SAVE ::  vertical_surface   !< flag indicating vertical surfaces
    35073513
    3508        TYPE(surf_type), DIMENSION(0:2), SAVE ::  surf_h             !< horizontal surface type on file
    3509        TYPE(surf_type), DIMENSION(0:3), SAVE ::  surf_v             !< vertical surface type on file
     3514       TYPE(surf_type), DIMENSION(0:2), SAVE ::  surf_h !< horizontal surface type on file
     3515       TYPE(surf_type), DIMENSION(0:3), SAVE ::  surf_v !< vertical surface type on file
    35103516
    35113517
     
    35133519
    35143520       SELECT CASE ( restart_string(1:length) )
    3515 
     3521!
     3522!--       Read the number of horizontally orientated surface elements and
     3523!--       allocate arrays
    35163524          CASE ( 'ns_h_on_file' )
    35173525             IF ( kk == 1 )  THEN
     
    35243532                IF ( ALLOCATED( surf_h(2)%start_index ) )                      &
    35253533                   CALL deallocate_surface_attributes_h_top( surf_h(2) )       
    3526 
     3534!
    35273535!--             Allocate memory for number of surface elements on file.
    35283536!--             Please note, these number is not necessarily the same as
     
    35353543                                        nys_on_file, nyn_on_file,              &
    35363544                                        nxl_on_file, nxr_on_file )
    3537 
     3545!
    35383546!--             Horizontal downward facing
    35393547                surf_h(1)%ns = ns_h_on_file(1)
     
    35413549                                        nys_on_file, nyn_on_file,              &
    35423550                                        nxl_on_file, nxr_on_file )
    3543 
     3551!
    35443552!--             Model top
    35453553                surf_h(2)%ns = ns_h_on_file(2)
     
    35553563
    35563564             ENDIF   
    3557 
     3565!
     3566!--       Read the number of vertically orientated surface elements and
     3567!--       allocate arrays
    35583568          CASE ( 'ns_v_on_file' )
    35593569             IF ( kk == 1 ) THEN
     
    35653575                ENDDO
    35663576
    3567 !--                Vertical surfaces
    35683577                DO  l = 0, 3
    35693578                   surf_v(l)%ns = ns_v_on_file(l)
     
    35743583
    35753584             ENDIF
    3576 
     3585!
     3586!--       Read start and end indices of surface elements at each (ji)-gridpoint
    35773587          CASE ( 'surf_h(0)%start_index' )
    35783588             IF ( kk == 1 )                                                    &
     
    35843594             horizontal_surface = .TRUE.
    35853595             vertical_surface   = .FALSE.
     3596!
     3597!--       Read specific attributes
    35863598          CASE ( 'surf_h(0)%us' )         
    35873599             IF ( ALLOCATED( surf_h(0)%us )  .AND.  kk == 1 )                  &
     
    41784190       END SELECT
    41794191!
    4180 !--    Redistribute surface elements on its respective type.
     4192!--    Redistribute surface elements on its respective type. Start with
     4193!--    horizontally orientated surfaces.
    41814194       IF ( horizontal_surface  .AND.                                          &
    41824195            .NOT. INDEX( restart_string(1:length), '%start_index' ) /= 0 )     &
     
    41874200             jc = nysc
    41884201             DO  j = nysf, nynf
    4189 
     4202!
     4203!--             Determine type of surface element, i.e. default, natural,
     4204!--             urban, at current grid point.
    41904205                surf_match_def  = surf_def_h(l)%end_index(jc,ic) >=            &
    41914206                                  surf_def_h(l)%start_index(jc,ic)
    41924207                surf_match_lsm  = ( surf_lsm_h%end_index(jc,ic)  >=            &
    41934208                                    surf_lsm_h%start_index(jc,ic) )            &
    4194                             .AND.  l == 0
     4209                             .AND.  l == 0
    41954210                surf_match_usm  = ( surf_usm_h%end_index(jc,ic)  >=            &
    41964211                                    surf_usm_h%start_index(jc,ic) )            &
    4197                             .AND.  l == 0
    4198                            
     4212                             .AND.  l == 0
     4213!
     4214!--             Write restart data onto default-type surfaces if required.
    41994215                IF ( surf_match_def )  THEN
     4216!
     4217!--                Set the start index for the local surface element
    42004218                   mm = surf_def_h(l)%start_index(jc,ic)
     4219!
     4220!--                For index pair (j,i) on file loop from start to end index,
     4221!--                and in case the local surface element mm is smaller than
     4222!--                the local end index, assign the respective surface data
     4223!--                to this element.
    42014224                   DO  m = surf_h(l)%start_index(j,i),                         &
    42024225                           surf_h(l)%end_index(j,i)
     
    42074230                   ENDDO
    42084231                ENDIF
    4209 
     4232!
     4233!--             Same for natural-type surfaces. Please note, it is implicitly
     4234!--             assumed that natural surface elements are below urban
     4235!--             urban surface elements if there are several horizontal surfaces
     4236!--             at (j,i). An example would be bridges.
    42104237                IF ( surf_match_lsm )  THEN
    42114238                   mm = surf_lsm_h%start_index(jc,ic)
     
    42184245                   ENDDO
    42194246                ENDIF
    4220 
     4247!
     4248!--             Same for urban-type surfaces
    42214249                IF ( surf_match_usm )  THEN
    42224250                   mm = surf_usm_h%start_index(jc,ic)
     
    42414269             jc = nysc
    42424270             DO  j = nysf, nynf
    4243 
     4271!
     4272!--             Determine type of surface element, i.e. default, natural,
     4273!--             urban, at current grid point.
    42444274                surf_match_def  = surf_def_v(l)%end_index(jc,ic) >=            &
    42454275                                  surf_def_v(l)%start_index(jc,ic)
     
    42484278                surf_match_usm  = surf_usm_v(l)%end_index(jc,ic) >=            &
    42494279                                  surf_usm_v(l)%start_index(jc,ic)
    4250                                  
     4280!
     4281!--             Write restart data onto default-type surfaces if required.               
    42514282                IF ( surf_match_def )  THEN
     4283!
     4284!--                Set the start index for the local surface element
    42524285                   mm = surf_def_v(l)%start_index(jc,ic)
     4286!
     4287!--                For index pair (j,i) on file loop from start to end index,
     4288!--                and in case the local surface element mm is smaller than
     4289!--                the local end index, assign the respective surface data
     4290!--                to this element.
    42534291                   DO  m = surf_v(l)%start_index(j,i),                         &
    42544292                           surf_v(l)%end_index(j,i)
     
    42594297                   ENDDO
    42604298                ENDIF
    4261 
     4299!
     4300!--             Same for natural-type surfaces. Please note, it is implicitly
     4301!--             assumed that natural surface elements are below urban
     4302!--             urban surface elements if there are several vertical surfaces
     4303!--             at (j,i). An example a terrain elevations with a building on
     4304!--             top. So far, initialization of urban surfaces below natural
     4305!--             surfaces on the same (j,i) is not possible, so that this case
     4306!--             cannot occur.
    42624307                IF ( surf_match_lsm )  THEN
    42634308                   mm = surf_lsm_v(l)%start_index(jc,ic)
     
    42934338! Description:
    42944339! ------------
    4295 !> Restores surfacle elements back on its respective type.
     4340!> Restores surface elements back on its respective type.
    42964341!------------------------------------------------------------------------------!
    42974342          SUBROUTINE restore_surface_elements( surf_target, m_target,          &
     
    45114556! Description:
    45124557! ------------
    4513 !> Routine maps surface data read from file after restart - 1D arrays
     4558!> Routine maps surface data read from file after restart - 1D arrays.
    45144559!------------------------------------------------------------------------------!
    45154560    SUBROUTINE surface_restore_elements_1d( surf_target, surf_file,            &
Note: See TracChangeset for help on using the changeset viewer.