Exemplo n.º 1
0
 def test_read_write_read_bladestructure_version_1(self):
     if not os.path.exists(self.test_dir):
         os.makedirs(self.test_dir)
     st3d = read_bladestructure(os.path.join(self.data_version_1, self.blade))
     write_bladestructure(st3d, os.path.join(self.test_dir, 'test'))
     st3dn = read_bladestructure(os.path.join(self.test_dir, 'test'))
     self.assertEqual(np.testing.assert_array_equal(
                      st3dn['web_def'],
                      st3d_desired['web_def']), None)
     shutil.rmtree(self.test_dir)
Exemplo n.º 2
0
 def test_read_write_read_bladestructure_version_1(self):
     if not os.path.exists(self.test_dir):
         os.makedirs(self.test_dir)
     st3d = read_bladestructure(os.path.join(self.data_version_1, self.blade))
     write_bladestructure(st3d, os.path.join(self.test_dir, 'test'))
     st3dn = read_bladestructure(os.path.join(self.test_dir, 'test'))
     self.assertEqual(np.testing.assert_array_equal(
                      st3dn['web_def'],
                      st3d_desired['web_def']), None)
     shutil.rmtree(self.test_dir)
Exemplo n.º 3
0
 def test_create_write_read_bladestructure(self):
     if not os.path.exists(self.test_dir):
         os.makedirs(self.test_dir)
     write_bladestructure(self.st3d, os.path.join(self.test_dir, 'test'))
     st3dn = read_bladestructure(os.path.join(self.test_dir, 'test'))
     self.assertEqual(np.testing.assert_array_equal(
                      self.st3d['DPs'][:, 4],
                      st3dn['DPs'][:, 4]), None)
     self.assertEqual(np.testing.assert_array_equal(
                      self.st3d['regions'][2]['thicknesses'][:, 4],
                      st3dn['regions'][2]['thicknesses'][:, 4]), None)
     uniax = self.uniax
     self.assertEqual(np.testing.assert_array_equal(
                      self.st3d['matprops'][1, :],
                      [uniax.E1,
                       uniax.E2,
                       uniax.E3,
                       uniax.nu12,
                       uniax.nu13,
                       uniax.nu23,
                       uniax.G12,
                       uniax.G13,
                       uniax.G23,
                       uniax.rho,
                       ]), None)
     shutil.rmtree(self.test_dir)
Exemplo n.º 4
0
 def test_create_write_read_bladestructure(self):
     if not os.path.exists(self.test_dir):
         os.makedirs(self.test_dir)
     write_bladestructure(self.st3d, os.path.join(self.test_dir, 'test'))
     st3dn = read_bladestructure(os.path.join(self.test_dir, 'test'))
     self.assertEqual(
         np.testing.assert_array_equal(self.st3d['DPs'][:, 4],
                                       st3dn['DPs'][:, 4]), None)
     self.assertEqual(
         np.testing.assert_array_equal(
             self.st3d['regions'][2]['thicknesses'][:, 4],
             st3dn['regions'][2]['thicknesses'][:, 4]), None)
     uniax = self.uniax
     self.assertEqual(
         np.testing.assert_array_equal(self.st3d['matprops'][1, :], [
             uniax.E1,
             uniax.E2,
             uniax.E3,
             uniax.nu12,
             uniax.nu13,
             uniax.nu23,
             uniax.G12,
             uniax.G13,
             uniax.G23,
             uniax.rho,
         ]), None)
     shutil.rmtree(self.test_dir)
Exemplo n.º 5
0
    def test_version_2_geo3d(self):

        if not os.path.exists(self.test_dir):
            os.makedirs(self.test_dir)
        st3d = read_bladestructure(os.path.join(self.data_version_2, 'Param2_10MW'))
        write_bladestructure(st3d, os.path.join(self.test_dir, 'test'))
        st3dn = read_bladestructure(os.path.join(self.test_dir, 'test'))
        self.assertEqual(np.testing.assert_array_equal(
                         st3dn['cap_DPs'],
                         st3d_desired['cap_DPs']), None)
        self.assertEqual(np.testing.assert_array_equal(
                         st3dn['le_DPs'],
                         st3d_desired['le_DPs']), None)
        self.assertEqual(np.testing.assert_array_equal(
                         st3dn['te_DPs'],
                         st3d_desired['te_DPs']), None)
        self.assertEqual(np.testing.assert_array_equal(
                         st3dn['cap_width_ps'],
                         st3d_desired['cap_width_ps']), None)
        shutil.rmtree(self.test_dir)
