Ignore:
Timestamp:
Oct 26, 2018 6:25:44 PM (5 years ago)
Author:
gronemeier
Message:

new: terrain-following masked output; bugfixes: increase vertical dimension of gamma_w_green_sat by 1, add checks for masked output for chemistry_model and radiation_model, reordered calls to xxx_define_netcdf_grid in masked output part

File:
1 edited

Legend:

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

    r3421 r3435  
    2525! -----------------
    2626! $Id$
     27! Bugfix: corrected order of calls to define_netcdf_grid for masked output
     28! Add vertical dimensions to masked output in case of terrain-following output
     29!
     30! 3421 2018-10-24 18:39:32Z gronemeier
    2731! Bugfix: move ocean output variables to ocean_mod
    2832! Renamed output variables
     
    589593               do3d_time_count, domask_time_count, end_time, land_surface,     &
    590594               mask_size_l, mask_i, mask_i_global, mask_j, mask_j_global,      &
    591                mask_k_global, message_string, mid, ntdim_2d_xy, ntdim_2d_xz,   &
     595               mask_k_global, mask_surface,                                    &
     596               message_string, mid, ntdim_2d_xy, ntdim_2d_xz,                  &
    592597               ntdim_2d_yz, ntdim_3d, nz_do3d, ocean_mode, plant_canopy,       &
    593598               run_description_header, section, simulated_time,                &
     
    873878!
    874879!--       Define spatial dimensions and coordinates:
    875 !--       Define vertical coordinate grid (zu grid)
    876           CALL netcdf_create_dim( id_set_mask(mid,av), 'zu_3d',                &
    877                                   mask_size(mid,3), id_dim_zu_mask(mid,av),    &
    878                                   470 )
    879           CALL netcdf_create_var( id_set_mask(mid,av),                         &
    880                                   (/ id_dim_zu_mask(mid,av) /), 'zu_3d',       &
    881                                   NF90_DOUBLE, id_var_zu_mask(mid,av),         &
    882                                   'meters', '', 471, 472, 000 )
    883 !
    884 !--       Define vertical coordinate grid (zw grid)
    885           CALL netcdf_create_dim( id_set_mask(mid,av), 'zw_3d',                &
    886                                   mask_size(mid,3), id_dim_zw_mask(mid,av),    &
    887                                   473 )
    888           CALL netcdf_create_var( id_set_mask(mid,av),                         &
    889                                   (/ id_dim_zw_mask(mid,av) /), 'zw_3d',       &
    890                                   NF90_DOUBLE, id_var_zw_mask(mid,av),         &
    891                                  'meters', '', 474, 475, 000 )
     880          IF ( mask_surface(mid) )  THEN
     881!
     882!--          In case of terrain-following output, the vertical dimensions are
     883!--          indices, not meters
     884             CALL netcdf_create_dim( id_set_mask(mid,av), 'ku_above_surf',     &
     885                                     mask_size(mid,3), id_dim_zu_mask(mid,av), &
     886                                     470 )
     887             CALL netcdf_create_var( id_set_mask(mid,av),                      &
     888                                     (/ id_dim_zu_mask(mid,av) /),             &
     889                                     'ku_above_surf',                          &
     890                                     NF90_DOUBLE, id_var_zu_mask(mid,av),      &
     891                                     '1', 'grid point above terrain',          &
     892                                     471, 472, 000 )
     893             CALL netcdf_create_dim( id_set_mask(mid,av), 'kw_above_surf',     &
     894                                     mask_size(mid,3), id_dim_zw_mask(mid,av), &
     895                                     473 )
     896             CALL netcdf_create_var( id_set_mask(mid,av),                      &
     897                                     (/ id_dim_zw_mask(mid,av) /),             &
     898                                     'kw_above_surf',                          &
     899                                     NF90_DOUBLE, id_var_zw_mask(mid,av),      &
     900                                    '1', 'grid point above terrain',           &
     901                                    474, 475, 000 )
     902          ELSE
     903!
     904!--          Define vertical coordinate grid (zu grid)
     905             CALL netcdf_create_dim( id_set_mask(mid,av), 'zu_3d',             &
     906                                     mask_size(mid,3), id_dim_zu_mask(mid,av), &
     907                                     470 )
     908             CALL netcdf_create_var( id_set_mask(mid,av),                      &
     909                                     (/ id_dim_zu_mask(mid,av) /), 'zu_3d',    &
     910                                     NF90_DOUBLE, id_var_zu_mask(mid,av),      &
     911                                     'meters', '', 471, 472, 000 )
     912!
     913!--          Define vertical coordinate grid (zw grid)
     914             CALL netcdf_create_dim( id_set_mask(mid,av), 'zw_3d',             &
     915                                     mask_size(mid,3), id_dim_zw_mask(mid,av), &
     916                                     473 )
     917             CALL netcdf_create_var( id_set_mask(mid,av),                      &
     918                                     (/ id_dim_zw_mask(mid,av) /), 'zw_3d',    &
     919                                     NF90_DOUBLE, id_var_zw_mask(mid,av),      &
     920                                    'meters', '', 474, 475, 000 )
     921          ENDIF
    892922!
    893923!--       Define x-axis (for scalar position)
     
    10681098!
    10691099!--                Check for quantities defined in other modules
     1100                   CALL tcm_define_netcdf_grid( domask( mid,av,i), found,      &
     1101                                                        grid_x, grid_y, grid_z )
     1102
    10701103                   IF ( .NOT. found  .AND.  air_chemistry )  THEN
    10711104                      CALL chem_define_netcdf_grid( domask(mid,av,i), found,   &
     
    11051138                                                         grid_z )
    11061139                   ENDIF
    1107 
    1108                    CALL tcm_define_netcdf_grid( domask( mid,av,i), found,      &
    1109                                                         grid_x, grid_y, grid_z )
    1110 
    11111140!
    11121141!--                Now check for user-defined quantities
     
    13431372          ALLOCATE( netcdf_data(mask_size(mid,3)) )
    13441373
    1345           netcdf_data = zu( mask_k_global(mid,:mask_size(mid,3)) )
    1346 
    1347           nc_stat = NF90_PUT_VAR( id_set_mask(mid,av), id_var_zu_mask(mid,av), &
    1348                                   netcdf_data, start = (/ 1 /), &
    1349                                   count = (/ mask_size(mid,3) /) )
    1350           CALL netcdf_handle_error( 'netcdf_define_header', 503 )
    1351 
    1352           netcdf_data = zw( mask_k_global(mid,:mask_size(mid,3)) )
    1353 
    1354           nc_stat = NF90_PUT_VAR( id_set_mask(mid,av), id_var_zw_mask(mid,av), &
    1355                                   netcdf_data, start = (/ 1 /), &
    1356                                   count = (/ mask_size(mid,3) /) )
    1357           CALL netcdf_handle_error( 'netcdf_define_header', 504 )
     1374          IF ( mask_surface(mid) )  THEN
     1375
     1376             netcdf_data = mask_k_global(mid,:mask_size(mid,3))
     1377
     1378             nc_stat = NF90_PUT_VAR( id_set_mask(mid,av), id_var_zu_mask(mid,av), &
     1379                                     netcdf_data, start = (/ 1 /), &
     1380                                     count = (/ mask_size(mid,3) /) )
     1381             CALL netcdf_handle_error( 'netcdf_define_header', 503 )
     1382
     1383             netcdf_data = mask_k_global(mid,:mask_size(mid,3))
     1384
     1385             nc_stat = NF90_PUT_VAR( id_set_mask(mid,av), id_var_zw_mask(mid,av), &
     1386                                     netcdf_data, start = (/ 1 /), &
     1387                                     count = (/ mask_size(mid,3) /) )
     1388             CALL netcdf_handle_error( 'netcdf_define_header', 504 )
     1389
     1390          ELSE
     1391
     1392             netcdf_data = zu( mask_k_global(mid,:mask_size(mid,3)) )
     1393
     1394             nc_stat = NF90_PUT_VAR( id_set_mask(mid,av), id_var_zu_mask(mid,av), &
     1395                                     netcdf_data, start = (/ 1 /), &
     1396                                     count = (/ mask_size(mid,3) /) )
     1397             CALL netcdf_handle_error( 'netcdf_define_header', 503 )
     1398
     1399             netcdf_data = zw( mask_k_global(mid,:mask_size(mid,3)) )
     1400
     1401             nc_stat = NF90_PUT_VAR( id_set_mask(mid,av), id_var_zw_mask(mid,av), &
     1402                                     netcdf_data, start = (/ 1 /), &
     1403                                     count = (/ mask_size(mid,3) /) )
     1404             CALL netcdf_handle_error( 'netcdf_define_header', 504 )
     1405
     1406          ENDIF
    13581407
    13591408          DEALLOCATE( netcdf_data )
Note: See TracChangeset for help on using the changeset viewer.