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