wawi 0.0.11__py3-none-any.whl → 0.0.12__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of wawi might be problematic. Click here for more details.

@@ -42,25 +42,29 @@ with open('element.json', 'w') as f:
42
42
  phi_full_disp = wawi.ext.abq.get_nodal_phi(step_obj, nodes, flatten_components=True, field_outputs=['UT', 'UR'])
43
43
 
44
44
  #%% Get pontoon data
45
- node_matrix_pontoons = wawi.ext.abq.get_element_matrices(region_hydro, obj=part)
45
+ pontoon_sets = ['P1', 'P2', 'P3', 'P4', 'P5', 'P6', 'P7']
46
+ pontoon_types = ['p17', 'p26', 'p345', 'p345', 'p345', 'p26', 'p17']
47
+ rotations = np.array([13.944407004001892, 9.2962713360012632, 4.6481356680006325, 0.0,
48
+ -4.6481356680006334, -9.2962713360012632, -13.944407004001883])
49
+
50
+ node_matrix_pontoons = np.vstack([wawi.ext.abq.get_element_matrices(db.rootAssembly.nodeSets[pset], obj=part) for pset in pontoon_sets])
46
51
  node_labels_pontoons = node_matrix_pontoons[:,0]
47
- nodes_pontoons = wawi.ext.abq.create_list_of_nodes(part, node_labels_pontoons)
48
- phi_h = wawi.ext.abq.get_nodal_phi(step_obj, nodes_pontoons, flatten_components=True, field_outputs=['UT', 'UR'])
49
52
 
50
53
  # Export pontoon.json
51
- pontoon_types = ['ptype_1']*7
52
- rotations = -np.array([13.944407004001892, 9.2962713360012632, 4.6481356680006325, 0.0,
53
- -4.6481356680006334, -9.2962713360012632, -13.944407004001883])
54
-
55
54
  pontoon_data = OrderedDict()
56
55
 
57
56
  for ix, node in enumerate(node_labels_pontoons):
58
- key = 'P'+str (ix+1)
57
+ key = pontoon_sets[ix]
59
58
  pontoon_data[key] = dict(coordinates=node_matrix_pontoons[ix, 1:].tolist(),
60
59
  node=node,
61
60
  rotation=rotations[ix],
62
61
  pontoon_type=pontoon_types[ix])
63
62
 
63
+
64
+ nodes_pontoons = wawi.ext.abq.create_list_of_nodes(part, node_labels_pontoons)
65
+ phi_h = wawi.ext.abq.get_nodal_phi(step_obj, nodes_pontoons, flatten_components=True, field_outputs=['UT', 'UR'])
66
+
67
+
64
68
  with open('pontoon.json', 'w') as f:
65
69
  json.dump(pontoon_data, f)
66
70
 
@@ -0,0 +1,47 @@
1
+ from sys import path
2
+ from collections import OrderedDict
3
+
4
+ path.append('C:/Users/knutankv/git-repos/wawi/') # this is an easy quick fix to enable importing wawi package in Abaqus environment
5
+ savefolder = 'C:/Temp/'
6
+
7
+ # NOTE: Only linear *beam* elements are supported in relevant sets!!
8
+
9
+ import wawi.ext.abq
10
+ import json
11
+ import numpy as np
12
+
13
+ #%% Get database object (ODB)
14
+ db = wawi.ext.abq.get_db('odb')
15
+
16
+ #%% Definitions
17
+ frequency_step = 'Step-11' # define set name to extract modal properties from
18
+ part = db.rootAssembly.instances['PART-1-1'] # define part
19
+ step_obj = db.steps[frequency_step]
20
+
21
+ part.ElementSet('ALL', part.elements) # get all elements (for full element and node matrix)
22
+
23
+ #%% Grab regions
24
+ region_full = part.elementSets['ALL']
25
+
26
+ #%% Get modal parameters
27
+ fn, m = wawi.ext.abq.get_modal_parameters(frequency_step)
28
+
29
+ #%% Get wind elements and mode shapes
30
+ node_matrix, element_matrix = wawi.ext.abq.get_element_matrices(region_full, obj=part)
31
+ node_labels = node_matrix[:,0]
32
+ nodes = wawi.ext.abq.create_list_of_nodes(part, node_labels)
33
+
34
+ # Export element definitions as json
35
+ el_data = dict(node_matrix=node_matrix.tolist(),
36
+ element_matrix=element_matrix.tolist())
37
+
38
+ with open('element.json', 'w') as f:
39
+ json.dump(el_data, f)
40
+
41
+ phi_full_disp = wawi.ext.abq.get_nodal_phi(step_obj, nodes, flatten_components=True, field_outputs=['U', 'UR'])
42
+
43
+ ## ------------------- EXPORT MODES ----------------
44
+ modal_data = dict(omega_n=(fn*2*np.pi).tolist(), m=m.tolist(), phi=dict(full=phi_full_disp.tolist()))
45
+
46
+ with open('modal.json', 'w') as f:
47
+ json.dump(modal_data, f)
@@ -3,10 +3,10 @@ import pytest
3
3
  import numpy as np