Exemplo n.º 6
0
def configure_with_surface():

    nsec = 8
    st3d = read_bladestructure(os.path.join(PATH, 'data/DTU10MW'))
    st3dn = interpolate_bladestructure(st3d, np.linspace(0, 1, nsec))

    p = Problem(root=Group())

    pf = read_blade_planform(
        os.path.join(PATH, 'data/DTU_10MW_RWT_blade_axis_prebend.dat'))
    s_new = np.linspace(0, 1, nsec)
    pf = redistribute_planform(pf, s=s_new)

    cfg = {}
    cfg['redistribute_flag'] = False
    cfg['blend_var'] = np.array([0.241, 0.301, 0.36, 1.0])
    afs = []
    for f in [
            os.path.join(PATH, 'data/ffaw3241.dat'),
            os.path.join(PATH, 'data/ffaw3301.dat'),
            os.path.join(PATH, 'data/ffaw3360.dat'),
            os.path.join(PATH, 'data/cylinder.dat')
    ]:

        afs.append(np.loadtxt(f))
    cfg['base_airfoils'] = afs
    d = PGLLoftedBladeSurface(cfg,
                              size_in=nsec,
                              size_out=(200, nsec, 3),
                              suffix='_st')
    r = p.root.add('blade_surf', d, promotes=['*'])

    spl = p.root.add('st_splines',
                     SplinedBladeStructure(st3dn),
                     promotes=['*'])
    spl.add_spline('DP04', np.linspace(0, 1, 4), spline_type='bezier')
    spl.add_spline(('r04uniax00T', 'r04uniax01T'),
                   np.linspace(0, 1, 4),
                   spline_type='bezier')
    spl.add_spline('w02biax00T', np.linspace(0, 1, 4), spline_type='bezier')
    p.root.add('st_props',
               BladeStructureProperties((200, nsec, 3), st3dn, [4, 5, 8, 9]),
               promotes=['*'])

    p.setup()
    for k, v in pf.iteritems():
        if k + '_st' in p.root.blade_surf.params.keys():
            p.root.blade_surf.params[k + '_st'] = v

    return p
def configure():

    st3d = read_bladestructure(os.path.join(PATH, 'data/DTU10MW'))
    st3dn = interpolate_bladestructure(st3d, np.linspace(0, 1, 8))

    p = Problem(root=Group())
    spl = p.root.add('st_splines', SplinedBladeStructure(st3dn), promotes=['*'])
    spl.add_spline('DP08', np.linspace(0, 1, 4), spline_type='bezier')
    spl.add_spline('DP09', np.linspace(0, 1, 4), spline_type='bezier')
    spl.add_spline(('DP04', 'DP05'), np.linspace(0, 1, 4), spline_type='bezier')
    spl.add_spline(('r04uniax00T', 'r04uniax01T'), np.linspace(0, 1, 4), spline_type='bezier')
    spl.add_spline('w02biax00T', np.linspace(0, 1, 4), spline_type='bezier')
    p.setup()
    return p
Exemplo n.º 8
0
def configure_with_surface():

    nsec = 20
    st3dn = read_bladestructure(
        os.path.join(PATH, 'data_version_2/Param2_10MW'))
    p = Problem(root=Group())

    pf = read_blade_planform(
        os.path.join(PATH, 'data/DTU_10MW_RWT_blade_axis_prebend.dat'))
    s_new = np.linspace(0, 1, nsec)
    pf = redistribute_planform(pf, s=s_new)

    cfg = {}
    cfg['redistribute_flag'] = False
    cfg['blend_var'] = np.array([0.241, 0.301, 0.36, 1.0])
    afs = []
    for f in [
            os.path.join(PATH, 'data/ffaw3241.dat'),
            os.path.join(PATH, 'data/ffaw3301.dat'),
            os.path.join(PATH, 'data/ffaw3360.dat'),
            os.path.join(PATH, 'data/cylinder.dat')
    ]:

        afs.append(np.loadtxt(f))
    cfg['base_airfoils'] = afs
    d = PGLLoftedBladeSurface(cfg,
                              size_in=nsec,
                              size_out=(200, nsec, 3),
                              suffix='_st')
    r = p.root.add('blade_surf', d, promotes=['*'])

    spl = p.root.add('st_splines',
                     SplinedBladeStructureParam2(st3dn, (200, nsec, 3)),
                     promotes=['*'])

    p.root.add('st_props',
               BladeStructureProperties((200, nsec, 3), st3dn, [4, 7, 10, 13]),
               promotes=['*'])

    spl.add_spline(('cap_width_ss', 'cap_width_ps'),
                   np.array([0., 0.52631578947368418, 1.]),
                   spline_type='linear')
    p.setup()
    for k, v in pf.iteritems():
        if k + '_st' in p.root.blade_surf.params.keys():
            p[k + '_st'] = v
    return p
Exemplo n.º 9
0
def configure():

    st3d = read_bladestructure(os.path.join(PATH, 'data/DTU10MW'))
    st3dn = interpolate_bladestructure(st3d, np.linspace(0, 1, 8))

    p = Problem(root=Group())
    spl = p.root.add('st_splines',
                     SplinedBladeStructure(st3dn),
                     promotes=['*'])
    spl.add_spline('DP08', np.linspace(0, 1, 4), spline_type='bezier')
    spl.add_spline('DP09', np.linspace(0, 1, 4), spline_type='bezier')
    spl.add_spline(('DP04', 'DP05'),
                   np.linspace(0, 1, 4),
                   spline_type='bezier')
    spl.add_spline(('r04uniax00T', 'r04uniax01T'),
                   np.linspace(0, 1, 4),
                   spline_type='bezier')
    spl.add_spline('w02biax00T', np.linspace(0, 1, 4), spline_type='bezier')
    p.setup()
    return p
Exemplo n.º 10
0
def configure_with_surface():

    nsec = 8
    st3d = read_bladestructure('data/DTU10MW')
    st3dn = interpolate_bladestructure(st3d, np.linspace(0, 1, nsec))

    p = Problem(root=Group())

    pf = read_blade_planform('data/DTU_10MW_RWT_blade_axis_prebend.dat')
    s_new = np.linspace(0, 1, nsec)
    pf = redistribute_planform(pf, s=s_new)

    cfg = {}
    cfg['redistribute_flag'] = False
    cfg['blend_var'] = np.array([0.241, 0.301, 0.36, 1.0])
    afs = []
    for f in ['data/ffaw3241.dat',
              'data/ffaw3301.dat',
              'data/ffaw3360.dat',
              'data/cylinder.dat']:

        afs.append(np.loadtxt(f))
    cfg['base_airfoils'] = afs
    d = PGLLoftedBladeSurface(cfg, size_in=nsec, size_out=(200, nsec, 3), suffix='_st')
    r = p.root.add('blade_surf', d, promotes=['*'])

    spl = p.root.add('st_splines', SplinedBladeStructure(st3dn), promotes=['*'])
    spl.add_spline('DP04', np.linspace(0, 1, 4), spline_type='bezier')
    spl.add_spline(('r04uniaxT', 'r04uniax01T'), np.linspace(0, 1, 4), spline_type='bezier')
    spl.add_spline('w02biaxT', np.linspace(0, 1, 4), spline_type='bezier')
    spl.configure()
    p.root.add('st_props', BladeStructureProperties((200, nsec, 3), st3dn, [4,5,8,9]), promotes=['*'])

    p.setup()
    for k, v in pf.iteritems():
        if k+'_st' in p.root.blade_surf.params.keys():
            p.root.blade_surf.params[k+'_st'] = v

    return p
def configure_with_surface():

    nsec = 20
    st3dn = read_bladestructure(os.path.join(PATH, 'data_version_2/Param2_10MW'))
    p = Problem(root=Group())

    pf = read_blade_planform(os.path.join(PATH, 'data/DTU_10MW_RWT_blade_axis_prebend.dat'))
    s_new = np.linspace(0, 1, nsec)
    pf = redistribute_planform(pf, s=s_new)

    cfg = {}
    cfg['redistribute_flag'] = False
    cfg['blend_var'] = np.array([0.241, 0.301, 0.36, 1.0])
    afs = []
    for f in [os.path.join(PATH, 'data/ffaw3241.dat'),
              os.path.join(PATH, 'data/ffaw3301.dat'),
              os.path.join(PATH, 'data/ffaw3360.dat'),
              os.path.join(PATH, 'data/cylinder.dat')]:

        afs.append(np.loadtxt(f))
    cfg['base_airfoils'] = afs
    d = PGLLoftedBladeSurface(cfg, size_in=nsec, size_out=(200, nsec, 3), suffix='_st')
    r = p.root.add('blade_surf', d, promotes=['*'])

    spl = p.root.add('st_splines', SplinedBladeStructureParam2(st3dn, (200, nsec, 3)), promotes=['*'])

    p.root.add('st_props', BladeStructureProperties((200, nsec, 3), st3dn,
                                                    [4, 7, 10, 13]),
                                                    promotes=['*'])

    spl.add_spline(('cap_width_ss',
                    'cap_width_ps'),
                    np.array([0., 0.52631578947368418, 1.]), spline_type='linear')
    p.setup()
    for k, v in pf.iteritems():
        if k+'_st' in p.root.blade_surf.params.keys():
            p[k+'_st'] = v
    return p
Exemplo n.º 12
0
    afs.append(np.loadtxt(f))

cfg['base_airfoils'] = afs

# this array contains the interpolator for the lofted surface
# in this case the relative thicknesses of the airfoils loaded above
cfg['blend_var'] = np.array([0.241, 0.301, 0.36, 1.0])

surf = root.add('blade_surf', PGLLoftedBladeSurface(cfg, size_in=nsec_st,
                size_out=(200, nsec_st, 3), suffix='_st'),
                promotes=['*'])

# --- 3 -----

# read the blade structure
st3d = read_bladestructure(os.path.join(PATH, 'data/DTU10MW'))

# and interpolate onto new distribution
st3dn = interpolate_bladestructure(st3d, s_st)

# add component for generating the splined blade structure
# defined in FUSED-Wind
spl_st = root.add('st_splines', SplinedBladeStructure(st3dn),
                  promotes=['*'])
spl_st.configure()

# --- 4 -----

# inputs to CS2DtoBECAS and BECASWrapper
config = {}
cfg = {}
Exemplo n.º 13
0
def configure(nsec_st, dry_run=False, FPM=False, with_sr=False):

    p = Problem(impl=impl, root=Group())

    p.root.add('blade_length_c',
               IndepVarComp('blade_length', 86.366),
               promotes=['*'])

    pfo = read_blade_planform('data/DTU_10MW_RWT_blade_axis_prebend.dat')
    nsec_ae = 50
    s_ae = np.linspace(0, 1, nsec_ae)
    s_st = np.linspace(0, 1, nsec_st)
    pf = {}
    pf['s'] = s_ae
    for k, v in pfo.iteritems():
        if k in ['s', 'smax', 'blade_length']: continue
        pf[k] = np.interp(s_ae, pfo['s'], v)

    spl = p.root.add('pf_splines', SplinedBladePlanform(pf), promotes=['*'])
    spl.configure()
    redist = p.root.add('pf_st',
                        PGLRedistributedPlanform('_st', nsec_ae, s_st),
                        promotes=['*'])

    cfg = {}
    cfg['redistribute_flag'] = False
    cfg['blend_var'] = np.array([0.241, 0.301, 0.36, 1.0])
    afs = []
    for f in [
            'data/ffaw3241.dat', 'data/ffaw3301.dat', 'data/ffaw3360.dat',
            'data/cylinder.dat'
    ]:

        afs.append(np.loadtxt(f))
    cfg['base_airfoils'] = afs
    surf = p.root.add('blade_surf',
                      PGLLoftedBladeSurface(cfg,
                                            size_in=nsec_st,
                                            size_out=(200, nsec_st, 3),
                                            suffix='_st'),
                      promotes=['*'])
    surf._dry_run = True
    # read the blade structure
    st3d = read_bladestructure('data/DTU10MW')

    # and interpolate onto new distribution
    st3dn = interpolate_bladestructure(st3d, s_st)

    spl = p.root.add('st_splines',
                     SplinedBladeStructure(st3dn),
                     promotes=['*'])
    spl.add_spline('DP04', np.linspace(0, 1, 4), spline_type='pchip')
    spl.add_spline('DP05', np.linspace(0, 1, 4), spline_type='pchip')
    spl.add_spline('DP08', np.linspace(0, 1, 4), spline_type='pchip')
    spl.add_spline('DP09', np.linspace(0, 1, 4), spline_type='pchip')
    spl.add_spline('r04uniaxT', np.linspace(0, 1, 4), spline_type='pchip')
    spl.add_spline('r08uniaxT', np.linspace(0, 1, 4), spline_type='pchip')
    spl.configure()
    # inputs to CS2DtoBECAS and BECASWrapper
    config = {}
    cfg = {}
    cfg['dry_run'] = dry_run
    cfg['path_shellexpander'] = '/Users/frza/git/BECAS_stable/shellexpander/shellexpander'
    cfg['dominant_elsets'] = ['REGION04', 'REGION08']
    cfg['max_layers'] = 0
    config['CS2DtoBECAS'] = cfg
    cfg = {}
    cfg['path_becas'] = '/Users/frza/git/BECAS_stable/BECAS/src/matlab'
    cfg['hawc2_FPM'] = FPM
    cfg['dry_run'] = dry_run
    cfg['analysis_mode'] = 'stiffness'
    config['BECASWrapper'] = cfg

    p.root.add('stiffness',
               BECASBeamStructure(p.root, config, st3dn, (200, nsec_st, 3)),
               promotes=['*'])
    p.setup()
    for k, v in pf.iteritems():
        if k in p.root.pf_splines.params.keys():
            p.root.pf_splines.params[k] = v

    # p['hub_radius'] = 2.8
    # p['blade_x'] = d.pf['x'] * 86.366
    # p['blade_z'] = d.pf['y'] * 86.366
    # p['blade_y'] = d.pf['z'] * 86.366
    return p
