示例#1
0
def configure(size_in=10, size_out=20):

    pf = {name:np.linspace(0, 1, 10) for name in ['s', 'x', 'y', 'z',
                                            'rot_x', 'rot_y', 'rot_z', 'chord', 'rthick','p_le']}
    s_new = np.linspace(0, 1, size_out)

    p = Problem(root=Group())
    r = p.root.add('redist', PGLRedistributedPlanform('_st', size_in, s_new), promotes=['*'])
    p.setup()
    for k, v in pf.iteritems():
        r.params[k] = v

    return p
def configure_surface():

    p = Problem(root=Group())
    root = p.root

    pf = read_blade_planform('data/DTU_10MW_RWT_blade_axis_prebend.dat')

    nsec_ae = 30
    nsec_st = 20
    dist = np.array([[0., 1./nsec_ae, 1], [1., 1./nsec_ae/3., nsec_ae]])
    s_ae = distfunc(dist)
    s_st = np.linspace(0, 1, nsec_st)
    pf = redistribute_planform(pf, s=s_ae)

    # --- 2

    # add planform spline component
    spl_ae = root.add('pf_splines', SplinedBladePlanform(pf), promotes=['*'])

    # component for interpolating planform onto structural mesh
    redist = root.add('pf_st', PGLRedistributedPlanform('_st', nsec_ae, s_st), promotes=['*'])

    # --- 3

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

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

    # --- 4

    # add splines to selected params
    for name in ['x', 'chord', 'rot_z', 'rthick']:
        spl_ae.add_spline(name, np.array([0, 0.25, 0.75, 1.]), spline_type='bezier')

    # configure
    spl_ae.configure()
    return p
示例#3
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
示例#4
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
# read the blade planform into a simple dictionary format
pf = read_blade_planform(os.path.join(PATH, 'data/DTU_10MW_RWT_blade_axis_prebend.dat'))

# spline the planform and interpolate onto s_ae distribution
pf = redistribute_planform(pf, s=s_ae)

# add planform spline component defined in FUSED-Wind
spl_ae = p.root.add('pf_splines', SplinedBladePlanform(pf), promotes=['*'])

# this method adds IndepVarComp's for all pf quantities
# in no splines are defined, see FUSED-Wind docs for more details
spl_ae.configure()

# component for interpolating planform onto structural mesh
redist = root.add('pf_st', PGLRedistributedPlanform('_st', nsec_ae, s_st),
                  promotes=['*'])

# configure blade surface for structural solver
cfg = {}
cfg['redistribute_flag'] = False

# read the airfoil family used on the blade
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