4
4
  from math import isclose
5
5
 
6
- # use the local wawi (Github folder) instead of the installed version (remove this when using the installed version)
7
- import sys
8
- import os
9
- sys.path.insert(0, os.path.abspath('C:\\Users\\aksef\\Documents\\GitHub\\wawi'))
6
+ # use the local wawi
7
+ #import sys
8
+ #import os
9
+ #sys.path.insert(0, r'C:\Users\aksef\OneDrive - Multiconsult\project\wawi\wawi_keep')
10
10
 
11
11
  # import functions
12
12
  from wawi.io import import_folder
@@ -108,7 +108,6 @@ def test_mean_speed_45():
108
108
  # PSD response
109
109
  S_exp = np.transpose(np.array( [ [0.0167, -0.007j], [0.007j, 0.00293] ] ))
110
110
 
111
-
112
111
  model = import_folder(model_folder)
113
112
  model.aero.windstate = iabse_11a_windstate(V)
114
113
 
@@ -121,11 +120,11 @@ def test_mean_speed_45():
121
120
  omega = np.array([0.001, f])*np.pi*2
122
121
  HH = eval_3d_fun(model.get_frf_fun(opt = 1), omega)
123
122
 
124
- model.aero.sections['girder0'].Admittance = lambda fred: np.full((4, 3), davenport(fred))
123
+ model.aero.sections['girder0'].admittance = lambda fred: np.full((4, 3), davenport(fred))
125
124
  model.run_freqsim(omega,
126
125
  include_selfexcited=['aero'],
127
126
  include_action=['aero'],
128
- print_progress=False, merge_aero_sections=True)
127
+ print_progress=False)
129
128
 
130
129
  global_dof_ix = np.array([2,3])
131
130
  S = model.get_result_psd(key='full',
@@ -170,12 +169,14 @@ def test_response_spectra(Vbuff, RS_vert_exp, RS_tors_exp):
170
169
  model.aero.windstate = iabse_11a_windstate(Vbuff)
171
170
  model.modal_dry.xi0 = .3e-2
172
171
  model.aero.sections['girder0'].ADs = ADs(**flatplate_ads())
173
- model.aero.sections['girder0'].Admittance = lambda fred: np.full((4, 3), davenport(fred))
172
+ model.aero.sections['girder0'].admittance = lambda fred: np.full((4, 3), davenport(fred))
174
173
 
175
174
  model.run_freqsim(omega_axis,
176
175
  include_selfexcited=['aero'],
177
176
  include_action=['aero'],
178
- print_progress=False, merge_aero_sections=True)
177
+ print_progress=False,
178
+ #merge_aero_sections=True
179
+ )
179
180
 
180
181
  global_dof_ix = np.array([2,3])
