wawi 0.0.17__py3-none-any.whl → 0.0.18__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.
wawi/__init__.py CHANGED
@@ -3,7 +3,7 @@
3
3
  '''
4
4
  __pdoc__ = {'wawi.ext.abq': False}
5
5
 
6
- __version__ = "0.0.17"
6
+ __version__ = "0.0.18"
7
7
 
8
8
  # Other packages
9
9
  import numpy as np
wawi/plot.py CHANGED
@@ -134,9 +134,8 @@ def save_plot(pl, path, w=None, h=None):
134
134
 
135
135
  pl.screenshot(path, window_size=[w,h], return_img=False)
136
136
 
137
- def plot_dir_and_crests(theta0, Tp, arrow_length=100, origin=np.array([0,0]),
138
- ax=None, n_repeats=2, crest_length=1000,
139
- alpha_crests=0.2, arrow_options={}):
137
+ def plot_dir_and_crests(theta0, Tp, U=0.0, thetaU=0.0, arrow_length=100, origin=np.array([0,0]), add_text=True,
138
+ ax=None, n_repeats=2, crest_length=1000, arrow_options={}, crest_options={}):
140
139
 
141
140
  """
142
141
  Plot wave direction arrow and wave crests on a matplotlib axis.
@@ -147,6 +146,10 @@ def plot_dir_and_crests(theta0, Tp, arrow_length=100, origin=np.array([0,0]),
147
146
  Wave direction in degrees (0 degrees is along the x-axis).
148
147
  Tp : float
149
148
  Peak wave period in seconds.
149
+ U : float, optional
150
+ Uniform current velocity [m/s]. Default is 0.0.
151
+ thetaU : float, optional
152
+ Angle of current in degrees. Default is 0.0.
150
153
  arrow_length : float, optional
151
154
  Length of the direction arrow (default is 100).
152
155
  origin : np.ndarray, optional
@@ -157,10 +160,13 @@ def plot_dir_and_crests(theta0, Tp, arrow_length=100, origin=np.array([0,0]),
157
160
  Number of wave crests to plot (default is 2).
158
161
  crest_length : float, optional
159
162
  Length of each wave crest line (default is 1000).
160
- alpha_crests : float, optional
161
- Transparency (alpha) for the crest lines (default is 0.2).
162
163
  arrow_options : dict, optional
163
164
  Additional keyword arguments for the arrow (default is {}).
165
+ crest_options : dict, optional
166
+ Additional keyword arguments for the crest lines (default is {})
167
+ add_text : bool, optional
168
+ Whether or not to add text annotation, default is True.
169
+
164
170
 
165
171
  Returns
166
172
  -------
@@ -174,8 +180,8 @@ def plot_dir_and_crests(theta0, Tp, arrow_length=100, origin=np.array([0,0]),
174
180
 
175
181
  Docstring generated by GitHub Copilot.
176
182
  """
177
- arr_opts = {'head_width': 4, 'width':2, 'edgecolor':'none'}
178
- arr_opts.update(**arrow_options)
183
+ arrow_options = {'head_width': 4, 'width':2, 'edgecolor':'none'} | arrow_options
184
+ crest_options = {'alpha': 0.2, 'color': 'black'} | crest_options
179
185
 
180
186
  if ax is None:
181
187
  ax = plt.gca()
@@ -183,10 +189,19 @@ def plot_dir_and_crests(theta0, Tp, arrow_length=100, origin=np.array([0,0]),
183
189
  # Plot wave angle and crests
184
190
  v = np.array([np.cos(theta0*np.pi/180), np.sin(theta0*np.pi/180)])
185
191
  v_norm = np.array([-np.sin(theta0*np.pi/180), np.cos(theta0*np.pi/180)])
186
- wave_length = 2*np.pi/get_kappa(2*np.pi/Tp, U=0.0)
187
192
 
188
- plt.arrow(origin[0],origin[1], arrow_length*v[0], arrow_length*v[1], **arr_opts)
189
- plt.text(origin[0], origin[1], f'$\\theta_0$ = {theta0}$^o$\n $T_p$={Tp} s\n $\\lambda=${wave_length:.0f} m')
193
+ theta_rel_U = (thetaU - theta0)*180/np.pi
194
+ wave_length = 2*np.pi/get_kappa(2*np.pi/Tp, U=U, theta_rel_U=theta_rel_U)
195
+
196
+ plt.arrow(origin[0],origin[1], arrow_length*v[0], arrow_length*v[1], **arrow_options)
197
+
198
+ if add_text:
199
+ plot_string = f'$\\theta_0$ = {theta0}$^o$\n $T_p$={Tp} s\n $\\lambda=${wave_length:.0f} m'
200
+
201
+ if U != 0.0:
202
+ plot_string = plot_string + f'\nU = {U:.1f}m/s @ {thetaU:.1f} deg'
203
+
204
+ plt.text(origin[0], origin[1], plot_string)
190
205
 
191
206
  dv = v*wave_length
192
207
  for n in range(n_repeats):
@@ -194,9 +209,10 @@ def plot_dir_and_crests(theta0, Tp, arrow_length=100, origin=np.array([0,0]),
194
209
  p2 = origin+v_norm*crest_length/2
195
210
  pts = np.vstack([p1,p2])
196
211
 
197
- ax.plot(pts[:,0], pts[:,1], alpha=alpha_crests, color='black', zorder=0)
212
+ ax.plot(pts[:,0], pts[:,1], zorder=0, **crest_options)
198
213
  origin = origin + dv
199
214
 
215
+ ax.axis('equal')
200
216
  return ax
201
217
 
202
218
  def rotate_image_about_pivot(Z, x, y, angle, x0=0, y0=0):
wawi/wave.py CHANGED
@@ -878,7 +878,7 @@ def dirdist_robust(s, theta0=0, dtheta=1e-4, theta=None):
878
878
  return D
879
879
 
880
880
 
881
- def dispersion_relation_scalar(w, h=np.inf, g=9.81, U=0.0):
881
+ def dispersion_relation_scalar(w, h=np.inf, g=9.81, U=0.0, theta_rel_U=0.0):
882
882
  """
883
883
  Compute the wave number `k` from the dispersion relation for surface gravity waves.
884
884
 
@@ -892,6 +892,8 @@ def dispersion_relation_scalar(w, h=np.inf, g=9.81, U=0.0):
892
892
  Gravitational acceleration [m/s^2]. Default is 9.81.
893
893
  U : float, optional
894
894
  Uniform current velocity [m/s]. Default is 0.0.
895
+ theta_rel_U : float, optional
896
+ Relative angle between current and wave direction, i.e., theta_current - theta_wave in rad.
895
897
 
896
898
  Returns
897
899
  -------
@@ -912,10 +914,12 @@ def dispersion_relation_scalar(w, h=np.inf, g=9.81, U=0.0):
912
914
 
913
915
  """
914
916
 
917
+ Uproj = U * np.cos(theta_rel_U)
918
+
915
919
  if h==np.inf:
916
- f = lambda k: g*k - (w-k*U)**2
920
+ f = lambda k: g*k - (w-k*Uproj)**2
917
921
  else:
918
- f = lambda k: g*k*np.tanh(k*h) - (w-k*U)**2
922
+ f = lambda k: g*k*np.tanh(k*h) - (w-k*Uproj)**2
919
923
 
920
924
  k0 = w**2/g # deep-water, zero-current wave number
921
925
 
wawi/wind.py CHANGED
@@ -808,19 +808,18 @@ def element_aero_mats(B, omega, ad_dict, L, T=None, phi=None, rho=1.225):
808
808
  # Spectra
809
809
  def kaimal_auto(omega, Lx, A, sigma, V):
810
810
  """
811
- Kaimal auto-spectral density function.
811
+ Kaimal auto-spectral density function (either single-component or three components).
812
812
 
813
813
  Parameters
814
814
  ----------
815
815
  omega : float
816
-
817
816
  Angular frequency.
818
- Lx : float
819
- Length scale.
820
- A : float
821
- Amplitude.
822
- sigma : float
823
- Standard deviation of the turbulence.
817
+ Lx : float or np.ndarray
818
+ Integral length scale(s).
819
+ A : float or np.ndarray
820
+ Spectral shape parameter(s).
821
+ sigma : float or np.ndarray
822
+ Standard deviation(s) of the turbulence.
824
823
  V : float
825
824
  Mean wind speed.
826
825
 
@@ -838,16 +837,16 @@ def kaimal_auto(omega, Lx, A, sigma, V):
838
837
 
839
838
  def von_karman_auto(omega, Lx, sigma, V):
840
839
  """
841
- Von Karman auto-spectral density function.
840
+ Von Karman auto-spectral density function (either single-component or three components).
842
841
 
843
842
  Parameters
844
843
  ----------
845
844
  omega : float
846
845
  Angular frequency.
847
- Lx : float
848
- Length scale.
849
- sigma : float
850
- Standard deviation of the turbulence.
846
+ Lx : float or np.ndarray
847
+ Integral length scale(s).
848
+ sigma : float or np.ndarray
849
+ Standard deviation(s) of the turbulence.
851
850
  V : float
852
851
  Mean wind speed.
853
852
  Returns
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: wawi
3
- Version: 0.0.17
3
+ Version: 0.0.18
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
@@ -92,17 +92,51 @@ pip install git+https://www.github.com/knutankv/wawi.git@main
92
92
  How does WAWI work?
93
93
  ======================
94
94
  By representing both aerodynamic and hydrodynamic motion-induced forces and excitation using a coordinate basis defined by the dry in-vacuum mode shapes of the structure, WAWI is able to versatily predict response based on input from any commercial FE software. The main structure used for response prediction is given in this figure:
95
+
95
96
  ![Model](https://raw.githubusercontent.com/knutankv/wawi/main/docs/flowchart.svg)
96
97
 
97
98
  The object structure of a WAWI model is given here:
98
- ![Modelattributes](https://raw.githubusercontent.com/knutankv/wawi/main/docs/structure.svg)
99
+
100
+ ![Model attributes](https://raw.githubusercontent.com/knutankv/wawi/main/docs/structure.svg)
99
101
 
100
102
  Further details regarding hydrodynamic definitions initiated by the `Hydro` class is given below:
103
+
101
104
  ![Hydro](https://raw.githubusercontent.com/knutankv/wawi/main/docs/hydro_part.svg)
102
105
 
103
106
  Further details regarding aerodynamic definitions initiated by the `Aero` class is given below:
107
+
104
108
  ![Aero](https://raw.githubusercontent.com/knutankv/wawi/main/docs/aero_part.svg)
105
109
 
110
+ Wave conditions
111
+ ----------------------
112
+ The wave field definition is based on the assumption that the two-dimensional wave spectral density can be decomposed into a directional distribution and a one-dimensional wave spectral density, i.e., $S_\eta(\omega,\theta) = D(\theta) S(\omega)$. The two factors are defined using these well-known formulations:
113
+
114
+ * $S(\omega)$: JONSWAP spectrum (see [Hasselmann et al., 1973](https://pure.mpg.de/pubman/faces/ViewItemOverviewPage.jsp?itemId=item_3262854))
115
+ * $D(\theta)$: cos-2s directional distribution (see Longuet-Higgins et al., 1963)
116
+
117
+ Currents are defined by a homogeneous current speed `U` and corresponding direction `thetaU`.
118
+
119
+ An example of a two-dimensional wave spectral density based on (arbitrarily chosen) parameters $H_s = 2.1$ m, $T_p = 2.1$ s, $\gamma = 4.0$, $s = 10$ and $\theta_0 = 75^\circ$ is shown in this plot:
120
+
121
+ ![2D wave PSD](https://raw.githubusercontent.com/knutankv/wawi/main/docs/wave_S2d.png)
122
+
123
+ It is noted that you can easily assign custom functions of the `S` and `D` of the seastate (or customly on all pontoons for full control) instead of relying on the built in JONSWAP and cos-2s definitions.
124
+
125
+ Wind conditions
126
+ ----------------------
127
+ The wind field is defined by single-point turbulence wind spectra (for all turbulence components $u$, $v$ and $w$) and coherence definitions.
128
+
129
+ By default, wind spectra can be defined using these two definitions:
130
+
131
+ * Kaimal spectrum defined by length scale parameters ($L^x_u$, $L^x_v$, $L^x_w$), spectral shape parameters ($A_u$, $A_v$ and $A_w$) and turbulence intensities ($I_u$, $I_v$ and $I_w$); see [Kaimal et al., 1972](https://www.climatexchange.nl/projects/alteddy/papers/Kaimal-1972.pdf)
132
+ * von Karmán spectrum defined by only length scale parameters ($L^x_u$, $L^x_v$, $L^x_w$) and turbulence intensities ($I_u=\sigma_u/U$, $I_v=\sigma_v/U$ and $I_w=\sigma_w/U$); see [von Kármán, 1948](http://dx.doi.org/10.1073/pnas.34.11.530)
133
+
134
+ Furthermore, the coherence of the wind field is defined by the nine decay parameters $C_{ux}$, $C_{vx}$, $C_{wx}$, $C_{uy}$, $C_{vy}$, $C_{wy}$, $C_{uz}$ $C_{vz}$, $C_{wz}$; see e.g. [Simiu and Scanlan, 1996](https://library.wur.nl/WebQuery/titel/1606468) for details.
135
+
136
+ An example of turbulence spectral densities based on (arbitrarily chosen) parameters $I_u=0.136$, $I_v=0.0$, $I_w=0.072$, $L^x_u=115$, $L^x_w=9.58$, $A_u=6.8$ (only relevant for Kaimal-type) and $A_w=9.4$ (only relevant for Kaimal-type) is given below:
137
+
138
+ ![1D turbulence PSD](https://raw.githubusercontent.com/knutankv/wawi/main/docs/wind_psd.png)
139
+
106
140
 
107
141
  Quick start
108
142
  =======================
@@ -181,16 +215,20 @@ References
181
215
  =======================
182
216
  The following papers provide background for the implementation:
183
217
 
184
- * Beam (FE) description of aerodynamic forces: [Øiseth et al. (2012)](https://www.sciencedirect.com/science/article/abs/pii/S0168874X11001880)
185
218
  * Wave modelling and response prediction: [Kvåle et al. (2016)](https://www.sciencedirect.com/science/article/abs/pii/S004579491500334X)
186
219
  * Inhomogeneous wave modelling: [Kvåle et al. (2024)](https://www.sciencedirect.com/science/article/pii/S0141118723003437)
187
220
  * Hydrodynamic interaction effects: [Fenerci et al. (2022)](https://www.sciencedirect.com/science/article/pii/S095183392200017X)
221
+ * Beam (FE) description of aerodynamic forces: [Øiseth et al. (2012)](https://www.sciencedirect.com/science/article/abs/pii/S0168874X11001880)
188
222
  * Wave-current interaction: [Fredriksen et al. (2024)](https://www.researchgate.net/profile/Arnt-Fredriksen/publication/386453916_On_the_wave-current_interaction_effect_on_linear_motion_for_floating_bridges/links/6751a40fabddbb448c65cbef/On-the-wave-current-interaction-effect-on-linear-motion-for-floating-bridges.pdf)
189
223
 
190
224
 
191
225
  Citation
192
226
  =======================
193
- Zenodo research entry: [![DOI](https://zenodo.org/badge/921621297.svg)](https://doi.org/10.5281/zenodo.14895014)
227
+ Please cite the use of this software as follows:
228
+
229
+ Kvåle, K. A., Fenerci, A., Petersen, Ø. W., & Øiseth, O. A. (2025). WAWI. Zenodo. https://doi.org/10.5281/zenodo.15482552
230
+ [![DOI](https://zenodo.org/badge/921621297.svg)](https://doi.org/10.5281/zenodo.14895014)
231
+
194
232
 
195
233
  Support
196
234
  =======================
@@ -4,21 +4,21 @@ tests/test_IABSE_step11a.py,sha256=zTWOxR78F0PNhNqiqodEcL65vdJXyMP78nkJumhy-RA,7
4
4
  tests/test_IABSE_step11c.py,sha256=TfxPlP70dhujKlSYbA-Gj4U-EJmYZ3jt6yjvX9wSXcA,10337
5
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=brqzCB0aImDc_fgazfOzS96O5S215IrmbT_1V_YMcIk,183
7
+ wawi/__init__.py,sha256=9LICE2nsa6XkgFeTM-0jQ7ztS3HrW15QrTAKq_1UIg8,183
8
8
  wawi/fe.py,sha256=wohMq-VGZnxZzfFGucWJXVrVLsD4MAS3jQs_P-HtyKI,12769
9
9
  wawi/general.py,sha256=Yt5DjDhzqNoYkQwu5nDZun-Kp_KqhV4DRLnMhUAYcQ0,23455
10
10
  wawi/identification.py,sha256=QDaz-ptH4_hXLTwLIEb28gr_KNiIiz3EQAgbNKXKZRI,2318
11
11
  wawi/io.py,sha256=DP0e7B8KBWLN8mMhWEeZIV17d_lObi_jCySX40ZdljQ,36475
12
12
  wawi/modal.py,sha256=NAqPQFqJVoPi26u32Pr8ekhL5dg_HAWfCMMmBmN1-3c,36504
13
- wawi/plot.py,sha256=uHMDElGO3Td3JwwETLVPImJ-L6QxJO3RzHmgQVBbcj4,30304
13
+ wawi/plot.py,sha256=gVoGjJoiKqGr0-6BBFFNPuZcUdiQwGzEFmdHswGeKzc,30878
14
14
  wawi/prob.py,sha256=JBDU9OB-ksBD9zDG0FZ05dTh47aO3mRhS_l1zpcCx8c,954
15
15
  wawi/random.py,sha256=3M7w07QzMmgRLsVs1V-DbNJnn1r8a7yY8vFpsiq0hug,5596
16
16
  wawi/signal.py,sha256=NTKgd7nHLy5onub1dfwe4AvvrNB6FtKGXEnL9LvE0Ao,3715
17
17
  wawi/structural.py,sha256=tptswGb5rZUXzqZkOI0odfSXpgtDALTYMAmJJ_LZORk,14344
18
18
  wawi/time_domain.py,sha256=8sSmp61E6HnopuQxP-lTR3fQHXkyPeVFNF6PZqcxVWQ,10048
19
19
  wawi/tools.py,sha256=Jgfk2wzKwKUv5OsQh1oGQI2bcK8Xa3togwntFEScK2Q,1004
20
- wawi/wave.py,sha256=AjPtsXvq2sPt5gMG9848BjAMjmLin2NhOlSsm2d6OUA,33598
21
- wawi/wind.py,sha256=tUEKKTW1evB6YXErvEWZzM_T8nF6jcbKpnhEv0ipjbo,62104
20
+ wawi/wave.py,sha256=75mQCgFtwrokCAF9y6RqwkLRcyOYjnu2MQkoLBXUFPc,33794
21
+ wawi/wind.py,sha256=uFybNXckq4u1S9uaWT9rW6JN8GbCZ_vHgsz-dLjAPt0,62313
22
22
  wawi/wind_code.py,sha256=r39K7-jvjat7gWlaNpv-JlPjDOZo8gwqgDNZ8TYFvZg,1202
23
23
  wawi/ext/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
24
24
  wawi/ext/abq.py,sha256=Wo-Zzb6b3lr_z7cNKTW-NdYJuVeAwZgwzlGhF_5Jym0,8905
@@ -31,8 +31,8 @@ wawi/model/_dry.py,sha256=KpmFlSinoY6DrSyc3Y0M8w1-cCC7VCFep-uzcqZsHz4,3940
31
31
  wawi/model/_hydro.py,sha256=7kzOqKou9RV1KoYXC-6oVw8gtnqfC-NfeohLFDiL-uI,27107
32
32
  wawi/model/_model.py,sha256=0Z5wBUFRzO_yKTF_HogUhE2-5oBkGLfVQU1qclNioVo,53306
33
33
  wawi/model/_screening.py,sha256=NRYkKq928z2lqMSUTpbQLls04td_9R_4dhkjU3Gv1oQ,3716
34
- wawi-0.0.17.dist-info/licenses/LICENSE,sha256=bH1aWhrNbbPLrYnVFRaoYYzcUr-figHjry-kGB7Tc54,1076
35
- wawi-0.0.17.dist-info/METADATA,sha256=PQt0sdJDdzzZqmcWIkFXhgyc9Zdcl8yMsipkd2WGY8s,9502
36
- wawi-0.0.17.dist-info/WHEEL,sha256=zaaOINJESkSfm_4HQVc5ssNzHCPXhJm0kEUakpsEHaU,91
37
- wawi-0.0.17.dist-info/top_level.txt,sha256=Nk5G_ZwgZRCb9ZMWZdr1M3QIskX6kCnlqeMl67N3zg8,20
38
- wawi-0.0.17.dist-info/RECORD,,
34
+ wawi-0.0.18.dist-info/licenses/LICENSE,sha256=bH1aWhrNbbPLrYnVFRaoYYzcUr-figHjry-kGB7Tc54,1076
35
+ wawi-0.0.18.dist-info/METADATA,sha256=g17rbdBIRVuADZp6n21xYLd5swNGm4gCbxGucWwqM8U,12228
36
+ wawi-0.0.18.dist-info/WHEEL,sha256=zaaOINJESkSfm_4HQVc5ssNzHCPXhJm0kEUakpsEHaU,91
37
+ wawi-0.0.18.dist-info/top_level.txt,sha256=Nk5G_ZwgZRCb9ZMWZdr1M3QIskX6kCnlqeMl67N3zg8,20
38
+ wawi-0.0.18.dist-info/RECORD,,
File without changes