wawi 0.0.8__py3-none-any.whl → 0.0.11__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.

@@ -0,0 +1,124 @@
1
+ import numpy as np
2
+ import json
3
+ from ._hydro import Seastate
4
+ from pathlib import Path
5
+
6
+ '''
7
+ SCREENING SUBMODULE
8
+ '''
9
+
10
+ class ScreeningCase:
11
+ def __init__(self, seastate, parvar, independent=True, name=None):
12
+
13
+ self.name = name
14
+ self.seastate = seastate
15
+ self.assign_parvar(parvar)
16
+ self.independent = independent
17
+ self.combos = self.get_parameter_space()
18
+ self.ix = -1
19
+
20
+ if not self.independent:
21
+ sz_prev = None
22
+ for key in self.parvar:
23
+ sz = len(self.parvar[key])
24
+
25
+ if sz_prev is not None and sz!=sz_prev:
26
+ raise ValueError('If dependent parameter arrays are requested, they must have the same length!')
27
+
28
+ sz_prev = sz*1
29
+
30
+
31
+ def assign_parvar(self, parvar):
32
+ self.parvar = dict()
33
+
34
+ for key in parvar:
35
+ if type(parvar[key]) is str:
36
+ self.parvar[key] = eval(parvar[key])
37
+ else:
38
+ self.parvar[key] = np.array(parvar[key])
39
+
40
+ # Convert angles
41
+ conversions = {'theta0': np.pi/180.0, 'thetaU': np.pi/180.0}
42
+
43
+ for key in self.parvar:
44
+ if key in conversions:
45
+ self.parvar[key] = self.parvar[key]*conversions[key]
46
+
47
+
48
+ def get_parameter_space(self):
49
+ pars = [self.parvar[k] for k in self.parvar]
50
+ keys = [k for k in self.parvar if k]
51
+
52
+ if self.independent:
53
+ combos = np.array(np.meshgrid(*pars)).reshape(len(keys),-1).T
54
+ else:
55
+ combos = np.vstack(pars).T
56
+
57
+ combo_dicts = [dict(zip(keys, combo)) for combo in combos]
58
+ return combo_dicts
59
+
60
+ @property
61
+ def n(self):
62
+ if self.independent:
63
+ return np.prod([len(v) for v in self.parvar.values()])
64
+ else:
65
+ return len(list(self.parvar.values())[0])
66
+
67
+ # Alternative constructor
68
+ @classmethod
69
+ def from_json(cls, json_file, **kwargs):
70
+ with open(json_file, 'r') as fileobj:
71
+ data = json.load(fileobj)
72
+
73
+ seastate = Seastate.from_json(data['seastate'], **kwargs)
74
+
75
+ # Update options if provided (to enable overriding options from screening setup)
76
+ if 'options' in data:
77
+ options = data['options']
78
+ else:
79
+ options = {}
80
+
81
+ if 'pontoon_options' in data:
82
+ pontoon_options = data['pontoon_options']
83
+ else:
84
+ pontoon_options = {}
85
+
86
+ seastate.options.update(**options)
87
+ seastate.pontoon_options.update(**pontoon_options)
88
+
89
+ parvar = data['parvar']
90
+ if 'independent' in data:
91
+ independent = data['independent']
92
+ else:
93
+ independent = True
94
+
95
+ return cls(seastate, parvar, independent=independent, name=Path(json_file).stem)
96
+
97
+ def get_combo(self):
98
+ return self.combos[self.ix]
99
+
100
+ def get_next_combo(self):
101
+ self.iterate_ix()
102
+ combo = self.combos[self.ix]
103
+ return combo
104
+
105
+ def iterate_seastate(self):
106
+ combo = self.get_next_combo()
107
+ if combo is not None:
108
+ for key in combo:
109
+ setattr(self.seastate, key, combo[key])
110
+
111
+ return self.seastate
112
+
113
+ def get_next_seastate(self):
114
+ self.iterate_seastate()
115
+ return self.seastate
116
+
117
+ def iterate_ix(self):
118
+ if self.ix == (self.n-1):
119
+ self.ix = 0 #reset
120
+ else:
121
+ self.ix += 1
122
+
123
+ def reset_ix(self):
124
+ self.ix = 0
wawi/time_domain.py CHANGED
@@ -52,6 +52,51 @@ def simulate_mdof(S, omega, fs=None, tmax=None, reg_factor=None, zero_limit=1e-1
52
52
  phase_angles=None, return_phase_angles=False, interpolation_kind='linear',
53
53
  component_scaling=None, print_status=False):
54
54
 
55
+ '''
56
+ Simulate time series from given cross-spectral density matrix.
57
+
58
+ Parameters
59
+ ----------------
60
+ S : float
61
+ cross-spectral density matrix (Ndofs x Ndofs x Nfreqs) as complex numpy array
62
+ omega : float
63
+ numpy array defining frequencies in rad/s
64
+ fs : float, optional
65
+ sampling frequency in Hz; if not given, the value is defined as two times the maximum of `omega`
66
+ tmax : float, optional
67
+ duration of realization in seconds
68
+ reg_factor : float, optional
69
+ to help the Cholesky decomposition to achieve a numerical solution,
70
+ a diagonal matrix with the norm of all frequency components of the matrix S scaled by the given factor
71
+ - if no value is given (--> None imposed), no regularization is conducted;
72
+ used as input to function `spectrum_to_process` which decomposes the spectral density
73
+ zero_limit : float, optional
74
+ frequency components where the norm of S is below this limit is set to zero
75
+ if no value is given (--> None imposed), no zero limit is applied;
76
+ used as input to function `spectrum_to_process` which decomposes the spectral density
77
+ phase_angles : float, optional
78
+ if previously conducted simulations are to be recreated, they can by inputting the phase angles
79
+ (to get the phase angles from simulation, see `return_phase_angles` input parameter)
80
+ return_phase_angles : bool, default=False
81
+ whether or not to return phase angle enabling recreation of the simulation
82
+ interpolation_kind : optional, default='linear'
83
+ interpolation type used for interpolation (to ensure that we get defined duration and sampling) prior to ifft
84
+ component_scaling : float, optional
85
+ values to use for scaling of components prior to decomposition (and thereafter rescale afterwards);
86
+ can help if some components are much smaller than others; size should match number of DOFs in S
87
+ print_status : False, optional
88
+ whether or not to print status messages
89
+
90
+ Returns
91
+ ----------------
92
+ p : float
93
+ time history
94
+ t : float
95
+ numpy array with time axis values corresponding to `p`
96
+ alpha : float
97
+ phase angles, only returned if `return_phase_angles` is True
98
+ '''
99
+
55
100
  if omega[0] !=0:
56
101
  omega = np.insert(omega, 0, 0)
57
102
  S = np.dstack([0*S[:,:,0], S])
wawi/wind.py CHANGED
@@ -6,7 +6,7 @@ from scipy.special import jv as besselj, yv as bessely
6
6
  from .general import rodrot, blkdiag
7
7
  from .plot import plot_ads
8
8
 
9
- conv_text='''
9
+ conv_text = r'''
10
10
  -----------------------------------------------------
11
11
  | |
12
12
  | ~ ~ ~~~ ~ ~~ ~ /^^^^^^^^^^^^\ 88ooo... . . . |
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.2
1
+ Metadata-Version: 2.4
2
2
  Name: wawi
3
- Version: 0.0.8
3
+ Version: 0.0.11
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
@@ -43,6 +43,7 @@ Requires-Dist: trame
43
43
  Requires-Dist: ipywidgets
44
44
  Requires-Dist: pyvistaqt
45
45
  Requires-Dist: beefpy
46
+ Dynamic: license-file
46
47
 
