h2lib 13.1.2601__py3-none-win_amd64.whl → 13.1.3102__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 CHANGED
Binary file
h2lib/_h2lib.py CHANGED
@@ -116,19 +116,53 @@ class H2LibThread(H2LibSignatures, DLLWrapper):
116
116
  def get_time(self):
117
117
  return np.round(H2LibSignatures.get_time(self, time=0.)[0][0], 6)
118
118
 
119
- def read_input(self, htc_path='htc/input_hawc.htc', model_path='.'):
120
- self._model_path = model_path
121
- self.cwd = self.model_path
122
- return H2LibSignatures.read_input(self, htc_path)
119
+ def read_input(self, htc_path, model_path='.'):
120
+ if htc_path is not None:
121
+ self._model_path = model_path
122
+ self.cwd = self.model_path
123
+ return H2LibSignatures.read_input(self, htc_path)
123
124
 
124
125
  def init(self, htc_path=None, model_path='.'):
125
- assert not hasattr(self, '_init_result'), "init called twice"
126
- if htc_path is not None:
127
- self.read_input(htc_path, model_path)
126
+ assert not self._initialized, "h2lib already initialized via init, init_AD or init_AL"
127
+ self.read_input(htc_path, model_path)
128
128
  r = H2LibSignatures.init(self)
129
129
  self._initialized = True
130
130
  return r
131
131
 
132
+ def init_AD(self, htc_path=None, model_path='.', tiploss_method=2, tiploss_shen_c2=21, rotor=0):
133
+ """Initialize HAWC2 for Actuator Disc workflow, where wind speeds including induction at the aerodynamic sections
134
+ are passed from e.g. CFD to HAWC2 via set_aerosections_windspeed.
135
+ This function will:
136
+ - Disable wind speed update at blade sections (wind speeds must be set via set_aerosections_windspeed)
137
+ - Disable HAWC2 induction (induction_method=0).
138
+ - set GetWindSpeedData%u_mean=nan to avoid unintended use of the free wind module in HAWC2
139
+ - set the tiploss_method. The default method is 2, which works with the AD workflow, but the tiploss_shen_c2
140
+ parameter must be tuned to give sensible results, see tiploss_method in the HAWC2 manual
141
+ """
142
+ assert not self._initialized, "h2lib already initialized via init, init_AD or init_AL"
143
+ self.read_input(htc_path, model_path)
144
+ r = H2LibSignatures.init_ad(self, rotor + 1, int(tiploss_method), float(tiploss_shen_c2))
145
+ self._initialized = True
146
+ return r
147
+
148
+ def init_AL(self, epsilon_smearing, htc_path=None, model_path='.', rotor=0):
149
+ """Initialize HAWC2 for Actuator Line workflow, where wind speeds including induction at the aerodynamic sections
150
+ are passed from e.g. CFD to HAWC2 via set_aerosections_windspeed.
151
+ This function will:
152
+ - Disable wind speed update at blade sections (wind speeds must be set via set_aerosections_windspeed)
153
+ - Enable viscous core correction which compensates for the missing induction due to smearing of the forces.
154
+ The method calculates the missing induction as a smearing factor times the normal near wake induction
155
+ (induction_method=2) while disregarding the BEM farwake contribution.
156
+ The smearing factor is based on the smearing size given by epsilon_smearing [m].
157
+ - set GetWindSpeedData%u_mean=nan to avoid unintended use of the free wind module in HAWC2
158
+ - set the tiploss_method to 0, to avoid unintended additional tiploss correction
159
+ """
160
+ assert not self._initialized, "h2lib already initialized via init, init_AD or init_AL"
161
+ self.read_input(htc_path, model_path)
162
+ r = H2LibSignatures.init_al(self, rotor=rotor + 1, epsilon_smearing=float(epsilon_smearing))
163
+ self._initialized = True
164
+ return r
165
+
132
166
  def step(self):
133
167
  self.time = np.round(H2LibSignatures.step(self, restype=np.float64)[1], 6)
134
168
  return self.time
@@ -944,12 +978,13 @@ class H2LibThread(H2LibSignatures, DLLWrapper):
944
978
 
945
979
  @contextmanager
946
980
  def set_LD_LIBRARY_PATH():
947
- _file__ = np.__file__
948
981
  old = os.environ.get('LD_LIBRARY_PATH', "")