181
182
  S = model.get_result_psd(key='full',
@@ -204,12 +205,12 @@ def test_RMS_response(Vbuff, RMS_vert_exp, RMS_tors_exp):
204
205
  model.aero.windstate = iabse_11a_windstate(Vbuff)
205
206
  model.modal_dry.xi0 = .3e-2
206
207
  model.aero.sections['girder0'].ADs = ADs(**flatplate_ads())
207
- model.aero.sections['girder0'].Admittance = lambda fred: np.full((4, 3), davenport(fred))
208
+ model.aero.sections['girder0'].admittance = lambda fred: np.full((4, 3), davenport(fred))
208
209
 
209
210
  model.run_freqsim(omega_axis,
210
211
  include_selfexcited=['aero'],
211
212
  include_action=['aero'],
212
- print_progress=False, merge_aero_sections=True)
213
+ print_progress=False)
213
214
 
214
215
  stds = model.get_result_std(key = 'full')
215
216
 
@@ -5,9 +5,9 @@ from math import isclose
5
5
  import dill
6
6
 
7
7
  # use the local wawi (Github folder) instead of the installed version (remove this when using the installed version)
8
- import sys
9
- import os
10
- sys.path.insert(0, os.path.abspath('C:\\Users\\aksef\\Documents\\GitHub\\wawi'))
8
+ #import sys
9
+ #import os
10
+ #sys.path.insert(0, os.path.abspath('C:\\Users\\aksef\\Documents\\GitHub\\wawi'))
11
11
 
12
12
  # import functions
13
13
  from wawi.io import import_folder
@@ -166,11 +166,11 @@ def test_mean_speed_45():
166
166
  omega = np.array([0.001, f])*np.pi*2
167
167
  HH = eval_3d_fun(model.get_frf_fun(opt = 1), omega)
168
168
 
169
- model.aero.sections['girder0'].Admittance = lambda fred: np.full((4, 3), davenport(fred))
169
+ model.aero.sections['girder0'].admittance = lambda fred: np.full((4, 3), davenport(fred))
170
170
  model.run_freqsim(omega,
171
171
  include_selfexcited=['aero'],
172
172
  include_action=['aero'],
173
- print_progress=False, merge_aero_sections=True)
173
+ print_progress=False)
174
174
 
175
175
  global_dof_ix = np.array([1,2,3])
176
176
  S = model.get_result_psd(key='full',
@@ -225,13 +225,13 @@ def test_response_spectra(Vbuff, RS_horz_exp, RS_vert_exp, RS_tors_exp):
225
225
  AD_funs = dill.load(file)
226
226
  AD_s = AD_dict(AD_funs)
227
227
  model.aero.sections['girder0'].ADs = ADs(**AD_s)
228
- model.aero.sections['girder0'].Admittance = lambda fred: np.full((4, 3), davenport(fred))
228
+ model.aero.sections['girder0'].admittance = lambda fred: np.full((4, 3), davenport(fred))
229
229
 
230
230
  # run analysis
231
231
  model.run_freqsim(omega_axis,
232
232
  include_selfexcited=['aero'],
233
233
  include_action=['aero'],
234
- print_progress=False, merge_aero_sections=True)
234
+ print_progress=False)
235
235
 
236
236
  # extract PSD
237
237
  global_dof_ix = np.array([1,2,3])
@@ -265,13 +265,13 @@ def test_RMS_response(Vbuff, RMS_horz_exp, RMS_vert_exp, RMS_tors_exp):
265
265
  AD_funs = dill.load(file)
266
266
  AD_s = AD_dict(AD_funs)
267
267
  model.aero.sections['girder0'].ADs = ADs(**AD_s)
268
- model.aero.sections['girder0'].Admittance = lambda fred: np.full((4, 3), davenport(fred))
268
+ model.aero.sections['girder0'].admittance = lambda fred: np.full((4, 3), davenport(fred))
269
269
 
270
270
  # run analysis
271
271
  model.run_freqsim(omega_axis,
272
272
  include_selfexcited=['aero'],
273
273
  include_action=['aero'],
274
- print_progress=False, merge_aero_sections=True)
274
+ print_progress=False)
275
275
 
276
276
  # RMS responses
277
277
  stds = model.get_result_std(key = 'full')
@@ -4,9 +4,9 @@ from math import isclose
4
4
  import dill
