Skip to content
Snippets Groups Projects
Commit 952bff8d authored by Mads M. Pedersen's avatar Mads M. Pedersen
Browse files

Merge branch 'hawc2_turbulence_file' of...

Merge branch 'hawc2_turbulence_file' of https://gitlab.windenergy.dtu.dk/toolbox/WindEnergyToolbox into hawc2_turbulence_file
parent 30eefcbf
No related branches found
No related tags found
No related merge requests found
Pipeline #7220 passed
begin simulation;
time_stop 1;
solvertype 1; (newmark)
on_no_convergence continue;
convergence_limits 1000 1 1e-08;
;logfile ./log/nasty_gust.log ;
;
begin newmark;
deltat 0.025;
end newmark;
end simulation;
;----------------------------------------------------------------------------------------------------------------------------------------------------------------
begin wind;
density 1.225;
wsp 10;
tint 1;
horizontal_input 0; 0=false, 1=true
windfield_rotations 0 0 0; yaw, tilt, rotation
center_pos0 0 0 -10; hub heigth
shear_format 1 0; 0=none,1=constant,2=log,3=power,4=linear
turb_format 1;
tower_shadow_method 0; 0=none, 1=potential flow, 2=jet
begin mann;
create_turb_parameters 30 1 3.9 1 1; L, alfaeps, gamma, seed, highfrq compensation
filename_u ./turb/mann_l30.0_ae1.00_g3.9_h1_512x8x8_0.977x16.00x16.00_s0001u.turb;
filename_v ./turb/mann_l30.0_ae1.00_g3.9_h1_512x8x8_0.977x16.00x16.00_s0001v.turb;
filename_w ./turb/mann_l30.0_ae1.00_g3.9_h1_512x8x8_0.977x16.00x16.00_s0001w.turb;
box_dim_u 512 0.977;
box_dim_v 8 16;
box_dim_w 8 16;
end mann;
end wind;
exit;
\ No newline at end of file
'''
Created on 17/07/2014
@author: MMPE
'''
from __future__ import unicode_literals
from __future__ import print_function
from __future__ import division
from __future__ import absolute_import
from future import standard_library
from wetb.hawc2.turbulence_file import TurbulenceFile
standard_library.install_aliases()
import os
import unittest
from wetb.hawc2.pc_file import PCFile
import numpy as np
tfp = os.path.join(os.path.dirname(__file__), 'test_files/') # test file path
class TestPCFile(unittest.TestCase):
def setUp(self):
unittest.TestCase.setUp(self)
# def test_TurbulenceFile(self):
# TurbulenceFile(tfp + "turb/mann_l29.4_ae1.00_g3.9_h1_64x8x8_1.000x2.00x2.00_s1001u.turb")
def test_load_from_htc(self):
u, v, w = TurbulenceFile.load_from_htc(tfp + "htcfiles/test_turb.htc")
self.assertEqual(u.data.shape, (512, 64))
if __name__ == "__main__":
#import sys;sys.argv = ['', 'Test.testName']
unittest.main()
'''
Created on 22. jun. 2017
@author: mmpe
'''
import os
import numpy as np
from wetb.hawc2.htc_file import HTCFile
from wetb.wind.turbulence import mann_turbulence
class TurbulenceFile(object):
def __init__(self, filename, Nxyz, dxyz, transport_speed=10, mean_wsp=0, center_position=(0, 0, -20)):
self.filename = filename
self.Nxyz = Nxyz
self.dxyz = dxyz
self.transport_speed = transport_speed
self.mean_wsp = mean_wsp
self.center_position = center_position
self.data = mann_turbulence.load(filename, Nxyz)
@staticmethod
def load_from_htc(htcfilename, modelpath=None, type='mann'):
htc = HTCFile(htcfilename, modelpath)
Nxyz = np.array([htc.wind[type]['box_dim_%s'%uvw][0] for uvw in 'uvw'])
dxyz = np.array([htc.wind[type]['box_dim_%s'%uvw][1] for uvw in 'uvw'])
center_position = htc.wind.center_pos0.values
wsp = htc.wind.wsp
return [TurbulenceFile(os.path.join(htc.modelpath , htc.wind[type]['filename_%s'%uvw][0]), Nxyz, dxyz,wsp, (0,wsp)[uvw=='u'], center_position) for uvw in 'uvw']
if __name__ == '__main__':
pass
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment