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