Newer
Older
5002
5003
5004
5005
5006
5007
5008
5009
5010
5011
5012
5013
5014
5015
5016
5017
5018
5019
5020
5021
5022
5023
5024
5025
5026
5027
5028
5029
5030
5031
5032
5033
5034
5035
5036
5037
5038
5039
5040
5041
5042
5043
5044
5045
5046
5047
5048
5049
5050
5051
5052
5053
5054
5055
5056
5057
5058
5059
5060
5061
5062
5063
5064
5065
5066
5067
5068
5069
5070
5071
5072
5073
5074
5075
5076
5077
5078
5079
5080
5081
5082
5083
5084
5085
5086
5087
5088
5089
5090
5091
"""
Move all Hawc2io to here? NO: this should be the wrapper, to interface
the htc_dict with the io functions
There should be a bare metal module/class for those who only want basic
python support for HAWC2 result files and/or launching simulations.
How to properly design this module? Change each class into a module? Or
leave like this?
"""
# OK, for now use this to do operations on HAWC2 results files
def __init___(self):
"""
"""
pass
def m_equiv(self, st_arr, load, pos):
r"""Centrifugal corrected equivalent moment
Convert beam loading into a single equivalent bending moment. Note that
this is dependent on the location in the cross section. Due to the
way we measure the strain on the blade and how we did the calibration
of those sensors.
.. math::
\epsilon = \frac{M_{x_{equiv}}y}{EI_{xx}} = \frac{M_x y}{EI_{xx}}
+ \frac{M_y x}{EI_{yy}} + \frac{F_z}{EA}
M_{x_{equiv}} = M_x + \frac{I_{xx}}{I_{yy}} M_y \frac{x}{y}
+ \frac{I_{xx}}{Ay} F_z
Parameters
----------
st_arr : np.ndarray(19)
Only one line of the st_arr is allowed and it should correspond
to the correct radial position of the strain gauge.
load : list(6)
list containing the load time series of following components
.. math:: load = F_x, F_y, F_z, M_x, M_y, M_z
and where each component is an ndarray(m)
pos : np.ndarray(2)
x,y position wrt neutral axis in the cross section for which the
equivalent load should be calculated
Returns
-------
m_eq : ndarray(m)
Equivalent load, see main title
"""
F_z = load[2]
M_x = load[3]
M_y = load[4]
x, y = pos[0], pos[1]
A = st_arr[ModelData.st_headers.A]
I_xx = st_arr[ModelData.st_headers.Ixx]
I_yy = st_arr[ModelData.st_headers.Iyy]
M_x_equiv = M_x + ( (I_xx/I_yy)*M_y*(x/y) ) + ( F_z*I_xx/(A*y) )
# or ignore edgewise moment
#M_x_equiv = M_x + ( F_z*I_xx/(A*y) )
return M_x_equiv
class ManTurb64(object):
"""
alfaeps, L, gamma, seed, nr_u, nr_v, nr_w, du, dv, dw high_freq_comp
mann_turb_x64.exe fname 1.0 29.4 3.0 1209 256 32 32 2.0 5 5 true
"""
def __init__(self):
self.man64_exe = 'mann_turb_x64.exe'
self.wine = 'WINEARCH=win64 WINEPREFIX=~/.wine64 wine'
def run():
pass
def gen_pbs(cases):
case0 = cases[list(cases.keys())[0]]
pbs = prepost.PBSScript()
# make sure the path's end with a trailing separator
pbs.pbsworkdir = os.path.join(case0['[run_dir]'], '')
pbs.path_pbs_e = os.path.join(case0['[pbs_out_dir]'], '')
pbs.path_pbs_o = os.path.join(case0['[pbs_out_dir]'], '')
pbs.path_pbs_i = os.path.join(case0['[pbs_in_dir]'], '')
pbs.check_dirs()
for cname, case in cases.items():
5101
5102
5103
5104
5105
5106
5107
5108
5109
5110
5111
5112
5113
5114
5115
5116
5117
5118
5119
5120
5121
5122
5123
5124
5125
5126
5127
5128
5129
5130
5131
5132
5133
5134
5135
5136
5137
5138
5139
5140
5141
5142
5143
5144
5145
5146
5147
5148
5149
5150
5151
5152
5153
5154
5155
5156
5157
5158
5159
5160
5161
5162
5163
5164
5165
5166
5167
5168
5169
5170
5171
5172
5173
5174
5175
5176
5177
5178
5179
5180
5181
5182
5183
5184
5185
5186
5187
5188
5189
5190
5191
5192
5193
5194
5195
5196
5197
5198
base = case['[case_id]']
pbs.path_pbs_e = os.path.join(case['[pbs_out_dir]'], base + '.err')
pbs.path_pbs_o = os.path.join(case['[pbs_out_dir]'], base + '.out')
pbs.path_pbs_i = os.path.join(case['[pbs_in_dir]'], base + '.pbs')
pbs.execute()
pbs.create()
def eigenbody(cases, debug=False):
"""
Read HAWC2 body eigenalysis result file
=======================================
This is basically a cases convience wrapper around Hawc2io.ReadEigenBody
Parameters
----------
cases : dict{ case : dict{tag : value} }
Dictionary where each case is a key and its value a dictionary
holding all the tags/value pairs as used for that case.
Returns
-------
cases : dict{ case : dict{tag : value} }
Dictionary where each case is a key and its value a dictionary
holding all the tags/value pairs as used for that case. For each
case, it is updated with the results, results2 of the eigenvalue
analysis performed for each body using the following respective
tags: [eigen_body_results] and [eigen_body_results2].
"""
#Body data for body number : 3 with the name :nacelle
#Results: fd [Hz] fn [Hz] log.decr [%]
#Mode nr: 1: 1.45388E-21 1.74896E-03 6.28319E+02
for case in cases:
# tags for the current case
tags = cases[case]
file_path = os.path.join(tags['[run_dir]'], tags['[eigenfreq_dir]'])
# FIXME: do not assuem anything about the file name here, should be
# fully defined in the tags/dataframe
file_name = tags['[case_id]'] + '_body_eigen'
# and load the eigenfrequency body results
results, results2 = windIO.ReadEigenBody(file_path, file_name,
nrmodes=10)
# add them to the htc_dict
cases[case]['[eigen_body_results]'] = results
cases[case]['[eigen_body_results2]'] = results2
return cases
def eigenstructure(cases, debug=False):
"""
Read HAWC2 structure eigenalysis result file
============================================
This is basically a cases convience wrapper around
windIO.ReadEigenStructure
Parameters
----------
cases : dict{ case : dict{tag : value} }
Dictionary where each case is a key and its value a dictionary
holding all the tags/value pairs as used for that case.
Returns
-------
cases : dict{ case : dict{tag : value} }
Dictionary where each case is a key and its value a dictionary
holding all the tags/value pairs as used for that case. For each
case, it is updated with the modes_arr of the eigenvalue
analysis performed for the structure.
The modes array (ndarray(3,n)) holds fd, fn and damping.
"""
for case in cases:
# tags for the current case
tags = cases[case]
file_path = os.path.join(tags['[run_dir]'], tags['[eigenfreq_dir]'])
# FIXME: do not assuem anything about the file name here, should be
# fully defined in the tags/dataframe
file_name = tags['[case_id]'] + '_strc_eigen'
# and load the eigenfrequency structure results
modes = windIO.ReadEigenStructure(file_path, file_name, max_modes=500)
# add them to the htc_dict
cases[case]['[eigen_structure]'] = modes
return cases
if __name__ == '__main__':
pass