5
5
 
6
6
  # use the local wawi (Github folder) instead of the installed version (remove this when using the installed version)
7
- import sys
8
- import os
9
- sys.path.insert(0, os.path.abspath('C:\\Users\\aksef\\Documents\\GitHub\\wawi'))
7
+ #import sys
8
+ #import os
9
+ #sys.path.insert(0, os.path.abspath('C:\\Users\\aksef\\Documents\\GitHub\\wawi'))
10
10
 
11
11
  from wawi.io import import_folder
12
12
  from wawi.model import Windstate
@@ -184,14 +184,14 @@ def test_RS_spectra():
184
184
  model.aero.windstate = iabse_2a_windstate(V)
185
185
  # admittance
186
186
  for key in model.aero.sections:
187
- model.aero.sections[key].Admittance = lambda fred: np.full((4, 3), davenport(fred))
187
+ model.aero.sections[key].admittance = lambda fred: np.full((4, 3), davenport(fred))
188
188
 
189
189
  # run analysis
190
190
  model.run_freqsim(omega,
191
191
  include_selfexcited=['aero'],
192
192
  include_action=['aero'],
193
- print_progress=False, merge_aero_sections=True,
194
- ensure_at_peaks=False) # keep the given frequency axis
193
+ print_progress=False,
194
+ ensure_at_peaks=False) # keep the given frequency axis
195
195
 
196
196
 
197
197
  # extract PSD - at the midpsan