949
-
950
- if '/lib/' in _file__: # pragma: no cover (only on linux)
951
- lib_path = _file__[:_file__.index("/lib/") + 5]
952
- os.environ['LD_LIBRARY_PATH'] = f'{lib_path}:{old}'
982
+ import site
983
+ lsts = [site.getsitepackages(), site.getusersitepackages()]
984
+ libs = [p[:p.index('/lib/') + 5] for lst in lsts for p in (lst, [lst])[isinstance(lst, str)] if '/lib/' in p]
985
+ lib64s = [p[:p.index('/lib64/') + 7] for lst in lsts for p in (lst, [lst])[isinstance(lst, str)] if '/lib64/' in p]
986
+ lib_paths = ":".join(libs + lib64s)
987
+ os.environ['LD_LIBRARY_PATH'] = f'{lib_paths}:{old}'
953
988
 
954
989
  try:
955
990
  yield
h2lib/_version.py CHANGED
@@ -1,4 +1,4 @@
1
1
  # This file is autogenerated and should not be modified manually
2
- __version__ = '13.1.2601'
3
- h2lib_version = '13.1.2601'
4
- hawc2_version = '13.1.26'
2
+ __version__ = '13.1.3102'
3
+ h2lib_version = '13.1.3102'
4
+ hawc2_version = '13.1.31+5-g08eea40'
h2lib/h2lib_signatures.py CHANGED
@@ -298,6 +298,21 @@ end subroutine'''
298
298
  end subroutine'''
299
299
  return self.get_lib_function('init')()
300
300
 
301
+ def init_ad(self, rotor, tiploss_method, tiploss_shen_c2):
302
+ '''subroutine init_ad(rotor, tiploss_method, tiploss_shen_c2) bind(C, name="init_ad")
303
+ integer*8, intent(in) :: rotor
304
+ integer*8, intent(in) :: tiploss_method
305
+ REAL(c_double), intent(in) :: tiploss_shen_c2
306
+ end subroutine'''
307
+ return self.get_lib_function('init_ad')(rotor, tiploss_method, tiploss_shen_c2)
308
+
309
+ def init_al(self, rotor, epsilon_smearing):
310
+ '''subroutine init_al(rotor, epsilon_smearing) bind(C, name="init_al")
311
+ real(c_double), intent(in) :: epsilon_smearing
312
+ integer*8, intent(in) :: rotor
313
+ end subroutine'''
314
+ return self.get_lib_function('init_al')(rotor, epsilon_smearing)
315
+
301
316
  def init_windfield(self, Nxyz, dxyz, box_offset_yz, transport_speed):
302
317
  '''subroutine init_windfield(Nxyz, dxyz, box_offset_yz, transport_speed) bind(C, name="init_windfield")
303
318
  integer*8, dimension(3), intent(in) :: Nxyz
@@ -1,7 +1,7 @@
1
- Metadata-Version: 2.2
1
+ Metadata-Version: 2.4
2
2
  Name: h2lib
3
- Version: 13.1.2601
4
- Summary: Python interface to HAWC2 (13.1.26)
3
+ Version: 13.1.3102
4
+ Summary: Python interface to HAWC2 (13.1.31+5-g08eea40)
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=s-0vzTnTAkCPi7q8sNsyjB8v8PfackauKFF40WIJFvU,30970368
2
+ h2lib/__init__.py,sha256=f3fO4I6IEFRM9LaV2O3w9Pioj3GPI8qRl7P5Tg5ONtE,528
3
+ h2lib/_h2lib.py,sha256=Sf-lc-moYGXqhZCH7DnwtMHR1revPN_uTYwDVP4Tl-E,39366
4
+ h2lib/_version.py,sha256=N9-xsR1zGb_HwvbhBXPpD4OJx0CzxYKb0iB_gU-SF5Q,160
5
+ h2lib/dll_wrapper.py,sha256=ZkcHog6jdVvzRNbVFza0atmMDTlbErf-42IqYITdVRE,12897
6
+ h2lib/h2lib_signatures.py,sha256=IbehcM2ajdjhKN6JMEHnPpo-agFtimfDF2XXcSfs4ZE,25790
7
+ h2lib-13.1.3102.dist-info/METADATA,sha256=Fb4r8r1oY3QJepfIQcELyTda4JtzNN6vB21_ScvbQUI,862
8
+ h2lib-13.1.3102.dist-info/WHEEL,sha256=ovhA9_Ei_7ok2fAych90j-feDV4goiAxbO7REePtvw0,101
9
+ h2lib-13.1.3102.dist-info/top_level.txt,sha256=y_a-tUqphEZQ_0nsWSMaSb21P8Lsd8hUxUdE9g2Dcbk,6
10
+ h2lib-13.1.3102.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: false
4
4
  Tag: cp312-cp312-win_amd64
5
5
 
@@ -1,10 +0,0 @@
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,,