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