Exemplo n.º 14
0
def configure_BECASBeamStructure(nsec,
                                 exec_mode,
                                 path_data,
                                 dry_run=False,
                                 FPM=False,
                                 with_sr=False):

    p = Problem(impl=impl, root=Group())

    p.root.add('blade_length_c',
               IndepVarComp('blade_length', 86.366),
               promotes=['*'])

    pf = read_blade_planform(
        os.path.join(path_data, 'DTU_10MW_RWT_blade_axis_prebend.dat'))
    nsec_ae = 50
    nsec_st = nsec
    s_ae = np.linspace(0, 1, nsec_ae)
    s_st = np.linspace(0, 1, nsec_st)
    pf = redistribute_planform(pf, s=s_ae)

    spl = p.root.add('pf_splines', SplinedBladePlanform(pf), promotes=['*'])
    spl.configure()
    redist = p.root.add('pf_st',
                        PGLRedistributedPlanform('_st', nsec_ae, s_st),
                        promotes=['*'])

    cfg = {}
    cfg['redistribute_flag'] = False
    cfg['blend_var'] = np.array([0.241, 0.301, 0.36, 1.0])
    afs = []
    for f in [
            'data/ffaw3241.dat', 'data/ffaw3301.dat', 'data/ffaw3360.dat',
            'data/cylinder.dat'
    ]:

        afs.append(np.loadtxt(f))
    cfg['base_airfoils'] = afs
    surf = p.root.add('blade_surf',
                      PGLLoftedBladeSurface(cfg,
                                            size_in=nsec_st,
                                            size_out=(200, nsec_st, 3),
                                            suffix='_st'),
                      promotes=['*'])

    # read the blade structure
    st3d = read_bladestructure(os.path.join(path_data, 'DTU10MW'))

    # and interpolate onto new distribution
    st3dn = interpolate_bladestructure(st3d, s_st)

    spl = p.root.add('st_splines',
                     SplinedBladeStructure(st3dn),
                     promotes=['*'])
    spl.add_spline('DP04', np.linspace(0, 1, 4), spline_type='bezier')
    spl.add_spline('r04uniax00T', np.linspace(0, 1, 4), spline_type='bezier')
    spl.add_spline('w02biax00T', np.linspace(0, 1, 4), spline_type='bezier')
    spl.configure()
    # inputs to CS2DtoBECAS and BECASWrapper
    config = {}
    cfg = {}
    cfg['dry_run'] = dry_run
    cfg['dominant_elsets'] = ['REGION04', 'REGION08']
    cfg['max_layers'] = 0
    config['CS2DtoBECAS'] = cfg
    cfg = {}
    cfg['exec_mode'] = exec_mode
    cfg['hawc2_FPM'] = FPM
    cfg['dry_run'] = dry_run
    cfg['exec_mode'] = exec_mode
    cfg['analysis_mode'] = 'stiffness'
    cfg['debug_mode'] = False
    config['BECASWrapper'] = cfg

    p.root.add('stiffness',
               BECASBeamStructure(p.root, config, st3dn, (200, nsec_st, 3)),
               promotes=['*'])
    p.root.add('stress_recovery',
               BECASStressRecovery(config, s_st, 2),
               promotes=['*'])

    p.setup()
    p['hub_radius'] = 2.8
    for k, v in pf.iteritems():
        if k in p.root.pf_splines.params.keys():
            p.root.pf_splines.params[k] = v

    # set some arbitrary values in the load vectors used to compute strains
    for i, x in enumerate(s_st):
        try:
            p['load_cases_sec%03d' % i] = np.ones((2, 6))
        except:
            pass

    return p
Exemplo n.º 15
0
import numpy as np
from fusedwind.turbine.structure import read_bladestructure, write_bladestructure, interpolate_bladestructure

st3d = read_bladestructure('data/DTU10MW')
write_bladestructure(st3d, 'test_out')
st3dn = read_bladestructure('test_out')

#s_new = np.linspace(0, 1, 20)
#st3dn = interpolate_bladestructure(r.st3d, s_new)
Exemplo n.º 16
0
# privide base airfoils as function of relative thickess
d.blend_var = [0.241, 0.301, 0.36, 0.48, 1.0]
for f in [os.path.join(PATH, 'data/ffaw3241.dat'),
          os.path.join(PATH, 'data/ffaw3301.dat'),
          os.path.join(PATH, 'data/ffaw3360.dat'),
          os.path.join(PATH, 'data/ffaw3480.dat'),
          os.path.join(PATH, 'data/cylinder.dat')]:

    d.base_airfoils.append(np.loadtxt(f))

d.update()

# --- 3 ---

# read the blade structure including the geo3d file
st3d = read_bladestructure(os.path.join(PATH, 'data_version_2/Param2_10MW'))

# instantiate class with st3d dict and set additional surface params
st = ComputeDPsParam2(st3d,
                      x=pf['x'],
                      y=pf['y'],
                      z=pf['z'],
                      surface=d.surface)

st.compute()

# save the DPs to new st file
st3d['DPs'] = st.DPs
write_bladestructure(st3d, 'param2_st')

