-
Notifications
You must be signed in to change notification settings - Fork 0
/
testScript.py
99 lines (77 loc) · 3.6 KB
/
testScript.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
#!/bin/python3
import logging
from pathlib import Path
import numpy as np
import pvtools
import waketools
import plottools
if __name__=='__main__':
logging.basicConfig(force=True, level=logging.DEBUG)
logger = logging.getLogger(__name__)
PRECURSOR_CASE = 'p002'
TURBINE_CASE = 't012'
CASE_DIR = Path(f'/mnt/scratch2/users/40146600/{TURBINE_CASE}')
TURBINE_CASE_FILE = CASE_DIR/f'{TURBINE_CASE}.foam'
TURBINE_TIP_RADIUS = 63.0
TURBINE_DIAMETER = 2 * TURBINE_TIP_RADIUS
TURBINE_HUB_HEIGHT = 90.0
TURBINE_BASE_COORDINATES = (1118.0, 1280.0)
# incoming wind direction in degrees clockwise from North
WIND_DIRECTION = np.radians(240)
DOMAIN_HEIGHT = 1000
CELLARRAYS = [
'U', 'UAvg',
'Uprime', 'uRMS', 'uuPrime2',
'p_rgh', 'p_rghAvg',
'T', 'TAvg',
'Tprime', 'TRMS', 'TTPrime2', 'uTPrime2',
'Rmean', 'qmean',
'kResolved', 'kSGS', 'kSGSmean',
'bodyForce',
'Rwall', 'qwall',
'SourceT', 'SourceU',
'T_0', 'U_0',
'epsilonSGSmean', 'kappat', 'nuSGSmean', 'nuSgs',
'omega', 'omegaAvg',
'Q'
]
turbine_origin = np.array([*TURBINE_BASE_COORDINATES, TURBINE_HUB_HEIGHT])
turbine_radius = TURBINE_TIP_RADIUS
# unit_normal = np.array([1.0, 0.577, 0.0])
# unit_normal /= np.linalg.norm(unit_normal)
wind_vector = np.array([-np.sin(WIND_DIRECTION),
-np.cos(WIND_DIRECTION),
0])
rangetoplot = range(-10,12)
SOWFATOOLS_DIR = CASE_DIR / 'postProcessing/sowfatools'
logger.debug(f'Creating directory {SOWFATOOLS_DIR}')
SOWFATOOLS_DIR.mkdir(parents=True, exist_ok=True)
ofcase = pvtools.loadof(TURBINE_CASE_FILE)
pvtools.integrate_wake(ofcase, (SOWFATOOLS_DIR
/f'{TURBINE_CASE}_turbineIntegratedWake'),
turbine_origin,
wind_vector, turbine_radius, distances=rangetoplot)
# Vertical Slices
# filepaths = [(SOWFATOOLS_DIR/f'{TURBINE_CASE}_verticalLineSample_{i}D')
# for i in rangetoplot]
# start_point = np.array([*turbine_origin[:2], 0])
# end_point = np.array([*turbine_origin[:2], DOMAIN_HEIGHT])
# start_points = np.array([(start_point + i * 2 * turbine_radius * wind_vector)
# for i in rangetoplot])
# end_points = np.array([(end_point + i * 2 * turbine_radius * wind_vector)
# for i in rangetoplot])
# pvtools.create_line_sample_series(ofcase, filepaths, start_points, end_points)
# Horizontal Slices
# filepaths = [(SOWFATOOLS_DIR/f'{TURBINE_CASE}_horizontalLineSample_{i}D')
# for i in rangetoplot]
# crossstream_vector = np.cross(wind_vector, np.array([0,0,1]))
# start_point = start_point - TURBINE_DIAMETER * crossstream_vector
# start_point[2] = TURBINE_HUB_HEIGHT
# end_point = end_point + TURBINE_DIAMETER * crossstream_vector
# end_point[2] = TURBINE_HUB_HEIGHT
# start_points = np.array([(start_point + i * 2 * turbine_radius * wind_vector)
# for i in rangetoplot])
# end_points = np.array([(end_point + i * 2 * turbine_radius * wind_vector)
# for i in rangetoplot])
# pvtools.create_line_sample_series(ofcase, filepaths, start_points, end_points)
logger.info("Finished")