Changeset 3537 for palm/trunk/UTIL/inifor/src/inifor_grid.f90
 Timestamp:
 Nov 20, 2018 10:53:14 AM (4 years ago)
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

palm/trunk/UTIL/inifor/src/inifor_grid.f90
r3456 r3537 26 26 !  27 27 ! $Id$ 28 ! Read COSMO domain extents and soil depths from input files 29 ! Report averaging mode and debugging mode in log 30 ! 31 ! 32 ! 3456 20181030 14:29:54Z eckhard 28 33 ! Remove surface forcing from netCDF output (radiation + precipitation) 29 34 ! NetCDf output of internal arrays only with debug option … … 83 88 RHO_L, OMEGA, HECTO 84 89 USE io, & 85 ONLY: get_netcdf_variable, get_netcdf_attribute, & 86 parse_command_line_arguments, validate_config 90 ONLY: get_netcdf_attribute, get_netcdf_dim_vector, & 91 get_netcdf_variable, parse_command_line_arguments, & 92 validate_config 87 93 USE netcdf, & 88 94 ONLY: NF90_MAX_NAME, NF90_MAX_VAR_DIMS … … 154 160 REAL(dp), DIMENSION(:,:,:), ALLOCATABLE, TARGET :: hfl !< heights of full layers (cell centres) above sea level in COSMODE, computed as arithmetic average of hhl 155 161 REAL(dp), DIMENSION(:), ALLOCATABLE, TARGET :: depths !< COSMODE's TERRAML soil layer depths 156 REAL(dp), DIMENSION(:), ALLOCATABLE, TARGET :: d_depth_rho_inv !< COSMODE's TERRAML soil layer thicknesses 162 REAL(dp), DIMENSION(:), ALLOCATABLE, TARGET :: d_depth !< COSMODE's TERRAML soil layer thicknesses 163 REAL(dp), DIMENSION(:), ALLOCATABLE, TARGET :: d_depth_rho_inv !< inverted soil water mass 157 164 REAL(dp), DIMENSION(:), ALLOCATABLE, TARGET :: rlon !< longitudes of COSMODE's rotatedpole grid 158 165 REAL(dp), DIMENSION(:), ALLOCATABLE, TARGET :: rlat !< latitudes of COSMODE's rotatedpole grid … … 177 184 INTEGER :: nlat !< number of latitudal points in target grid (COSMODE) 178 185 INTEGER :: nlev !< number of levels in target grid (COSMODE) 179 INTEGER :: layers !< number of COSMODE soil layers186 INTEGER :: ndepths !< number of COSMODE soil layers 180 187 INTEGER :: start_hour_flow !< start of flow forcing in number of hours relative to start_date 181 188 INTEGER :: start_hour_soil !< start of soil forcing in number of hours relative to start_date, typically equals start_hour_flow … … 293 300 start_hour_soilmoisture =  (4 * 7 * 24)  2 294 301 295 lonmin = 5.0_dp * TO_RADIANS296 lonmax = 5.5_dp * TO_RADIANS297 latmin = 5.0_dp * TO_RADIANS298 latmax = 6.5_dp * TO_RADIANS299 300 302 ! COSMODE default rotated pole 301 303 phi_n = 40.0_dp * TO_RADIANS 302 304 phi_equat = 50.0_dp * TO_RADIANS 303 305 lambda_n = 170.0_dp * TO_RADIANS 304 305 ! COMSMODE soil layers306 layers = 8307 ALLOCATE( depths(layers), d_depth_rho_inv(layers) )308 depths = (/0.005_dp, 0.02_dp, 0.06_dp, 0.18_dp, 0.54_dp, 1.62_dp, 4.86_dp, 14.58_dp/)309 d_depth_rho_inv = 1.0_dp / &310 ( (/0.01_dp, 0.02_dp, 0.06_dp, 0.18_dp, 0.54_dp, 1.62_dp, 4.86_dp, 14.58_dp/) * RHO_L )311 306 312 307 ! Defaultmain centre (_c) of the PALM4U grid in the geographical system (_g) … … 395 390 CALL report('setup_parameters', "initialization mode: " // TRIM(cfg % ic_mode)) 396 391 CALL report('setup_parameters', " forcing mode: " // TRIM(cfg % bc_mode)) 392 CALL report('setup_parameters', " averaging mode: " // TRIM(cfg % averaging_mode)) 397 393 CALL report('setup_parameters', " data path: " // TRIM(cfg % input_path)) 398 394 CALL report('setup_parameters', " hhl file: " // TRIM(cfg % hhl_file)) … … 400 396 CALL report('setup_parameters', " namelist file: " // TRIM(cfg % namelist_file)) 401 397 CALL report('setup_parameters', " output data file: " // TRIM(output_file % name)) 398 IF (cfg % debug ) CALL report('setup_parameters', " debugging mode: enabled") 402 399 403 400 CALL run_control('time', 'init') … … 472 469 cosmo_var % name = 'HHL' 473 470 CALL get_netcdf_variable(cfg % hhl_file, cosmo_var, hhl) 471 CALL get_netcdf_dim_vector(cfg % hhl_file, 'rlon', rlon) 472 CALL get_netcdf_dim_vector(cfg % hhl_file, 'rlat', rlat) 473 CALL get_netcdf_dim_vector(soil_files(1), 'depth_2', depths) 474 474 CALL run_control('time', 'read') 475 475 … … 478 478 nlat = SIZE(hhl, 2) 479 479 nlev = SIZE(hhl, 3) 480 480 ndepths = SIZE(depths) 481 482 lonmin = MINVAL(rlon) * TO_RADIANS 483 lonmax = MAXVAL(rlon) * TO_RADIANS 484 latmin = MINVAL(rlat) * TO_RADIANS 485 latmax = MAXVAL(rlat) * TO_RADIANS 481 486 CALL run_control('time', 'comp') 482 487 483 488 ! Appoximate COSMODE heights of full layers (cell centres) 484 489 ALLOCATE( hfl(nlon, nlat, nlev1) ) 490 ALLOCATE( d_depth(ndepths), d_depth_rho_inv(ndepths) ) 491 485 492 CALL run_control('time', 'alloc') 493 CALL get_soil_layer_thickness( depths, d_depth ) 494 d_depth_rho_inv = 1.0_dp / ( d_depth * RHO_L ) 495 496 ! Appoximate COSMODE heights of full layers (cell centres) 486 497 DO k = 1, nlev1 487 498 hfl(:,:,k) = 0.5_dp * ( hhl(:,:,k) + & 488 499 hhl(:,:,k+1) ) 489 500 END DO 501 CALL run_control('time', 'comp') 502 503 490 504 491 505 ! … … 1489 1503 END IF 1490 1504 1491 ! Copy averaged grid to all COSMO column ts, leads to computing the same1505 ! Copy averaged grid to all COSMO columns, leads to computing the same 1492 1506 ! vertical interpolation weights for all columns and to COSMO grid level 1493 1507 ! based averaging onto the averaged COSMO heights. … … 1542 1556 1543 1557 imin = CEILING( (avg_grid % lon(1)  cosmo_lon(0)) / dlon ) 1544 imax = FLOOR ((avg_grid % lon(2)  cosmo_lon(0)) / dlon )1558 imax = FLOOR ( (avg_grid % lon(2)  cosmo_lon(0)) / dlon ) 1545 1559 1546 1560 jmin = CEILING( (avg_grid % lat(1)  cosmo_lat(0)) / dlat ) 1547 jmax = FLOOR ((avg_grid % lat(2)  cosmo_lat(0)) / dlat )1561 jmax = FLOOR ( (avg_grid % lat(2)  cosmo_lat(0)) / dlat ) 1548 1562 1549 message = "Averaging over "//&1550 TRIM(str(imin)) // " < i < " // TRIM(str(imax)) //&1563 message = "Averaging '" // TRIM(avg_grid % kind) // "' over "// & 1564 TRIM(str(imin)) // " <= i <= " // TRIM(str(imax)) // & 1551 1565 " and " // & 1552 TRIM(str(jmin)) // " < j <" // TRIM(str(jmax))1566 TRIM(str(jmin)) // " <= j <= " // TRIM(str(jmax)) 1553 1567 CALL report( 'get_cosmo_averaging_region', message ) 1554 1568 … … 1557 1571 avg_grid % n_columns = nx * ny 1558 1572 1559 ALLOCATE( avg_grid % iii(avg_grid % n_columns), 1573 ALLOCATE( avg_grid % iii(avg_grid % n_columns), & 1560 1574 avg_grid % jjj(avg_grid % n_columns) ) 1561 1575 … … 3933 3947 END SUBROUTINE fill_water_cells 3934 3948 3949 3950 !! 3951 ! Description: 3952 !  3953 !> Fills the thickness array of the COSMO soil layers. Since COSMO's (i.e. 3954 !> TERRA_ML's [1]) soil layer boundaries follow the rule 3955 !> 3956 !> depth(0) = 0.0, and 3957 !> depth(k) = 0.01 * 3**(k1), k in [1,2,3,...,7] 3958 !> 3959 !> and full levels are defined as the midpoints between two layer boundaries, 3960 !> all except the first layer thicknesses equal the depth of the midpoint. 3961 !> 3962 !> [1] A Description of the Nonhydrostatic Regional COSMO Model Part II : 3963 !> Physical Parameterization*, Sect. 11 TERRA_ML. 3964 !> http://www.cosmomodel.org/content/model/documentation/core/cosmoPhysParamtr.pdf) 3965 !> 3966 !> Input parameters: 3967 !>  3968 !> 3969 !> depths: array of full soil layer depths (cell midpoints) 3970 !> 3971 !> 3972 !> Output parameters: 3973 !>  3974 !> 3975 !> d_depth: array of soil layer thicknesses 3976 !> 3977 !! 3978 SUBROUTINE get_soil_layer_thickness(depths, d_depth) 3979 3980 REAL(dp), INTENT(IN) :: depths(:) 3981 REAL(dp), INTENT(OUT) :: d_depth(:) 3982 3983 d_depth(:) = depths(:) 3984 d_depth(1) = 2.0_dp * depths(1) 3985 3986 END SUBROUTINE get_soil_layer_thickness 3987 3935 3988 END MODULE grid
Note: See TracChangeset
for help on using the changeset viewer.