Example #1
0
def configure(cfg):

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

    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')
    p = Problem(root=Group())
    r = p.root.add('blade_surf', d, 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(cfg):

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

    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')
    p = Problem(root=Group())
    r = p.root.add('blade_surf', d, 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(spline_type):

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

    p = Problem(root=Group())
    spl = p.root.add('pf_splines', SplinedBladePlanform(pf), promotes=['*'])
    for name in ['x', 'chord', 'rot_z', 'rthick']:
        spl.add_spline(name, np.array([0, 0.25, 0.75, 1.]), spline_type=spline_type)
    p.setup()
    return p
def configure(spline_type):

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

    p = Problem(root=Group())
    spl = p.root.add('pf_splines', SplinedBladePlanform(pf), promotes=['*'])
    for name in ['x', 'chord', 'rot_z', 'rthick']:
        spl.add_spline(name,
                       np.array([0, 0.25, 0.75, 1.]),
                       spline_type=spline_type)
    spl.configure()
    p.setup()
    return p
Example #5
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_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
Example #7
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
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
Example #10
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
Example #11
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
# number of aerodynamic calculation points (not relevant for this example)
nsec_ae = 30

# distribute structural and aerodynamic grid evenly
s_ae = np.linspace(0, 1, nsec_ae)
s_st = np.linspace(0, 1, nsec_st)

# add an ExecComp defining blade length TODO: this shouldn't be necessary
root.add('blade_length_c', ExecComp('blade_length = 86.366'), promotes=['*'])

# 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
Example #13
0
def configure(nsec, dry_run=False, FPM=False, par_fd=1):

    p = Problem(impl=impl, root=ParallelFDGroup(par_fd))

    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 = 4
    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, 2), spline_type='bezier')
    spl.add_spline('r08uniaxT', np.linspace(0, 1, 2), 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'] = '/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.root.add('dv0', IndepVarComp('ud_T', np.zeros(2)))
    p.driver.add_desvar('dv0.ud_T')
    p.root.connect('dv0.ud_T', 'r04uniaxT_C')
    p.root.connect('dv0.ud_T', 'r08uniaxT_C')
    p.driver.add_objective('blade_mass')
    p.root.fd_options['force_fd'] = True
    p.root.fd_options['step_size'] = 1.e-3

    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
def configure(nsec, dry_run=False, FPM=False, par_fd=1):

    p = Problem(impl=impl, root=ParallelFDGroup(par_fd))

    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 = 4
    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, 2), spline_type='bezier')
    spl.add_spline('r08uniaxT', np.linspace(0, 1, 2), 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'] = '/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.root.add('dv0', IndepVarComp('ud_T', np.zeros(2)))
    p.driver.add_desvar('dv0.ud_T')
    p.root.connect('dv0.ud_T', 'r04uniaxT_C')
    p.root.connect('dv0.ud_T', 'r08uniaxT_C')
    p.driver.add_objective('blade_mass')
    p.root.fd_options['force_fd'] = True
    p.root.fd_options['step_size'] = 1.e-3

    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
# number of aerodynamic calculation points (not relevant for this example)
nsec_ae = 30

# distribute structural and aerodynamic grid evenly
s_ae = np.linspace(0, 1, nsec_ae)
s_st = np.linspace(0, 1, nsec_st)

# add an ExecComp defining blade length TODO: this shouldn't be necessary
root.add('blade_length_c', ExecComp('blade_length = 86.366'), promotes=['*'])

# 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