# --- 4 ---
Exemplo n.º 17
0
def configure(nsec, dry_run=False, FPM=False, with_sr=False):

    p = Problem(impl=impl, root=Group())

    p.root.add('blade_length_c', IndepVarComp('blade_length', 86.366), promotes=['*'])

    pf = read_blade_planform('data/DTU_10MW_RWT_blade_axis_prebend.dat')
    nsec_ae = 50
    nsec_st = nsec
    s_ae = np.linspace(0, 1, nsec_ae)
    s_st = np.linspace(0, 1, nsec_st)
    pf = redistribute_planform(pf, s=s_ae)

    spl = p.root.add('pf_splines', SplinedBladePlanform(pf), promotes=['*'])
    spl.configure()
    redist = p.root.add('pf_st', PGLRedistributedPlanform('_st', nsec_ae, s_st), promotes=['*'])

    cfg = {}
    cfg['redistribute_flag'] = False
    cfg['blend_var'] = np.array([0.241, 0.301, 0.36, 1.0])
    afs = []
    for f in ['data/ffaw3241.dat',
              'data/ffaw3301.dat',
              'data/ffaw3360.dat',
              'data/cylinder.dat']:

        afs.append(np.loadtxt(f))
    cfg['base_airfoils'] = afs
    surf = p.root.add('blade_surf', PGLLoftedBladeSurface(cfg, size_in=nsec_st,
                                    size_out=(200, nsec_st, 3), suffix='_st'), promotes=['*'])

    # read the blade structure
    st3d = read_bladestructure('data/DTU10MW')

    # and interpolate onto new distribution
    st3dn = interpolate_bladestructure(st3d, s_st)

    spl = p.root.add('st_splines', SplinedBladeStructure(st3dn), promotes=['*'])
    spl.add_spline('DP04', np.linspace(0, 1, 4), spline_type='bezier')
    spl.add_spline('r04uniaxT', np.linspace(0, 1, 4), spline_type='bezier')
    spl.add_spline('w02biaxT', np.linspace(0, 1, 4), spline_type='bezier')
    spl.configure()
    # inputs to CS2DtoBECAS and BECASWrapper
    config = {}
    cfg = {}
    cfg['dry_run'] = dry_run
    cfg['path_shellexpander'] = os.path.join(user_home, 'git/BECAS_stable/shellexpander/src')
    cfg['dominant_elsets'] = ['REGION04', 'REGION08']
    cfg['max_layers'] = 0
    config['CS2DtoBECAS'] = cfg
    cfg = {}
    cfg['path_becas'] = os.path.join(user_home, 'git/BECAS_stable/BECAS/src/matlab')
    cfg['hawc2_FPM'] = FPM
    cfg['dry_run'] = dry_run
    cfg['analysis_mode'] = 'stiffness'
    config['BECASWrapper'] = cfg

    p.root.add('stiffness', BECASBeamStructure(p.root, config, st3dn, (200, nsec_st, 3)), promotes=['*'])
    p.root.add('stress_recovery', BECASStressRecovery(config, s_st, 2), promotes=['*'])

    p.setup()
    p['hub_radius'] = 2.8
    for k, v in pf.iteritems():
        if k in p.root.pf_splines.params.keys():
            p.root.pf_splines.params[k] = v

    # set some arbitrary values in the load vectors used to compute strains
    for i, x in enumerate(s_st):
        try:
            p['load_cases_sec%03d' % i] = np.ones((2, 6))
        except:
            pass

    return p
Exemplo n.º 18
0
 def test_read_bladestructure_version_1(self):
     st3d_actual = read_bladestructure(os.path.join(self.data_version_1, self.blade))
     self.assertEqual(np.testing.assert_array_equal(
                      st3d_actual['web_def'],
                      st3d_desired['web_def']), None)
Exemplo n.º 19
0
 def test_read_bladestructure_version_1(self):
     st3d_actual = read_bladestructure(os.path.join(self.data_version_1, self.blade))
     self.assertEqual(np.testing.assert_array_equal(
                      st3d_actual['web_def'],
                      st3d_desired['web_def']), None)
Exemplo n.º 20
0
    afs.append(np.loadtxt(f))

cfg['base_airfoils'] = afs

# this array contains the interpolator for the lofted surface
# in this case the relative thicknesses of the airfoils loaded above
cfg['blend_var'] = np.array([0.241, 0.301, 0.36, 1.0])

surf = root.add('blade_surf', PGLLoftedBladeSurface(cfg, size_in=nsec_st,
                size_out=(200, nsec_st, 3), suffix='_st'),
                promotes=['*'])

# --- 3 -----

# read the blade structure
st3d = read_bladestructure(os.path.join(PATH, 'data/DTU10MW'))