@@ -237,7 +237,7 @@ def test_RMS_response(Vbuff, RMS_horz_exp1, RMS_vert_exp1, RMS_tors_exp1, RMS_ho
237
237
  model.aero.windstate = iabse_2a_windstate(Vbuff)
238
238
  # admittance
239
239
  for key in model.aero.sections:
240
- model.aero.sections[key].Admittance = lambda fred: np.full((4, 3), davenport(fred))
240
+ model.aero.sections[key].admittance = lambda fred: np.full((4, 3), davenport(fred))
241
241
 
242
242
  #model.run_eig(w_initial=model.modal_dry.omega_n.tolist(), freq_kind=True, itmax=100) # alters integration
243
243
 
@@ -245,7 +245,7 @@ def test_RMS_response(Vbuff, RMS_horz_exp1, RMS_vert_exp1, RMS_tors_exp1, RMS_ho
245
245
  model.run_freqsim(omega,
246
246
  include_selfexcited=['aero'],
247
247
  include_action=['aero'],
248
- print_progress=False, merge_aero_sections=True)
248
+ print_progress=False)
249
249
  # RMS responses
250
250
  stds = model.get_result_std(key = 'full')
251
251
  # global dofs
wawi/__init__.py CHANGED
@@ -3,7 +3,7 @@
3
3
  '''
4
4
  __pdoc__ = {'wawi.ext.abq': False}
5
5
 
6
- __version__ = "0.0.11"
6
+ __version__ = "0.0.12"
7
7
 
8
8
  # Other packages
9
9
  import numpy as np
wawi/modal.py CHANGED
@@ -192,7 +192,7 @@ def iteig(K, C, M, omega=None, omega_ref=0, input_functions=True, itmax=None, to
192
192
  q[:, m] = phi[:,0]
193
193
 
194
194
  if print_progress:
195
- pp(m+2,2*ndofs, sym='>', postfix=' finished with iterative modal analysis.')
195
+ pp(m+2,2*ndofs+1, sym='>', postfix=' finished with iterative modal analysis.')
196
196
 
197
197
  if print_progress:
198
198
  print(' ')
@@ -323,7 +323,7 @@ def iteig_freq(K, C, M, omega=None, itmax=15, reference_omega=0, input_functions
323
323
  q[:, m] = qi[:, m]
324
324
 
325
325
  if print_progress:
326
- pp(m+2,2*ndofs, sym='>', postfix=' finished with iterative modal analysis.')
326
+ pp(m+2 ,2*ndofs+1, sym='>', postfix=' finished with iterative modal analysis.')
327
327
 
328
328
  if print_progress:
329
329
  print(' ')
wawi/model/_model.py CHANGED
@@ -16,6 +16,8 @@ from wawi.structural import freqsim
16
16
  from wawi.tools import print_progress as pp
17
17
  from wawi.wave import stochastic_linearize, waveaction_fft, harmonic_linearize
18
18
  from wawi.wind import windaction, windaction_static
19
+ # from wawi.io import import_folder
20
+
19
21
  import dill
20
22
 
21
23
 
@@ -266,6 +268,17 @@ class Model:
266
268
 
267
269
  self.Cquad_lin = 0.0
268
270
 
271
+ # Not used due to circular referencing.
272
+ # @staticmethod
273
+ # def from_folder(*args, **kwargs):
274
+ # '''
275
+ # Alternative constructor. Passes all inputs to `wawi.io.import_folder`.
276
+ # '''
277
+
278
+ # model = import_folder(*args, **kwargs)
279
+
280
+ # return model
281
+
269
282
 
270
283
  @staticmethod #alternative constructor
271
284
  def from_wwi(path):
@@ -568,7 +581,7 @@ class Model:
568
581
  pl.add_point_labels(np.vstack([wind_origin]), [f'U={self.aero.windstate.U0:.2f} m/s from heading {self.aero.windstate.direction:.1f} deg (CW)'])
569
582
 
570
583
  # Plot wave arrow
571
- if plot_wave_direction and self.hydro.seastate is not None:
584
+ if plot_wave_direction and self.hydro is not None and self.hydro.seastate is not None:
572
585
  if self.hydro.seastate.homogeneous:
573
586
  if wave_origin=='center':
574
587
  wave_origin = origin*1
@@ -1335,4 +1348,10 @@ class Model:
1335
1348
  return ix
1336
1349
 
1337
1350
  def get_node_ixs(self, nodelabels):
1338
- return [self.get_node_ix(nodelabel) for nodelabel in nodelabels]
1351
+ return [self.get_node_ix(nodelabel) for nodelabel in nodelabels]
1352
+
1353
+ def get_aerosection_phi_and_x(self, key):
1354
+ ixs = self.aero.phi_ixs[key]
1355
+ x = np.vstack([node.coordinates for node in self.aero.eldef[key].nodes])
1356
+
1357
+ return ixs, x
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: wawi
3
- Version: 0.0.11
3
+ Version: 0.0.12
4
4
  Summary: WAve and WInd response prediction
5
5
  Author-email: "Knut A. Kvåle" <knut.a.kvale@ntnu.no>, Ole Øiseth <ole.oiseth@ntnu.no>, Aksel Fenerci <aksel.fenerci@ntnu.no>, Øivind Wiig Petersen <oyvind.w.petersen@ntnu.no>
6
6
  License: MIT License
@@ -1,15 +1,15 @@
1
- examples/3 Software interfacing/Abaqus model export/bergsoysund-export.py,sha256=-1jrDNmevOcB1IV0iLOiW0z-QiNkOv8GkGk-7K8CcK0,2606
2
- examples/3 Software interfacing/Abaqus model export/test.py,sha256=kAmol3XZQ2jkO2qujEQrqx38Q24LbzrYZzqE5ng5-E8,2188
3
- tests/test_IABSE_step11a.py,sha256=guRsaP9gpERvSp0Ui3hO-WH764BcIe6Qx8vC4QVTAoU,8013
4
- tests/test_IABSE_step11c.py,sha256=U_NcL6BAmnQG7MSjkr8KYk9hH8ZPdZgg17pM9ugUBzo,10412
5
- tests/test_IABSE_step2a.py,sha256=L5AyTOJZ_sPmcmW_4h-sQfRwvVW71LZkXc1yz33DABM,10203
1
+ examples/3 Software interfacing/Abaqus model export/bergsoysund-export.py,sha256=3HSV009z5oqIUgM6B7xucUpGeh2f8SzC9FSiyP0zd7A,2760
2
+ examples/3 Software interfacing/Abaqus model export/hardanger-export.py,sha256=YiqS-TxnkydwVHE7k-57nP6CDsxqSXgWR3f8UytAubY,1603
3
+ tests/test_IABSE_step11a.py,sha256=zTWOxR78F0PNhNqiqodEcL65vdJXyMP78nkJumhy-RA,7915
4
+ tests/test_IABSE_step11c.py,sha256=TfxPlP70dhujKlSYbA-Gj4U-EJmYZ3jt6yjvX9wSXcA,10337
5
+ tests/test_IABSE_step2a.py,sha256=9pAd1em2IEY4k5N-jAigV3VGup0QsbUxnwSiziuMbUg,10134
6
6
  tests/test_wind.py,sha256=r4rx6f8Tn-u4fn4gGPBMrL_JJQ2SVHGQiQ9sQuMQCPo,1707
7
- wawi/__init__.py,sha256=rH8H6W3AN1iZb8rU9K_8k-mycRSvQNxFq97Biy0-hzw,183
7
+ wawi/__init__.py,sha256=7vUvWFZzW67YG3yHPiBO_bsphhLLgEF4N7wdUkJeEq8,183
8
8
  wawi/fe.py,sha256=22QKI1GlfsG7o_TpFXaKJfzmbO2_2zdIMaoJmaIZdmY,4001
9
9
  wawi/general.py,sha256=xHRoDkcchrL6Y7pTUqGsjBHh8YBLvX9dYcNXXCjQap8,13787
10
10
  wawi/identification.py,sha256=bVB6EVRR6J39OO9ckuzNJ6f0FwIo4cLqfYgrsIN89TE,1748
11
11
  wawi/io.py,sha256=cr8XLF7bwpTCxpZ84YjOyWjc5uuu-JjGv8vY9UKH-HI,25327
12
- wawi/modal.py,sha256=WjNGFsk0C3tYRy18Q9WNRCatmGJtq1JSv0WrkGV02Eo,20247
12
+ wawi/modal.py,sha256=L1Rs_YVEADOmsQL-hJ43eb8Nt5VpYuB1VHOjYK2O9X0,20252
13
13
  wawi/plot.py,sha256=jllJcjZxTBqjzBoT4k9jLXVUnie8oqNr8371IJvCd3c,19791
14
14
  wawi/prob.py,sha256=0nCdKdwkNf4M6sHyCZuYlt06gD0NmqRNfl4KesgySWA,215
15
15
  wawi/random.py,sha256=MHPpyTlRJSJFkCmeTAmw4Q5K1BPoFVb0Nxg0jDhkuIM,871
@@ -29,10 +29,10 @@ wawi/model/__init__.py,sha256=u6B-dugP76LBkOUVMs0KAoQ81PeRHwFL0M8MbNeAaJA,218
29
29
  wawi/model/_aero.py,sha256=tvWMjMoVi9ZVBc3NZ_s-wSofbEk1cc5jf5s-Swv2RxQ,9337
30
30
  wawi/model/_dry.py,sha256=KpmFlSinoY6DrSyc3Y0M8w1-cCC7VCFep-uzcqZsHz4,3940
31
31
  wawi/model/_hydro.py,sha256=1tUj19OgvEjItNtBxXuPHf0zWtKv_ioTrOcgl9Ov3dg,26960
32
- wawi/model/_model.py,sha256=34qblCqGpIKwbsa38CJ3a8KbHYyX8LDWOFQhdRwK98Q,52504
32
+ wawi/model/_model.py,sha256=ynZkyoU00crTAlu7sN0CmJsn-J8vwK7BDbMCh0pb-hI,53061
33
33
  wawi/model/_screening.py,sha256=NRYkKq928z2lqMSUTpbQLls04td_9R_4dhkjU3Gv1oQ,3716
34
- wawi-0.0.11.dist-info/licenses/LICENSE,sha256=bH1aWhrNbbPLrYnVFRaoYYzcUr-figHjry-kGB7Tc54,1076
35
- wawi-0.0.11.dist-info/METADATA,sha256=TPaFfAkztMCRaw4F8U5JT6XqOK2IjY3orqmBmguLoaY,6530
36
- wawi-0.0.11.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
37
- wawi-0.0.11.dist-info/top_level.txt,sha256=Nk5G_ZwgZRCb9ZMWZdr1M3QIskX6kCnlqeMl67N3zg8,20
38
- wawi-0.0.11.dist-info/RECORD,,
34
+ wawi-0.0.12.dist-info/licenses/LICENSE,sha256=bH1aWhrNbbPLrYnVFRaoYYzcUr-figHjry-kGB7Tc54,1076
35
+ wawi-0.0.12.dist-info/METADATA,sha256=lXTUPijzmyd6QOJ2LmCPJaF7H_NWkysiOZkJkhlKqlU,6530
36
+ wawi-0.0.12.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
37
+ wawi-0.0.12.dist-info/top_level.txt,sha256=Nk5G_ZwgZRCb9ZMWZdr1M3QIskX6kCnlqeMl67N3zg8,20
38
+ wawi-0.0.12.dist-info/RECORD,,
@@ -1,67 +0,0 @@
1
- from sys import path
2
- from collections import OrderedDict
3
-
4
- path.append('C:/Users/knutankv/git-repos/wawi/') # this is an easy quick fix to enable importing wawi package in Abaqus environment
5
- savefolder = 'C:/Temp/'
6
-
7
- import wawi.ext.abq
8
- import json
9
- import numpy as np
10
-
11
- #%% Get (O) database object
12
- db = wawi.ext.abq.get_db('odb')
13
-
14
- #%% Definitions
15
- frequency_step = 'Step-6'
16
- part = db.rootAssembly.instances['BRIDGE-1']
17
- step_obj = db.steps[frequency_step]
18
-
19
- if 'ALL' not in part.elementSets: #CREATE SET OF ALL ELEMENTS IN PART
20
- part.ElementSet('ALL', part.elements)
21
-
22
- #%% Grab regions
23
- region_full = part.elementSets['ALL']
24
- region_hydro = part.nodeSets['SPRING']
25
-
26
- #%% Get modal parameters
27
- fn, m = wawi.ext.abq.get_modal_parameters(frequency_step)
28
-
29
- #%% Get wind elements and mode shapes
30
- node_matrix, element_matrix = wawi.ext.abq.get_element_matrices(region_full, obj=part)
31
- node_labels = node_matrix[:,0]
32
-
33
- # Export element definitions as json
34
- el_data = dict(node_matrix=node_matrix.tolist(), element_matrix=element_matrix.tolist())
35
-
36
- with open('element.json', 'w') as f:
37
- json.dump(el_data, f)
38
-
39
- phi_full_disp = wawi.ext.abq.get_nodal_phi(step_obj, node_labels, flatten_components=True)
40
-
41
- #%% Get pontoon data
42
- node_matrix_pontoons = wawi.ext.abq.get_element_matrices(region_hydro, obj=part, sort_nodes_fun=None)
43
- node_labels = node_matrix_pontoons[:,0]
44
- phi_h = wawi.ext.abq.get_nodal_phi(step_obj, node_labels, flatten_components=True)
45
-
46
- # Export pontoon.json
47
- pontoon_types = ['ptype_1']*48
48
- rotations = np.zeros(48)
49
-
50
- pontoon_data = OrderedDict()
51
-
52
- for ix, node in enumerate(node_labels):
53
- key = 'P'+str (ix+1)
54
- pontoon_data[key] = dict(coordinates=node_matrix_pontoons[ix, 1:].tolist(),
55
- node=node,
56
- rotation=rotations[ix],
57
- pontoon_type=pontoon_types[ix])
58
-
59
- with open('pontoon.json', 'w') as f:
60
- json.dump(pontoon_data, f)
61
-
62
- ## ------------------- EXPORT MODES ----------------
63
- modal_data = dict(omega_n=(fn*2*np.pi).tolist(), m=m.tolist(), phi=dict(full=phi_full_disp.tolist(),
64
- hydro=phi_h.tolist()))
65
-
66
- with open('modal.json', 'w') as f:
67
- json.dump(modal_data, f)
File without changes