47
48
  ![WAWI logo](https://raw.githubusercontent.com/knutankv/wawi/main/wawi-logo-animated.svg)
48
49
  =======================
@@ -133,6 +134,13 @@ Examples
133
134
  =======================
134
135
  Examples are provided as Jupyter Notebooks in the [examples folder](https://github.com/knutankv/wawi/tree/main/examples).
135
136
 
137
+ The examples are structured in the following folders based on their topic:
138
+
139
+ * **0 Model generation and setup** - *Describing how a model is defined, either using input files together with the function `wawi.io.import_folder` or using the classes available in the `wawi.model` module directly (in the latter case, the open source Python library BEEF is used to create the required parameters directly in the notebook).*
140
+ * **1 Modal analysis** - *Describing how to set up iterative (and incremental) modal analyses to represent the contributions from aerodynamics and hydrodynamices. Also, an example showing how to set up a multi-modal flutter analysis is given.*
141
+ * **2 Response prediction** - *Describing how to conduct response analyses using WAWI. This includes assigning wind states, sea states, and the necessary commands to run a frequency domain analysis. Furthermore, more advanced topics such as wave-current interaction, inhomogeneous waves and stochastic linearization to represent quadratic drag damping are given in separate examples. Three models are considered: (i) a simple curved floating bridge, (ii) a single beam, (iii) a suspension bridge.*
142
+ * **3 Software interfacing** - *Describing how to export necessary data from other software (limited to Abaqus for now) to construct a WAWI model.*
143
+
136
144
  References
137
145
  =======================
138
146
 
@@ -0,0 +1,38 @@
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
6
+ tests/test_wind.py,sha256=r4rx6f8Tn-u4fn4gGPBMrL_JJQ2SVHGQiQ9sQuMQCPo,1707
7
+ wawi/__init__.py,sha256=rH8H6W3AN1iZb8rU9K_8k-mycRSvQNxFq97Biy0-hzw,183
8
+ wawi/fe.py,sha256=22QKI1GlfsG7o_TpFXaKJfzmbO2_2zdIMaoJmaIZdmY,4001
9
+ wawi/general.py,sha256=xHRoDkcchrL6Y7pTUqGsjBHh8YBLvX9dYcNXXCjQap8,13787
10
+ wawi/identification.py,sha256=bVB6EVRR6J39OO9ckuzNJ6f0FwIo4cLqfYgrsIN89TE,1748
11
+ wawi/io.py,sha256=cr8XLF7bwpTCxpZ84YjOyWjc5uuu-JjGv8vY9UKH-HI,25327
12
+ wawi/modal.py,sha256=WjNGFsk0C3tYRy18Q9WNRCatmGJtq1JSv0WrkGV02Eo,20247
13
+ wawi/plot.py,sha256=jllJcjZxTBqjzBoT4k9jLXVUnie8oqNr8371IJvCd3c,19791
14
+ wawi/prob.py,sha256=0nCdKdwkNf4M6sHyCZuYlt06gD0NmqRNfl4KesgySWA,215
15
+ wawi/random.py,sha256=MHPpyTlRJSJFkCmeTAmw4Q5K1BPoFVb0Nxg0jDhkuIM,871
16
+ wawi/signal.py,sha256=9HJs7VUhXOccuYPo12A0IUVoBIAJ2e_9F3rL-q3JuP4,1179
17
+ wawi/structural.py,sha256=t25ohH4uBbzUJ7Hqn_kUfYhxcikZkRp8da-9dn7aEbw,8341
18
+ wawi/time_domain.py,sha256=q8-H2xceP-2BmtOfbRQqYhD1JSb0z7jGq-dL_MzAX40,6122
19
+ wawi/tools.py,sha256=-hFBvf0qK4AMn2MQRhrOitDMMMKm2QuRkVfbPBefEkQ,332
20
+ wawi/wave.py,sha256=hhKg3KhKMBhOoCI7g8PFOGUbYgVhDyGmnYdBEdJ8mkY,16064
21
+ wawi/wind.py,sha256=VHy07IbrCJxlqR0Z5O5WRc9YE4jb-MqFbULPiXhj0NA,38211
22
+ wawi/wind_code.py,sha256=8OKLPpqc84obNNKBoYb2NunKjcn6a3i_pAWpIFEwg4Q,223
23
+ wawi/ext/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
24
+ wawi/ext/abq.py,sha256=Wo-Zzb6b3lr_z7cNKTW-NdYJuVeAwZgwzlGhF_5Jym0,8905
25
+ wawi/ext/ansys.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
26
+ wawi/ext/orcaflex.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
27
+ wawi/ext/sofistik.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
28
+ wawi/model/__init__.py,sha256=u6B-dugP76LBkOUVMs0KAoQ81PeRHwFL0M8MbNeAaJA,218
29
+ wawi/model/_aero.py,sha256=tvWMjMoVi9ZVBc3NZ_s-wSofbEk1cc5jf5s-Swv2RxQ,9337
30
+ wawi/model/_dry.py,sha256=KpmFlSinoY6DrSyc3Y0M8w1-cCC7VCFep-uzcqZsHz4,3940
31
+ wawi/model/_hydro.py,sha256=1tUj19OgvEjItNtBxXuPHf0zWtKv_ioTrOcgl9Ov3dg,26960
32
+ wawi/model/_model.py,sha256=34qblCqGpIKwbsa38CJ3a8KbHYyX8LDWOFQhdRwK98Q,52504
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,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (75.8.0)
2
+ Generator: setuptools (78.1.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5
 
@@ -0,0 +1,3 @@
1
+ examples
2
+ tests
3
+ wawi
@@ -1,21 +0,0 @@
1
- wawi/__init__.py,sha256=oZOxto9PG8WxUfEE02tcFY0o5-yLRR8lK8WXH30zxDE,158
2
- wawi/fe.py,sha256=22QKI1GlfsG7o_TpFXaKJfzmbO2_2zdIMaoJmaIZdmY,4001
3
- wawi/general.py,sha256=xHRoDkcchrL6Y7pTUqGsjBHh8YBLvX9dYcNXXCjQap8,13787
4
- wawi/identification.py,sha256=bVB6EVRR6J39OO9ckuzNJ6f0FwIo4cLqfYgrsIN89TE,1748
5
- wawi/io.py,sha256=NrziwlebaZUEdu8nWKNXKExHNZZKMzJ0gSHciBTJ4As,25323
6
- wawi/modal.py,sha256=WjNGFsk0C3tYRy18Q9WNRCatmGJtq1JSv0WrkGV02Eo,20247
7
- wawi/plot.py,sha256=jllJcjZxTBqjzBoT4k9jLXVUnie8oqNr8371IJvCd3c,19791
8
- wawi/prob.py,sha256=0nCdKdwkNf4M6sHyCZuYlt06gD0NmqRNfl4KesgySWA,215
9
- wawi/random.py,sha256=MHPpyTlRJSJFkCmeTAmw4Q5K1BPoFVb0Nxg0jDhkuIM,871
10
- wawi/signal.py,sha256=9HJs7VUhXOccuYPo12A0IUVoBIAJ2e_9F3rL-q3JuP4,1179
11
- wawi/structural.py,sha256=t25ohH4uBbzUJ7Hqn_kUfYhxcikZkRp8da-9dn7aEbw,8341
12
- wawi/time_domain.py,sha256=Oe-jviwDtBgpSmA7ZVmKEqQ5tdvsekXwOakYO1qUsN4,3841
13
- wawi/tools.py,sha256=-hFBvf0qK4AMn2MQRhrOitDMMMKm2QuRkVfbPBefEkQ,332
14
- wawi/wave.py,sha256=hhKg3KhKMBhOoCI7g8PFOGUbYgVhDyGmnYdBEdJ8mkY,16064
15
- wawi/wind.py,sha256=1rUqiEdMaUrhprs87TBdX24l1uDCOINaYkBChMLYWso,38208
16
- wawi/wind_code.py,sha256=8OKLPpqc84obNNKBoYb2NunKjcn6a3i_pAWpIFEwg4Q,223
17
- wawi-0.0.8.dist-info/LICENSE,sha256=bH1aWhrNbbPLrYnVFRaoYYzcUr-figHjry-kGB7Tc54,1076
18
- wawi-0.0.8.dist-info/METADATA,sha256=nlNip0I5cZlcT3lgLf5lXTysEeQ2y8nSVMapDTvoXlA,5197
19
- wawi-0.0.8.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
20
- wawi-0.0.8.dist-info/top_level.txt,sha256=sE2NH_xVXnDKTGeIYzeX5IyU_j5vYDLl32v5uLiOMT4,5
21
- wawi-0.0.8.dist-info/RECORD,,
@@ -1 +0,0 @@
1
- wawi