# and interpolate onto new distribution
st3dn = interpolate_bladestructure(st3d, s_st)

# add component for generating the splined blade structure
# defined in FUSED-Wind
spl_st = root.add('st_splines', SplinedBladeStructure(st3dn),
                  promotes=['*'])
spl_st.configure()

# --- 4 -----

# inputs to CS2DtoBECAS and BECASWrapper
config = {}
cfg = {}
def configure(nsec_st, dry_run=False, FPM=False, with_sr=False):

    p = Problem(impl=impl, root=Group())

    p.root.add('blade_length_c', IndepVarComp('blade_length', 86.366), promotes=['*'])

    pfo = read_blade_planform('data/DTU_10MW_RWT_blade_axis_prebend.dat')
    nsec_ae = 50
    s_ae = np.linspace(0, 1, nsec_ae)
    s_st = np.linspace(0, 1, nsec_st)
    pf = {}
    pf['s'] = s_ae
    for k, v in pfo.iteritems():
        if k in ['s', 'smax', 'blade_length']: continue
        pf[k] = np.interp(s_ae, pfo['s'], v)

    spl = p.root.add('pf_splines', SplinedBladePlanform(pf), promotes=['*'])
    spl.configure()
    redist = p.root.add('pf_st', PGLRedistributedPlanform('_st', nsec_ae, s_st), promotes=['*'])

    cfg = {}
    cfg['redistribute_flag'] = False
    cfg['blend_var'] = np.array([0.241, 0.301, 0.36, 1.0])
    afs = []
    for f in ['data/ffaw3241.dat',
              'data/ffaw3301.dat',
              'data/ffaw3360.dat',
              'data/cylinder.dat']:

        afs.append(np.loadtxt(f))
    cfg['base_airfoils'] = afs
    surf = p.root.add('blade_surf', PGLLoftedBladeSurface(cfg, size_in=nsec_st,
                                    size_out=(200, nsec_st, 3), suffix='_st'), promotes=['*'])
    surf._dry_run = True
    # read the blade structure
    st3d = read_bladestructure('data/DTU10MW')

    # and interpolate onto new distribution
    st3dn = interpolate_bladestructure(st3d, s_st)

    spl = p.root.add('st_splines', SplinedBladeStructure(st3dn), promotes=['*'])
    spl.add_spline('DP04', np.linspace(0, 1, 4), spline_type='pchip')
    spl.add_spline('DP05', np.linspace(0, 1, 4), spline_type='pchip')
    spl.add_spline('DP08', np.linspace(0, 1, 4), spline_type='pchip')
    spl.add_spline('DP09', np.linspace(0, 1, 4), spline_type='pchip')
    spl.add_spline('r04uniaxT', np.linspace(0, 1, 4), spline_type='pchip')
    spl.add_spline('r08uniaxT', np.linspace(0, 1, 4), spline_type='pchip')
    spl.configure()
    # inputs to CS2DtoBECAS and BECASWrapper
    config = {}
    cfg = {}
    cfg['dry_run'] = dry_run
    cfg['path_shellexpander'] = '/Users/frza/git/BECAS_stable/shellexpander/shellexpander'
    cfg['dominant_elsets'] = ['REGION04', 'REGION08']
    cfg['max_layers'] = 0
    config['CS2DtoBECAS'] = cfg
    cfg = {}
    cfg['path_becas'] = '/Users/frza/git/BECAS_stable/BECAS/src/matlab'
    cfg['hawc2_FPM'] = FPM
    cfg['dry_run'] = dry_run
    cfg['analysis_mode'] = 'stiffness'
    config['BECASWrapper'] = cfg

    p.root.add('stiffness', BECASBeamStructure(p.root, config, st3dn, (200, nsec_st, 3)), promotes=['*'])
    p.setup()
    for k, v in pf.iteritems():
        if k in p.root.pf_splines.params.keys():
            p.root.pf_splines.params[k] = v

    # p['hub_radius'] = 2.8
    # p['blade_x'] = d.pf['x'] * 86.366
    # p['blade_z'] = d.pf['y'] * 86.366
    # p['blade_y'] = d.pf['z'] * 86.366
    return p