Changeset 4150 for palm/trunk/SOURCE
- Timestamp:
- Aug 8, 2019 8:00:47 PM (5 years ago)
- Location:
- palm/trunk/SOURCE
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
palm/trunk/SOURCE/init_3d_model.f90
r4131 r4150 25 25 ! ----------------- 26 26 ! $Id$ 27 ! Input of additional surface variables independent on land- or urban-surface 28 ! model 29 ! 30 ! 4131 2019-08-02 11:06:18Z monakurppa 27 31 ! Allocate sums and sums_l to allow profile output for salsa variables. 28 32 ! … … 661 665 662 666 USE netcdf_data_input_mod, & 663 ONLY: init_3d, & 664 netcdf_data_input_init_3d, netcdf_data_input_interpolate 665 667 ONLY: char_fill, & 668 check_existence, & 669 close_input_file, & 670 get_attribute, & 671 get_variable, & 672 init_3d, & 673 input_pids_static, & 674 inquire_num_variables, & 675 inquire_variable_names, & 676 input_file_static, & 677 netcdf_data_input_init_3d, & 678 open_read_file, & 679 real_2d 680 666 681 USE nesting_offl_mod, & 667 682 ONLY: nesting_offl_init … … 695 710 696 711 USE surface_mod, & 697 ONLY : init_surface_arrays, init_surfaces, surf_def_h, surf_lsm_h, & 698 surf_usm_h, get_topography_top_index_ji 712 ONLY : init_single_surface_properties, & 713 init_surface_arrays, & 714 init_surfaces, & 715 surf_def_h, & 716 surf_def_v, & 717 surf_lsm_h, & 718 surf_usm_h, & 719 get_topography_top_index_ji 699 720 700 721 #if defined( _OPENACC ) … … 710 731 IMPLICIT NONE 711 732 712 INTEGER(iwp) :: i !< grid index in x direction 713 INTEGER(iwp) :: ind_array(1) !< dummy used to determine start index for external pressure forcing 714 INTEGER(iwp) :: j !< grid index in y direction 715 INTEGER(iwp) :: k !< grid index in z direction 716 INTEGER(iwp) :: k_surf !< surface level index 717 INTEGER(iwp) :: m !< index of surface element in surface data type 718 INTEGER(iwp) :: sr !< index of statistic region 733 CHARACTER(LEN=50), DIMENSION(:), ALLOCATABLE :: vars_pids_static !< variable names in static input file 734 735 INTEGER(iwp) :: i !< grid index in x direction 736 INTEGER(iwp) :: ind_array(1) !< dummy used to determine start index for external pressure forcing 737 INTEGER(iwp) :: j !< grid index in y direction 738 INTEGER(iwp) :: k !< grid index in z direction 739 INTEGER(iwp) :: k_surf !< surface level index 740 INTEGER(iwp) :: l !< running index over surface orientation 741 INTEGER(iwp) :: m !< index of surface element in surface data type 742 INTEGER(iwp) :: num_vars_pids_static !< number of variables in static input file 743 INTEGER(iwp) :: nz_u_shift !< topography-top index on u-grid, used to vertically shift initial profiles 744 INTEGER(iwp) :: nz_v_shift !< topography-top index on v-grid, used to vertically shift initial profiles 745 INTEGER(iwp) :: nz_w_shift !< topography-top index on w-grid, used to vertically shift initial profiles 746 INTEGER(iwp) :: nz_s_shift !< topography-top index on scalar-grid, used to vertically shift initial profiles 747 INTEGER(iwp) :: nz_u_shift_l !< topography-top index on u-grid, used to vertically shift initial profiles 748 INTEGER(iwp) :: nz_v_shift_l !< topography-top index on v-grid, used to vertically shift initial profiles 749 INTEGER(iwp) :: nz_w_shift_l !< topography-top index on w-grid, used to vertically shift initial profiles 750 INTEGER(iwp) :: nz_s_shift_l !< topography-top index on scalar-grid, used to vertically shift initial profiles 751 INTEGER(iwp) :: nzt_l !< index of top PE boundary for multigrid level 752 INTEGER(iwp) :: pids_static_id !< file id for static input file 753 INTEGER(iwp) :: sr !< index of statistic region 719 754 720 755 INTEGER(iwp), DIMENSION(:), ALLOCATABLE :: ngp_2dh_l !< toal number of horizontal grid points in statistical region on subdomain … … 723 758 INTEGER(iwp), DIMENSION(:,:), ALLOCATABLE :: ngp_2dh_s_inner_l !< number of horizontal non-topography grid points on subdomain 724 759 760 761 725 762 REAL(wp), DIMENSION(:), ALLOCATABLE :: init_l !< dummy array used for averaging 3D data to obtain inital profiles 726 763 REAL(wp), DIMENSION(:), ALLOCATABLE :: p_hydrostatic !< hydrostatic pressure 727 764 728 INTEGER(iwp) :: l !< loop variable729 INTEGER(iwp) :: nzt_l !< index of top PE boundary for multigrid level730 765 REAL(wp) :: dx_l !< grid spacing along x on different multigrid level 731 766 REAL(wp) :: dy_l !< grid spacing along y on different multigrid level … … 738 773 REAL(wp), DIMENSION(:), ALLOCATABLE :: ngp_3d_inner_tmp !< total number of non-topography grid points 739 774 740 INTEGER(iwp) :: nz_u_shift !< topography-top index on u-grid, used to vertically shift initial profiles 741 INTEGER(iwp) :: nz_v_shift !< topography-top index on v-grid, used to vertically shift initial profiles 742 INTEGER(iwp) :: nz_w_shift !< topography-top index on w-grid, used to vertically shift initial profiles 743 INTEGER(iwp) :: nz_s_shift !< topography-top index on scalar-grid, used to vertically shift initial profiles 744 INTEGER(iwp) :: nz_u_shift_l !< topography-top index on u-grid, used to vertically shift initial profiles 745 INTEGER(iwp) :: nz_v_shift_l !< topography-top index on v-grid, used to vertically shift initial profiles 746 INTEGER(iwp) :: nz_w_shift_l !< topography-top index on w-grid, used to vertically shift initial profiles 747 INTEGER(iwp) :: nz_s_shift_l !< topography-top index on scalar-grid, used to vertically shift initial profiles 748 749 775 TYPE(real_2d) :: tmp_2d !< temporary variable to input additional surface-data from static file 776 750 777 CALL location_message( 'model initialization', 'start' ) 751 778 … … 1619 1646 ENDDO 1620 1647 ENDIF 1621 1622 1648 ! 1623 1649 !-- Initialization of the turbulence recycling method … … 2005 2031 ENDIF 2006 2032 2033 ENDIF 2034 ! 2035 !-- In the following, surface properties can be further initialized with 2036 !-- input from static driver file. 2037 !-- At the moment this affects only default surfaces. For example, 2038 !-- roughness length or sensible / latent heat fluxes can be initialized 2039 !-- heterogeneously for default surfaces. Therefore, a generic routine 2040 !-- from netcdf_data_input_mod is called to read a 2D array. 2041 IF ( input_pids_static ) THEN 2042 ! 2043 !-- Open the static input file 2044 CALL open_read_file( TRIM( input_file_static ) // & 2045 TRIM( coupling_char ), & 2046 pids_static_id ) 2047 2048 CALL inquire_num_variables( pids_static_id, num_vars_pids_static ) 2049 ! 2050 !-- Allocate memory to store variable names and read them 2051 ALLOCATE( vars_pids_static(1:num_vars_pids_static) ) 2052 CALL inquire_variable_names( pids_static_id, vars_pids_static ) 2053 2054 ALLOCATE( tmp_2d%var(nys:nyn,nxl:nxr) ) 2055 tmp_2d%var = 0.0_wp 2056 ! 2057 !-- Input roughness length. 2058 IF ( check_existence( vars_pids_static, 'z0' ) ) THEN 2059 ! 2060 !-- Read _FillValue attribute 2061 CALL get_attribute( pids_static_id, char_fill, tmp_2d%fill, & 2062 .FALSE., 'z0' ) 2063 ! 2064 !-- Read variable 2065 CALL get_variable( pids_static_id, 'z0', tmp_2d%var, & 2066 nxl, nxr, nys, nyn ) 2067 ! 2068 !-- Initialize roughness length. Note, z0 will be only initialized at 2069 !-- default-type surfaces. At natural or urban z0 is implicitly 2070 !-- initialized bythe respective parameter lists. 2071 !-- Initialize horizontal surface elements. 2072 CALL init_single_surface_properties( surf_def_h(0)%z0, & 2073 tmp_2d%var, & 2074 surf_def_h(0)%ns, & 2075 tmp_2d%fill, & 2076 surf_def_h(0)%i, & 2077 surf_def_h(0)%j ) 2078 ! 2079 !-- Initialize roughness also at vertical surface elements. 2080 !-- Note, the actual 2D input arrays are only defined on the 2081 !-- subdomain. Therefore, pass the index arrays with their respective 2082 !-- offset values. 2083 DO l = 0, 3 2084 CALL init_single_surface_properties( & 2085 surf_def_v(l)%z0, & 2086 tmp_2d%var, & 2087 surf_def_v(l)%ns, & 2088 tmp_2d%fill, & 2089 surf_def_v(l)%i + surf_def_v(l)%ioff, & 2090 surf_def_v(l)%j + surf_def_v(l)%joff ) 2091 ENDDO 2092 2093 ENDIF 2094 ! 2095 !-- Additional variables, e.g. shf, qsws, etc, can be initialized the 2096 !-- same way. 2097 2098 DEALLOCATE( tmp_2d%var ) 2099 ! 2100 !-- Finally, close the input file. 2101 CALL close_input_file( pids_static_id ) 2007 2102 ENDIF 2008 2103 ! -
palm/trunk/SOURCE/netcdf_data_input_mod.f90
r4125 r4150 25 25 ! ----------------- 26 26 ! $Id$ 27 ! Some variables are given the public attribute, in order to call netcdf input 28 ! from single routines 29 ! 30 ! 4125 2019-07-29 13:31:44Z suehring 27 31 ! To enable netcdf-parallel access for lateral boundary data (dynamic input), 28 32 ! zero number of elements are passed to the respective get_variable routine … … 944 948 945 949 ! 950 !-- Public data structures 951 PUBLIC real_2d 952 ! 946 953 !-- Public variables 947 954 PUBLIC albedo_pars_f, albedo_type_f, basal_area_density_f, buildings_f, & 948 building_id_f, building_pars_f, building_type_f, 955 building_id_f, building_pars_f, building_type_f, char_fill, & 949 956 chem_emis, chem_emis_att, chem_emis_att_type, chem_emis_val_type, & 950 957 coord_ref_sys, & -
palm/trunk/SOURCE/surface_mod.f90
r4104 r4150 26 26 ! ----------------- 27 27 ! $Id$ 28 ! Generic routine to initialize single surface properties added 29 ! 30 ! 4104 2019-07-17 17:08:20Z suehring 28 31 ! Bugfix, initialization of index space for boundary data structure accidantly 29 32 ! run over ghost points, causing a segmentation fault. … … 642 645 END INTERFACE init_bc 643 646 647 INTERFACE init_single_surface_properties 648 MODULE PROCEDURE init_single_surface_properties 649 END INTERFACE init_single_surface_properties 650 644 651 INTERFACE init_surfaces 645 652 MODULE PROCEDURE init_surfaces … … 685 692 ! 686 693 !-- Public subroutines and functions 687 PUBLIC get_topography_top_index, get_topography_top_index_ji, init_bc, init_surfaces, & 688 init_surface_arrays, surface_rrd_local, surface_restore_elements, surface_wrd_local, & 689 surface_last_actions 694 PUBLIC get_topography_top_index, & 695 get_topography_top_index_ji, & 696 init_bc, & 697 init_single_surface_properties, & 698 init_surfaces, & 699 init_surface_arrays, & 700 surface_last_actions, & 701 surface_rrd_local, & 702 surface_restore_elements, & 703 surface_wrd_local 690 704 691 705 #if defined( _OPENACC ) … … 3035 3049 END SUBROUTINE init_surfaces 3036 3050 3051 ! Description: 3052 ! ------------ 3053 !> Initialize single surface properties from 2D input arrays 3054 !------------------------------------------------------------------------------! 3055 SUBROUTINE init_single_surface_properties( var_surf, var_2d, & 3056 ns, fill_value, & 3057 index_space_i, & 3058 index_space_j & 3059 ) 3060 3061 INTEGER(iwp) :: m !< running index over surface elements 3062 INTEGER(iwp) :: ns !< number of surface elements in var_surf 3063 3064 INTEGER(iwp), DIMENSION(1:ns) :: index_space_i !< grid indices along x direction where surface properties should be defined 3065 INTEGER(iwp), DIMENSION(1:ns) :: index_space_j !< grid indices along y direction where surface properties should be defined 3066 3067 REAL(wp) :: fill_value !< fill value in var_2d 3068 3069 REAL(wp), DIMENSION(1:ns) :: var_surf !< 1D surface variable that should be initialized 3070 REAL(wp), DIMENSION(nys:nyn,nxl:nxr) :: var_2d !< input variable 3071 3072 DO m = 1, ns 3073 IF ( var_2d(index_space_j(m),index_space_i(m)) /= fill_value ) THEN 3074 var_surf(m) = var_2d(index_space_j(m),index_space_i(m)) 3075 ENDIF 3076 ENDDO 3077 3078 END SUBROUTINE init_single_surface_properties 3037 3079 3038 3080 !------------------------------------------------------------------------------!
Note: See TracChangeset
for help on using the changeset viewer.