h2lib 13.1.2301__py3-none-win_amd64.whl → 13.1.2601__py3-none-win_amd64.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.
- h2lib/HAWC2Lib.dll +0 -0
- h2lib/_h2lib.py +45 -6
- h2lib/_version.py +3 -3
- h2lib/dll_wrapper.py +7 -4
- h2lib/h2lib_signatures.py +25 -9
- {h2lib-13.1.2301.dist-info → h2lib-13.1.2601.dist-info}/METADATA +2 -2
- h2lib-13.1.2601.dist-info/RECORD +10 -0
- h2lib-13.1.2301.dist-info/RECORD +0 -10
- {h2lib-13.1.2301.dist-info → h2lib-13.1.2601.dist-info}/WHEEL +0 -0
- {h2lib-13.1.2301.dist-info → h2lib-13.1.2601.dist-info}/top_level.txt +0 -0
h2lib/HAWC2Lib.dll
CHANGED
Binary file
|
h2lib/_h2lib.py
CHANGED
@@ -137,6 +137,28 @@ class H2LibThread(H2LibSignatures, DLLWrapper):
|
|
137
137
|
self.time = np.round(H2LibSignatures.run(self, np.float64(time), restype=np.float64)[1], 6)
|
138
138
|
return self.time
|
139
139
|
|
140
|
+
def check_convergence(self):
|
141
|
+
"""
|
142
|
+
Check the convergence of the simulation. Typically, after a time step or a call to the static solver.
|
143
|
+
|
144
|
+
Returns
|
145
|
+
-------
|
146
|
+
bconv : bool
|
147
|
+
`True` if the solution has converged.
|
148
|
+
resq : real
|
149
|
+
Residual on internal-external forces.
|
150
|
+
resg : real
|
151
|
+
Residual on constraint equations.
|
152
|
+
resd : real
|
153
|
+
Residual on increment.
|
154
|
+
"""
|
155
|
+
bconv = False
|
156
|
+
resq = -1.0
|
157
|
+
resg = -1.0
|
158
|
+
resd = -1.0
|
159
|
+
bconv, resq, resg, resd = H2LibSignatures.check_convergence(self, bconv, resq, resg, resd)[0]
|
160
|
+
return bconv, resq, resg, resd
|
161
|
+
|
140
162
|
def linearize(self):
|
141
163
|
"""
|
142
164
|
Linearize the system, as done by the system eigen-analysis.
|
@@ -325,10 +347,23 @@ class H2LibThread(H2LibSignatures, DLLWrapper):
|
|
325
347
|
"""
|
326
348
|
H2LibSignatures.solver_static_delete(self)
|
327
349
|
|
328
|
-
def solver_static_run(self):
|
350
|
+
def solver_static_run(self, reset_structure=False):
|
329
351
|
"""
|
330
352
|
Run the complete static solver algorithm.
|
331
353
|
|
354
|
+
When the calls to the static solver are independent, it may be convenient to
|
355
|
+
set `reset_structure = True`, so that the staic solver will run from the
|
356
|
+
undeflected configuration, as specified in the htc file. On the other hand,
|
357
|
+
if the static solver is obtained for increasing wind speeds, then it is convenient
|
358
|
+
to start from the last converged solution, thus setting `reset_structure = False`,
|
359
|
+
as done by HAWCStab2.
|
360
|
+
|
361
|
+
Parameters
|
362
|
+
----------
|
363
|
+
reset_structure : bool, optional,
|
364
|
+
If `True` this function will reset the structure deflection and orientation
|
365
|
+
before running the static solver. The default is `False`.
|
366
|
+
|
332
367
|
Raises
|
333
368
|
------
|
334
369
|
RuntimeError
|
@@ -340,10 +375,14 @@ class H2LibThread(H2LibSignatures, DLLWrapper):
|
|
340
375
|
|
341
376
|
"""
|
342
377
|
error_code = -1
|
343
|
-
error_code = H2LibSignatures.solver_static_run(self, error_code)[0]
|
378
|
+
_, error_code = H2LibSignatures.solver_static_run(self, reset_structure, error_code)[0]
|
344
379
|
if error_code > 0:
|
345
380
|
raise _ERROR_CODES[error_code]
|
346
381
|
|
382
|
+
def structure_reset(self):
|
383
|
+
"""Reset the structure deflection and orientation."""
|
384
|
+
H2LibSignatures.structure_reset(self)
|
385
|
+
|
347
386
|
def add_sensor(self, sensor_line):
|
348
387
|
"""Add sensor to hawc2. The sensor will be accessible from h2lib but will not show up in the output file of HAWC2
|
349
388
|
Note, that some sensors consist of multiple HAWC2 sensors, e.g. "wind free_wind" which has a Vx, Vy and Vz sensors
|
@@ -453,8 +492,8 @@ class H2LibThread(H2LibSignatures, DLLWrapper):
|
|
453
492
|
main_body,
|
454
493
|
mbdy_eulerang_table.shape[0],
|
455
494
|
np.asfortranarray(mbdy_eulerang_table.astype(np.float64)),
|
456
|
-
angles_in_deg,
|
457
|
-
reset_orientation,
|
495
|
+
bool(angles_in_deg),
|
496
|
+
bool(reset_orientation),
|
458
497
|
np.asfortranarray(mbdy_ini_rotvec_d1.astype(np.float64)),
|
459
498
|
error_code,
|
460
499
|
)[0][-1]
|
@@ -510,7 +549,7 @@ class H2LibThread(H2LibSignatures, DLLWrapper):
|
|
510
549
|
reset_orientation : bool, optional,
|
511
550
|
If `True` this function will reset the orientation to no rotation
|
512
551
|
before applying `mbdy2_eulerang_table`. The default is `False`.
|
513
|
-
mbdy2_ini_rotvec_d1 : (4) ndarray, optional
|
552
|
+
mbdy2_ini_rotvec_d1 : (4) ndarray or list, optional
|
514
553
|
Angular velocity. First 3 elements for the direction and last for the magnitude.
|
515
554
|
Equivalent to HAWC2 command `mbdy2_ini_rotvec_d1`.
|
516
555
|
The default is 0 speed.
|
@@ -548,7 +587,7 @@ class H2LibThread(H2LibSignatures, DLLWrapper):
|
|
548
587
|
np.asfortranarray(mbdy2_eulerang_table.astype(np.float64)),
|
549
588
|
bool(angles_in_deg),
|
550
589
|
reset_orientation,
|
551
|
-
np.asfortranarray(mbdy2_ini_rotvec_d1.astype(np.float64)
|
590
|
+
np.asfortranarray(mbdy2_ini_rotvec_d1).astype(np.float64),
|
552
591
|
error_code)[0][-1]
|
553
592
|
if error_code > 0:
|
554
593
|
raise _ERROR_CODES[error_code]
|
h2lib/_version.py
CHANGED
@@ -1,4 +1,4 @@
|
|
1
1
|
# This file is autogenerated and should not be modified manually
|
2
|
-
__version__ = '13.1.
|
3
|
-
h2lib_version = '13.1.
|
4
|
-
hawc2_version = '13.1.
|
2
|
+
__version__ = '13.1.2601'
|
3
|
+
h2lib_version = '13.1.2601'
|
4
|
+
hawc2_version = '13.1.26'
|
h2lib/dll_wrapper.py
CHANGED
@@ -6,7 +6,7 @@ import platform
|
|
6
6
|
import os
|
7
7
|
import ctypes
|
8
8
|
from _ctypes import POINTER
|
9
|
-
from ctypes import c_int, c_double, c_char, c_char_p, c_long, c_longlong, Structure
|
9
|
+
from ctypes import c_int, c_double, c_char, c_char_p, c_long, c_longlong, c_bool, Structure
|
10
10
|
from contextlib import contextmanager
|
11
11
|
import tempfile
|
12
12
|
try:
|
@@ -16,11 +16,12 @@ except ImportError:
|
|
16
16
|
import sys
|
17
17
|
from pathlib import Path
|
18
18
|
import atexit
|
19
|
+
|
19
20
|
c_int_p = POINTER(ctypes.c_long)
|
20
21
|
c_long_p = POINTER(ctypes.c_longlong)
|
21
|
-
|
22
22
|
c_double_p = POINTER(ctypes.c_double)
|
23
23
|
c_float_p = POINTER(ctypes.c_float)
|
24
|
+
c_bool_p = POINTER(ctypes.c_bool)
|
24
25
|
|
25
26
|
|
26
27
|
# Add support for complex numbers to ctypes.
|
@@ -110,7 +111,9 @@ def wrap(self, f, *args, **kwargs):
|
|
110
111
|
args[i] = np.require(args[i], requirements=['C', 'F'][self.fortran])
|
111
112
|
|
112
113
|
for arg in args:
|
113
|
-
if isinstance(arg,
|
114
|
+
if isinstance(arg, bool):
|
115
|
+
c_args.append(c_bool_p(c_bool(arg)))
|
116
|
+
elif isinstance(arg, int):
|
114
117
|
c_args.append(c_long_p(c_longlong(arg)))
|
115
118
|
elif isinstance(arg, float):
|
116
119
|
c_args.append(c_double_p(c_double(arg)))
|
@@ -149,7 +152,7 @@ def wrap(self, f, *args, **kwargs):
|
|
149
152
|
ret_args = []
|
150
153
|
for arg in args:
|
151
154
|
c_arg = c_args.pop(0)
|
152
|
-
if isinstance(arg, (int, float)):
|
155
|
+
if isinstance(arg, (int, float, bool)):
|
153
156
|
ret_args.append(c_arg.contents.value)
|
154
157
|
elif isinstance(arg, (str)):
|
155
158
|
ret_args.append(c_arg.value.decode('cp1252'))
|
h2lib/h2lib_signatures.py
CHANGED
@@ -11,6 +11,15 @@ class H2LibSignatures():
|
|
11
11
|
end subroutine'''
|
12
12
|
return self.get_lib_function('add_sensor')(sensor_line, index_start, index_stop)
|
13
13
|
|
14
|
+
def check_convergence(self, bconv, resq, resg, resd):
|
15
|
+
'''subroutine check_convergence(bconv, resq, resg, resd) bind(C, name='check_convergence')
|
16
|
+
logical(kind=c_bool), intent(out) :: bconv
|
17
|
+
real(c_double), intent(out) :: resq
|
18
|
+
real(c_double), intent(out) :: resg
|
19
|
+
real(c_double), intent(out) :: resd
|
20
|
+
end subroutine'''
|
21
|
+
return self.get_lib_function('check_convergence')(bconv, resq, resg, resd)
|
22
|
+
|
14
23
|
def do_system_eigenanalysis(self, include_damping, n_modes, natural_frequencies, damping_ratios, error_code):
|
15
24
|
'''subroutine do_system_eigenanalysis(include_damping, n_modes, natural_frequencies, damping_ratios, error_code) &
|
16
25
|
logical(kind=c_bool), intent(in) :: include_damping
|
@@ -361,8 +370,8 @@ end subroutine'''
|
|
361
370
|
'''subroutine set_orientation_base(main_body_name, &
|
362
371
|
character(kind=c_char, len=1), dimension(256), intent(in) :: main_body_name
|
363
372
|
real(kind=c_double), dimension(n_rows, 3), intent(in) :: mbdy_eulerang_table
|
364
|
-
logical, intent(in) :: angles_in_deg
|
365
|
-
logical, intent(in) :: reset_orientation
|
373
|
+
logical(c_bool), intent(in) :: angles_in_deg
|
374
|
+
logical(c_bool), intent(in) :: reset_orientation
|
366
375
|
real(kind=c_double), dimension(4), intent(in) :: mbdy_ini_rotvec_d1
|
367
376
|
end subroutine'''
|
368
377
|
return self.get_lib_function('set_orientation_base')(main_body_name,
|
@@ -380,7 +389,7 @@ character(kind=c_char, len=1), dimension(256), intent(in ) :: main_bod
|
|
380
389
|
integer(kind=8), intent(in ) :: node_1
|
381
390
|
integer(kind=8), intent(in ) :: node_2
|
382
391
|
real(kind=c_double), dimension(n_rows, 3), intent(in ) :: mbdy2_eulerang_table
|
383
|
-
logical,
|
392
|
+
logical(c_bool), intent(in ) :: angles_in_deg
|
384
393
|
character(kind=c_char, len=256) :: mbdy_1_name ! Same as main_body_1_name, but as string instead of an array of characters.
|
385
394
|
character(kind=c_char, len=256) :: mbdy_2_name ! Same as main_body_2_name, but as string instead of an array of characters.
|
386
395
|
type(Tmain_body_input), pointer :: main_body_1 ! The main body pointer associated to main_body_1_name.
|
@@ -420,11 +429,12 @@ end subroutine'''
|
|
420
429
|
end subroutine'''
|
421
430
|
return self.get_lib_function('solver_static_init')()
|
422
431
|
|
423
|
-
def solver_static_run(self, error_code):
|
424
|
-
'''subroutine solver_static_run(error_code) bind(C, name="solver_static_run")
|
432
|
+
def solver_static_run(self, reset_structure, error_code):
|
433
|
+
'''subroutine solver_static_run(reset_structure, error_code) bind(C, name="solver_static_run")
|
434
|
+
logical(c_bool), intent(in) :: reset_structure
|
425
435
|
integer(8), intent(out) :: error_code
|
426
436
|
end subroutine'''
|
427
|
-
return self.get_lib_function('solver_static_run')(error_code)
|
437
|
+
return self.get_lib_function('solver_static_run')(reset_structure, error_code)
|
428
438
|
|
429
439
|
def solver_static_solve(self, error_code):
|
430
440
|
'''subroutine solver_static_solve(error_code) &
|
@@ -453,10 +463,17 @@ end subroutine'''
|
|
453
463
|
|
454
464
|
def stop_on_error(self, flag):
|
455
465
|
'''subroutine stop_on_error(flag) bind(C, name="stop_on_error")
|
456
|
-
logical, intent(in) :: flag
|
466
|
+
logical(c_bool), intent(in) :: flag
|
457
467
|
end subroutine'''
|
458
468
|
return self.get_lib_function('stop_on_error')(flag)
|
459
469
|
|
470
|
+
def structure_reset(self, ):
|
471
|
+
'''subroutine structure_reset() bind(C, name="structure_reset")
|
472
|
+
!DEC$ ATTRIBUTES DLLEXPORT :: structure_reset
|
473
|
+
integer*4 :: i, j
|
474
|
+
end subroutine'''
|
475
|
+
return self.get_lib_function('structure_reset')()
|
476
|
+
|
460
477
|
def test_hdf5(self, ):
|
461
478
|
'''subroutine test_hdf5() BIND(C, NAME='test_hdf5')
|
462
479
|
!DEC$ ATTRIBUTES DLLEXPORT :: test_hdf5
|
@@ -480,9 +497,8 @@ end subroutine'''
|
|
480
497
|
def write_output(self, ):
|
481
498
|
'''subroutine write_output() bind(C, name="write_output")
|
482
499
|
!DEC$ ATTRIBUTES DLLEXPORT :: write_output
|
483
|
-
logical :: firstcall
|
484
500
|
integer :: nr, dummy=1
|
485
|
-
character*10 :: status = 'close'
|
501
|
+
character*10 :: status = 'close'
|
486
502
|
Type (Toutvar) :: ov_dummy
|
487
503
|
end subroutine'''
|
488
504
|
return self.get_lib_function('write_output')()
|
@@ -1,7 +1,7 @@
|
|
1
1
|
Metadata-Version: 2.2
|
2
2
|
Name: h2lib
|
3
|
-
Version: 13.1.
|
4
|
-
Summary: Python interface to HAWC2 (13.1.
|
3
|
+
Version: 13.1.2601
|
4
|
+
Summary: Python interface to HAWC2 (13.1.26)
|
5
5
|
Download-URL:
|
6
6
|
Author: Mads M. Pedersen, S.G.Horcas and N.G.Ramos
|
7
7
|
Author-email: mmpe@dtu.dk
|
@@ -0,0 +1,10 @@
|
|
1
|
+
h2lib/HAWC2Lib.dll,sha256=0hhBIkpISAacSb47XZWx--a8-p4VozfK98fSIgp8bnY,30908416
|
2
|
+
h2lib/__init__.py,sha256=f3fO4I6IEFRM9LaV2O3w9Pioj3GPI8qRl7P5Tg5ONtE,528
|
3
|
+
h2lib/_h2lib.py,sha256=5YLmLIrnpUEDYTMMDUfdiqkNB9uhApt45Iy0o8-hdTo,36698
|
4
|
+
h2lib/_version.py,sha256=D7AppHvtXTcaO5MZsCOYp_eYDc2qNhzn1h0mS3zEU6Y,149
|
5
|
+
h2lib/dll_wrapper.py,sha256=ZkcHog6jdVvzRNbVFza0atmMDTlbErf-42IqYITdVRE,12897
|
6
|
+
h2lib/h2lib_signatures.py,sha256=hDefbIIUVPdyc-PqV6_tdzmoJVKUrsTJ8rm1JV24yH0,25073
|
7
|
+
h2lib-13.1.2601.dist-info/METADATA,sha256=VT_imUf1hhAaxBXOqwQ8FzJApsFs9Mo066e6OiLHSNI,851
|
8
|
+
h2lib-13.1.2601.dist-info/WHEEL,sha256=cRmSBGD-cl98KkuHMNqv9Ac9L9_VqTvcBYwpIvxN0cg,101
|
9
|
+
h2lib-13.1.2601.dist-info/top_level.txt,sha256=y_a-tUqphEZQ_0nsWSMaSb21P8Lsd8hUxUdE9g2Dcbk,6
|
10
|
+
h2lib-13.1.2601.dist-info/RECORD,,
|
h2lib-13.1.2301.dist-info/RECORD
DELETED
@@ -1,10 +0,0 @@
|
|
1
|
-
h2lib/HAWC2Lib.dll,sha256=1DDWenk7w_1d-v7KFgWLcQ55KAOipPH2tj4pIqHCCHU,30859264
|
2
|
-
h2lib/__init__.py,sha256=f3fO4I6IEFRM9LaV2O3w9Pioj3GPI8qRl7P5Tg5ONtE,528
|
3
|
-
h2lib/_h2lib.py,sha256=L2DyUjbQzksXk6Uxw9ONu4eu_qcrYfSyEN8BWhqMoH8,35071
|
4
|
-
h2lib/_version.py,sha256=5VdqQ05CAw21vzOGZvE7_ih5_mCKGbYrwlNtPD_C6pw,160
|
5
|
-
h2lib/dll_wrapper.py,sha256=CfuRfDPEmmfYlEGKUmiXiuMhNiMcf24ripPHgqd8CiE,12761
|
6
|
-
h2lib/h2lib_signatures.py,sha256=1CuaSNfaTgnbhqcSaehQGNVHhKpvLFwgs2UucKWVQJE,24289
|
7
|
-
h2lib-13.1.2301.dist-info/METADATA,sha256=ctfxJlbL2MoblaX6BEnAml31TBjNBDhj0_N9rPOFxOI,862
|
8
|
-
h2lib-13.1.2301.dist-info/WHEEL,sha256=cRmSBGD-cl98KkuHMNqv9Ac9L9_VqTvcBYwpIvxN0cg,101
|
9
|
-
h2lib-13.1.2301.dist-info/top_level.txt,sha256=y_a-tUqphEZQ_0nsWSMaSb21P8Lsd8hUxUdE9g2Dcbk,6
|
10
|
-
h2lib-13.1.2301.dist-info/RECORD,,
|
File without changes
|
File without changes
|