[1820] | 1 | !> @file wind_turbine_model_mod.f90 |
---|
[1912] | 2 | !------------------------------------------------------------------------------! |
---|
[1819] | 3 | ! This file is part of PALM. |
---|
| 4 | ! |
---|
| 5 | ! PALM is free software: you can redistribute it and/or modify it under the terms |
---|
| 6 | ! of the GNU General Public License as published by the Free Software Foundation, |
---|
| 7 | ! either version 3 of the License, or (at your option) any later version. |
---|
| 8 | ! |
---|
| 9 | ! PALM is distributed in the hope that it will be useful, but WITHOUT ANY |
---|
| 10 | ! WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR |
---|
| 11 | ! A PARTICULAR PURPOSE. See the GNU General Public License for more details. |
---|
| 12 | ! |
---|
| 13 | ! You should have received a copy of the GNU General Public License along with |
---|
| 14 | ! PALM. If not, see <http://www.gnu.org/licenses/>. |
---|
| 15 | ! |
---|
| 16 | ! Copyright 1997-2016 Leibniz Universitaet Hannover |
---|
[1912] | 17 | !------------------------------------------------------------------------------! |
---|
[1819] | 18 | ! |
---|
| 19 | ! Current revisions: |
---|
| 20 | ! ----------------- |
---|
[1913] | 21 | ! |
---|
[1930] | 22 | ! |
---|
[1913] | 23 | ! Former revisions: |
---|
| 24 | ! ----------------- |
---|
| 25 | ! $Id: wind_turbine_model_mod.f90 1930 2016-06-09 16:32:12Z knoop $ |
---|
[1844] | 26 | ! |
---|
[1930] | 27 | ! 1929 2016-06-09 16:25:25Z suehring |
---|
| 28 | ! Bugfix: added preprocessor directives for parallel and serial mode |
---|
| 29 | ! |
---|
[1917] | 30 | ! 1914 2016-05-26 14:44:07Z witha |
---|
[1821] | 31 | ! Initial revision |
---|
| 32 | ! |
---|
[1819] | 33 | ! |
---|
| 34 | ! Description: |
---|
| 35 | ! ------------ |
---|
| 36 | !> This module calculates the effect of wind turbines on the flow fields. The |
---|
| 37 | !> initial version contains only the advanced actuator disk with rotation method |
---|
| 38 | !> (ADM-R). |
---|
| 39 | !> The wind turbines include the tower effect, can be yawed and tilted. |
---|
| 40 | !> The wind turbine model includes controllers for rotational speed, pitch and |
---|
| 41 | !> yaw. |
---|
| 42 | !> Currently some specifications of the NREL 5 MW reference turbine |
---|
| 43 | !> are hardcoded whereas most input data comes from separate files (currently |
---|
| 44 | !> external, planned to be included as namelist which will be read in |
---|
| 45 | !> automatically). |
---|
| 46 | !> |
---|
| 47 | !> @todo Revise code according to PALM Coding Standard |
---|
| 48 | !> @todo Implement ADM and ALM turbine models |
---|
| 49 | !> @todo Generate header information |
---|
[1917] | 50 | !> @todo Implement further parameter checks and error messages |
---|
[1819] | 51 | !> @todo Revise and add code documentation |
---|
| 52 | !> @todo Output turbine parameters as timeseries |
---|
| 53 | !> @todo Include additional output variables |
---|
[1864] | 54 | !> @todo Revise smearing the forces for turbines in yaw |
---|
| 55 | !> @todo Revise nacelle and tower parameterization |
---|
| 56 | !> @todo Allow different turbine types in one simulation |
---|
[1819] | 57 | ! |
---|
| 58 | !------------------------------------------------------------------------------! |
---|
| 59 | MODULE wind_turbine_model_mod |
---|
| 60 | |
---|
| 61 | USE arrays_3d, & |
---|
| 62 | ONLY: dd2zu, tend, u, v, w, zu, zw |
---|
| 63 | |
---|
| 64 | USE constants |
---|
| 65 | |
---|
| 66 | USE control_parameters, & |
---|
| 67 | ONLY: dt_3d, dz, message_string, simulated_time |
---|
| 68 | |
---|
| 69 | USE cpulog, & |
---|
| 70 | ONLY: cpu_log, log_point_s |
---|
| 71 | |
---|
| 72 | USE grid_variables, & |
---|
| 73 | ONLY: ddx, dx, ddy, dy |
---|
| 74 | |
---|
| 75 | USE indices, & |
---|
| 76 | ONLY: nbgp, nx, nxl, nxlg, nxr, nxrg, ny, nyn, nyng, nys, nysg, nz, & |
---|
| 77 | nzb, nzb_u_inner, nzb_v_inner, nzb_w_inner, nzt |
---|
| 78 | |
---|
| 79 | USE kinds |
---|
| 80 | |
---|
| 81 | USE pegrid |
---|
| 82 | |
---|
| 83 | |
---|
| 84 | IMPLICIT NONE |
---|
| 85 | |
---|
[1864] | 86 | PRIVATE |
---|
[1819] | 87 | |
---|
[1839] | 88 | LOGICAL :: wind_turbine=.FALSE. !< switch for use of wind turbine model |
---|
[1819] | 89 | |
---|
| 90 | ! |
---|
| 91 | !-- Variables specified in the namelist wind_turbine_par |
---|
| 92 | |
---|
[1864] | 93 | INTEGER(iwp) :: nairfoils = 8 !< number of airfoils of the used turbine model (for ADM-R and ALM) |
---|
[1839] | 94 | INTEGER(iwp) :: nturbines = 1 !< number of turbines |
---|
[1819] | 95 | |
---|
[1839] | 96 | LOGICAL :: pitch_control = .FALSE. !< switch for use of pitch controller |
---|
| 97 | LOGICAL :: speed_control = .FALSE. !< switch for use of speed controller |
---|
| 98 | LOGICAL :: yaw_control = .FALSE. !< switch for use of yaw controller |
---|
[1819] | 99 | |
---|
[1839] | 100 | REAL(wp) :: segment_length = 1.0_wp !< length of the segments, the rotor area is divided into |
---|
| 101 | !< (in tangential direction, as factor of MIN(dx,dy,dz)) |
---|
| 102 | REAL(wp) :: segment_width = 0.5_wp !< width of the segments, the rotor area is divided into |
---|
| 103 | !< (in radial direction, as factor of MIN(dx,dy,dz)) |
---|
| 104 | REAL(wp) :: time_turbine_on = 0.0_wp !< time at which turbines are started |
---|
| 105 | REAL(wp) :: tilt = 0.0_wp !< vertical tilt of the rotor [degree] ( positive = backwards ) |
---|
[1819] | 106 | |
---|
[1912] | 107 | REAL(wp), DIMENSION(1:100) :: dtow = 0.0_wp !< tower diameter [m] |
---|
| 108 | REAL(wp), DIMENSION(1:100) :: omega_rot = 0.0_wp !< inital or constant rotor speed [rad/s] |
---|
| 109 | REAL(wp), DIMENSION(1:100) :: phi_yaw = 0.0_wp !< yaw angle [degree] ( clockwise, 0 = facing west ) |
---|
| 110 | REAL(wp), DIMENSION(1:100) :: pitch_add = 0.0_wp !< constant pitch angle |
---|
| 111 | REAL(wp), DIMENSION(1:100) :: rcx = 9999999.9_wp !< position of hub in x-direction |
---|
| 112 | REAL(wp), DIMENSION(1:100) :: rcy = 9999999.9_wp !< position of hub in y-direction |
---|
| 113 | REAL(wp), DIMENSION(1:100) :: rcz = 9999999.9_wp !< position of hub in z-direction |
---|
| 114 | REAL(wp), DIMENSION(1:100) :: rnac = 0.0_wp !< nacelle diameter [m] |
---|
| 115 | REAL(wp), DIMENSION(1:100) :: rr = 63.0_wp !< rotor radius [m] |
---|
| 116 | REAL(wp), DIMENSION(1:100) :: turb_cd_nacelle = 0.85_wp !< drag coefficient for nacelle |
---|
| 117 | REAL(wp), DIMENSION(1:100) :: turb_cd_tower = 1.2_wp !< drag coefficient for tower |
---|
[1839] | 118 | |
---|
[1819] | 119 | ! |
---|
| 120 | !-- Variables specified in the namelist for speed controller |
---|
| 121 | !-- Default values are from the NREL 5MW research turbine (Jonkman, 2008) |
---|
| 122 | |
---|
[1912] | 123 | REAL(wp) :: rated_power = 5296610.0_wp !< rated turbine power [W] |
---|
[1839] | 124 | REAL(wp) :: gear_ratio = 97.0_wp !< Gear ratio from rotor to generator |
---|
| 125 | REAL(wp) :: inertia_rot = 34784179.0_wp !< Inertia of the rotor [kg/m2] |
---|
| 126 | REAL(wp) :: inertia_gen = 534.116_wp !< Inertia of the generator [kg/m2] |
---|
| 127 | REAL(wp) :: gen_eff = 0.944_wp !< Electric efficiency of the generator |
---|
| 128 | REAL(wp) :: gear_eff = 1.0_wp !< Loss between rotor and generator |
---|
| 129 | REAL(wp) :: air_dens = 1.225_wp !< Air density to convert to W [kg/m3] |
---|
| 130 | REAL(wp) :: rated_genspeed = 121.6805_wp !< Rated generator speed [rad/s] |
---|
[1912] | 131 | REAL(wp) :: max_torque_gen = 47402.91_wp !< Maximum of the generator torque [Nm] |
---|
[1839] | 132 | REAL(wp) :: slope2 = 2.332287_wp !< Slope constant for region 2 |
---|
| 133 | REAL(wp) :: min_reg2 = 91.21091_wp !< Lower generator speed boundary of region 2 [rad/s] |
---|
| 134 | REAL(wp) :: min_reg15 = 70.16224_wp !< Lower generator speed boundary of region 1.5 [rad/s] |
---|
[1912] | 135 | REAL(wp) :: max_trq_rate = 15000.0_wp !< Max generator torque increase [Nm/s] |
---|
| 136 | REAL(wp) :: pitch_rate = 8.0_wp !< Max pitch rate [degree/s] |
---|
[1839] | 137 | |
---|
[1912] | 138 | |
---|
[1819] | 139 | ! |
---|
| 140 | !-- Variables specified in the namelist for yaw control |
---|
| 141 | |
---|
[1839] | 142 | REAL(wp) :: yaw_speed = 0.005236_wp !< speed of the yaw actuator [rad/s] |
---|
| 143 | REAL(wp) :: max_miss = 0.08726_wp !< maximum tolerated yaw missalignment [rad] |
---|
| 144 | REAL(wp) :: min_miss = 0.008726_wp !< minimum yaw missalignment for which the actuator stops [rad] |
---|
| 145 | |
---|
[1819] | 146 | ! |
---|
| 147 | !-- Set flag for output files TURBINE_PARAMETERS |
---|
| 148 | TYPE file_status |
---|
| 149 | LOGICAL :: opened, opened_before |
---|
| 150 | END TYPE file_status |
---|
| 151 | |
---|
[1912] | 152 | TYPE(file_status), DIMENSION(500) :: openfile_turb_mod = & |
---|
| 153 | file_status(.FALSE.,.FALSE.) |
---|
[1819] | 154 | |
---|
| 155 | ! |
---|
| 156 | !-- Variables for initialization of the turbine model |
---|
| 157 | |
---|
[1839] | 158 | INTEGER(iwp) :: inot !< turbine loop index (turbine id) |
---|
| 159 | INTEGER(iwp) :: nsegs_max !< maximum number of segments (all turbines, required for allocation of arrays) |
---|
| 160 | INTEGER(iwp) :: nrings_max !< maximum number of rings (all turbines, required for allocation of arrays) |
---|
| 161 | INTEGER(iwp) :: ring !< ring loop index (ring number) |
---|
| 162 | INTEGER(iwp) :: rr_int !< |
---|
| 163 | INTEGER(iwp) :: upper_end !< |
---|
[1819] | 164 | |
---|
[1839] | 165 | INTEGER(iwp), DIMENSION(1) :: lct !< |
---|
[1819] | 166 | |
---|
[1912] | 167 | INTEGER(iwp), DIMENSION(:), ALLOCATABLE :: i_hub !< index belonging to x-position of the turbine |
---|
| 168 | INTEGER(iwp), DIMENSION(:), ALLOCATABLE :: i_smear !< index defining the area for the smearing of the forces (x-direction) |
---|
| 169 | INTEGER(iwp), DIMENSION(:), ALLOCATABLE :: j_hub !< index belonging to y-position of the turbine |
---|
| 170 | INTEGER(iwp), DIMENSION(:), ALLOCATABLE :: j_smear !< index defining the area for the smearing of the forces (y-direction) |
---|
| 171 | INTEGER(iwp), DIMENSION(:), ALLOCATABLE :: k_hub !< index belonging to hub height |
---|
| 172 | INTEGER(iwp), DIMENSION(:), ALLOCATABLE :: k_smear !< index defining the area for the smearing of the forces (z-direction) |
---|
| 173 | INTEGER(iwp), DIMENSION(:), ALLOCATABLE :: nrings !< number of rings per turbine |
---|
| 174 | INTEGER(iwp), DIMENSION(:), ALLOCATABLE :: nsegs_total !< total number of segments per turbine |
---|
[1819] | 175 | |
---|
[1912] | 176 | INTEGER(iwp), DIMENSION(:,:), ALLOCATABLE :: nsegs !< number of segments per ring and turbine |
---|
[1819] | 177 | |
---|
[1912] | 178 | ! |
---|
| 179 | !- parameters for the smearing from the rotor to the cartesian grid |
---|
[1864] | 180 | REAL(wp) :: pol_a !< parameter for the polynomial smearing fct |
---|
| 181 | REAL(wp) :: pol_b !< parameter for the polynomial smearing fct |
---|
[1912] | 182 | REAL(wp) :: delta_t_factor !< |
---|
[1864] | 183 | REAL(wp) :: eps_factor !< |
---|
[1839] | 184 | REAL(wp) :: eps_min !< |
---|
| 185 | REAL(wp) :: eps_min2 !< |
---|
| 186 | REAL(wp) :: sqrt_arg !< |
---|
[1819] | 187 | |
---|
[1839] | 188 | ! |
---|
| 189 | !-- Variables for the calculation of lift and drag coefficients |
---|
[1912] | 190 | REAL(wp), DIMENSION(:), ALLOCATABLE :: ard !< |
---|
| 191 | REAL(wp), DIMENSION(:), ALLOCATABLE :: crd !< |
---|
| 192 | REAL(wp), DIMENSION(:), ALLOCATABLE :: delta_r !< radial segment length |
---|
| 193 | REAL(wp), DIMENSION(:), ALLOCATABLE :: lrd !< |
---|
[1864] | 194 | |
---|
[1912] | 195 | REAL(wp) :: accu_cl_cd_tab = 0.1_wp !< Accuracy of the interpolation of |
---|
| 196 | !< the lift and drag coeff [deg] |
---|
[1819] | 197 | |
---|
[1912] | 198 | REAL(wp), DIMENSION(:,:), ALLOCATABLE :: turb_cd_tab !< table of the blade drag coefficient |
---|
| 199 | REAL(wp), DIMENSION(:,:), ALLOCATABLE :: turb_cl_tab !< table of the blade lift coefficient |
---|
[1819] | 200 | |
---|
[1912] | 201 | REAL(wp), DIMENSION(:,:,:), ALLOCATABLE :: nac_cd_surf !< 3d field of the tower drag coefficient |
---|
| 202 | REAL(wp), DIMENSION(:,:,:), ALLOCATABLE :: tow_cd_surf !< 3d field of the nacelle drag coefficient |
---|
[1819] | 203 | |
---|
| 204 | ! |
---|
| 205 | !-- Variables for the calculation of the forces |
---|
[1912] | 206 | |
---|
[1839] | 207 | REAL(wp) :: cur_r !< |
---|
[1912] | 208 | REAL(wp) :: delta_t !< tangential segment length |
---|
[1839] | 209 | REAL(wp) :: phi_rotor !< |
---|
| 210 | REAL(wp) :: pre_factor !< |
---|
| 211 | REAL(wp) :: torque_seg !< |
---|
| 212 | REAL(wp) :: u_int_l !< |
---|
| 213 | REAL(wp) :: u_int_u !< |
---|
| 214 | REAL(wp) :: u_rot !< |
---|
| 215 | REAL(wp) :: v_int_l !< |
---|
| 216 | REAL(wp) :: v_int_u !< |
---|
| 217 | REAL(wp) :: w_int_l !< |
---|
| 218 | REAL(wp) :: w_int_u !< |
---|
[1912] | 219 | ! |
---|
| 220 | !- Tendencies from the nacelle and tower thrust |
---|
| 221 | REAL(wp) :: tend_nac_x = 0.0_wp !< |
---|
| 222 | REAL(wp) :: tend_tow_x = 0.0_wp !< |
---|
| 223 | REAL(wp) :: tend_nac_y = 0.0_wp !< |
---|
| 224 | REAL(wp) :: tend_tow_y = 0.0_wp !< |
---|
[1819] | 225 | |
---|
[1912] | 226 | REAL(wp), DIMENSION(:), ALLOCATABLE :: alpha_attack !< |
---|
| 227 | REAL(wp), DIMENSION(:), ALLOCATABLE :: chord !< |
---|
| 228 | REAL(wp), DIMENSION(:), ALLOCATABLE :: omega_gen !< curr. generator speed |
---|
| 229 | REAL(wp), DIMENSION(:), ALLOCATABLE :: phi_rel !< |
---|
| 230 | REAL(wp), DIMENSION(:), ALLOCATABLE :: pitch_add_old!< |
---|
| 231 | REAL(wp), DIMENSION(:), ALLOCATABLE :: torque_total !< |
---|
| 232 | REAL(wp), DIMENSION(:), ALLOCATABLE :: thrust_rotor !< |
---|
| 233 | REAL(wp), DIMENSION(:), ALLOCATABLE :: turb_cl !< |
---|
| 234 | REAL(wp), DIMENSION(:), ALLOCATABLE :: turb_cd !< |
---|
| 235 | REAL(wp), DIMENSION(:), ALLOCATABLE :: vrel !< |
---|
| 236 | REAL(wp), DIMENSION(:), ALLOCATABLE :: vtheta !< |
---|
| 237 | |
---|
| 238 | REAL(wp), DIMENSION(:,:), ALLOCATABLE :: rbx, rby, rbz !< coordinates of the blade elements |
---|
| 239 | REAL(wp), DIMENSION(:,:), ALLOCATABLE :: rotx, roty, rotz !< normal vectors to the rotor coordinates |
---|
| 240 | |
---|
| 241 | ! |
---|
| 242 | !- Fields for the interpolation of velocities on the rotor grid |
---|
| 243 | REAL(wp), DIMENSION(:,:,:), ALLOCATABLE :: u_int !< |
---|
| 244 | REAL(wp), DIMENSION(:,:,:), ALLOCATABLE :: u_int_1_l !< |
---|
| 245 | REAL(wp), DIMENSION(:,:,:), ALLOCATABLE :: v_int !< |
---|
| 246 | REAL(wp), DIMENSION(:,:,:), ALLOCATABLE :: v_int_1_l !< |
---|
| 247 | REAL(wp), DIMENSION(:,:,:), ALLOCATABLE :: w_int !< |
---|
| 248 | REAL(wp), DIMENSION(:,:,:), ALLOCATABLE :: w_int_1_l !< |
---|
| 249 | |
---|
| 250 | ! |
---|
| 251 | !- rotor tendencies on the segments |
---|
| 252 | REAL(wp), DIMENSION(:), ALLOCATABLE :: thrust_seg !< |
---|
| 253 | REAL(wp), DIMENSION(:), ALLOCATABLE :: torque_seg_y !< |
---|
| 254 | REAL(wp), DIMENSION(:), ALLOCATABLE :: torque_seg_z !< |
---|
| 255 | |
---|
| 256 | ! |
---|
| 257 | !- rotor tendencies on the rings |
---|
| 258 | REAL(wp), DIMENSION(:,:), ALLOCATABLE :: thrust_ring !< |
---|
| 259 | REAL(wp), DIMENSION(:,:), ALLOCATABLE :: torque_ring_y !< |
---|
| 260 | REAL(wp), DIMENSION(:,:), ALLOCATABLE :: torque_ring_z !< |
---|
| 261 | |
---|
| 262 | ! |
---|
| 263 | !- rotor tendencies on rotor grids for all turbines |
---|
| 264 | REAL(wp), DIMENSION(:,:,:), ALLOCATABLE :: thrust !< |
---|
| 265 | REAL(wp), DIMENSION(:,:,:), ALLOCATABLE :: torque_y !< |
---|
| 266 | REAL(wp), DIMENSION(:,:,:), ALLOCATABLE :: torque_z !< |
---|
| 267 | |
---|
| 268 | ! |
---|
| 269 | !- rotor tendencies on coordinate grid |
---|
| 270 | REAL(wp), DIMENSION(:,:,:), ALLOCATABLE :: rot_tend_x !< |
---|
| 271 | REAL(wp), DIMENSION(:,:,:), ALLOCATABLE :: rot_tend_y !< |
---|
| 272 | REAL(wp), DIMENSION(:,:,:), ALLOCATABLE :: rot_tend_z !< |
---|
| 273 | ! |
---|
| 274 | !- variables for the rotation of the rotor coordinates |
---|
| 275 | REAL(wp), DIMENSION(1:100,1:3,1:3) :: rot_coord_trans !< matrix for rotation of rotor coordinates |
---|
| 276 | |
---|
[1839] | 277 | REAL(wp), DIMENSION(1:3) :: rot_eigen_rad !< |
---|
| 278 | REAL(wp), DIMENSION(1:3) :: rot_eigen_azi !< |
---|
| 279 | REAL(wp), DIMENSION(1:3) :: rot_eigen_nor !< |
---|
| 280 | REAL(wp), DIMENSION(1:3) :: re !< |
---|
| 281 | REAL(wp), DIMENSION(1:3) :: rea !< |
---|
| 282 | REAL(wp), DIMENSION(1:3) :: ren !< |
---|
| 283 | REAL(wp), DIMENSION(1:3) :: rote !< |
---|
| 284 | REAL(wp), DIMENSION(1:3) :: rota !< |
---|
| 285 | REAL(wp), DIMENSION(1:3) :: rotn !< |
---|
[1819] | 286 | |
---|
[1839] | 287 | ! |
---|
| 288 | !-- Fixed variables for the speed controller |
---|
[1819] | 289 | |
---|
[1912] | 290 | LOGICAL :: start_up = .TRUE. !< |
---|
[1864] | 291 | |
---|
[1912] | 292 | REAL(wp) :: Fcorner !< corner freq for the controller low pass filter |
---|
| 293 | REAL(wp) :: min_reg25 !< min region 2.5 |
---|
| 294 | REAL(wp) :: om_rate !< rotor speed change |
---|
| 295 | REAL(wp) :: slope15 !< slope in region 1.5 |
---|
| 296 | REAL(wp) :: slope25 !< slope in region 2.5 |
---|
| 297 | REAL(wp) :: trq_rate !< torque change |
---|
| 298 | REAL(wp) :: vs_sysp !< |
---|
| 299 | REAL(wp) :: lp_coeff !< coeff for the controller low pass filter |
---|
[1864] | 300 | |
---|
| 301 | REAL(wp), DIMENSION(:), ALLOCATABLE :: omega_gen_old !< last gen. speed |
---|
| 302 | REAL(wp), DIMENSION(:), ALLOCATABLE :: omega_gen_f !< filtered gen. sp |
---|
| 303 | REAL(wp), DIMENSION(:), ALLOCATABLE :: omega_gen_f_old !< last filt. gen. sp |
---|
| 304 | REAL(wp), DIMENSION(:), ALLOCATABLE :: torque_gen !< generator torque |
---|
| 305 | REAL(wp), DIMENSION(:), ALLOCATABLE :: torque_gen_old !< last gen. torque |
---|
[1819] | 306 | |
---|
[1864] | 307 | REAL(wp), DIMENSION(100) :: omega_rot_l = 0.0_wp !< local rot speed [rad/s] |
---|
[1839] | 308 | ! |
---|
| 309 | !-- Fixed variables for the yaw controller |
---|
[1819] | 310 | |
---|
[1912] | 311 | REAL(wp), DIMENSION(:) , ALLOCATABLE :: yawdir !< direction to yaw |
---|
| 312 | REAL(wp), DIMENSION(:) , ALLOCATABLE :: phi_yaw_l !< local (cpu) yaw angle |
---|
| 313 | REAL(wp), DIMENSION(:) , ALLOCATABLE :: wd30_l !< local (cpu) long running avg of the wd |
---|
| 314 | REAL(wp), DIMENSION(:) , ALLOCATABLE :: wd2_l !< local (cpu) short running avg of the wd |
---|
| 315 | REAL(wp), DIMENSION(:) , ALLOCATABLE :: wdir !< wind direction at hub |
---|
| 316 | REAL(wp), DIMENSION(:) , ALLOCATABLE :: u_inflow !< wind speed at hub |
---|
| 317 | REAL(wp), DIMENSION(:) , ALLOCATABLE :: wdir_l !< |
---|
| 318 | REAL(wp), DIMENSION(:) , ALLOCATABLE :: u_inflow_l !< |
---|
| 319 | REAL(wp), DIMENSION(:,:), ALLOCATABLE :: wd30 !< |
---|
| 320 | REAL(wp), DIMENSION(:,:), ALLOCATABLE :: wd2 !< |
---|
| 321 | LOGICAL, DIMENSION(1:100) :: doyaw = .FALSE. !< |
---|
| 322 | INTEGER(iwp) :: WDLON !< |
---|
| 323 | INTEGER(iwp) :: WDSHO !< |
---|
[1819] | 324 | |
---|
| 325 | |
---|
[1839] | 326 | SAVE |
---|
[1819] | 327 | |
---|
[1839] | 328 | |
---|
| 329 | INTERFACE wtm_parin |
---|
| 330 | MODULE PROCEDURE wtm_parin |
---|
| 331 | END INTERFACE wtm_parin |
---|
[1912] | 332 | |
---|
| 333 | INTERFACE wtm_check_parameters |
---|
| 334 | MODULE PROCEDURE wtm_check_parameters |
---|
| 335 | END INTERFACE wtm_check_parameters |
---|
[1839] | 336 | |
---|
| 337 | INTERFACE wtm_init_arrays |
---|
| 338 | MODULE PROCEDURE wtm_init_arrays |
---|
| 339 | END INTERFACE wtm_init_arrays |
---|
| 340 | |
---|
| 341 | INTERFACE wtm_init |
---|
| 342 | MODULE PROCEDURE wtm_init |
---|
| 343 | END INTERFACE wtm_init |
---|
| 344 | |
---|
[1912] | 345 | INTERFACE wtm_read_blade_tables |
---|
| 346 | MODULE PROCEDURE wtm_read_blade_tables |
---|
| 347 | END INTERFACE wtm_read_blade_tables |
---|
[1839] | 348 | |
---|
[1819] | 349 | INTERFACE wtm_forces |
---|
| 350 | MODULE PROCEDURE wtm_forces |
---|
[1839] | 351 | MODULE PROCEDURE wtm_yawcontrol |
---|
[1819] | 352 | END INTERFACE wtm_forces |
---|
[1864] | 353 | |
---|
| 354 | INTERFACE wtm_rotate_rotor |
---|
| 355 | MODULE PROCEDURE wtm_rotate_rotor |
---|
| 356 | END INTERFACE wtm_rotate_rotor |
---|
| 357 | |
---|
| 358 | INTERFACE wtm_speed_control |
---|
| 359 | MODULE PROCEDURE wtm_init_speed_control |
---|
| 360 | MODULE PROCEDURE wtm_speed_control |
---|
| 361 | END INTERFACE wtm_speed_control |
---|
[1819] | 362 | |
---|
| 363 | INTERFACE wtm_tendencies |
---|
| 364 | MODULE PROCEDURE wtm_tendencies |
---|
| 365 | MODULE PROCEDURE wtm_tendencies_ij |
---|
| 366 | END INTERFACE wtm_tendencies |
---|
[1864] | 367 | |
---|
| 368 | |
---|
[1912] | 369 | PUBLIC wtm_check_parameters, wtm_forces, wtm_init, wtm_init_arrays, & |
---|
| 370 | wtm_parin, wtm_tendencies, wtm_tendencies_ij, wind_turbine |
---|
[1819] | 371 | |
---|
| 372 | CONTAINS |
---|
| 373 | |
---|
| 374 | |
---|
| 375 | !------------------------------------------------------------------------------! |
---|
| 376 | ! Description: |
---|
| 377 | ! ------------ |
---|
[1839] | 378 | !> Parin for &wind_turbine_par for wind turbine model |
---|
[1819] | 379 | !------------------------------------------------------------------------------! |
---|
[1839] | 380 | SUBROUTINE wtm_parin |
---|
[1819] | 381 | |
---|
| 382 | |
---|
| 383 | IMPLICIT NONE |
---|
[1912] | 384 | |
---|
| 385 | INTEGER(iwp) :: ierrn !< |
---|
[1819] | 386 | |
---|
[1839] | 387 | CHARACTER (LEN=80) :: line !< dummy string that contains the current line of the parameter file |
---|
| 388 | |
---|
| 389 | NAMELIST /wind_turbine_par/ air_dens, dtow, gear_eff, gear_ratio, & |
---|
[1864] | 390 | gen_eff, inertia_gen, inertia_rot, max_miss, & |
---|
[1839] | 391 | max_torque_gen, max_trq_rate, min_miss, & |
---|
[1864] | 392 | min_reg15, min_reg2, nairfoils, nturbines, & |
---|
[1912] | 393 | omega_rot, phi_yaw, pitch_add, pitch_control,& |
---|
[1839] | 394 | rated_genspeed, rated_power, rcx, rcy, rcz, & |
---|
| 395 | rnac, rr, segment_length, segment_width, & |
---|
[1864] | 396 | slope2, speed_control, tilt, time_turbine_on,& |
---|
[1912] | 397 | turb_cd_nacelle, turb_cd_tower, & |
---|
[1839] | 398 | yaw_control, yaw_speed |
---|
| 399 | |
---|
[1819] | 400 | ! |
---|
[1839] | 401 | !-- Try to find wind turbine model package |
---|
| 402 | REWIND ( 11 ) |
---|
| 403 | line = ' ' |
---|
| 404 | DO WHILE ( INDEX( line, '&wind_turbine_par' ) == 0 ) |
---|
| 405 | READ ( 11, '(A)', END=10 ) line |
---|
| 406 | ENDDO |
---|
| 407 | BACKSPACE ( 11 ) |
---|
| 408 | |
---|
| 409 | ! |
---|
| 410 | !-- Read user-defined namelist |
---|
[1912] | 411 | READ ( 11, wind_turbine_par, IOSTAT=ierrn ) |
---|
| 412 | |
---|
| 413 | IF ( ierrn < 0 ) THEN |
---|
| 414 | message_string = 'errors in \$wind_turbine_par' |
---|
| 415 | CALL message( 'wtm_parin', 'PA0???', 1, 2, 0, 6, 0 ) |
---|
| 416 | ENDIF |
---|
| 417 | |
---|
[1839] | 418 | ! |
---|
| 419 | !-- Set flag that indicates that the wind turbine model is switched on |
---|
| 420 | wind_turbine = .TRUE. |
---|
| 421 | |
---|
[1912] | 422 | 10 CONTINUE ! TBD Change from continue, mit ierrn machen |
---|
[1839] | 423 | |
---|
| 424 | |
---|
| 425 | END SUBROUTINE wtm_parin |
---|
| 426 | |
---|
[1912] | 427 | SUBROUTINE wtm_check_parameters |
---|
| 428 | |
---|
| 429 | |
---|
| 430 | IMPLICIT NONE |
---|
| 431 | |
---|
| 432 | IF ( ( .NOT.speed_control ) .AND. pitch_control ) THEN |
---|
| 433 | message_string = 'pitch_control = .TRUE. requires '// & |
---|
| 434 | 'speed_control = .TRUE.' |
---|
| 435 | CALL message( 'wtm_check_parameters', 'PA0???', 1, 2, 0, 6, 0 ) |
---|
| 436 | ENDIF |
---|
| 437 | |
---|
| 438 | IF ( ANY( omega_rot(1:nturbines) <= 0.0 ) ) THEN |
---|
| 439 | message_string = 'omega_rot <= 0.0, Please set omega_rot to ' // & |
---|
| 440 | 'a value larger than zero' |
---|
| 441 | CALL message( 'wtm_check_parameters', 'PA0???', 1, 2, 0, 6, 0 ) |
---|
| 442 | ENDIF |
---|
| 443 | |
---|
| 444 | |
---|
| 445 | IF ( ANY( rcx(1:nturbines) == 9999999.9_wp ) .OR. & |
---|
| 446 | ANY( rcy(1:nturbines) == 9999999.9_wp ) .OR. & |
---|
| 447 | ANY( rcz(1:nturbines) == 9999999.9_wp ) ) THEN |
---|
| 448 | |
---|
| 449 | message_string = 'rcx, rcy, rcz ' // & |
---|
| 450 | 'have to be given for each turbine.' |
---|
| 451 | CALL message( 'wtm_check_parameters', 'PA0???', 1, 2, 0, 6, 0 ) |
---|
| 452 | |
---|
| 453 | ENDIF |
---|
| 454 | |
---|
| 455 | |
---|
| 456 | END SUBROUTINE wtm_check_parameters |
---|
| 457 | |
---|
| 458 | |
---|
[1839] | 459 | !------------------------------------------------------------------------------! |
---|
| 460 | ! Description: |
---|
| 461 | ! ------------ |
---|
| 462 | !> Allocate wind turbine model arrays |
---|
| 463 | !------------------------------------------------------------------------------! |
---|
| 464 | SUBROUTINE wtm_init_arrays |
---|
| 465 | |
---|
| 466 | |
---|
| 467 | IMPLICIT NONE |
---|
| 468 | |
---|
[1864] | 469 | REAL(wp) :: delta_r_factor !< |
---|
| 470 | REAL(wp) :: delta_r_init !< |
---|
| 471 | |
---|
[1839] | 472 | ! |
---|
| 473 | !-- To be able to allocate arrays with dimension of rotor rings and segments, |
---|
[1819] | 474 | !-- the maximum possible numbers of rings and segments have to be calculated: |
---|
| 475 | |
---|
| 476 | ALLOCATE( nrings(1:nturbines) ) |
---|
| 477 | ALLOCATE( delta_r(1:nturbines) ) |
---|
| 478 | |
---|
| 479 | nrings(:) = 0 |
---|
| 480 | delta_r(:) = 0.0_wp |
---|
| 481 | |
---|
| 482 | ! |
---|
| 483 | !-- Thickness (radial) of each ring and length (tangential) of each segment: |
---|
| 484 | delta_r_factor = segment_width |
---|
| 485 | delta_t_factor = segment_length |
---|
| 486 | delta_r_init = delta_r_factor * MIN( dx, dy, dz) |
---|
| 487 | delta_t = delta_t_factor * MIN( dx, dy, dz) |
---|
| 488 | |
---|
| 489 | DO inot = 1, nturbines |
---|
| 490 | ! |
---|
| 491 | !-- Determine number of rings: |
---|
| 492 | nrings(inot) = NINT( rr(inot) / delta_r_init ) |
---|
| 493 | |
---|
| 494 | delta_r(inot) = rr(inot) / nrings(inot) |
---|
| 495 | |
---|
| 496 | ENDDO |
---|
| 497 | |
---|
| 498 | nrings_max = MAXVAL(nrings) |
---|
| 499 | |
---|
| 500 | ALLOCATE( nsegs(1:nrings_max,1:nturbines) ) |
---|
| 501 | ALLOCATE( nsegs_total(1:nturbines) ) |
---|
| 502 | |
---|
| 503 | nsegs(:,:) = 0 |
---|
| 504 | nsegs_total(:) = 0 |
---|
| 505 | |
---|
| 506 | |
---|
| 507 | DO inot = 1, nturbines |
---|
| 508 | DO ring = 1, nrings(inot) |
---|
| 509 | ! |
---|
| 510 | !-- Determine number of segments for each ring: |
---|
[1839] | 511 | nsegs(ring,inot) = MAX( 8, CEILING( delta_r_factor * pi * & |
---|
| 512 | ( 2.0_wp * ring - 1.0_wp ) / & |
---|
| 513 | delta_t_factor ) ) |
---|
[1819] | 514 | ENDDO |
---|
| 515 | ! |
---|
| 516 | !-- Total sum of all rotor segments: |
---|
[1839] | 517 | nsegs_total(inot) = SUM( nsegs(:,inot) ) |
---|
[1819] | 518 | |
---|
| 519 | ENDDO |
---|
| 520 | |
---|
| 521 | ! |
---|
| 522 | !-- Maximum number of segments per ring: |
---|
| 523 | nsegs_max = MAXVAL(nsegs) |
---|
| 524 | |
---|
[1864] | 525 | !! |
---|
| 526 | !!-- TODO: Folgendes im Header ausgeben! |
---|
| 527 | ! IF ( myid == 0 ) THEN |
---|
| 528 | ! PRINT*, 'nrings(1) = ', nrings(1) |
---|
| 529 | ! PRINT*, '--------------------------------------------------' |
---|
| 530 | ! PRINT*, 'nsegs(:,1) = ', nsegs(:,1) |
---|
| 531 | ! PRINT*, '--------------------------------------------------' |
---|
| 532 | ! PRINT*, 'nrings_max = ', nrings_max |
---|
| 533 | ! PRINT*, 'nsegs_max = ', nsegs_max |
---|
| 534 | ! PRINT*, 'nsegs_total(1) = ', nsegs_total(1) |
---|
| 535 | ! ENDIF |
---|
[1819] | 536 | |
---|
| 537 | |
---|
| 538 | ! |
---|
| 539 | !-- Allocate 1D arrays (dimension = number of turbines) |
---|
| 540 | ALLOCATE( i_hub(1:nturbines) ) |
---|
| 541 | ALLOCATE( i_smear(1:nturbines) ) |
---|
| 542 | ALLOCATE( j_hub(1:nturbines) ) |
---|
| 543 | ALLOCATE( j_smear(1:nturbines) ) |
---|
| 544 | ALLOCATE( k_hub(1:nturbines) ) |
---|
| 545 | ALLOCATE( k_smear(1:nturbines) ) |
---|
| 546 | ALLOCATE( torque_total(1:nturbines) ) |
---|
[1912] | 547 | ALLOCATE( thrust_rotor(1:nturbines) ) |
---|
[1819] | 548 | |
---|
| 549 | ! |
---|
| 550 | !-- Allocation of the 1D arrays for speed pitch_control |
---|
| 551 | ALLOCATE( omega_gen(1:nturbines) ) |
---|
[1864] | 552 | ALLOCATE( omega_gen_old(1:nturbines) ) |
---|
[1819] | 553 | ALLOCATE( omega_gen_f(1:nturbines) ) |
---|
| 554 | ALLOCATE( omega_gen_f_old(1:nturbines) ) |
---|
[1912] | 555 | ALLOCATE( pitch_add_old(1:nturbines) ) |
---|
[1819] | 556 | ALLOCATE( torque_gen(1:nturbines) ) |
---|
| 557 | ALLOCATE( torque_gen_old(1:nturbines) ) |
---|
| 558 | |
---|
| 559 | ! |
---|
| 560 | !-- Allocation of the 1D arrays for yaw control |
---|
| 561 | ALLOCATE( yawdir(1:nturbines) ) |
---|
| 562 | ALLOCATE( u_inflow(1:nturbines) ) |
---|
| 563 | ALLOCATE( wdir(1:nturbines) ) |
---|
| 564 | ALLOCATE( u_inflow_l(1:nturbines) ) |
---|
| 565 | ALLOCATE( wdir_l(1:nturbines) ) |
---|
| 566 | ALLOCATE( phi_yaw_l(1:nturbines) ) |
---|
| 567 | |
---|
| 568 | ! |
---|
| 569 | !-- Allocate 1D arrays (dimension = number of rotor segments) |
---|
| 570 | ALLOCATE( alpha_attack(1:nsegs_max) ) |
---|
| 571 | ALLOCATE( chord(1:nsegs_max) ) |
---|
| 572 | ALLOCATE( phi_rel(1:nsegs_max) ) |
---|
| 573 | ALLOCATE( thrust_seg(1:nsegs_max) ) |
---|
| 574 | ALLOCATE( torque_seg_y(1:nsegs_max) ) |
---|
| 575 | ALLOCATE( torque_seg_z(1:nsegs_max) ) |
---|
[1839] | 576 | ALLOCATE( turb_cd(1:nsegs_max) ) |
---|
| 577 | ALLOCATE( turb_cl(1:nsegs_max) ) |
---|
[1819] | 578 | ALLOCATE( vrel(1:nsegs_max) ) |
---|
| 579 | ALLOCATE( vtheta(1:nsegs_max) ) |
---|
| 580 | |
---|
| 581 | ! |
---|
| 582 | !-- Allocate 2D arrays (dimension = number of rotor rings and segments) |
---|
| 583 | ALLOCATE( rbx(1:nrings_max,1:nsegs_max) ) |
---|
| 584 | ALLOCATE( rby(1:nrings_max,1:nsegs_max) ) |
---|
| 585 | ALLOCATE( rbz(1:nrings_max,1:nsegs_max) ) |
---|
| 586 | ALLOCATE( thrust_ring(1:nrings_max,1:nsegs_max) ) |
---|
| 587 | ALLOCATE( torque_ring_y(1:nrings_max,1:nsegs_max) ) |
---|
| 588 | ALLOCATE( torque_ring_z(1:nrings_max,1:nsegs_max) ) |
---|
| 589 | |
---|
| 590 | ! |
---|
| 591 | !-- Allocate additional 2D arrays |
---|
| 592 | ALLOCATE( rotx(1:nturbines,1:3) ) |
---|
| 593 | ALLOCATE( roty(1:nturbines,1:3) ) |
---|
| 594 | ALLOCATE( rotz(1:nturbines,1:3) ) |
---|
| 595 | |
---|
| 596 | ! |
---|
| 597 | !-- Allocate 3D arrays (dimension = number of grid points) |
---|
[1912] | 598 | ALLOCATE( nac_cd_surf(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
| 599 | ALLOCATE( rot_tend_x(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
| 600 | ALLOCATE( rot_tend_y(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
| 601 | ALLOCATE( rot_tend_z(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
[1819] | 602 | ALLOCATE( thrust(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
| 603 | ALLOCATE( torque_y(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
| 604 | ALLOCATE( torque_z(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
[1912] | 605 | ALLOCATE( tow_cd_surf(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
[1819] | 606 | |
---|
| 607 | ! |
---|
| 608 | !-- Allocate additional 3D arrays |
---|
| 609 | ALLOCATE( u_int(1:nturbines,1:nrings_max,1:nsegs_max) ) |
---|
| 610 | ALLOCATE( u_int_1_l(1:nturbines,1:nrings_max,1:nsegs_max) ) |
---|
| 611 | ALLOCATE( v_int(1:nturbines,1:nrings_max,1:nsegs_max) ) |
---|
| 612 | ALLOCATE( v_int_1_l(1:nturbines,1:nrings_max,1:nsegs_max) ) |
---|
| 613 | ALLOCATE( w_int(1:nturbines,1:nrings_max,1:nsegs_max) ) |
---|
| 614 | ALLOCATE( w_int_1_l(1:nturbines,1:nrings_max,1:nsegs_max) ) |
---|
| 615 | |
---|
| 616 | ! |
---|
| 617 | !-- All of the arrays are initialized with a value of zero: |
---|
| 618 | i_hub(:) = 0 |
---|
| 619 | i_smear(:) = 0 |
---|
| 620 | j_hub(:) = 0 |
---|
| 621 | j_smear(:) = 0 |
---|
| 622 | k_hub(:) = 0 |
---|
| 623 | k_smear(:) = 0 |
---|
[1912] | 624 | |
---|
[1819] | 625 | torque_total(:) = 0.0_wp |
---|
[1912] | 626 | thrust_rotor(:) = 0.0_wp |
---|
[1819] | 627 | |
---|
| 628 | omega_gen(:) = 0.0_wp |
---|
[1864] | 629 | omega_gen_old(:) = 0.0_wp |
---|
[1819] | 630 | omega_gen_f(:) = 0.0_wp |
---|
| 631 | omega_gen_f_old(:) = 0.0_wp |
---|
[1912] | 632 | pitch_add_old(:) = 0.0_wp |
---|
[1819] | 633 | torque_gen(:) = 0.0_wp |
---|
| 634 | torque_gen_old(:) = 0.0_wp |
---|
| 635 | |
---|
| 636 | yawdir(:) = 0.0_wp |
---|
| 637 | wdir(:) = 0.0_wp |
---|
| 638 | u_inflow(:) = 0.0_wp |
---|
| 639 | |
---|
| 640 | ! |
---|
| 641 | !-- Allocate 1D arrays (dimension = number of rotor segments) |
---|
| 642 | alpha_attack(:) = 0.0_wp |
---|
| 643 | chord(:) = 0.0_wp |
---|
| 644 | phi_rel(:) = 0.0_wp |
---|
| 645 | thrust_seg(:) = 0.0_wp |
---|
| 646 | torque_seg_y(:) = 0.0_wp |
---|
| 647 | torque_seg_z(:) = 0.0_wp |
---|
[1864] | 648 | turb_cd(:) = 0.0_wp |
---|
| 649 | turb_cl(:) = 0.0_wp |
---|
[1819] | 650 | vrel(:) = 0.0_wp |
---|
| 651 | vtheta(:) = 0.0_wp |
---|
| 652 | |
---|
| 653 | rbx(:,:) = 0.0_wp |
---|
| 654 | rby(:,:) = 0.0_wp |
---|
| 655 | rbz(:,:) = 0.0_wp |
---|
| 656 | thrust_ring(:,:) = 0.0_wp |
---|
| 657 | torque_ring_y(:,:) = 0.0_wp |
---|
| 658 | torque_ring_z(:,:) = 0.0_wp |
---|
| 659 | |
---|
| 660 | rotx(:,:) = 0.0_wp |
---|
| 661 | roty(:,:) = 0.0_wp |
---|
| 662 | rotz(:,:) = 0.0_wp |
---|
[1864] | 663 | turb_cl_tab(:,:) = 0.0_wp |
---|
| 664 | turb_cd_tab(:,:) = 0.0_wp |
---|
[1819] | 665 | |
---|
[1912] | 666 | nac_cd_surf(:,:,:) = 0.0_wp |
---|
| 667 | rot_tend_x(:,:,:) = 0.0_wp |
---|
| 668 | rot_tend_y(:,:,:) = 0.0_wp |
---|
| 669 | rot_tend_z(:,:,:) = 0.0_wp |
---|
[1819] | 670 | thrust(:,:,:) = 0.0_wp |
---|
| 671 | torque_y(:,:,:) = 0.0_wp |
---|
| 672 | torque_z(:,:,:) = 0.0_wp |
---|
[1912] | 673 | tow_cd_surf(:,:,:) = 0.0_wp |
---|
[1819] | 674 | |
---|
| 675 | u_int(:,:,:) = 0.0_wp |
---|
| 676 | u_int_1_l(:,:,:) = 0.0_wp |
---|
| 677 | v_int(:,:,:) = 0.0_wp |
---|
| 678 | v_int_1_l(:,:,:) = 0.0_wp |
---|
| 679 | w_int(:,:,:) = 0.0_wp |
---|
| 680 | w_int_1_l(:,:,:) = 0.0_wp |
---|
| 681 | |
---|
| 682 | |
---|
[1839] | 683 | END SUBROUTINE wtm_init_arrays |
---|
[1819] | 684 | |
---|
| 685 | |
---|
| 686 | !------------------------------------------------------------------------------! |
---|
| 687 | ! Description: |
---|
| 688 | ! ------------ |
---|
[1839] | 689 | !> Initialization of the wind turbine model |
---|
[1819] | 690 | !------------------------------------------------------------------------------! |
---|
[1839] | 691 | SUBROUTINE wtm_init |
---|
[1819] | 692 | |
---|
[1839] | 693 | |
---|
[1819] | 694 | IMPLICIT NONE |
---|
| 695 | |
---|
| 696 | INTEGER(iwp) :: i !< running index |
---|
| 697 | INTEGER(iwp) :: j !< running index |
---|
| 698 | INTEGER(iwp) :: k !< running index |
---|
[1864] | 699 | |
---|
[1819] | 700 | ! |
---|
[1864] | 701 | !-- Help variables for the smearing function |
---|
| 702 | REAL(wp) :: eps_kernel !< |
---|
| 703 | |
---|
[1839] | 704 | ! |
---|
[1864] | 705 | !-- Help variables for calculation of the tower drag |
---|
| 706 | INTEGER(iwp) :: tower_n !< |
---|
| 707 | INTEGER(iwp) :: tower_s !< |
---|
[1839] | 708 | ! |
---|
[1864] | 709 | !-- Help variables for the calulaction of the nacelle drag |
---|
| 710 | INTEGER(iwp) :: i_ip !< |
---|
| 711 | INTEGER(iwp) :: i_ipg !< |
---|
| 712 | |
---|
| 713 | REAL(wp) :: yvalue |
---|
| 714 | REAL(wp) :: dy_int !< |
---|
| 715 | REAL(wp) :: dz_int !< |
---|
| 716 | |
---|
| 717 | REAL(wp), DIMENSION(:,:), ALLOCATABLE :: circle_points !< |
---|
| 718 | |
---|
| 719 | INTEGER(iwp), DIMENSION(:), ALLOCATABLE :: index_nacb !< |
---|
| 720 | INTEGER(iwp), DIMENSION(:), ALLOCATABLE :: index_nacl !< |
---|
| 721 | INTEGER(iwp), DIMENSION(:), ALLOCATABLE :: index_nacr !< |
---|
| 722 | INTEGER(iwp), DIMENSION(:), ALLOCATABLE :: index_nact !< |
---|
| 723 | |
---|
| 724 | ALLOCATE( index_nacb(1:nturbines) ) |
---|
| 725 | ALLOCATE( index_nacl(1:nturbines) ) |
---|
| 726 | ALLOCATE( index_nacr(1:nturbines) ) |
---|
| 727 | ALLOCATE( index_nact(1:nturbines) ) |
---|
[1819] | 728 | |
---|
| 729 | |
---|
[1864] | 730 | IF ( speed_control) THEN |
---|
| 731 | |
---|
| 732 | CALL wtm_speed_control |
---|
| 733 | |
---|
| 734 | ENDIF |
---|
| 735 | |
---|
[1839] | 736 | ! |
---|
[1819] | 737 | !------------------------------------------------------------------------------! |
---|
[1839] | 738 | !-- Calculation of parameters for the regularization kernel |
---|
| 739 | !-- (smearing of the forces) |
---|
[1819] | 740 | !------------------------------------------------------------------------------! |
---|
| 741 | ! |
---|
[1839] | 742 | !-- In the following, some of the required parameters for the smearing will |
---|
| 743 | !-- be calculated: |
---|
[1819] | 744 | |
---|
[1839] | 745 | !-- The kernel is set equal to twice the grid spacing which has turned out to |
---|
| 746 | !-- be a reasonable value (see e.g. Troldborg et al. (2013), Wind Energy, |
---|
[1819] | 747 | !-- DOI: 10.1002/we.1608): |
---|
| 748 | eps_kernel = 2.0_wp * dx |
---|
| 749 | ! |
---|
[1839] | 750 | !-- The zero point (eps_min) of the polynomial function must be the following |
---|
| 751 | !-- if the integral of the polynomial function (for values < eps_min) shall |
---|
| 752 | !-- be equal to the integral of the Gaussian function used before: |
---|
| 753 | eps_min = ( 105.0_wp / 32.0_wp )**( 1.0_wp / 3.0_wp ) * & |
---|
| 754 | pi**( 1.0_wp / 6.0_wp ) * eps_kernel |
---|
[1819] | 755 | ! |
---|
| 756 | !-- Square of eps_min: |
---|
| 757 | eps_min2 = eps_min**2 |
---|
| 758 | ! |
---|
| 759 | !-- Parameters in the polynomial function: |
---|
[1864] | 760 | pol_a = 1.0_wp / eps_min**4 |
---|
| 761 | pol_b = 2.0_wp / eps_min**2 |
---|
[1819] | 762 | ! |
---|
[1839] | 763 | !-- Normalization factor which is the inverse of the integral of the smearing |
---|
| 764 | !-- function: |
---|
| 765 | eps_factor = 105.0_wp / ( 32.0_wp * pi * eps_min**3 ) |
---|
| 766 | |
---|
[1864] | 767 | !-- Change tilt angle to rad: |
---|
| 768 | tilt = tilt * pi / 180.0_wp |
---|
| 769 | |
---|
[1819] | 770 | ! |
---|
[1864] | 771 | !-- Change yaw angle to rad: |
---|
| 772 | phi_yaw(:) = phi_yaw(:) * pi / 180.0_wp |
---|
[1819] | 773 | |
---|
[1864] | 774 | |
---|
[1819] | 775 | DO inot = 1, nturbines |
---|
| 776 | ! |
---|
[1864] | 777 | !-- Rotate the rotor coordinates in case yaw and tilt are defined |
---|
| 778 | CALL wtm_rotate_rotor( inot ) |
---|
[1819] | 779 | |
---|
| 780 | ! |
---|
| 781 | !-- Determine the indices of the hub height |
---|
| 782 | i_hub(inot) = INT( rcx(inot) / dx ) |
---|
| 783 | j_hub(inot) = INT( ( rcy(inot) + 0.5_wp * dy ) / dy ) |
---|
| 784 | k_hub(inot) = INT( ( rcz(inot) + 0.5_wp * dz ) / dz ) |
---|
| 785 | |
---|
| 786 | ! |
---|
| 787 | !-- Determining the area to which the smearing of the forces is applied. |
---|
[1839] | 788 | !-- As smearing now is effectively applied only for distances smaller than |
---|
| 789 | !-- eps_min, the smearing area can be further limited and regarded as a |
---|
| 790 | !-- function of eps_min: |
---|
[1819] | 791 | i_smear(inot) = CEILING( ( rr(inot) + eps_min ) / dx ) |
---|
| 792 | j_smear(inot) = CEILING( ( rr(inot) + eps_min ) / dy ) |
---|
| 793 | k_smear(inot) = CEILING( ( rr(inot) + eps_min ) / dz ) |
---|
[1864] | 794 | |
---|
[1819] | 795 | ENDDO |
---|
| 796 | |
---|
| 797 | ! |
---|
| 798 | !------------------------------------------------------------------------------! |
---|
[1839] | 799 | !-- Determine the area within each grid cell that overlaps with the area |
---|
| 800 | !-- of the nacelle and the tower (needed for calculation of the forces) |
---|
[1819] | 801 | !------------------------------------------------------------------------------! |
---|
| 802 | ! |
---|
| 803 | !-- Note: so far this is only a 2D version, in that the mean flow is |
---|
| 804 | !-- perpendicular to the rotor area. |
---|
| 805 | |
---|
| 806 | ! |
---|
| 807 | !-- Allocation of the array containing information on the intersection points |
---|
| 808 | !-- between rotor disk and the numerical grid: |
---|
| 809 | upper_end = ( ny + 1 ) * 10000 |
---|
| 810 | |
---|
| 811 | ALLOCATE( circle_points(1:2,1:upper_end) ) |
---|
[1839] | 812 | |
---|
| 813 | circle_points(:,:) = 0.0_wp |
---|
[1819] | 814 | |
---|
[1839] | 815 | |
---|
| 816 | DO inot = 1, nturbines ! loop over number of turbines |
---|
[1819] | 817 | ! |
---|
[1839] | 818 | !-- Determine the grid index (u-grid) that corresponds to the location of |
---|
| 819 | !-- the rotor center (reduces the amount of calculations in the case that |
---|
| 820 | !-- the mean flow is perpendicular to the rotor area): |
---|
[1819] | 821 | i = i_hub(inot) |
---|
| 822 | |
---|
| 823 | ! |
---|
[1839] | 824 | !-- Determine the left and the right edge of the nacelle (corresponding |
---|
| 825 | !-- grid point indices): |
---|
[1819] | 826 | index_nacl(inot) = INT( ( rcy(inot) - rnac(inot) + 0.5_wp * dy ) / dy ) |
---|
| 827 | index_nacr(inot) = INT( ( rcy(inot) + rnac(inot) + 0.5_wp * dy ) / dy ) |
---|
| 828 | ! |
---|
[1839] | 829 | !-- Determine the bottom and the top edge of the nacelle (corresponding |
---|
| 830 | !-- grid point indices).The grid point index has to be increased by 1, as |
---|
| 831 | !-- the first level for the u-component (index 0) is situated below the |
---|
| 832 | !-- surface. All points between z=0 and z=dz/s would already be contained |
---|
| 833 | !-- in grid box 1. |
---|
[1819] | 834 | index_nacb(inot) = INT( ( rcz(inot) - rnac(inot) ) / dz ) + 1 |
---|
| 835 | index_nact(inot) = INT( ( rcz(inot) + rnac(inot) ) / dz ) + 1 |
---|
| 836 | |
---|
| 837 | ! |
---|
| 838 | !-- Determine the indices of the grid boxes containing the left and |
---|
[1864] | 839 | !-- the right boundaries of the tower: |
---|
[1819] | 840 | tower_n = ( rcy(inot) + 0.5_wp * dtow(inot) - 0.5_wp * dy ) / dy |
---|
| 841 | tower_s = ( rcy(inot) - 0.5_wp * dtow(inot) - 0.5_wp * dy ) / dy |
---|
| 842 | |
---|
| 843 | ! |
---|
| 844 | !-- Determine the fraction of the grid box area overlapping with the tower |
---|
[1864] | 845 | !-- area and multiply it with the drag of the tower: |
---|
[1839] | 846 | IF ( ( nxlg <= i ) .AND. ( nxrg >= i ) ) THEN |
---|
[1819] | 847 | |
---|
| 848 | DO j = nys, nyn |
---|
| 849 | ! |
---|
[1839] | 850 | !-- Loop from south to north boundary of tower |
---|
| 851 | IF ( ( j >= tower_s ) .AND. ( j <= tower_n ) ) THEN |
---|
| 852 | |
---|
[1819] | 853 | DO k = nzb, nzt |
---|
| 854 | |
---|
| 855 | IF ( k == k_hub(inot) ) THEN |
---|
| 856 | IF ( tower_n - tower_s >= 1 ) THEN |
---|
[1839] | 857 | ! |
---|
[1819] | 858 | !-- leftmost and rightmost grid box: |
---|
| 859 | IF ( j == tower_s ) THEN |
---|
[1912] | 860 | tow_cd_surf(k,j,i) = ( rcz(inot) - & |
---|
| 861 | ( k_hub(inot) * dz - 0.5_wp * dz ) ) * & ! extension in z-direction |
---|
| 862 | ( ( tower_s + 1.0_wp + 0.5_wp ) * dy - & |
---|
| 863 | ( rcy(inot) - 0.5_wp * dtow(inot) ) ) * & ! extension in y-direction |
---|
| 864 | turb_cd_tower(inot) |
---|
[1819] | 865 | ELSEIF ( j == tower_n ) THEN |
---|
[1912] | 866 | tow_cd_surf(k,j,i) = ( rcz(inot) - & |
---|
| 867 | ( k_hub(inot) * dz - 0.5_wp * dz ) ) * & ! extension in z-direction |
---|
| 868 | ( ( rcy(inot) + 0.5_wp * dtow(inot) ) - & |
---|
| 869 | ( tower_n + 0.5_wp ) * dy ) * & ! extension in y-direction |
---|
| 870 | turb_cd_tower(inot) |
---|
[1819] | 871 | ! |
---|
| 872 | !-- grid boxes inbetween |
---|
[1912] | 873 | !-- (where tow_cd_surf = grid box area): |
---|
[1819] | 874 | ELSE |
---|
[1912] | 875 | tow_cd_surf(k,j,i) = ( rcz(inot) - & |
---|
| 876 | ( k_hub(inot) * dz - 0.5_wp * dz ) ) * & |
---|
| 877 | dy * turb_cd_tower(inot) |
---|
[1819] | 878 | ENDIF |
---|
| 879 | ! |
---|
| 880 | !-- tower lies completely within one grid box: |
---|
| 881 | ELSE |
---|
[1912] | 882 | tow_cd_surf(k,j,i) = ( rcz(inot) - & |
---|
[1839] | 883 | ( k_hub(inot) * dz - 0.5_wp * dz ) ) * & |
---|
[1912] | 884 | dtow(inot) * turb_cd_tower(inot) |
---|
[1819] | 885 | ENDIF |
---|
[1839] | 886 | ! |
---|
| 887 | !-- In case that k is smaller than k_hub the following actions |
---|
| 888 | !-- are carried out: |
---|
[1819] | 889 | ELSEIF ( k < k_hub(inot) ) THEN |
---|
| 890 | |
---|
[1839] | 891 | IF ( ( tower_n - tower_s ) >= 1 ) THEN |
---|
| 892 | ! |
---|
[1819] | 893 | !-- leftmost and rightmost grid box: |
---|
| 894 | IF ( j == tower_s ) THEN |
---|
[1912] | 895 | tow_cd_surf(k,j,i) = dz * ( & |
---|
[1839] | 896 | ( tower_s + 1 + 0.5_wp ) * dy - & |
---|
| 897 | ( rcy(inot) - 0.5_wp * dtow(inot) ) & |
---|
[1912] | 898 | ) * turb_cd_tower(inot) |
---|
[1819] | 899 | ELSEIF ( j == tower_n ) THEN |
---|
[1912] | 900 | tow_cd_surf(k,j,i) = dz * ( & |
---|
[1839] | 901 | ( rcy(inot) + 0.5_wp * dtow(inot) ) - & |
---|
| 902 | ( tower_n + 0.5_wp ) * dy & |
---|
[1912] | 903 | ) * turb_cd_tower(inot) |
---|
[1839] | 904 | ! |
---|
| 905 | !-- grid boxes inbetween |
---|
[1912] | 906 | !-- (where tow_cd_surf = grid box area): |
---|
[1819] | 907 | ELSE |
---|
[1912] | 908 | tow_cd_surf(k,j,i) = dz * dy * turb_cd_tower(inot) |
---|
[1819] | 909 | ENDIF |
---|
[1839] | 910 | ! |
---|
[1819] | 911 | !-- tower lies completely within one grid box: |
---|
| 912 | ELSE |
---|
[1912] | 913 | tow_cd_surf(k,j,i) = dz * dtow(inot) * & |
---|
| 914 | turb_cd_tower(inot) |
---|
[1839] | 915 | ENDIF ! end if larger than grid box |
---|
| 916 | |
---|
| 917 | ENDIF ! end if k == k_hub |
---|
| 918 | |
---|
| 919 | ENDDO ! end loop over k |
---|
| 920 | |
---|
| 921 | ENDIF ! end if inside north and south boundary of tower |
---|
| 922 | |
---|
| 923 | ENDDO ! end loop over j |
---|
| 924 | |
---|
| 925 | ENDIF ! end if hub inside domain + ghostpoints |
---|
[1819] | 926 | |
---|
[1839] | 927 | |
---|
[1912] | 928 | CALL exchange_horiz( tow_cd_surf, nbgp ) |
---|
[1819] | 929 | |
---|
[1839] | 930 | ! |
---|
[1864] | 931 | !-- Calculation of the nacelle area |
---|
| 932 | !-- CAUTION: Currently disabled due to segmentation faults on the FLOW HPC |
---|
| 933 | !-- cluster (Oldenburg) |
---|
| 934 | !! |
---|
| 935 | !!-- Tabulate the points on the circle that are required in the following for |
---|
| 936 | !!-- the calculation of the Riemann integral (node points; they are called |
---|
| 937 | !!-- circle_points in the following): |
---|
| 938 | ! |
---|
| 939 | ! dy_int = dy / 10000.0_wp |
---|
| 940 | ! |
---|
| 941 | ! DO i_ip = 1, upper_end |
---|
| 942 | ! yvalue = dy_int * ( i_ip - 0.5_wp ) + 0.5_wp * dy !<--- segmentation fault |
---|
| 943 | ! sqrt_arg = rnac(inot)**2 - ( yvalue - rcy(inot) )**2 !<--- segmentation fault |
---|
| 944 | ! IF ( sqrt_arg >= 0.0_wp ) THEN |
---|
| 945 | !! |
---|
| 946 | !!-- bottom intersection point |
---|
| 947 | ! circle_points(1,i_ip) = rcz(inot) - SQRT( sqrt_arg ) |
---|
| 948 | !! |
---|
| 949 | !!-- top intersection point |
---|
| 950 | ! circle_points(2,i_ip) = rcz(inot) + SQRT( sqrt_arg ) !<--- segmentation fault |
---|
| 951 | ! ELSE |
---|
| 952 | ! circle_points(:,i_ip) = -111111 !<--- segmentation fault |
---|
| 953 | ! ENDIF |
---|
| 954 | ! ENDDO |
---|
| 955 | ! |
---|
| 956 | ! |
---|
| 957 | ! DO j = nys, nyn |
---|
| 958 | !! |
---|
| 959 | !!-- In case that the grid box is located completely outside the nacelle |
---|
| 960 | !!-- (y) it can automatically be stated that there is no overlap between |
---|
| 961 | !!-- the grid box and the nacelle and consequently we can set |
---|
[1912] | 962 | !!-- nac_cd_surf(:,j,i) = 0.0: |
---|
[1864] | 963 | ! IF ( ( j >= index_nacl(inot) ) .AND. ( j <= index_nacr(inot) ) ) THEN |
---|
| 964 | ! DO k = nzb+1, nzt |
---|
| 965 | !! |
---|
| 966 | !!-- In case that the grid box is located completely outside the |
---|
| 967 | !!-- nacelle (z) it can automatically be stated that there is no |
---|
| 968 | !!-- overlap between the grid box and the nacelle and consequently |
---|
[1912] | 969 | !!-- we can set nac_cd_surf(k,j,i) = 0.0: |
---|
[1864] | 970 | ! IF ( ( k >= index_nacb(inot) ) .OR. & |
---|
| 971 | ! ( k <= index_nact(inot) ) ) THEN |
---|
| 972 | !! |
---|
| 973 | !!-- For all other cases Riemann integrals are calculated. |
---|
| 974 | !!-- Here, the points on the circle that have been determined |
---|
| 975 | !!-- above are used in order to calculate the overlap between the |
---|
| 976 | !!-- gridbox and the nacelle area (area approached by 10000 |
---|
| 977 | !!-- rectangulars dz_int * dy_int): |
---|
| 978 | ! DO i_ipg = 1, 10000 |
---|
| 979 | ! dz_int = dz |
---|
| 980 | ! i_ip = j * 10000 + i_ipg |
---|
| 981 | !! |
---|
| 982 | !!-- Determine the vertical extension dz_int of the circle |
---|
| 983 | !!-- within the current grid box: |
---|
| 984 | ! IF ( ( circle_points(2,i_ip) < zw(k) ) .AND. & !<--- segmentation fault |
---|
| 985 | ! ( circle_points(2,i_ip) >= zw(k-1) ) ) THEN |
---|
| 986 | ! dz_int = dz_int - & !<--- segmentation fault |
---|
| 987 | ! ( zw(k) - circle_points(2,i_ip) ) |
---|
| 988 | ! ENDIF |
---|
| 989 | ! IF ( ( circle_points(1,i_ip) <= zw(k) ) .AND. & !<--- segmentation fault |
---|
| 990 | ! ( circle_points(1,i_ip) > zw(k-1) ) ) THEN |
---|
| 991 | ! dz_int = dz_int - & |
---|
| 992 | ! ( circle_points(1,i_ip) - zw(k-1) ) |
---|
| 993 | ! ENDIF |
---|
| 994 | ! IF ( zw(k-1) > circle_points(2,i_ip) ) THEN |
---|
| 995 | ! dz_int = 0.0_wp |
---|
| 996 | ! ENDIF |
---|
| 997 | ! IF ( zw(k) < circle_points(1,i_ip) ) THEN |
---|
| 998 | ! dz_int = 0.0_wp |
---|
| 999 | ! ENDIF |
---|
| 1000 | ! IF ( ( nxlg <= i ) .AND. ( nxrg >= i ) ) THEN |
---|
[1912] | 1001 | ! nac_cd_surf(k,j,i) = nac_cd_surf(k,j,i) + & !<--- segmentation fault |
---|
| 1002 | ! dy_int * dz_int * turb_cd_nacelle(inot) |
---|
[1864] | 1003 | ! ENDIF |
---|
| 1004 | ! ENDDO |
---|
| 1005 | ! ENDIF |
---|
| 1006 | ! ENDDO |
---|
| 1007 | ! ENDIF |
---|
[1819] | 1008 | ! |
---|
[1864] | 1009 | ! ENDDO |
---|
[1819] | 1010 | ! |
---|
[1912] | 1011 | ! CALL exchange_horiz( nac_cd_surf, nbgp ) !<--- segmentation fault |
---|
[1819] | 1012 | |
---|
[1864] | 1013 | ENDDO ! end of loop over turbines |
---|
[1819] | 1014 | |
---|
[1912] | 1015 | tow_cd_surf = tow_cd_surf / ( dx * dy * dz ) ! Normalize tower drag |
---|
| 1016 | nac_cd_surf = nac_cd_surf / ( dx * dy * dz ) ! Normalize nacelle drag |
---|
[1819] | 1017 | |
---|
[1912] | 1018 | CALL wtm_read_blade_tables |
---|
[1839] | 1019 | |
---|
[1864] | 1020 | END SUBROUTINE wtm_init |
---|
| 1021 | |
---|
| 1022 | |
---|
[1819] | 1023 | !------------------------------------------------------------------------------! |
---|
[1864] | 1024 | ! Description: |
---|
| 1025 | ! ------------ |
---|
| 1026 | !> Read in layout of the rotor blade , the lift and drag tables |
---|
| 1027 | !> and the distribution of lift and drag tables along the blade |
---|
[1819] | 1028 | !------------------------------------------------------------------------------! |
---|
[1912] | 1029 | ! |
---|
| 1030 | SUBROUTINE wtm_read_blade_tables |
---|
[1819] | 1031 | |
---|
[1839] | 1032 | |
---|
[1864] | 1033 | IMPLICIT NONE |
---|
| 1034 | |
---|
| 1035 | INTEGER(iwp) :: ii !< running index |
---|
| 1036 | INTEGER(iwp) :: jj !< running index |
---|
[1843] | 1037 | |
---|
[1864] | 1038 | INTEGER(iwp) :: ierrn !< |
---|
| 1039 | |
---|
| 1040 | CHARACTER(200) :: chmess !< Read in string |
---|
[1839] | 1041 | |
---|
[1864] | 1042 | INTEGER(iwp) :: dlen !< no. rows of local table |
---|
| 1043 | INTEGER(iwp) :: dlenbl !< no. rows of cd, cl table |
---|
| 1044 | INTEGER(iwp) :: ialpha !< table position of current alpha value |
---|
| 1045 | INTEGER(iwp) :: iialpha !< |
---|
| 1046 | INTEGER(iwp) :: iir !< |
---|
| 1047 | INTEGER(iwp) :: radres !< radial resolution |
---|
| 1048 | INTEGER(iwp) :: t1 !< no. of airfoil |
---|
| 1049 | INTEGER(iwp) :: t2 !< no. of airfoil |
---|
| 1050 | INTEGER(iwp) :: trow !< |
---|
| 1051 | INTEGER(iwp) :: dlenbl_int !< no. rows of interpolated cd, cl tables |
---|
[1839] | 1052 | |
---|
[1864] | 1053 | REAL(wp) :: alpha_attack_i !< |
---|
| 1054 | REAL(wp) :: weight_a !< |
---|
| 1055 | REAL(wp) :: weight_b !< |
---|
[1839] | 1056 | |
---|
[1864] | 1057 | INTEGER(iwp), DIMENSION(:), ALLOCATABLE :: ttoint1 !< |
---|
| 1058 | INTEGER(iwp), DIMENSION(:), ALLOCATABLE :: ttoint2 !< |
---|
[1839] | 1059 | |
---|
[1864] | 1060 | REAL(wp), DIMENSION(:), ALLOCATABLE :: turb_cd_sel1 !< |
---|
| 1061 | REAL(wp), DIMENSION(:), ALLOCATABLE :: turb_cd_sel2 !< |
---|
| 1062 | REAL(wp), DIMENSION(:), ALLOCATABLE :: turb_cl_sel1 !< |
---|
| 1063 | REAL(wp), DIMENSION(:), ALLOCATABLE :: turb_cl_sel2 !< |
---|
| 1064 | REAL(wp), DIMENSION(:), ALLOCATABLE :: read_cl_cd !< read in var array |
---|
[1839] | 1065 | |
---|
[1864] | 1066 | REAL(wp), DIMENSION(:), ALLOCATABLE :: alpha_attack_tab !< |
---|
| 1067 | REAL(wp), DIMENSION(:), ALLOCATABLE :: trad1 !< |
---|
| 1068 | REAL(wp), DIMENSION(:), ALLOCATABLE :: trad2 !< |
---|
| 1069 | REAL(wp), DIMENSION(:,:), ALLOCATABLE :: turb_cd_table !< |
---|
| 1070 | REAL(wp), DIMENSION(:,:), ALLOCATABLE :: turb_cl_table !< |
---|
[1839] | 1071 | |
---|
[1864] | 1072 | ALLOCATE ( read_cl_cd(1:2*nairfoils+1) ) |
---|
[1839] | 1073 | |
---|
[1864] | 1074 | ! |
---|
| 1075 | !-- Read in the distribution of lift and drag tables along the blade, the |
---|
| 1076 | !-- layout of the rotor blade and the lift and drag tables: |
---|
| 1077 | |
---|
| 1078 | OPEN ( 201, FILE='WTM_DATA', STATUS='OLD', FORM='FORMATTED', IOSTAT=ierrn ) |
---|
| 1079 | |
---|
| 1080 | IF ( ierrn /= 0 ) THEN |
---|
| 1081 | message_string = 'file WTM_DATA does not exist' |
---|
| 1082 | CALL message( 'wtm_init', 'PA0???', 1, 2, 0, 6, 0 ) |
---|
| 1083 | ENDIF |
---|
| 1084 | ! |
---|
| 1085 | !-- Read distribution table: |
---|
| 1086 | |
---|
| 1087 | dlen = 0 |
---|
| 1088 | |
---|
| 1089 | READ ( 201, '(3/)' ) |
---|
| 1090 | |
---|
| 1091 | rloop3: DO |
---|
| 1092 | READ ( 201, *, IOSTAT=ierrn ) chmess |
---|
| 1093 | IF ( ierrn < 0 .OR. chmess == '#' .OR. chmess == '') EXIT rloop3 |
---|
| 1094 | dlen = dlen + 1 |
---|
| 1095 | ENDDO rloop3 |
---|
| 1096 | |
---|
| 1097 | ALLOCATE( trad1(1:dlen), trad2(1:dlen), ttoint1(1:dlen), ttoint2(1:dlen)) |
---|
| 1098 | |
---|
| 1099 | DO jj = 1,dlen+1 |
---|
| 1100 | BACKSPACE ( 201, IOSTAT=ierrn ) |
---|
| 1101 | ENDDO |
---|
| 1102 | |
---|
| 1103 | DO jj = 1,dlen |
---|
| 1104 | READ ( 201, * ) trad1(jj), trad2(jj), ttoint1(jj), ttoint2(jj) |
---|
| 1105 | ENDDO |
---|
| 1106 | |
---|
| 1107 | ! |
---|
| 1108 | !-- Read layout table: |
---|
| 1109 | |
---|
[1839] | 1110 | dlen = 0 |
---|
[1864] | 1111 | |
---|
[1839] | 1112 | READ ( 201, '(3/)') |
---|
[1864] | 1113 | |
---|
[1843] | 1114 | rloop1: DO |
---|
[1864] | 1115 | READ ( 201, *, IOSTAT=ierrn ) chmess |
---|
| 1116 | IF ( ierrn < 0 .OR. chmess == '#' .OR. chmess == '') EXIT rloop1 |
---|
| 1117 | dlen = dlen + 1 |
---|
[1843] | 1118 | ENDDO rloop1 |
---|
[1864] | 1119 | |
---|
[1839] | 1120 | ALLOCATE( lrd(1:dlen), ard(1:dlen), crd(1:dlen) ) |
---|
[1864] | 1121 | DO jj = 1, dlen+1 |
---|
| 1122 | BACKSPACE ( 201, IOSTAT=ierrn ) |
---|
| 1123 | ENDDO |
---|
| 1124 | DO jj = 1, dlen |
---|
| 1125 | READ ( 201, * ) lrd(jj), ard(jj), crd(jj) |
---|
[1839] | 1126 | ENDDO |
---|
[1819] | 1127 | |
---|
[1864] | 1128 | ! |
---|
| 1129 | !-- Read tables (turb_cl(alpha),turb_cd(alpha) for the different profiles: |
---|
[1819] | 1130 | |
---|
[1864] | 1131 | dlen = 0 |
---|
| 1132 | |
---|
[1839] | 1133 | READ ( 201, '(3/)' ) |
---|
[1864] | 1134 | |
---|
[1843] | 1135 | rloop2: DO |
---|
[1864] | 1136 | READ ( 201, *, IOSTAT=ierrn ) chmess |
---|
| 1137 | IF ( ierrn < 0 .OR. chmess == '#' .OR. chmess == '') EXIT rloop2 |
---|
| 1138 | dlen = dlen + 1 |
---|
| 1139 | ENDDO rloop2 |
---|
| 1140 | |
---|
[1912] | 1141 | ALLOCATE( alpha_attack_tab(1:dlen), turb_cl_table(1:dlen,1:nairfoils), & |
---|
[1864] | 1142 | turb_cd_table(1:dlen,1:nairfoils) ) |
---|
| 1143 | |
---|
| 1144 | DO jj = 1,dlen+1 |
---|
| 1145 | BACKSPACE ( 201, IOSTAT=ierrn ) |
---|
| 1146 | ENDDO |
---|
| 1147 | |
---|
[1839] | 1148 | DO jj = 1,dlen |
---|
[1864] | 1149 | READ ( 201, * ) read_cl_cd |
---|
| 1150 | alpha_attack_tab(jj) = read_cl_cd(1) |
---|
| 1151 | DO ii= 1, nairfoils |
---|
| 1152 | turb_cl_table(jj,ii) = read_cl_cd(ii*2) |
---|
| 1153 | turb_cd_table(jj,ii) = read_cl_cd(ii*2+1) |
---|
[1819] | 1154 | ENDDO |
---|
[1864] | 1155 | |
---|
[1839] | 1156 | ENDDO |
---|
[1864] | 1157 | |
---|
| 1158 | dlenbl = dlen |
---|
| 1159 | |
---|
[1839] | 1160 | CLOSE ( 201 ) |
---|
[1819] | 1161 | |
---|
[1864] | 1162 | ! |
---|
| 1163 | !-- For each possible radial position (resolution: 0.1 m --> 630 values) and |
---|
| 1164 | !-- each possible angle of attack (resolution: 0.01 degrees --> 36000 values!) |
---|
| 1165 | !-- determine the lift and drag coefficient by interpolating between the |
---|
| 1166 | !-- tabulated values of each table (interpolate to current angle of attack) |
---|
| 1167 | !-- and between the tables (interpolate to current radial position): |
---|
[1839] | 1168 | |
---|
[1864] | 1169 | ALLOCATE( turb_cl_sel1(0:dlenbl) ) |
---|
| 1170 | ALLOCATE( turb_cl_sel2(0:dlenbl) ) |
---|
| 1171 | ALLOCATE( turb_cd_sel1(0:dlenbl) ) |
---|
| 1172 | ALLOCATE( turb_cd_sel2(0:dlenbl) ) |
---|
[1819] | 1173 | |
---|
[1864] | 1174 | radres = INT( rr(1) * 10.0_wp ) + 1_iwp |
---|
| 1175 | dlenbl_int = INT( 360.0_wp / accu_cl_cd_tab ) + 1_iwp |
---|
[1839] | 1176 | |
---|
[1864] | 1177 | |
---|
| 1178 | ALLOCATE( turb_cl_tab(0:dlenbl_int,1:radres) ) |
---|
| 1179 | ALLOCATE( turb_cd_tab(0:dlenbl_int,1:radres) ) |
---|
| 1180 | |
---|
| 1181 | |
---|
| 1182 | DO iir = 1, radres ! loop over radius |
---|
| 1183 | |
---|
| 1184 | DO iialpha = 1, dlenbl_int ! loop over angles |
---|
| 1185 | |
---|
| 1186 | cur_r = ( iir - 1_iwp ) * 0.1_wp |
---|
| 1187 | alpha_attack_i = -180.0_wp + REAL( iialpha-1 ) * accu_cl_cd_tab |
---|
| 1188 | ialpha = 1 |
---|
| 1189 | |
---|
| 1190 | DO WHILE ( alpha_attack_i > alpha_attack_tab(ialpha) ) |
---|
| 1191 | ialpha = ialpha + 1 |
---|
| 1192 | ENDDO |
---|
[1819] | 1193 | ! |
---|
[1864] | 1194 | !-- Find position in table |
---|
| 1195 | lct = MINLOC( ABS( trad1 - cur_r ) ) |
---|
| 1196 | ! lct(1) = lct(1) |
---|
[1819] | 1197 | |
---|
[1864] | 1198 | IF ( ( trad1(lct(1)) - cur_r ) .GT. 0.0 ) THEN |
---|
| 1199 | lct(1) = lct(1) - 1 |
---|
| 1200 | ENDIF |
---|
[1819] | 1201 | |
---|
[1864] | 1202 | trow = lct(1) |
---|
| 1203 | ! |
---|
| 1204 | !-- Calculate weights for interpolation |
---|
| 1205 | weight_a = ( trad2(trow) - cur_r ) / ( trad2(trow) - trad1(trow) ) |
---|
| 1206 | weight_b = ( cur_r - trad1(trow) ) / ( trad2(trow) - trad1(trow) ) |
---|
| 1207 | t1 = ttoint1(trow) |
---|
| 1208 | t2 = ttoint2(trow) |
---|
[1819] | 1209 | |
---|
[1912] | 1210 | IF ( t1 .EQ. t2 ) THEN ! if both are the same, the weights are NaN |
---|
| 1211 | weight_a = 0.5_wp ! then do interpolate in between same twice |
---|
| 1212 | weight_b = 0.5_wp ! using 0.5 as weight |
---|
[1864] | 1213 | ENDIF |
---|
[1819] | 1214 | |
---|
[1864] | 1215 | IF ( t1 == 0 .AND. t2 == 0 ) THEN |
---|
| 1216 | turb_cd_sel1 = 0.0_wp |
---|
| 1217 | turb_cd_sel2 = 0.0_wp |
---|
| 1218 | turb_cl_sel1 = 0.0_wp |
---|
| 1219 | turb_cl_sel2 = 0.0_wp |
---|
| 1220 | ELSE |
---|
| 1221 | turb_cd_sel1 = turb_cd_table(:,t1) |
---|
| 1222 | turb_cd_sel2 = turb_cd_table(:,t2) |
---|
| 1223 | turb_cl_sel1 = turb_cl_table(:,t1) |
---|
| 1224 | turb_cl_sel2 = turb_cl_table(:,t2) |
---|
| 1225 | ENDIF |
---|
| 1226 | |
---|
[1912] | 1227 | ! |
---|
| 1228 | !-- Interpolation of lift and drag coefficiencts on fine grid of radius |
---|
| 1229 | !-- segments and angles of attack |
---|
| 1230 | |
---|
| 1231 | turb_cl_tab(iialpha,iir) = ( alpha_attack_tab(ialpha) - & |
---|
| 1232 | alpha_attack_i ) / & |
---|
[1864] | 1233 | ( alpha_attack_tab(ialpha) - & |
---|
| 1234 | alpha_attack_tab(ialpha-1) ) * & |
---|
| 1235 | ( weight_a * turb_cl_sel1(ialpha-1) + & |
---|
| 1236 | weight_b * turb_cl_sel2(ialpha-1) ) +& |
---|
| 1237 | ( alpha_attack_i - & |
---|
| 1238 | alpha_attack_tab(ialpha-1) ) / & |
---|
| 1239 | ( alpha_attack_tab(ialpha) - & |
---|
| 1240 | alpha_attack_tab(ialpha-1) ) * & |
---|
| 1241 | ( weight_a * turb_cl_sel1(ialpha) + & |
---|
| 1242 | weight_b * turb_cl_sel2(ialpha) ) |
---|
[1912] | 1243 | turb_cd_tab(iialpha,iir) = ( alpha_attack_tab(ialpha) - & |
---|
| 1244 | alpha_attack_i ) / & |
---|
[1864] | 1245 | ( alpha_attack_tab(ialpha) - & |
---|
| 1246 | alpha_attack_tab(ialpha-1) ) * & |
---|
| 1247 | ( weight_a * turb_cd_sel1(ialpha-1) + & |
---|
| 1248 | weight_b * turb_cd_sel2(ialpha-1) ) +& |
---|
| 1249 | ( alpha_attack_i - & |
---|
| 1250 | alpha_attack_tab(ialpha-1) ) / & |
---|
| 1251 | ( alpha_attack_tab(ialpha) - & |
---|
| 1252 | alpha_attack_tab(ialpha-1) ) * & |
---|
| 1253 | ( weight_a * turb_cd_sel1(ialpha) + & |
---|
| 1254 | weight_b * turb_cd_sel2(ialpha) ) |
---|
[1819] | 1255 | |
---|
[1912] | 1256 | ENDDO ! end loop over angles of attack |
---|
[1819] | 1257 | |
---|
[1864] | 1258 | ENDDO ! end loop over radius |
---|
| 1259 | |
---|
[1912] | 1260 | END SUBROUTINE wtm_read_blade_tables |
---|
[1819] | 1261 | |
---|
| 1262 | |
---|
[1864] | 1263 | !------------------------------------------------------------------------------! |
---|
| 1264 | ! Description: |
---|
| 1265 | ! ------------ |
---|
| 1266 | !> The projection matrix for the coordinate system of therotor disc in respect |
---|
| 1267 | !> to the yaw and tilt angle of the rotor is calculated |
---|
| 1268 | !------------------------------------------------------------------------------! |
---|
| 1269 | SUBROUTINE wtm_rotate_rotor( inot ) |
---|
[1819] | 1270 | |
---|
[1864] | 1271 | |
---|
| 1272 | IMPLICIT NONE |
---|
| 1273 | |
---|
| 1274 | INTEGER(iwp) :: inot |
---|
| 1275 | ! |
---|
| 1276 | !-- Calculation of the rotation matrix for the application of the tilt to |
---|
| 1277 | !-- the rotors |
---|
| 1278 | rot_eigen_rad(1) = SIN( phi_yaw(inot) ) ! x-component of the radial eigenvector |
---|
| 1279 | rot_eigen_rad(2) = COS( phi_yaw(inot) ) ! y-component of the radial eigenvector |
---|
| 1280 | rot_eigen_rad(3) = 0.0_wp ! z-component of the radial eigenvector |
---|
| 1281 | |
---|
| 1282 | rot_eigen_azi(1) = 0.0_wp ! x-component of the azimuth eigenvector |
---|
| 1283 | rot_eigen_azi(2) = 0.0_wp ! y-component of the azimuth eigenvector |
---|
| 1284 | rot_eigen_azi(3) = 1.0_wp ! z-component of the azimuth eigenvector |
---|
| 1285 | |
---|
| 1286 | rot_eigen_nor(1) = COS( phi_yaw(inot) ) ! x-component of the normal eigenvector |
---|
| 1287 | rot_eigen_nor(2) = -SIN( phi_yaw(inot) ) ! y-component of the normal eigenvector |
---|
| 1288 | rot_eigen_nor(3) = 0.0_wp ! z-component of the normal eigenvector |
---|
[1839] | 1289 | |
---|
[1864] | 1290 | ! |
---|
| 1291 | !-- Calculation of the coordinate transformation matrix to apply a tilt to |
---|
| 1292 | !-- the rotor. If tilt = 0, rot_coord_trans is a unit matrix. |
---|
[1819] | 1293 | |
---|
[1912] | 1294 | rot_coord_trans(inot,1,1) = rot_eigen_rad(1)**2 * & |
---|
[1864] | 1295 | ( 1.0_wp - COS( tilt ) ) + COS( tilt ) |
---|
[1912] | 1296 | rot_coord_trans(inot,1,2) = rot_eigen_rad(1) * rot_eigen_rad(2) * & |
---|
| 1297 | ( 1.0_wp - COS( tilt ) ) - & |
---|
[1864] | 1298 | rot_eigen_rad(3) * SIN( tilt ) |
---|
[1912] | 1299 | rot_coord_trans(inot,1,3) = rot_eigen_rad(1) * rot_eigen_rad(3) * & |
---|
| 1300 | ( 1.0_wp - COS( tilt ) ) + & |
---|
[1864] | 1301 | rot_eigen_rad(2) * SIN( tilt ) |
---|
[1912] | 1302 | rot_coord_trans(inot,2,1) = rot_eigen_rad(2) * rot_eigen_rad(1) * & |
---|
| 1303 | ( 1.0_wp - COS( tilt ) ) + & |
---|
[1864] | 1304 | rot_eigen_rad(3) * SIN( tilt ) |
---|
[1912] | 1305 | rot_coord_trans(inot,2,2) = rot_eigen_rad(2)**2 * & |
---|
[1864] | 1306 | ( 1.0_wp - COS( tilt ) ) + COS( tilt ) |
---|
[1912] | 1307 | rot_coord_trans(inot,2,3) = rot_eigen_rad(2) * rot_eigen_rad(3) * & |
---|
| 1308 | ( 1.0_wp - COS( tilt ) ) - & |
---|
[1864] | 1309 | rot_eigen_rad(1) * SIN( tilt ) |
---|
[1912] | 1310 | rot_coord_trans(inot,3,1) = rot_eigen_rad(3) * rot_eigen_rad(1) * & |
---|
| 1311 | ( 1.0_wp - COS( tilt ) ) - & |
---|
[1864] | 1312 | rot_eigen_rad(2) * SIN( tilt ) |
---|
[1912] | 1313 | rot_coord_trans(inot,3,2) = rot_eigen_rad(3) * rot_eigen_rad(2) * & |
---|
| 1314 | ( 1.0_wp - COS( tilt ) ) + & |
---|
[1864] | 1315 | rot_eigen_rad(1) * SIN( tilt ) |
---|
[1912] | 1316 | rot_coord_trans(inot,3,3) = rot_eigen_rad(3)**2 * & |
---|
[1864] | 1317 | ( 1.0_wp - COS( tilt ) ) + COS( tilt ) |
---|
[1839] | 1318 | |
---|
[1864] | 1319 | ! |
---|
| 1320 | !-- Vectors for the Transformation of forces from the rotor's spheric |
---|
| 1321 | !-- coordinate system to the cartesian coordinate system |
---|
| 1322 | rotx(inot,:) = MATMUL( rot_coord_trans(inot,:,:), rot_eigen_nor ) |
---|
| 1323 | roty(inot,:) = MATMUL( rot_coord_trans(inot,:,:), rot_eigen_rad ) |
---|
| 1324 | rotz(inot,:) = MATMUL( rot_coord_trans(inot,:,:), rot_eigen_azi ) |
---|
| 1325 | |
---|
| 1326 | END SUBROUTINE wtm_rotate_rotor |
---|
[1839] | 1327 | |
---|
| 1328 | |
---|
[1819] | 1329 | !------------------------------------------------------------------------------! |
---|
| 1330 | ! Description: |
---|
| 1331 | ! ------------ |
---|
[1839] | 1332 | !> Calculation of the forces generated by the wind turbine |
---|
[1819] | 1333 | !------------------------------------------------------------------------------! |
---|
| 1334 | SUBROUTINE wtm_forces |
---|
| 1335 | |
---|
[1864] | 1336 | |
---|
[1819] | 1337 | IMPLICIT NONE |
---|
| 1338 | |
---|
| 1339 | CHARACTER (LEN=2) :: turbine_id |
---|
| 1340 | |
---|
[1839] | 1341 | INTEGER(iwp) :: i, j, k !< loop indices |
---|
| 1342 | INTEGER(iwp) :: inot !< turbine loop index (turbine id) |
---|
| 1343 | INTEGER(iwp) :: iialpha, iir !< |
---|
| 1344 | INTEGER(iwp) :: rseg, rseg_int !< |
---|
| 1345 | INTEGER(iwp) :: ring, ring_int !< |
---|
| 1346 | INTEGER(iwp) :: ii, jj, kk !< |
---|
[1912] | 1347 | |
---|
[1839] | 1348 | REAL(wp) :: sin_rot, cos_rot !< |
---|
| 1349 | REAL(wp) :: sin_yaw, cos_yaw !< |
---|
[1912] | 1350 | |
---|
| 1351 | REAL(wp) :: aa, bb, cc, dd !< interpolation distances |
---|
| 1352 | REAL(wp) :: gg !< interpolation volume var |
---|
| 1353 | |
---|
| 1354 | REAL(wp) :: dist_u_3d, dist_v_3d, dist_w_3d !< smearing distances |
---|
| 1355 | |
---|
| 1356 | |
---|
[1839] | 1357 | ! |
---|
[1819] | 1358 | ! Variables for pitch control |
---|
| 1359 | REAL(wp) :: torque_max=0.0_wp |
---|
[1839] | 1360 | LOGICAL :: pitch_sw=.FALSE. |
---|
| 1361 | |
---|
[1819] | 1362 | INTEGER(iwp), DIMENSION(1) :: lct=0 |
---|
[1839] | 1363 | REAL(wp), DIMENSION(1) :: rad_d=0.0_wp |
---|
[1819] | 1364 | |
---|
| 1365 | |
---|
[1864] | 1366 | CALL cpu_log( log_point_s(61), 'wtm_forces', 'start' ) |
---|
[1819] | 1367 | |
---|
| 1368 | |
---|
| 1369 | IF ( simulated_time >= time_turbine_on ) THEN |
---|
| 1370 | |
---|
[1864] | 1371 | ! |
---|
[1819] | 1372 | !-- Set forces to zero for each new time step: |
---|
| 1373 | thrust(:,:,:) = 0.0_wp |
---|
| 1374 | torque_y(:,:,:) = 0.0_wp |
---|
| 1375 | torque_z(:,:,:) = 0.0_wp |
---|
| 1376 | torque_total(:) = 0.0_wp |
---|
[1912] | 1377 | rot_tend_x(:,:,:) = 0.0_wp |
---|
| 1378 | rot_tend_y(:,:,:) = 0.0_wp |
---|
| 1379 | rot_tend_z(:,:,:) = 0.0_wp |
---|
| 1380 | thrust_rotor(:) = 0.0_wp |
---|
[1819] | 1381 | ! |
---|
| 1382 | !-- Loop over number of turbines: |
---|
| 1383 | DO inot = 1, nturbines |
---|
| 1384 | |
---|
| 1385 | cos_yaw = COS(phi_yaw(inot)) |
---|
| 1386 | sin_yaw = SIN(phi_yaw(inot)) |
---|
| 1387 | ! |
---|
[1839] | 1388 | !-- Loop over rings of each turbine: |
---|
[1819] | 1389 | DO ring = 1, nrings(inot) |
---|
| 1390 | |
---|
| 1391 | thrust_seg(:) = 0.0_wp |
---|
| 1392 | torque_seg_y(:) = 0.0_wp |
---|
| 1393 | torque_seg_z(:) = 0.0_wp |
---|
| 1394 | ! |
---|
| 1395 | !-- Determine distance between each ring (center) and the hub: |
---|
| 1396 | cur_r = (ring - 0.5_wp) * delta_r(inot) |
---|
| 1397 | |
---|
| 1398 | ! |
---|
[1839] | 1399 | !-- Loop over segments of each ring of each turbine: |
---|
[1819] | 1400 | DO rseg = 1, nsegs(ring,inot) |
---|
| 1401 | ! |
---|
[1864] | 1402 | !-- !-----------------------------------------------------------! |
---|
| 1403 | !-- !-- Determine coordinates of the ring segments --! |
---|
| 1404 | !-- !-----------------------------------------------------------! |
---|
[1819] | 1405 | ! |
---|
[1864] | 1406 | !-- Determine angle of ring segment towards zero degree angle of |
---|
| 1407 | !-- rotor system (at zero degree rotor direction vectors aligned |
---|
| 1408 | !-- with y-axis): |
---|
[1819] | 1409 | phi_rotor = rseg * 2.0_wp * pi / nsegs(ring,inot) |
---|
| 1410 | cos_rot = COS( phi_rotor ) |
---|
| 1411 | sin_rot = SIN( phi_rotor ) |
---|
| 1412 | |
---|
[1864] | 1413 | !-- Now the direction vectors can be determined with respect to |
---|
| 1414 | !-- the yaw and tilt angle: |
---|
[1819] | 1415 | re(1) = cos_rot * sin_yaw |
---|
[1839] | 1416 | re(2) = cos_rot * cos_yaw |
---|
[1819] | 1417 | re(3) = sin_rot |
---|
| 1418 | |
---|
| 1419 | rote = MATMUL( rot_coord_trans(inot,:,:), re ) |
---|
| 1420 | ! |
---|
| 1421 | !-- Coordinates of the single segments (center points): |
---|
| 1422 | rbx(ring,rseg) = rcx(inot) + cur_r * rote(1) |
---|
| 1423 | rby(ring,rseg) = rcy(inot) + cur_r * rote(2) |
---|
| 1424 | rbz(ring,rseg) = rcz(inot) + cur_r * rote(3) |
---|
| 1425 | |
---|
[1864] | 1426 | !-- !-----------------------------------------------------------! |
---|
| 1427 | !-- !-- Interpolation of the velocity components from the --! |
---|
| 1428 | !-- !-- cartesian grid point to the coordinates of each ring --! |
---|
| 1429 | !-- !-- segment (follows a method used in the particle model) --! |
---|
| 1430 | !-- !-----------------------------------------------------------! |
---|
[1819] | 1431 | |
---|
| 1432 | u_int(inot,ring,rseg) = 0.0_wp |
---|
| 1433 | u_int_1_l(inot,ring,rseg) = 0.0_wp |
---|
| 1434 | |
---|
| 1435 | v_int(inot,ring,rseg) = 0.0_wp |
---|
| 1436 | v_int_1_l(inot,ring,rseg) = 0.0_wp |
---|
| 1437 | |
---|
| 1438 | w_int(inot,ring,rseg) = 0.0_wp |
---|
| 1439 | w_int_1_l(inot,ring,rseg) = 0.0_wp |
---|
| 1440 | |
---|
| 1441 | ! |
---|
| 1442 | !-- Interpolation of the u-component: |
---|
| 1443 | |
---|
| 1444 | ii = rbx(ring,rseg) * ddx |
---|
| 1445 | jj = ( rby(ring,rseg) - 0.5_wp * dy ) * ddy |
---|
| 1446 | kk = ( rbz(ring,rseg) - 0.5_wp * dz ) / dz |
---|
| 1447 | ! |
---|
[1864] | 1448 | !-- Interpolate only if all required information is available on |
---|
| 1449 | !-- the current PE: |
---|
[1839] | 1450 | IF ( ( ii >= nxl ) .AND. ( ii <= nxr ) ) THEN |
---|
| 1451 | IF ( ( jj >= nys ) .AND. ( jj <= nyn ) ) THEN |
---|
[1819] | 1452 | |
---|
[1839] | 1453 | aa = ( ( ii + 1 ) * dx - rbx(ring,rseg) ) * & |
---|
| 1454 | ( ( jj + 1 + 0.5_wp ) * dy - rby(ring,rseg) ) |
---|
| 1455 | bb = ( rbx(ring,rseg) - ii * dx ) * & |
---|
| 1456 | ( ( jj + 1 + 0.5_wp ) * dy - rby(ring,rseg) ) |
---|
| 1457 | cc = ( ( ii+1 ) * dx - rbx(ring,rseg) ) * & |
---|
| 1458 | ( rby(ring,rseg) - ( jj + 0.5_wp ) * dy ) |
---|
| 1459 | dd = ( rbx(ring,rseg) - ii * dx ) * & |
---|
| 1460 | ( rby(ring,rseg) - ( jj + 0.5_wp ) * dy ) |
---|
[1819] | 1461 | gg = dx * dy |
---|
| 1462 | |
---|
[1864] | 1463 | u_int_l = ( aa * u(kk,jj,ii) + & |
---|
| 1464 | bb * u(kk,jj,ii+1) + & |
---|
| 1465 | cc * u(kk,jj+1,ii) + & |
---|
| 1466 | dd * u(kk,jj+1,ii+1) & |
---|
[1819] | 1467 | ) / gg |
---|
| 1468 | |
---|
[1864] | 1469 | u_int_u = ( aa * u(kk+1,jj,ii) + & |
---|
| 1470 | bb * u(kk+1,jj,ii+1) + & |
---|
| 1471 | cc * u(kk+1,jj+1,ii) + & |
---|
| 1472 | dd * u(kk+1,jj+1,ii+1) & |
---|
[1819] | 1473 | ) / gg |
---|
| 1474 | |
---|
[1864] | 1475 | u_int_1_l(inot,ring,rseg) = u_int_l + & |
---|
| 1476 | ( rbz(ring,rseg) - zu(kk) ) / dz * & |
---|
[1819] | 1477 | ( u_int_u - u_int_l ) |
---|
| 1478 | |
---|
| 1479 | ELSE |
---|
| 1480 | u_int_1_l(inot,ring,rseg) = 0.0_wp |
---|
| 1481 | ENDIF |
---|
| 1482 | ELSE |
---|
| 1483 | u_int_1_l(inot,ring,rseg) = 0.0_wp |
---|
| 1484 | ENDIF |
---|
| 1485 | |
---|
| 1486 | |
---|
| 1487 | ! |
---|
| 1488 | !-- Interpolation of the v-component: |
---|
| 1489 | ii = ( rbx(ring,rseg) - 0.5_wp * dx ) * ddx |
---|
[1839] | 1490 | jj = rby(ring,rseg) * ddy |
---|
[1819] | 1491 | kk = ( rbz(ring,rseg) + 0.5_wp * dz ) / dz |
---|
| 1492 | ! |
---|
[1864] | 1493 | !-- Interpolate only if all required information is available on |
---|
| 1494 | !-- the current PE: |
---|
[1839] | 1495 | IF ( ( ii >= nxl ) .AND. ( ii <= nxr ) ) THEN |
---|
| 1496 | IF ( ( jj >= nys ) .AND. ( jj <= nyn ) ) THEN |
---|
[1819] | 1497 | |
---|
[1839] | 1498 | aa = ( ( ii + 1 + 0.5_wp ) * dx - rbx(ring,rseg) ) * & |
---|
| 1499 | ( ( jj + 1 ) * dy - rby(ring,rseg) ) |
---|
| 1500 | bb = ( rbx(ring,rseg) - ( ii + 0.5_wp ) * dx ) * & |
---|
| 1501 | ( ( jj + 1 ) * dy - rby(ring,rseg) ) |
---|
| 1502 | cc = ( ( ii + 1 + 0.5_wp ) * dx - rbx(ring,rseg) ) * & |
---|
| 1503 | ( rby(ring,rseg) - jj * dy ) |
---|
| 1504 | dd = ( rbx(ring,rseg) - ( ii + 0.5_wp ) * dx ) * & |
---|
| 1505 | ( rby(ring,rseg) - jj * dy ) |
---|
[1819] | 1506 | gg = dx * dy |
---|
| 1507 | |
---|
[1864] | 1508 | v_int_l = ( aa * v(kk,jj,ii) + & |
---|
| 1509 | bb * v(kk,jj,ii+1) + & |
---|
| 1510 | cc * v(kk,jj+1,ii) + & |
---|
| 1511 | dd * v(kk,jj+1,ii+1) & |
---|
[1819] | 1512 | ) / gg |
---|
| 1513 | |
---|
[1864] | 1514 | v_int_u = ( aa * v(kk+1,jj,ii) + & |
---|
| 1515 | bb * v(kk+1,jj,ii+1) + & |
---|
| 1516 | cc * v(kk+1,jj+1,ii) + & |
---|
| 1517 | dd * v(kk+1,jj+1,ii+1) & |
---|
[1819] | 1518 | ) / gg |
---|
| 1519 | |
---|
[1864] | 1520 | v_int_1_l(inot,ring,rseg) = v_int_l + & |
---|
| 1521 | ( rbz(ring,rseg) - zu(kk) ) / dz * & |
---|
[1819] | 1522 | ( v_int_u - v_int_l ) |
---|
| 1523 | |
---|
| 1524 | ELSE |
---|
| 1525 | v_int_1_l(inot,ring,rseg) = 0.0_wp |
---|
| 1526 | ENDIF |
---|
| 1527 | ELSE |
---|
| 1528 | v_int_1_l(inot,ring,rseg) = 0.0_wp |
---|
| 1529 | ENDIF |
---|
| 1530 | |
---|
| 1531 | |
---|
| 1532 | ! |
---|
| 1533 | !-- Interpolation of the w-component: |
---|
| 1534 | ii = ( rbx(ring,rseg) - 0.5_wp * dx ) * ddx |
---|
| 1535 | jj = ( rby(ring,rseg) - 0.5_wp * dy ) * ddy |
---|
[1839] | 1536 | kk = rbz(ring,rseg) / dz |
---|
[1819] | 1537 | ! |
---|
[1864] | 1538 | !-- Interpolate only if all required information is available on |
---|
| 1539 | !-- the current PE: |
---|
[1839] | 1540 | IF ( ( ii >= nxl ) .AND. ( ii <= nxr ) ) THEN |
---|
| 1541 | IF ( ( jj >= nys ) .AND. ( jj <= nyn ) ) THEN |
---|
[1819] | 1542 | |
---|
[1839] | 1543 | aa = ( ( ii + 1 + 0.5_wp ) * dx - rbx(ring,rseg) ) * & |
---|
| 1544 | ( ( jj + 1 + 0.5_wp ) * dy - rby(ring,rseg) ) |
---|
| 1545 | bb = ( rbx(ring,rseg) - ( ii + 0.5_wp ) * dx ) * & |
---|
| 1546 | ( ( jj + 1 + 0.5_wp ) * dy - rby(ring,rseg) ) |
---|
| 1547 | cc = ( ( ii + 1 + 0.5_wp ) * dx - rbx(ring,rseg) ) * & |
---|
| 1548 | ( rby(ring,rseg) - ( jj + 0.5_wp ) * dy ) |
---|
| 1549 | dd = ( rbx(ring,rseg) - ( ii + 0.5_wp ) * dx ) * & |
---|
| 1550 | ( rby(ring,rseg) - ( jj + 0.5_wp ) * dy ) |
---|
[1819] | 1551 | gg = dx * dy |
---|
| 1552 | |
---|
[1864] | 1553 | w_int_l = ( aa * w(kk,jj,ii) + & |
---|
| 1554 | bb * w(kk,jj,ii+1) + & |
---|
| 1555 | cc * w(kk,jj+1,ii) + & |
---|
| 1556 | dd * w(kk,jj+1,ii+1) & |
---|
[1819] | 1557 | ) / gg |
---|
| 1558 | |
---|
[1864] | 1559 | w_int_u = ( aa * w(kk+1,jj,ii) + & |
---|
| 1560 | bb * w(kk+1,jj,ii+1) + & |
---|
| 1561 | cc * w(kk+1,jj+1,ii) + & |
---|
| 1562 | dd * w(kk+1,jj+1,ii+1) & |
---|
[1819] | 1563 | ) / gg |
---|
| 1564 | |
---|
[1864] | 1565 | w_int_1_l(inot,ring,rseg) = w_int_l + & |
---|
| 1566 | ( rbz(ring,rseg) - zw(kk) ) / dz * & |
---|
[1819] | 1567 | ( w_int_u - w_int_l ) |
---|
| 1568 | ELSE |
---|
| 1569 | w_int_1_l(inot,ring,rseg) = 0.0_wp |
---|
| 1570 | ENDIF |
---|
| 1571 | ELSE |
---|
| 1572 | w_int_1_l(inot,ring,rseg) = 0.0_wp |
---|
| 1573 | ENDIF |
---|
| 1574 | |
---|
| 1575 | ENDDO |
---|
| 1576 | ENDDO |
---|
| 1577 | |
---|
| 1578 | ENDDO |
---|
| 1579 | |
---|
| 1580 | ! |
---|
| 1581 | !-- Exchange between PEs (information required on each PE): |
---|
| 1582 | #if defined( __parallel ) |
---|
[1839] | 1583 | CALL MPI_ALLREDUCE( u_int_1_l, u_int, nturbines * MAXVAL(nrings) * & |
---|
| 1584 | MAXVAL(nsegs), MPI_REAL, MPI_SUM, comm2d, ierr ) |
---|
| 1585 | CALL MPI_ALLREDUCE( v_int_1_l, v_int, nturbines * MAXVAL(nrings) * & |
---|
| 1586 | MAXVAL(nsegs), MPI_REAL, MPI_SUM, comm2d, ierr ) |
---|
| 1587 | CALL MPI_ALLREDUCE( w_int_1_l, w_int, nturbines * MAXVAL(nrings) * & |
---|
| 1588 | MAXVAL(nsegs), MPI_REAL, MPI_SUM, comm2d, ierr ) |
---|
[1819] | 1589 | #else |
---|
| 1590 | u_int = u_int_1_l |
---|
| 1591 | v_int = v_int_1_l |
---|
| 1592 | w_int = w_int_1_l |
---|
| 1593 | #endif |
---|
| 1594 | |
---|
| 1595 | |
---|
| 1596 | ! |
---|
| 1597 | !-- Loop over number of turbines: |
---|
[1912] | 1598 | |
---|
[1819] | 1599 | DO inot = 1, nturbines |
---|
[1912] | 1600 | pit_loop: DO |
---|
[1819] | 1601 | |
---|
[1912] | 1602 | IF ( pitch_sw ) THEN |
---|
[1839] | 1603 | torque_total(inot) = 0.0_wp |
---|
[1912] | 1604 | thrust_rotor(inot) = 0.0_wp |
---|
| 1605 | pitch_add(inot) = pitch_add(inot) + 0.25_wp |
---|
| 1606 | ! IF ( myid == 0 ) PRINT*, 'Pitch', inot, pitch_add(inot) |
---|
| 1607 | ELSE |
---|
| 1608 | cos_yaw = COS(phi_yaw(inot)) |
---|
| 1609 | sin_yaw = SIN(phi_yaw(inot)) |
---|
| 1610 | IF ( pitch_control ) THEN |
---|
| 1611 | pitch_add(inot) = MAX(pitch_add_old(inot) - pitch_rate * & |
---|
| 1612 | dt_3d , 0.0_wp ) |
---|
| 1613 | ENDIF |
---|
[1819] | 1614 | ENDIF |
---|
| 1615 | |
---|
[1839] | 1616 | ! |
---|
| 1617 | !-- Loop over rings of each turbine: |
---|
[1819] | 1618 | DO ring = 1, nrings(inot) |
---|
| 1619 | ! |
---|
| 1620 | !-- Determine distance between each ring (center) and the hub: |
---|
| 1621 | cur_r = (ring - 0.5_wp) * delta_r(inot) |
---|
[1839] | 1622 | ! |
---|
| 1623 | !-- Loop over segments of each ring of each turbine: |
---|
[1819] | 1624 | DO rseg = 1, nsegs(ring,inot) |
---|
| 1625 | ! |
---|
[1839] | 1626 | !-- Determine angle of ring segment towards zero degree angle of |
---|
| 1627 | !-- rotor system (at zero degree rotor direction vectors aligned |
---|
| 1628 | !-- with y-axis): |
---|
[1819] | 1629 | phi_rotor = rseg * 2.0_wp * pi / nsegs(ring,inot) |
---|
| 1630 | cos_rot = COS(phi_rotor) |
---|
| 1631 | sin_rot = SIN(phi_rotor) |
---|
| 1632 | ! |
---|
[1839] | 1633 | !-- Now the direction vectors can be determined with respect to |
---|
| 1634 | !-- the yaw and tilt angle: |
---|
[1819] | 1635 | re(1) = cos_rot * sin_yaw |
---|
| 1636 | re(2) = cos_rot * cos_yaw |
---|
| 1637 | re(3) = sin_rot |
---|
| 1638 | |
---|
[1864] | 1639 | ! The current unit vector in azimuthal direction: |
---|
[1819] | 1640 | rea(1) = - sin_rot * sin_yaw |
---|
| 1641 | rea(2) = - sin_rot * cos_yaw |
---|
| 1642 | rea(3) = cos_rot |
---|
| 1643 | |
---|
| 1644 | ! |
---|
[1864] | 1645 | !-- To respect the yawing angle for the calculations of |
---|
| 1646 | !-- velocities and forces the unit vectors perpendicular to the |
---|
| 1647 | !-- rotor area in direction of the positive yaw angle are defined: |
---|
[1819] | 1648 | ren(1) = cos_yaw |
---|
| 1649 | ren(2) = - sin_yaw |
---|
| 1650 | ren(3) = 0.0_wp |
---|
| 1651 | ! |
---|
| 1652 | !-- Multiplication with the coordinate transformation matrix |
---|
[1864] | 1653 | !-- gives the final unit vector with consideration of the rotor |
---|
| 1654 | !-- tilt: |
---|
[1819] | 1655 | rote = MATMUL( rot_coord_trans(inot,:,:), re ) |
---|
| 1656 | rota = MATMUL( rot_coord_trans(inot,:,:), rea ) |
---|
| 1657 | rotn = MATMUL( rot_coord_trans(inot,:,:), ren ) |
---|
| 1658 | ! |
---|
| 1659 | !-- Coordinates of the single segments (center points): |
---|
| 1660 | rbx(ring,rseg) = rcx(inot) + cur_r * rote(1) |
---|
| 1661 | |
---|
| 1662 | rby(ring,rseg) = rcy(inot) + cur_r * rote(2) |
---|
| 1663 | |
---|
| 1664 | rbz(ring,rseg) = rcz(inot) + cur_r * rote(3) |
---|
| 1665 | |
---|
| 1666 | ! |
---|
[1864] | 1667 | !-- !-----------------------------------------------------------! |
---|
| 1668 | !-- !-- Calculation of various angles and relative velocities --! |
---|
| 1669 | !-- !-----------------------------------------------------------! |
---|
[1819] | 1670 | ! |
---|
[1864] | 1671 | !-- In the following the 3D-velocity field is projected its |
---|
[1819] | 1672 | !-- components perpedicular and parallel to the rotor area |
---|
| 1673 | !-- The calculation of forces will be done in the rotor- |
---|
| 1674 | !-- coordinates y' and z. |
---|
| 1675 | !-- The yaw angle will be reintroduced when the force is applied |
---|
| 1676 | !-- on the hydrodynamic equations |
---|
[1864] | 1677 | ! |
---|
| 1678 | !-- Projection of the xy-velocities relative to the rotor area |
---|
| 1679 | ! |
---|
[1819] | 1680 | !-- Velocity perpendicular to the rotor area: |
---|
[1864] | 1681 | u_rot = u_int(inot,ring,rseg)*rotn(1) + & |
---|
| 1682 | v_int(inot,ring,rseg)*rotn(2) + & |
---|
[1819] | 1683 | w_int(inot,ring,rseg)*rotn(3) |
---|
| 1684 | ! |
---|
[1864] | 1685 | !-- Projection of the 3D-velocity vector in the azimuthal |
---|
| 1686 | !-- direction: |
---|
| 1687 | vtheta(rseg) = rota(1) * u_int(inot,ring,rseg) + & |
---|
| 1688 | rota(2) * v_int(inot,ring,rseg) + & |
---|
[1819] | 1689 | rota(3) * w_int(inot,ring,rseg) |
---|
| 1690 | ! |
---|
[1864] | 1691 | !-- Determination of the angle phi_rel between the rotor plane |
---|
| 1692 | !-- and the direction of the flow relative to the rotor: |
---|
[1819] | 1693 | |
---|
[1864] | 1694 | phi_rel(rseg) = ATAN( u_rot / & |
---|
| 1695 | ( omega_rot(inot) * cur_r - & |
---|
[1819] | 1696 | vtheta(rseg) ) ) |
---|
| 1697 | |
---|
| 1698 | ! |
---|
[1864] | 1699 | !-- Interpolation of the local pitch angle from tabulated values |
---|
| 1700 | !-- to the current radial position: |
---|
[1819] | 1701 | |
---|
| 1702 | lct=minloc(ABS(cur_r-lrd)) |
---|
| 1703 | rad_d=cur_r-lrd(lct) |
---|
| 1704 | |
---|
| 1705 | IF (cur_r == 0.0_wp) THEN |
---|
| 1706 | alpha_attack(rseg) = 0.0_wp |
---|
| 1707 | ELSE IF (cur_r >= lrd(size(ard))) THEN |
---|
[1864] | 1708 | alpha_attack(rseg) = ( ard(size(ard)) + & |
---|
| 1709 | ard(size(ard)-1) ) / 2.0_wp |
---|
[1819] | 1710 | ELSE |
---|
[1864] | 1711 | alpha_attack(rseg) = ( ard(lct(1)) * & |
---|
| 1712 | ( ( lrd(lct(1)+1) - cur_r ) / & |
---|
| 1713 | ( lrd(lct(1)+1) - lrd(lct(1)) ) & |
---|
| 1714 | ) ) + ( ard(lct(1)+1) * & |
---|
| 1715 | ( ( cur_r - lrd(lct(1)) ) / & |
---|
| 1716 | ( lrd(lct(1)+1) - lrd(lct(1)) ) ) ) |
---|
[1819] | 1717 | ENDIF |
---|
| 1718 | |
---|
| 1719 | ! |
---|
[1864] | 1720 | !-- In Fortran radian instead of degree is used as unit for all |
---|
| 1721 | !-- angles. Therefore, a transformation from angles given in |
---|
| 1722 | !-- degree to angles given in radian is necessary here: |
---|
| 1723 | alpha_attack(rseg) = alpha_attack(rseg) * & |
---|
[1819] | 1724 | ( (2.0_wp*pi) / 360.0_wp ) |
---|
| 1725 | ! |
---|
[1864] | 1726 | !-- Substraction of the local pitch angle to obtain the local |
---|
| 1727 | !-- angle of attack: |
---|
[1819] | 1728 | alpha_attack(rseg) = phi_rel(rseg) - alpha_attack(rseg) |
---|
| 1729 | ! |
---|
[1864] | 1730 | !-- Preliminary transformation back from angles given in radian |
---|
| 1731 | !-- to angles given in degree: |
---|
| 1732 | alpha_attack(rseg) = alpha_attack(rseg) * & |
---|
[1819] | 1733 | ( 360.0_wp / (2.0_wp*pi) ) |
---|
| 1734 | ! |
---|
[1864] | 1735 | !-- Correct with collective pitch angle: |
---|
[1819] | 1736 | alpha_attack = alpha_attack + pitch_add(inot) |
---|
| 1737 | |
---|
| 1738 | ! |
---|
[1864] | 1739 | !-- Determination of the magnitude of the flow velocity relative |
---|
| 1740 | !-- to the rotor: |
---|
[1912] | 1741 | vrel(rseg) = SQRT( u_rot**2 + & |
---|
| 1742 | ( omega_rot(inot) * cur_r - & |
---|
[1819] | 1743 | vtheta(rseg) )**2 ) |
---|
| 1744 | |
---|
| 1745 | ! |
---|
[1864] | 1746 | !-- !-----------------------------------------------------------! |
---|
| 1747 | !-- !-- Interpolation of chord as well as lift and drag --! |
---|
| 1748 | !-- !-- coefficients from tabulated values --! |
---|
| 1749 | !-- !-----------------------------------------------------------! |
---|
[1819] | 1750 | |
---|
| 1751 | ! |
---|
[1864] | 1752 | !-- Interpolation of the chord_length from tabulated values to |
---|
| 1753 | !-- the current radial position: |
---|
[1819] | 1754 | |
---|
| 1755 | IF (cur_r == 0.0_wp) THEN |
---|
| 1756 | chord(rseg) = 0.0_wp |
---|
| 1757 | ELSE IF (cur_r >= lrd(size(crd))) THEN |
---|
[1864] | 1758 | chord(rseg) = (crd(size(crd)) + ard(size(crd)-1)) / 2.0_wp |
---|
[1819] | 1759 | ELSE |
---|
[1864] | 1760 | chord(rseg) = ( crd(lct(1)) * & |
---|
| 1761 | ( ( lrd(lct(1)+1) - cur_r ) / & |
---|
| 1762 | ( lrd(lct(1)+1) - lrd(lct(1)) ) ) ) + & |
---|
| 1763 | ( crd(lct(1)+1) * & |
---|
| 1764 | ( ( cur_r-lrd(lct(1)) ) / & |
---|
| 1765 | ( lrd(lct(1)+1) - lrd(lct(1)) ) ) ) |
---|
[1819] | 1766 | ENDIF |
---|
| 1767 | |
---|
| 1768 | ! |
---|
| 1769 | !-- Determine index of current angle of attack, needed for |
---|
[1864] | 1770 | !-- finding the appropriate interpolated values of the lift and |
---|
| 1771 | !-- drag coefficients (-180.0 degrees = 0, +180.0 degrees = 36000, |
---|
| 1772 | !-- so one index every 0.01 degrees): |
---|
| 1773 | iialpha = CEILING( ( alpha_attack(rseg) + 180.0_wp ) & |
---|
[1839] | 1774 | * ( 1.0_wp / accu_cl_cd_tab ) ) |
---|
[1819] | 1775 | ! |
---|
| 1776 | !-- Determine index of current radial position, needed for |
---|
[1864] | 1777 | !-- finding the appropriate interpolated values of the lift and |
---|
| 1778 | !-- drag coefficients (one index every 0.1 m): |
---|
[1819] | 1779 | iir = CEILING( cur_r * 10.0_wp ) |
---|
| 1780 | ! |
---|
[1864] | 1781 | !-- Read in interpolated values of the lift and drag coefficients |
---|
| 1782 | !-- for the current radial position and angle of attack: |
---|
[1839] | 1783 | turb_cl(rseg) = turb_cl_tab(iialpha,iir) |
---|
| 1784 | turb_cd(rseg) = turb_cd_tab(iialpha,iir) |
---|
[1819] | 1785 | |
---|
| 1786 | ! |
---|
[1864] | 1787 | !-- Final transformation back from angles given in degree to |
---|
| 1788 | !-- angles given in radian: |
---|
| 1789 | alpha_attack(rseg) = alpha_attack(rseg) * & |
---|
[1819] | 1790 | ( (2.0_wp*pi) / 360.0_wp ) |
---|
| 1791 | |
---|
| 1792 | ! |
---|
| 1793 | !-- !-----------------------------------------------------! |
---|
| 1794 | !-- !-- Calculation of the forces --! |
---|
| 1795 | !-- !-----------------------------------------------------! |
---|
| 1796 | |
---|
| 1797 | ! |
---|
[1864] | 1798 | !-- Calculate the pre_factor for the thrust and torque forces: |
---|
[1819] | 1799 | |
---|
| 1800 | pre_factor = 0.5_wp * (vrel(rseg)**2) * 3.0_wp * & |
---|
| 1801 | chord(rseg) * delta_r(inot) / nsegs(ring,inot) |
---|
| 1802 | |
---|
| 1803 | ! |
---|
[1864] | 1804 | !-- Calculate the thrust force (x-component of the total force) |
---|
| 1805 | !-- for each ring segment: |
---|
| 1806 | thrust_seg(rseg) = pre_factor * & |
---|
| 1807 | ( turb_cl(rseg) * COS(phi_rel(rseg)) + & |
---|
| 1808 | turb_cd(rseg) * SIN(phi_rel(rseg)) ) |
---|
[1819] | 1809 | |
---|
| 1810 | ! |
---|
[1864] | 1811 | !-- Determination of the second of the additional forces acting |
---|
| 1812 | !-- on the flow in the azimuthal direction: force vector as basis |
---|
| 1813 | !-- for torque (torque itself would be the vector product of the |
---|
| 1814 | !-- radius vector and the force vector): |
---|
| 1815 | torque_seg = pre_factor * & |
---|
| 1816 | ( turb_cl(rseg) * SIN(phi_rel(rseg)) - & |
---|
[1839] | 1817 | turb_cd(rseg) * COS(phi_rel(rseg)) ) |
---|
[1819] | 1818 | ! |
---|
| 1819 | !-- Decomposition of the force vector into two parts: |
---|
[1864] | 1820 | !-- One acting along the y-direction and one acting along the |
---|
| 1821 | !-- z-direction of the rotor coordinate system: |
---|
[1819] | 1822 | |
---|
| 1823 | torque_seg_y(rseg) = -torque_seg * sin_rot |
---|
| 1824 | torque_seg_z(rseg) = torque_seg * cos_rot |
---|
| 1825 | |
---|
[1912] | 1826 | ! |
---|
| 1827 | !-- Add the segment thrust to the thrust of the whole rotor |
---|
| 1828 | thrust_rotor(inot) = thrust_rotor(inot) + & |
---|
| 1829 | thrust_seg(rseg) |
---|
| 1830 | |
---|
| 1831 | |
---|
[1819] | 1832 | torque_total(inot) = torque_total(inot) + (torque_seg * cur_r) |
---|
| 1833 | |
---|
[1864] | 1834 | ENDDO !-- end of loop over ring segments |
---|
[1819] | 1835 | |
---|
| 1836 | ! |
---|
[1864] | 1837 | !-- Restore the forces into arrays containing all the segments of |
---|
| 1838 | !-- each ring: |
---|
[1819] | 1839 | thrust_ring(ring,:) = thrust_seg(:) |
---|
| 1840 | torque_ring_y(ring,:) = torque_seg_y(:) |
---|
| 1841 | torque_ring_z(ring,:) = torque_seg_z(:) |
---|
| 1842 | |
---|
| 1843 | |
---|
[1864] | 1844 | ENDDO !-- end of loop over rings |
---|
[1819] | 1845 | |
---|
| 1846 | |
---|
[1864] | 1847 | CALL cpu_log( log_point_s(62), 'wtm_controller', 'start' ) |
---|
[1819] | 1848 | |
---|
[1912] | 1849 | |
---|
| 1850 | IF ( speed_control ) THEN |
---|
| 1851 | ! |
---|
| 1852 | !-- Calculation of the current generator speed for rotor speed control |
---|
| 1853 | |
---|
| 1854 | ! |
---|
| 1855 | !-- The acceleration of the rotor speed is calculated from |
---|
| 1856 | !-- the force balance of the accelerating torque |
---|
| 1857 | !-- and the torque of the rotating rotor and generator |
---|
| 1858 | om_rate = ( torque_total(inot) * air_dens * gear_eff - & |
---|
| 1859 | gear_ratio * torque_gen_old(inot) ) / & |
---|
| 1860 | ( inertia_rot + & |
---|
| 1861 | gear_ratio * gear_ratio * inertia_gen ) * dt_3d |
---|
[1819] | 1862 | |
---|
[1912] | 1863 | ! |
---|
| 1864 | !-- The generator speed is given by the product of gear gear_ratio |
---|
| 1865 | !-- and rotor speed |
---|
| 1866 | omega_gen(inot) = gear_ratio * ( omega_rot(inot) + om_rate ) |
---|
| 1867 | |
---|
| 1868 | ENDIF |
---|
| 1869 | |
---|
[1864] | 1870 | IF ( pitch_control ) THEN |
---|
[1819] | 1871 | |
---|
[1912] | 1872 | ! |
---|
| 1873 | !-- If the current generator speed is above rated, the pitch is not |
---|
| 1874 | !-- saturated and the change from the last time step is within the |
---|
| 1875 | !-- maximum pitch rate, then the pitch loop is repeated with a pitch |
---|
| 1876 | !-- gain |
---|
| 1877 | IF ( ( omega_gen(inot) > rated_genspeed ) .AND. & |
---|
| 1878 | ( pitch_add(inot) < 25.0_wp ) .AND. & |
---|
| 1879 | ( pitch_add(inot) < pitch_add_old(inot) + & |
---|
| 1880 | pitch_rate * dt_3d ) ) THEN |
---|
[1864] | 1881 | pitch_sw = .TRUE. |
---|
[1912] | 1882 | ! |
---|
| 1883 | !-- Go back to beginning of pit_loop |
---|
| 1884 | CYCLE pit_loop |
---|
[1819] | 1885 | ENDIF |
---|
[1912] | 1886 | |
---|
| 1887 | ! |
---|
| 1888 | !-- The current pitch is saved for the next time step |
---|
| 1889 | pitch_add_old(inot) = pitch_add(inot) |
---|
[1864] | 1890 | pitch_sw = .FALSE. |
---|
[1819] | 1891 | ENDIF |
---|
[1912] | 1892 | EXIT pit_loop |
---|
| 1893 | ENDDO pit_loop ! Recursive pitch control loop |
---|
[1819] | 1894 | |
---|
[1864] | 1895 | |
---|
[1819] | 1896 | ! |
---|
[1864] | 1897 | !-- Call the rotor speed controller |
---|
| 1898 | |
---|
[1819] | 1899 | IF ( speed_control ) THEN |
---|
| 1900 | ! |
---|
[1864] | 1901 | !-- Find processor at i_hub, j_hub |
---|
[1912] | 1902 | IF ( ( nxl <= i_hub(inot) ) .AND. ( nxr >= i_hub(inot) ) ) & |
---|
| 1903 | THEN |
---|
| 1904 | IF ( ( nys <= j_hub(inot) ) .AND. ( nyn >= j_hub(inot) ) )& |
---|
| 1905 | THEN |
---|
[1864] | 1906 | CALL wtm_speed_control( inot ) |
---|
| 1907 | ENDIF |
---|
[1912] | 1908 | ENDIF |
---|
[1864] | 1909 | |
---|
[1819] | 1910 | ENDIF |
---|
| 1911 | |
---|
| 1912 | |
---|
[1864] | 1913 | CALL cpu_log( log_point_s(62), 'wtm_controller', 'stop' ) |
---|
[1819] | 1914 | |
---|
[1864] | 1915 | CALL cpu_log( log_point_s(63), 'wtm_smearing', 'start' ) |
---|
[1819] | 1916 | |
---|
| 1917 | |
---|
[1864] | 1918 | !-- !-----------------------------------------------------------------! |
---|
| 1919 | !-- !-- Regularization kernel --! |
---|
| 1920 | !-- !-- Smearing of the forces and interpolation to cartesian grid --! |
---|
| 1921 | !-- !-----------------------------------------------------------------! |
---|
[1819] | 1922 | ! |
---|
[1864] | 1923 | !-- The aerodynamic blade forces need to be distributed smoothly on |
---|
| 1924 | !-- several mesh points in order to avoid singular behaviour |
---|
[1819] | 1925 | ! |
---|
| 1926 | !-- Summation over sum of weighted forces. The weighting factor |
---|
[1864] | 1927 | !-- (calculated in user_init) includes information on the distance |
---|
| 1928 | !-- between the center of the grid cell and the rotor segment under |
---|
| 1929 | !-- consideration |
---|
[1819] | 1930 | ! |
---|
[1864] | 1931 | !-- To save computing time, apply smearing only for the relevant part |
---|
| 1932 | !-- of the model domain: |
---|
[1819] | 1933 | ! |
---|
| 1934 | !-- |
---|
| 1935 | !-- Calculation of the boundaries: |
---|
[1864] | 1936 | i_smear(inot) = CEILING( ( rr(inot) * ABS( roty(inot,1) ) + & |
---|
| 1937 | eps_min ) / dx ) |
---|
| 1938 | j_smear(inot) = CEILING( ( rr(inot) * ABS( roty(inot,2) ) + & |
---|
| 1939 | eps_min ) / dy ) |
---|
[1819] | 1940 | |
---|
[1864] | 1941 | DO i = MAX( nxl, i_hub(inot) - i_smear(inot) ), & |
---|
[1819] | 1942 | MIN( nxr, i_hub(inot) + i_smear(inot) ) |
---|
[1864] | 1943 | DO j = MAX( nys, j_hub(inot) - j_smear(inot) ), & |
---|
[1819] | 1944 | MIN( nyn, j_hub(inot) + j_smear(inot) ) |
---|
| 1945 | DO k = MAX( nzb_u_inner(j,i)+1, k_hub(inot) - k_smear(inot) ), & |
---|
| 1946 | k_hub(inot) + k_smear(inot) |
---|
| 1947 | DO ring = 1, nrings(inot) |
---|
| 1948 | DO rseg = 1, nsegs(ring,inot) |
---|
| 1949 | ! |
---|
| 1950 | !-- Determine the square of the distance between the |
---|
| 1951 | !-- current grid point and each rotor area segment: |
---|
[1864] | 1952 | dist_u_3d = ( i * dx - rbx(ring,rseg) )**2 + & |
---|
| 1953 | ( j * dy + 0.5_wp * dy - rby(ring,rseg) )**2 + & |
---|
| 1954 | ( k * dz - 0.5_wp * dz - rbz(ring,rseg) )**2 |
---|
| 1955 | dist_v_3d = ( i * dx + 0.5_wp * dx - rbx(ring,rseg) )**2 + & |
---|
| 1956 | ( j * dy - rby(ring,rseg) )**2 + & |
---|
| 1957 | ( k * dz - 0.5_wp * dz - rbz(ring,rseg) )**2 |
---|
| 1958 | dist_w_3d = ( i * dx + 0.5_wp * dx - rbx(ring,rseg) )**2 + & |
---|
| 1959 | ( j * dy + 0.5_wp * dy - rby(ring,rseg) )**2 + & |
---|
| 1960 | ( k * dz - rbz(ring,rseg) )**2 |
---|
[1819] | 1961 | |
---|
| 1962 | ! |
---|
| 1963 | !-- 3D-smearing of the forces with a polynomial function |
---|
| 1964 | !-- (much faster than the old Gaussian function), using |
---|
| 1965 | !-- some parameters that have been calculated in user_init. |
---|
| 1966 | !-- The function is only similar to Gaussian function for |
---|
| 1967 | !-- squared distances <= eps_min2: |
---|
| 1968 | IF ( dist_u_3d <= eps_min2 ) THEN |
---|
[1864] | 1969 | thrust(k,j,i) = thrust(k,j,i) + & |
---|
| 1970 | thrust_ring(ring,rseg) * & |
---|
| 1971 | ( ( pol_a * dist_u_3d - pol_b ) * & |
---|
| 1972 | dist_u_3d + 1.0_wp ) * eps_factor |
---|
[1819] | 1973 | ENDIF |
---|
| 1974 | IF ( dist_v_3d <= eps_min2 ) THEN |
---|
[1864] | 1975 | torque_y(k,j,i) = torque_y(k,j,i) + & |
---|
| 1976 | torque_ring_y(ring,rseg) * & |
---|
| 1977 | ( ( pol_a * dist_v_3d - pol_b ) *& |
---|
| 1978 | dist_v_3d + 1.0_wp ) * eps_factor |
---|
[1819] | 1979 | ENDIF |
---|
| 1980 | IF ( dist_w_3d <= eps_min2 ) THEN |
---|
[1864] | 1981 | torque_z(k,j,i) = torque_z(k,j,i) + & |
---|
| 1982 | torque_ring_z(ring,rseg) * & |
---|
| 1983 | ( ( pol_a * dist_w_3d - pol_b ) *& |
---|
| 1984 | dist_w_3d + 1.0_wp ) * eps_factor |
---|
[1819] | 1985 | ENDIF |
---|
| 1986 | |
---|
| 1987 | ENDDO ! End of loop over rseg |
---|
| 1988 | ENDDO ! End of loop over ring |
---|
| 1989 | |
---|
| 1990 | ! |
---|
| 1991 | !-- Rotation of force components: |
---|
[1912] | 1992 | rot_tend_x(k,j,i) = rot_tend_x(k,j,i) + & |
---|
[1864] | 1993 | thrust(k,j,i)*rotx(inot,1) + & |
---|
| 1994 | torque_y(k,j,i)*roty(inot,1) + & |
---|
[1819] | 1995 | torque_z(k,j,i)*rotz(inot,1) |
---|
| 1996 | |
---|
[1912] | 1997 | rot_tend_y(k,j,i) = rot_tend_y(k,j,i) + & |
---|
[1864] | 1998 | thrust(k,j,i)*rotx(inot,2) + & |
---|
| 1999 | torque_y(k,j,i)*roty(inot,2) + & |
---|
[1819] | 2000 | torque_z(k,j,i)*rotz(inot,2) |
---|
| 2001 | |
---|
[1912] | 2002 | rot_tend_z(k,j,i) = rot_tend_z(k,j,i) + & |
---|
[1864] | 2003 | thrust(k,j,i)*rotx(inot,3) + & |
---|
| 2004 | torque_y(k,j,i)*roty(inot,3) + & |
---|
[1819] | 2005 | torque_z(k,j,i)*rotz(inot,3) |
---|
| 2006 | |
---|
| 2007 | ENDDO ! End of loop over k |
---|
| 2008 | ENDDO ! End of loop over j |
---|
| 2009 | ENDDO ! End of loop over i |
---|
| 2010 | |
---|
[1864] | 2011 | CALL cpu_log( log_point_s(63), 'wtm_smearing', 'stop' ) |
---|
[1819] | 2012 | |
---|
[1912] | 2013 | ENDDO !-- end of loop over turbines |
---|
[1819] | 2014 | |
---|
| 2015 | |
---|
| 2016 | IF ( yaw_control ) THEN |
---|
| 2017 | ! |
---|
| 2018 | !-- Allocate arrays for yaw control at first call |
---|
| 2019 | !-- Can't be allocated before dt_3d is set |
---|
| 2020 | IF ( start_up ) THEN |
---|
[1864] | 2021 | WDLON = NINT( 30.0_wp / dt_3d ) ! 30s running mean array |
---|
[1819] | 2022 | ALLOCATE( wd30(1:nturbines,1:WDLON) ) |
---|
[1912] | 2023 | wd30 = 999.0_wp ! Set to dummy value |
---|
[1819] | 2024 | ALLOCATE( wd30_l(1:WDLON) ) |
---|
| 2025 | |
---|
[1864] | 2026 | WDSHO = NINT( 2.0_wp / dt_3d ) ! 2s running mean array |
---|
[1819] | 2027 | ALLOCATE( wd2(1:nturbines,1:WDSHO) ) |
---|
[1912] | 2028 | wd2 = 999.0_wp ! Set to dummy value |
---|
[1819] | 2029 | ALLOCATE( wd2_l(1:WDSHO) ) |
---|
| 2030 | start_up = .FALSE. |
---|
| 2031 | ENDIF |
---|
| 2032 | |
---|
| 2033 | ! |
---|
| 2034 | !-- Calculate the inflow wind speed |
---|
| 2035 | !-- |
---|
| 2036 | !-- Loop over number of turbines: |
---|
| 2037 | DO inot = 1, nturbines |
---|
| 2038 | ! |
---|
| 2039 | !-- Find processor at i_hub, j_hub |
---|
[1912] | 2040 | IF ( ( nxl <= i_hub(inot) ) .AND. ( nxr >= i_hub(inot) ) ) & |
---|
| 2041 | THEN |
---|
| 2042 | IF ( ( nys <= j_hub(inot) ) .AND. ( nyn >= j_hub(inot) ) )& |
---|
| 2043 | THEN |
---|
[1864] | 2044 | |
---|
[1819] | 2045 | u_inflow_l(inot) = u(k_hub(inot),j_hub(inot),i_hub(inot)) |
---|
[1864] | 2046 | |
---|
[1912] | 2047 | wdir_l(inot) = -1.0_wp * ATAN2( & |
---|
| 2048 | 0.5_wp * ( v(k_hub(inot),j_hub(inot),i_hub(inot)+1) + & |
---|
| 2049 | v(k_hub(inot),j_hub(inot),i_hub(inot)) ) , & |
---|
| 2050 | 0.5_wp * ( u(k_hub(inot),j_hub(inot)+1,i_hub(inot)) + & |
---|
| 2051 | u(k_hub(inot),j_hub(inot),i_hub(inot)) ) ) |
---|
[1864] | 2052 | |
---|
| 2053 | CALL wtm_yawcontrol( inot ) |
---|
| 2054 | |
---|
[1819] | 2055 | phi_yaw_l(inot) = phi_yaw(inot) |
---|
| 2056 | |
---|
| 2057 | ENDIF |
---|
| 2058 | ENDIF |
---|
| 2059 | |
---|
[1864] | 2060 | ENDDO !-- end of loop over turbines |
---|
| 2061 | |
---|
| 2062 | ! |
---|
[1929] | 2063 | !-- Transfer of information to the other cpus |
---|
| 2064 | #if defined( __parallel ) |
---|
[1864] | 2065 | CALL MPI_ALLREDUCE( u_inflow_l, u_inflow, nturbines, MPI_REAL, & |
---|
| 2066 | MPI_SUM, comm2d, ierr ) |
---|
| 2067 | CALL MPI_ALLREDUCE( wdir_l, wdir, nturbines, MPI_REAL, MPI_SUM, & |
---|
| 2068 | comm2d, ierr ) |
---|
| 2069 | CALL MPI_ALLREDUCE( phi_yaw_l, phi_yaw, nturbines, MPI_REAL, & |
---|
| 2070 | MPI_SUM, comm2d, ierr ) |
---|
[1929] | 2071 | #else |
---|
| 2072 | u_inflow = u_inflow_l |
---|
| 2073 | wdir = wdir_l |
---|
| 2074 | phi_yaw = phi_yaw_l |
---|
| 2075 | #endif |
---|
[1819] | 2076 | DO inot = 1, nturbines |
---|
[1864] | 2077 | ! |
---|
| 2078 | !-- Update rotor orientation |
---|
| 2079 | CALL wtm_rotate_rotor( inot ) |
---|
[1819] | 2080 | |
---|
| 2081 | ENDDO ! End of loop over turbines |
---|
| 2082 | |
---|
| 2083 | END IF |
---|
[1864] | 2084 | |
---|
| 2085 | IF ( speed_control ) THEN |
---|
| 2086 | ! |
---|
| 2087 | !-- Transfer of information to the other cpus |
---|
[1912] | 2088 | ! CALL MPI_ALLREDUCE( omega_gen, omega_gen_old, nturbines, & |
---|
| 2089 | ! MPI_REAL,MPI_SUM, comm2d, ierr ) |
---|
[1929] | 2090 | #if defined( __parallel ) |
---|
[1864] | 2091 | CALL MPI_ALLREDUCE( torque_gen, torque_gen_old, nturbines, & |
---|
| 2092 | MPI_REAL, MPI_SUM, comm2d, ierr ) |
---|
| 2093 | CALL MPI_ALLREDUCE( omega_rot_l, omega_rot, nturbines, & |
---|
| 2094 | MPI_REAL, MPI_SUM, comm2d, ierr ) |
---|
[1912] | 2095 | CALL MPI_ALLREDUCE( omega_gen_f, omega_gen_f_old, nturbines, & |
---|
| 2096 | MPI_REAL, MPI_SUM, comm2d, ierr ) |
---|
[1929] | 2097 | #else |
---|
| 2098 | torque_gen_old = torque_gen |
---|
| 2099 | omega_rot = omega_rot_l |
---|
| 2100 | omega_gen_f_old = omega_gen_f |
---|
| 2101 | #endif |
---|
[1864] | 2102 | |
---|
| 2103 | ENDIF |
---|
[1819] | 2104 | |
---|
| 2105 | DO inot = 1, nturbines |
---|
| 2106 | |
---|
| 2107 | IF ( myid == 0 ) THEN |
---|
| 2108 | IF ( openfile_turb_mod(400+inot)%opened ) THEN |
---|
| 2109 | WRITE ( 400+inot, 106 ) simulated_time, omega_rot(inot), & |
---|
[1912] | 2110 | omega_gen(inot), torque_gen_old(inot), & |
---|
[1864] | 2111 | torque_total(inot), pitch_add(inot), & |
---|
[1912] | 2112 | torque_gen_old(inot)*omega_gen(inot)*gen_eff, & |
---|
[1864] | 2113 | torque_total(inot)*omega_rot(inot)*air_dens, & |
---|
[1912] | 2114 | thrust_rotor(inot), & |
---|
[1864] | 2115 | wdir(inot)*180.0_wp/pi, & |
---|
| 2116 | (phi_yaw(inot))*180.0_wp/pi |
---|
[1912] | 2117 | |
---|
[1819] | 2118 | ELSE |
---|
| 2119 | |
---|
| 2120 | WRITE ( turbine_id,'(I2.2)') inot |
---|
[1864] | 2121 | OPEN ( 400+inot, FILE=( 'TURBINE_PARAMETERS'//turbine_id ), & |
---|
| 2122 | FORM='FORMATTED' ) |
---|
[1819] | 2123 | WRITE ( 400+inot, 105 ) inot |
---|
| 2124 | WRITE ( 400+inot, 106 ) simulated_time, omega_rot(inot), & |
---|
[1912] | 2125 | omega_gen(inot), torque_gen_old(inot), & |
---|
[1864] | 2126 | torque_total(inot), pitch_add(inot), & |
---|
[1912] | 2127 | torque_gen_old(inot)*omega_gen(inot)*gen_eff, & |
---|
[1864] | 2128 | torque_total(inot)*omega_rot(inot)*air_dens, & |
---|
[1912] | 2129 | thrust_rotor(inot), & |
---|
[1864] | 2130 | wdir(inot)*180.0_wp/pi, & |
---|
| 2131 | (phi_yaw(inot))*180.0_wp/pi |
---|
[1819] | 2132 | ENDIF |
---|
| 2133 | ENDIF |
---|
| 2134 | |
---|
[1912] | 2135 | !-- Set open flag |
---|
[1819] | 2136 | openfile_turb_mod(400+inot)%opened = .TRUE. |
---|
[1864] | 2137 | ENDDO !-- end of loop over turbines |
---|
[1819] | 2138 | |
---|
| 2139 | ENDIF |
---|
| 2140 | |
---|
[1864] | 2141 | CALL cpu_log( log_point_s(61), 'wtm_forces', 'stop' ) |
---|
[1819] | 2142 | |
---|
[1912] | 2143 | ! |
---|
| 2144 | !-- Formats |
---|
[1819] | 2145 | 105 FORMAT ('Turbine control data for turbine ',I2,1X,':'/ & |
---|
| 2146 | &'----------------------------------------'/ & |
---|
| 2147 | &' Time RSpeed GSpeed ', & |
---|
[1912] | 2148 | 'GenTorque AeroTorque Pitch Power(Gen) Power(Rot) ', & |
---|
| 2149 | 'RotThrust WDirection YawOrient') |
---|
[1819] | 2150 | |
---|
[1864] | 2151 | 106 FORMAT (F9.3,2X,F7.3,2X,F7.2,2X,F9.1,3X,F9.1,1X,F6.2,2X,F10.1,2X, & |
---|
| 2152 | F10.1,1X,F9.1,2X,F7.2,1X,F7.2) |
---|
[1819] | 2153 | |
---|
| 2154 | |
---|
| 2155 | END SUBROUTINE wtm_forces |
---|
| 2156 | |
---|
| 2157 | |
---|
[1839] | 2158 | !------------------------------------------------------------------------------! |
---|
| 2159 | ! Description: |
---|
| 2160 | ! ------------ |
---|
| 2161 | !> Yaw controller for the wind turbine model |
---|
| 2162 | !------------------------------------------------------------------------------! |
---|
| 2163 | SUBROUTINE wtm_yawcontrol( inot ) |
---|
| 2164 | |
---|
[1819] | 2165 | USE constants |
---|
| 2166 | USE kinds |
---|
[1839] | 2167 | |
---|
| 2168 | IMPLICIT NONE |
---|
[1819] | 2169 | |
---|
| 2170 | INTEGER(iwp) :: inot |
---|
| 2171 | INTEGER(iwp) :: i_wd_30 |
---|
| 2172 | REAL(wp) :: missal |
---|
| 2173 | |
---|
| 2174 | i_wd_30 = 0_iwp |
---|
| 2175 | |
---|
| 2176 | ! |
---|
[1864] | 2177 | !-- The yaw controller computes a 30s running mean of the wind direction. |
---|
| 2178 | !-- If the difference between turbine alignment and wind direction exceeds |
---|
| 2179 | !-- 5°, the turbine is yawed. The mechanism stops as soon as the 2s-running |
---|
| 2180 | !-- mean of the missalignment is smaller than 0.5°. |
---|
| 2181 | !-- Attention: If the timestep during the simulation changes significantly |
---|
| 2182 | !-- the lengths of the running means change and it does not correspond to |
---|
| 2183 | !-- 30s/2s anymore. |
---|
| 2184 | !-- ! Needs to be modified for these situations ! |
---|
| 2185 | !-- For wind from the east, the averaging of the wind direction could cause |
---|
| 2186 | !-- problems and the yaw controller is probably flawed. -> Routine for |
---|
| 2187 | !-- averaging needs to be improved! |
---|
| 2188 | ! |
---|
| 2189 | !-- Check if turbine is not yawing |
---|
[1819] | 2190 | IF ( .NOT. doyaw(inot) ) THEN |
---|
[1843] | 2191 | ! |
---|
[1864] | 2192 | !-- Write current wind direction into array |
---|
[1843] | 2193 | wd30_l = wd30(inot,:) |
---|
| 2194 | wd30_l = CSHIFT( wd30_l, SHIFT=-1 ) |
---|
[1819] | 2195 | wd30_l(1) = wdir(inot) |
---|
[1843] | 2196 | ! |
---|
[1864] | 2197 | !-- Check if array is full ( no more dummies ) |
---|
[1819] | 2198 | IF ( .NOT. ANY( wd30_l == 999.) ) THEN |
---|
| 2199 | |
---|
| 2200 | missal = SUM( wd30_l ) / SIZE( wd30_l ) - phi_yaw(inot) |
---|
| 2201 | ! |
---|
[1864] | 2202 | !-- Check if turbine is missaligned by more than max_miss |
---|
[1843] | 2203 | IF ( ABS( missal ) > max_miss ) THEN |
---|
| 2204 | ! |
---|
[1864] | 2205 | !-- Check in which direction to yaw |
---|
[1843] | 2206 | yawdir(inot) = SIGN( 1.0_wp, missal ) |
---|
[1819] | 2207 | ! |
---|
[1864] | 2208 | !-- Start yawing of turbine |
---|
[1843] | 2209 | phi_yaw(inot) = phi_yaw(inot) + yawdir(inot) * yaw_speed * dt_3d |
---|
[1819] | 2210 | doyaw(inot) = .TRUE. |
---|
[1864] | 2211 | wd30_l = 999. ! fill with dummies again |
---|
[1819] | 2212 | ENDIF |
---|
| 2213 | ENDIF |
---|
| 2214 | |
---|
| 2215 | wd30(inot,:) = wd30_l |
---|
| 2216 | |
---|
| 2217 | ! |
---|
[1864] | 2218 | !-- If turbine is already yawing: |
---|
| 2219 | !-- Initialize 2 s running mean and yaw until the missalignment is smaller |
---|
| 2220 | !-- than min_miss |
---|
[1819] | 2221 | |
---|
| 2222 | ELSE |
---|
| 2223 | ! |
---|
| 2224 | !-- Initialize 2 s running mean |
---|
| 2225 | wd2_l = wd2(inot,:) |
---|
[1864] | 2226 | wd2_l = CSHIFT( wd2_l, SHIFT = -1 ) |
---|
[1819] | 2227 | wd2_l(1) = wdir(inot) |
---|
[1843] | 2228 | ! |
---|
[1864] | 2229 | !-- Check if array is full ( no more dummies ) |
---|
| 2230 | IF ( .NOT. ANY( wd2_l == 999.0_wp ) ) THEN |
---|
| 2231 | ! |
---|
| 2232 | !-- Calculate missalignment of turbine |
---|
[1819] | 2233 | missal = SUM( wd2_l - phi_yaw(inot) ) / SIZE( wd2_l ) |
---|
[1864] | 2234 | ! |
---|
| 2235 | !-- Check if missalignment is still larger than 0.5 degree and if the |
---|
| 2236 | !-- yaw direction is still right |
---|
| 2237 | IF ( ( ABS( missal ) > min_miss ) .AND. & |
---|
| 2238 | ( yawdir(inot) == SIGN( 1.0_wp, missal ) ) ) THEN |
---|
| 2239 | ! |
---|
| 2240 | !-- Continue yawing |
---|
| 2241 | phi_yaw(inot) = phi_yaw(inot) + yawdir(inot) * yaw_speed * dt_3d |
---|
[1819] | 2242 | ELSE |
---|
[1864] | 2243 | ! |
---|
| 2244 | !-- Stop yawing |
---|
[1819] | 2245 | doyaw(inot) = .FALSE. |
---|
[1864] | 2246 | wd2_l = 999.0_wp ! fill with dummies again |
---|
[1819] | 2247 | ENDIF |
---|
| 2248 | ELSE |
---|
[1864] | 2249 | ! |
---|
| 2250 | !-- Continue yawing |
---|
[1843] | 2251 | phi_yaw(inot) = phi_yaw(inot) + yawdir(inot) * yaw_speed * dt_3d |
---|
[1819] | 2252 | ENDIF |
---|
| 2253 | |
---|
| 2254 | wd2(inot,:) = wd2_l |
---|
| 2255 | |
---|
| 2256 | ENDIF |
---|
| 2257 | |
---|
[1839] | 2258 | END SUBROUTINE wtm_yawcontrol |
---|
[1819] | 2259 | |
---|
[1864] | 2260 | |
---|
[1819] | 2261 | !------------------------------------------------------------------------------! |
---|
| 2262 | ! Description: |
---|
| 2263 | ! ------------ |
---|
[1864] | 2264 | !> Initialization of the speed control |
---|
| 2265 | !------------------------------------------------------------------------------! |
---|
| 2266 | SUBROUTINE wtm_init_speed_control |
---|
| 2267 | |
---|
| 2268 | |
---|
| 2269 | IMPLICIT NONE |
---|
| 2270 | |
---|
| 2271 | ! |
---|
| 2272 | !-- If speed control is set, remaining variables and control_parameters for |
---|
| 2273 | !-- the control algorithm are calculated |
---|
| 2274 | ! |
---|
| 2275 | !-- Calculate slope constant for region 15 |
---|
| 2276 | slope15 = ( slope2 * min_reg2 * min_reg2 ) / ( min_reg2 - min_reg15 ) |
---|
| 2277 | ! |
---|
| 2278 | !-- Calculate upper limit of slipage region |
---|
| 2279 | vs_sysp = rated_genspeed / 1.1_wp |
---|
| 2280 | ! |
---|
| 2281 | !-- Calculate slope of slipage region |
---|
| 2282 | slope25 = ( rated_power / rated_genspeed ) / & |
---|
| 2283 | ( rated_genspeed - vs_sysp ) |
---|
| 2284 | ! |
---|
| 2285 | !-- Calculate lower limit of slipage region |
---|
| 2286 | min_reg25 = ( slope25 - SQRT( slope25 * ( slope25 - 4.0_wp * & |
---|
| 2287 | slope2 * vs_sysp ) ) ) / & |
---|
| 2288 | ( 2.0_wp * slope2 ) |
---|
| 2289 | ! |
---|
| 2290 | !-- Frequency for the simple low pass filter |
---|
| 2291 | Fcorner = 0.25_wp |
---|
| 2292 | ! |
---|
| 2293 | !-- At the first timestep the torque is set to its maximum to prevent |
---|
| 2294 | !-- an overspeeding of the rotor |
---|
| 2295 | torque_gen_old(:) = max_torque_gen |
---|
| 2296 | |
---|
| 2297 | END SUBROUTINE wtm_init_speed_control |
---|
| 2298 | |
---|
| 2299 | |
---|
| 2300 | !------------------------------------------------------------------------------! |
---|
| 2301 | ! Description: |
---|
| 2302 | ! ------------ |
---|
| 2303 | !> Simple controller for the regulation of the rotor speed |
---|
| 2304 | !------------------------------------------------------------------------------! |
---|
| 2305 | SUBROUTINE wtm_speed_control( inot ) |
---|
| 2306 | |
---|
| 2307 | |
---|
| 2308 | IMPLICIT NONE |
---|
| 2309 | |
---|
[1912] | 2310 | INTEGER(iwp) :: inot |
---|
| 2311 | |
---|
| 2312 | |
---|
[1864] | 2313 | |
---|
| 2314 | ! |
---|
| 2315 | !-- The controller is based on the fortran script from Jonkman |
---|
| 2316 | !-- et al. 2009 "Definition of a 5 MW Reference Wind Turbine for |
---|
| 2317 | !-- offshore system developement" |
---|
| 2318 | |
---|
| 2319 | ! |
---|
| 2320 | !-- The generator speed is filtered by a low pass filter |
---|
| 2321 | !-- for the control of the generator torque |
---|
| 2322 | lp_coeff = EXP( -2.0_wp * 3.14_wp * dt_3d * Fcorner ) |
---|
[1912] | 2323 | omega_gen_f(inot) = ( 1.0_wp - lp_coeff ) * omega_gen(inot) + lp_coeff *& |
---|
[1864] | 2324 | omega_gen_f_old(inot) |
---|
| 2325 | |
---|
| 2326 | IF ( omega_gen_f(inot) <= min_reg15 ) THEN |
---|
| 2327 | ! |
---|
| 2328 | !-- Region 1: Generator torque is set to zero to accelerate the rotor: |
---|
| 2329 | torque_gen(inot) = 0 |
---|
| 2330 | |
---|
| 2331 | ELSEIF ( omega_gen_f(inot) <= min_reg2 ) THEN |
---|
| 2332 | ! |
---|
| 2333 | !-- Region 1.5: Generator torque is increasing linearly with rotor speed: |
---|
| 2334 | torque_gen(inot) = slope15 * ( omega_gen_f(inot) - min_reg15 ) |
---|
| 2335 | |
---|
| 2336 | ELSEIF ( omega_gen_f(inot) <= min_reg25 ) THEN |
---|
| 2337 | ! |
---|
| 2338 | !-- Region 2: Generator torque is increased by the square of the generator |
---|
| 2339 | !-- speed to keep the TSR optimal: |
---|
| 2340 | torque_gen(inot) = slope2 * omega_gen_f(inot) * omega_gen_f(inot) |
---|
| 2341 | |
---|
| 2342 | ELSEIF ( omega_gen_f(inot) < rated_genspeed ) THEN |
---|
| 2343 | ! |
---|
| 2344 | !-- Region 2.5: Slipage region between 2 and 3: |
---|
| 2345 | torque_gen(inot) = slope25 * ( omega_gen_f(inot) - vs_sysp ) |
---|
| 2346 | |
---|
| 2347 | ELSE |
---|
| 2348 | ! |
---|
| 2349 | !-- Region 3: Generator torque is antiproportional to the rotor speed to |
---|
| 2350 | !-- keep the power constant: |
---|
| 2351 | torque_gen(inot) = rated_power / omega_gen_f(inot) |
---|
| 2352 | |
---|
| 2353 | ENDIF |
---|
| 2354 | ! |
---|
| 2355 | !-- Calculate torque rate and confine with a max |
---|
| 2356 | trq_rate = ( torque_gen(inot) - torque_gen_old(inot) ) / dt_3d |
---|
| 2357 | trq_rate = MIN( MAX( trq_rate, -1.0_wp * max_trq_rate ), max_trq_rate ) |
---|
| 2358 | ! |
---|
| 2359 | !-- Calculate new gen torque and confine with max torque |
---|
| 2360 | torque_gen(inot) = torque_gen_old(inot) + trq_rate * dt_3d |
---|
| 2361 | torque_gen(inot) = MIN( torque_gen(inot), max_torque_gen ) |
---|
| 2362 | ! |
---|
| 2363 | !-- Overwrite values for next timestep |
---|
[1912] | 2364 | omega_rot_l(inot) = omega_gen(inot) / gear_ratio |
---|
[1864] | 2365 | |
---|
| 2366 | |
---|
| 2367 | END SUBROUTINE wtm_speed_control |
---|
| 2368 | |
---|
| 2369 | |
---|
| 2370 | !------------------------------------------------------------------------------! |
---|
| 2371 | ! Description: |
---|
| 2372 | ! ------------ |
---|
[1839] | 2373 | !> Application of the additional forces generated by the wind turbine on the |
---|
| 2374 | !> flow components (tendency terms) |
---|
| 2375 | !> Call for all grid points |
---|
[1819] | 2376 | !------------------------------------------------------------------------------! |
---|
| 2377 | SUBROUTINE wtm_tendencies( component ) |
---|
| 2378 | |
---|
[1839] | 2379 | |
---|
[1819] | 2380 | IMPLICIT NONE |
---|
| 2381 | |
---|
[1839] | 2382 | INTEGER(iwp) :: component !< prognostic variable (u,v,w) |
---|
| 2383 | INTEGER(iwp) :: i !< running index |
---|
| 2384 | INTEGER(iwp) :: j !< running index |
---|
| 2385 | INTEGER(iwp) :: k !< running index |
---|
[1819] | 2386 | |
---|
| 2387 | |
---|
| 2388 | SELECT CASE ( component ) |
---|
| 2389 | |
---|
| 2390 | CASE ( 1 ) |
---|
| 2391 | ! |
---|
| 2392 | !-- Apply the x-component of the force to the u-component of the flow: |
---|
[1864] | 2393 | IF ( simulated_time >= time_turbine_on ) THEN |
---|
[1819] | 2394 | DO i = nxlg, nxrg |
---|
| 2395 | DO j = nysg, nyng |
---|
| 2396 | DO k = nzb_u_inner(j,i)+1, k_hub(1) + k_smear(1) |
---|
| 2397 | ! |
---|
[1864] | 2398 | !-- Calculate the thrust generated by the nacelle and the tower |
---|
[1912] | 2399 | tend_nac_x = 0.5_wp * nac_cd_surf(k,j,i) * & |
---|
[1819] | 2400 | SIGN( u(k,j,i)**2 , u(k,j,i) ) |
---|
[1912] | 2401 | tend_tow_x = 0.5_wp * tow_cd_surf(k,j,i) * & |
---|
[1819] | 2402 | SIGN( u(k,j,i)**2 , u(k,j,i) ) |
---|
| 2403 | |
---|
[1912] | 2404 | tend(k,j,i) = tend(k,j,i) - rot_tend_x(k,j,i) & |
---|
| 2405 | - tend_nac_x - tend_tow_x |
---|
[1819] | 2406 | ENDDO |
---|
| 2407 | ENDDO |
---|
| 2408 | ENDDO |
---|
| 2409 | ENDIF |
---|
| 2410 | |
---|
| 2411 | CASE ( 2 ) |
---|
| 2412 | ! |
---|
| 2413 | !-- Apply the y-component of the force to the v-component of the flow: |
---|
[1864] | 2414 | IF ( simulated_time >= time_turbine_on ) THEN |
---|
[1819] | 2415 | DO i = nxlg, nxrg |
---|
| 2416 | DO j = nysg, nyng |
---|
| 2417 | DO k = nzb_v_inner(j,i)+1, k_hub(1) + k_smear(1) |
---|
[1912] | 2418 | tend_nac_y = 0.5_wp * nac_cd_surf(k,j,i) * & |
---|
[1819] | 2419 | SIGN( v(k,j,i)**2 , v(k,j,i) ) |
---|
[1912] | 2420 | tend_tow_y = 0.5_wp * tow_cd_surf(k,j,i) * & |
---|
[1819] | 2421 | SIGN( v(k,j,i)**2 , v(k,j,i) ) |
---|
[1912] | 2422 | tend(k,j,i) = tend(k,j,i) - rot_tend_y(k,j,i) & |
---|
| 2423 | - tend_nac_y - tend_tow_y |
---|
[1819] | 2424 | ENDDO |
---|
| 2425 | ENDDO |
---|
| 2426 | ENDDO |
---|
| 2427 | ENDIF |
---|
| 2428 | |
---|
| 2429 | CASE ( 3 ) |
---|
| 2430 | ! |
---|
| 2431 | !-- Apply the z-component of the force to the w-component of the flow: |
---|
[1864] | 2432 | IF ( simulated_time >= time_turbine_on ) THEN |
---|
[1819] | 2433 | DO i = nxlg, nxrg |
---|
| 2434 | DO j = nysg, nyng |
---|
| 2435 | DO k = nzb_w_inner(j,i)+1, k_hub(1) + k_smear(1) |
---|
[1912] | 2436 | tend(k,j,i) = tend(k,j,i) - rot_tend_z(k,j,i) |
---|
[1819] | 2437 | ENDDO |
---|
| 2438 | ENDDO |
---|
| 2439 | ENDDO |
---|
| 2440 | ENDIF |
---|
| 2441 | |
---|
| 2442 | |
---|
| 2443 | CASE DEFAULT |
---|
| 2444 | |
---|
| 2445 | WRITE( message_string, * ) 'unknown prognostic variable: ', component |
---|
| 2446 | CALL message( 'wtm_tendencies', 'PA04??', 1, 2, 0, 6, 0 ) |
---|
| 2447 | |
---|
| 2448 | END SELECT |
---|
| 2449 | |
---|
| 2450 | |
---|
| 2451 | END SUBROUTINE wtm_tendencies |
---|
| 2452 | |
---|
| 2453 | |
---|
| 2454 | !------------------------------------------------------------------------------! |
---|
| 2455 | ! Description: |
---|
| 2456 | ! ------------ |
---|
[1839] | 2457 | !> Application of the additional forces generated by the wind turbine on the |
---|
| 2458 | !> flow components (tendency terms) |
---|
| 2459 | !> Call for grid point i,j |
---|
[1819] | 2460 | !------------------------------------------------------------------------------! |
---|
| 2461 | SUBROUTINE wtm_tendencies_ij( i, j, component ) |
---|
| 2462 | |
---|
| 2463 | |
---|
| 2464 | IMPLICIT NONE |
---|
| 2465 | |
---|
[1839] | 2466 | INTEGER(iwp) :: component !< prognostic variable (u,v,w) |
---|
| 2467 | INTEGER(iwp) :: i !< running index |
---|
| 2468 | INTEGER(iwp) :: j !< running index |
---|
| 2469 | INTEGER(iwp) :: k !< running index |
---|
[1819] | 2470 | |
---|
| 2471 | SELECT CASE ( component ) |
---|
| 2472 | |
---|
| 2473 | CASE ( 1 ) |
---|
| 2474 | ! |
---|
| 2475 | !-- Apply the x-component of the force to the u-component of the flow: |
---|
[1839] | 2476 | IF ( simulated_time >= time_turbine_on ) THEN |
---|
[1819] | 2477 | |
---|
| 2478 | DO k = nzb_u_inner(j,i)+1, k_hub(1) + k_smear(1) |
---|
| 2479 | ! |
---|
[1839] | 2480 | !-- Calculate the thrust generated by the nacelle and the tower |
---|
[1912] | 2481 | tend_nac_x = 0.5_wp * nac_cd_surf(k,j,i) * & |
---|
[1819] | 2482 | SIGN( u(k,j,i)**2 , u(k,j,i) ) |
---|
[1912] | 2483 | tend_tow_x = 0.5_wp * tow_cd_surf(k,j,i) * & |
---|
[1819] | 2484 | SIGN( u(k,j,i)**2 , u(k,j,i) ) |
---|
[1912] | 2485 | tend(k,j,i) = tend(k,j,i) - rot_tend_x(k,j,i) & |
---|
| 2486 | - tend_nac_x - tend_tow_x |
---|
[1819] | 2487 | ENDDO |
---|
| 2488 | ENDIF |
---|
| 2489 | |
---|
| 2490 | CASE ( 2 ) |
---|
| 2491 | ! |
---|
| 2492 | !-- Apply the y-component of the force to the v-component of the flow: |
---|
[1839] | 2493 | IF ( simulated_time >= time_turbine_on ) THEN |
---|
[1819] | 2494 | DO k = nzb_v_inner(j,i)+1, k_hub(1) + k_smear(1) |
---|
[1912] | 2495 | tend_nac_y = 0.5_wp * nac_cd_surf(k,j,i) * & |
---|
[1819] | 2496 | SIGN( v(k,j,i)**2 , v(k,j,i) ) |
---|
[1912] | 2497 | tend_tow_y = 0.5_wp * tow_cd_surf(k,j,i) * & |
---|
[1819] | 2498 | SIGN( v(k,j,i)**2 , v(k,j,i) ) |
---|
[1912] | 2499 | tend(k,j,i) = tend(k,j,i) - rot_tend_y(k,j,i) & |
---|
| 2500 | - tend_nac_y - tend_tow_y |
---|
[1819] | 2501 | ENDDO |
---|
| 2502 | ENDIF |
---|
| 2503 | |
---|
| 2504 | CASE ( 3 ) |
---|
| 2505 | ! |
---|
| 2506 | !-- Apply the z-component of the force to the w-component of the flow: |
---|
[1839] | 2507 | IF ( simulated_time >= time_turbine_on ) THEN |
---|
[1819] | 2508 | DO k = nzb_w_inner(j,i)+1, k_hub(1) + k_smear(1) |
---|
[1912] | 2509 | tend(k,j,i) = tend(k,j,i) - rot_tend_z(k,j,i) |
---|
[1819] | 2510 | ENDDO |
---|
| 2511 | ENDIF |
---|
| 2512 | |
---|
| 2513 | |
---|
| 2514 | CASE DEFAULT |
---|
| 2515 | |
---|
| 2516 | WRITE( message_string, * ) 'unknown prognostic variable: ', component |
---|
| 2517 | CALL message( 'wtm_tendencies', 'PA04??', 1, 2, 0, 6, 0 ) |
---|
| 2518 | |
---|
| 2519 | END SELECT |
---|
| 2520 | |
---|
| 2521 | |
---|
| 2522 | END SUBROUTINE wtm_tendencies_ij |
---|
| 2523 | |
---|
| 2524 | END MODULE wind_turbine_model_mod |
---|