예제 #1
0
    def test_DLC_envelope(self):

        opt_tags = dlcdefs.excel_stabcon('./DLCs/', fext='xls', silent=True)

        reader = HAWC2InputReader()
        reader.htc_master_file = 'main_h2_envelope.htc'
        reader.execute()

        for icase, case in enumerate(opt_tags):
            case['[run_dir]'] = ''
            writer = HAWC2InputWriter()
            writer.vartrees = reader.vartrees
            writer.vartrees.aero.ae_filename = 'data/' + case[
                '[case_id]'] + '_ae.dat'
            writer.vartrees.aero.pc_filename = 'data/' + case[
                '[case_id]'] + '_pc.dat'
            writer.case_id = case['[case_id]']
            writer.vartrees.tags2var(case)
            writer.execute()

            wrapper = HAWC2Wrapper()
            wrapper.copyback_results = False
            wrapper.hawc2bin = 'HAWC2mb.exe'
            wrapper.log_directory = case['[log_dir]']
            wrapper.case_id = writer.case_id
            wrapper.verbose = False
            wrapper.compute()

            config = {}
            config['neq'] = 4
            config['no_bins'] = 46
            config['m'] = [12]

            ch_list = []
            string = 'blade%i-blade%i-node-%3.3i-'
            for iblade in range(1, 4):
                for i in range(1, 6):
                    ch_list.append([
                        string % (iblade, iblade, i) + 'momentvec-x',
                        string % (iblade, iblade, i) + 'momentvec-y',
                        string % (iblade, iblade, i) + 'momentvec-z',
                        string % (iblade, iblade, i) + 'forcevec-x',
                        string % (iblade, iblade, i) + 'forcevec-y',
                        string % (iblade, iblade, i) + 'forcevec-z'
                    ])

            config['ch_envelope'] = ch_list
            output = HAWC2OutputBase(config)
            output.execute(case)
예제 #2
0
    def get_dlc_casedefs(self):
        """
        Create iter_dict and opt_tags based on spreadsheets
        """

        iter_dict = dict()
        iter_dict['[empty]'] = [False]

        # see if a htc/DLCs dir exists
        dlcs_dir = os.path.join(self.P_SOURCE, 'htc', 'DLCs')
        if os.path.exists(dlcs_dir):
            opt_tags = dlcdefs.excel_stabcon(dlcs_dir)
        else:
            opt_tags = dlcdefs.excel_stabcon(os.path.join(self.P_SOURCE, 'htc'))

        if len(opt_tags) < 1:
            raise ValueError('There are is not a single case defined. Make sure '
                             'the DLC spreadsheets are configured properly.')

        # add all the root files, except anything with *.zip
        f_ziproot = []
        for (dirpath, dirnames, fnames) in os.walk(self.P_SOURCE):
            # remove all zip files
            for i, fname in enumerate(fnames):
                if fname.endswith('.zip'):
                    fnames.pop(i)
            f_ziproot.extend(fnames)
            break
        # and add those files
        for opt in opt_tags:
            opt['[zip_root_files]'] = f_ziproot

        self.master.output_dirs.extend('[Case folder]')
        self.master.output_dirs.extend('[case_id]')

        return iter_dict, opt_tags
예제 #3
0
def launch_dlcs_excel(sim_id,
                      silent=False,
                      verbose=False,
                      pbs_turb=False,
                      runmethod=None,
                      write_htc=True,
                      zipchunks=False,
                      walltime='04:00:00',
                      postpro_node=False,
                      compress=False,
                      dlcs_dir='htc/DLCs',
                      postpro_node_zipchunks=True,
                      wine_arch='win32',
                      wine_prefix='~/.wine32',
                      m=[3, 4, 6, 8, 9, 10, 12],
                      prelude='',
                      linux=False):
    """
    Launch load cases defined in Excel files
    """

    iter_dict = dict()
    iter_dict['[empty]'] = [False]

    if postpro_node or postpro_node_zipchunks:
        #        pyenv = 'py36-wetb'
        pyenv = 'wetb_py3'
    else:
        pyenv = None

    # FIXME: THIS IS VERY MESSY, we have wine_prefix/arch and exesingle/chunks
    if linux:
        wine_arch = None
        wine_prefix = None
        prelude = 'module load mpi/openmpi_1.6.5_intelv14.0.0\n'

    # if linux:
    #     pyenv = 'wetb_py3'
    #     pyenv_cmd = 'source /home/python/miniconda3/bin/activate'
    #     exesingle = "{hawc2_exe:} {fname_htc:}"
    #     exechunks = "({winenumactl:} {hawc2_exe:} {fname_htc:}) "
    #     exechunks += "2>&1 | tee {fname_pbs_out:}"
    # else:
    #     pyenv = ''
    #     pyenv_cmd = 'source /home/ozgo/bin/activate_hawc2cfd.sh'
    #     exesingle = "time {hawc2_exe:} {fname_htc:}"
    #     exechunks = "(time numactl --physcpubind=$CPU_NR {hawc2_exe:} {fname_htc:}) "
    #     exechunks += "2>&1 | tee {fname_pbs_out:}"

    # see if a htc/DLCs dir exists
    # Load all DLC definitions and make some assumptions on tags that are not
    # defined
    if os.path.exists(dlcs_dir):
        opt_tags = dlcdefs.excel_stabcon(dlcs_dir,
                                         silent=silent,
                                         p_source=P_SOURCE)
    else:
        opt_tags = dlcdefs.excel_stabcon(os.path.join(P_SOURCE, 'htc'),
                                         silent=silent,
                                         p_source=P_SOURCE)

    if len(opt_tags) < 1:
        raise ValueError('There are is not a single case defined. Make sure '
                         'the DLC spreadsheets are configured properly.')

    # add all the root files, except anything with *.zip
    f_ziproot = []
    for (dirpath, dirnames, fnames) in os.walk(P_SOURCE):
        # remove all zip files
        for i, fname in enumerate(fnames):
            if not fname.endswith('.zip'):
                f_ziproot.append(fname)
        break
    # and add those files
    for opt in opt_tags:
        opt['[zip_root_files]'] = f_ziproot

    if runmethod == None:
        runmethod = RUNMETHOD

    master = master_tags(sim_id,
                         runmethod=runmethod,
                         silent=silent,
                         verbose=verbose)
    master.tags['[sim_id]'] = sim_id
    master.tags['[walltime]'] = walltime
    master.output_dirs.append('[Case folder]')
    master.output_dirs.append('[Case id.]')

    # TODO: copy master and DLC exchange files to p_root too!!

    # all tags set in master_tags will be overwritten by the values set in
    # variable_tag_func(), iter_dict and opt_tags
    # values set in iter_dict have precedence over opt_tags vartag_func()
    # has precedense over iter_dict, which has precedence over opt_tags.
    # dlcdefs.vartag_excel_stabcon adds support for creating hydro files
    vartag_func = dlcdefs.vartag_excel_stabcon
    cases = sim.prepare_launch(iter_dict,
                               opt_tags,
                               master,
                               vartag_func,
                               write_htc=write_htc,
                               runmethod=runmethod,
                               copyback_turb=True,
                               update_cases=False,
                               msg='',
                               ignore_non_unique=False,
                               run_only_new=False,
                               pbs_fname_appendix=False,
                               short_job_names=False,
                               silent=silent,
                               verbose=verbose,
                               pyenv=pyenv,
                               m=[3, 4, 6, 8, 9, 10, 12],
                               postpro_node=postpro_node,
                               exechunks=None,
                               exesingle=None,
                               prelude=prelude,
                               postpro_node_zipchunks=postpro_node_zipchunks,
                               wine_arch=wine_arch,
                               wine_prefix=wine_prefix)

    if pbs_turb:
        # to avoid confusing HAWC2 simulations and Mann64 generator PBS files,
        # MannTurb64 places PBS launch scripts in a "pbs_in_turb" folder
        mann64 = sim.MannTurb64(silent=silent)
        mann64.walltime = '00:59:59'
        mann64.queue = 'workq'
        mann64.gen_pbs(cases)

    if zipchunks:
        # create chunks
        # sort so we have minimal copying turb files from mimer to node/scratch
        # note that walltime here is for running all cases assigned to the
        # respective nodes. It is not walltime per case.
        sorts_on = ['[DLC]', '[Windspeed]']
        create_chunks_htc_pbs(cases,
                              sort_by_values=sorts_on,
                              queue='workq',
                              ppn=20,
                              nr_procs_series=3,
                              walltime='20:00:00',
                              chunks_dir='zip-chunks-jess',
                              compress=compress,
                              wine_arch=wine_arch,
                              wine_prefix=wine_prefix,
                              prelude=prelude)


#        create_chunks_htc_pbs(cases, sort_by_values=sorts_on, queue='workq',
#                              ppn=12, nr_procs_series=3, walltime='20:00:00',
#                              chunks_dir='zip-chunks-gorm', compress=compress,
#                              wine_arch=wine_arch, wine_prefix=wine_prefix)

    df = sim.Cases(cases).cases2df()
    df.to_excel(os.path.join(POST_DIR, sim_id + '.xls'))
예제 #4
0
    def __init__(self, config, dlcs_folder, dlcs_fext='xls', cssize=None, pfsize=None):
        super(HAWC2AeroElasticSolver, self).__init__()

        if cssize is not None:
            print 'Warning: cssize should be set in config["structural_sections"]'
            config['structural_sections'] = cssize

        if pfsize is not None:
            print 'Warning: pfsize should be set in config["aerodynamic_sections"]'
            config['aerodynamic_sections'] = pfsize

        # check that the config is ok
        self._check_config(config)

        # load cases and their tags
        dlcs = dlcdefs.excel_stabcon(dlcs_folder, fext=dlcs_fext, silent=True)
        self.ncases = len(dlcs)
        if self.ncases == 0:
            raise RuntimeError('Something went wrong when reading the DLCs, ncases=0!')

        promote = []
        if config['with_tsr']:
            promote.append('tsr')

        if config['with_structure']:
            promote.append('blade_beam_structure')

        if config['with_geom']:
            var = ['s', 'x', 'y', 'z', 'rot_x', 'rot_y', 'rot_z',
                             'chord', 'rthick', 'p_le']
            for v in var:
                promote.append(v)
            promote.append('blade_length')

        if 'with_aero_coeffs' in config.keys():
            if config['with_aero_coeffs']:
                promote.append('airfoildata:blend_var')
                for i in range(config['naero_coeffs']):
                    promote.extend(['airfoildata:aoa%02d' % i,
                                    'airfoildata:cl%02d' % i,
                                    'airfoildata:cd%02d' % i,
                                    'airfoildata:cm%02d' % i])

        # Add outputs
        agg_promo = []
        for stat in config['HAWC2Outputs']['stat_list']:
            name = 'stat_'+stat
            agg_promo.append(name)
        for m in config['HAWC2Outputs']['m']:
            name = 'fatigue_m%i' % m
            agg_promo.append(name)

        if 'ch_envelope' in config['HAWC2Outputs'].keys():
            for isec in range(config['structural_sections']):
                name = 'blade_loads_envelope_sec%03d' % isec
                agg_promo.append(name)

        self.add('aggregate', OutputsAggregator(config, len(dlcs)),
                 promotes=agg_promo)

        pg = self.add('pg', ParallelGroup(), promotes=promote)

        for icase, case in enumerate(dlcs):
            case_id = case['[case_id]'].replace('-', '_')
            pg.add(case_id, HAWC2Workflow(config, case),
                   promotes=promote)

            self.connect('pg.%s.outputs_statistics' % case_id,
                         'aggregate.outputs_statistics_%d' % icase)
            self.connect('pg.%s.outputs_fatigue' % case_id,
                         'aggregate.outputs_fatigue_%d' % icase)
            if 'ch_envelope' in config['HAWC2Outputs'].keys():
                self.connect('pg.%s.outputs_envelope' % case_id,
                             'aggregate.outputs_envelope_%d' % icase)
예제 #5
0
    def test_DLC(self):

        opt_tags = dlcdefs.excel_stabcon('./DLCs/', fext='xls', silent=True)

        reader = HAWC2InputReader()
        reader.htc_master_file = 'main_h2.htc'
        reader.execute()
        nan = np.nan
        std_ref = [
            [
                1.15468610453, 20.623820042, 0.0740770493071, 0.0,
                1.63883455995e-13, 0.0, 2.92527680742e-13, 0.0,
                1.05186187846e-13, 0.00448084986512, 0.0, 0.0, 0.0,
                0.0667195480442, 0.0399570220043, 0.0472457197536,
                8274.98592144, 2262.75202353, 1757.4399563, 1312.15413729,
                160.871998807, 1728.97639082, 2342.04778773, 2037.83218151,
                642.926932085, 528.301580539, 1863.59205836, 28.5365363394,
                623.07691339, 3799.86728189, 97.9153652396, 1184.56277166,
                4311.55945802, 91.3815558524, 337.08531561, 716.108650974,
                9.8802695592, 393.601651419, 2052.93701803, 35.1914829007,
                566.294446379, 2164.10365741, 31.2861603289, 0.00519990875458,
                0.0317126196777, 0.152721894284, 0.112067971908,
                0.158007178759, 0.181269098788, 0.010676652669, 0.433596301372,
                0.175455345668, 0.013016978806, 0.434643362013, 0.359175518897,
                0.0214229824982, 18.6265089573, 2.06803508288, 25.0941539507,
                0.212244149063, 1.31535369178, 1.02342877799, 2.57083866195,
                0.131488392814, 0.0976950118386, 0.233573131863,
                0.00221016870252, 0.00374349100002, 0.00730561627894, 0.0, 0.0,
                0.0, 0.0, 0.0, 0.0158365766493, 0.000246378358914,
                0.000246373116992, 0.0, 17355.3928633, 17298.5867446, 0.0, 0.0,
                0.0, 0.000246376550094, 1825.73496434, 0.00514181322312,
                0.00511408917708, 0.0, 2.38418579102e-07, 0.0, 0.0, 0.0,
                6.76987012183e-19, 0.0, 0.0, 0.00607777508278, 62.6460368858,
                19.4451050235, 0.0, 62.6460368858, 0.0206862416792,
                642931.690171, 1.78813934326e-07, 0.0, 0.0, 0.0, 0.0, 0.0,
                12.84568112
            ],
            [
                1.15468610453, 20.623820042, 0.0740770493071, 0.0,
                1.63883455995e-13, 0.0, 2.92527680742e-13, 0.0,
                1.05186187846e-13, 0.00448084986512, 0.0, 0.0, 0.0,
                0.0618272310876, 0.136897588111, 0.0416334075112,
                8274.98592144, 2262.75202353, 1757.4399563, 1312.15413729,
                160.871998807, 1728.97639082, 2342.04778773, 2037.83218151,
                642.926932085, 528.301580539, 1863.59205836, 28.5365363394,
                623.07691339, 3799.86728189, 97.9153652396, 1184.56277166,
                4311.55945802, 91.3815558524, 337.08531561, 716.108650974,
                9.8802695592, 393.601651419, 2052.93701803, 35.1914829007,
                566.294446379, 2164.10365741, 31.2861603289, 0.00519990875458,
                0.0317126196777, 0.152721894284, 0.112067971908,
                0.158007178759, 0.181269098788, 0.010676652669, 0.433596301372,
                0.175455345668, 0.013016978806, 0.434643362013, 0.359175518897,
                0.0214229824982, 18.6265089573, 2.06803508288, 25.0941539507,
                0.0772392568926, 0.922723143347, 1.26687366066, 2.22751007797,
                0.0900142147177, 0.12071187503, 0.202693610237,
                0.00358832154051, 0.00394294579261, 0.00862773061716, 0.0, 0.0,
                0.0, 0.0, 0.0, 0.0237388360613, 0.000246378358914,
                0.000246373116992, 0.0, 17355.3928633, 17298.5867446, 0.0, 0.0,
                0.0, 0.000246376550094, 1825.73496434, 0.00514181322312,
                0.00511408917708, 0.0, 2.38418579102e-07, 0.0, 0.0, 0.0,
                6.76987012183e-19, 0.0, 0.0, 0.00607777508278, 62.6460368858,
                19.4451050235, 0.0, 62.6460368858, 0.0206862416792,
                642931.690171, 1.78813934326e-07, 0.0, 0.0, 0.0, 0.0, 0.0,
                12.84568112
            ],
            [
                1.15468610453, 20.623820042, 0.0740770493071, 0.0,
                1.63883455995e-13, 0.0, 2.92527680742e-13, 0.0,
                1.05186187846e-13, 0.00448084986512, 0.0, 0.0, 0.0,
                0.0304850999051, 0.0493848314637, 0.018868019291,
                8274.98592144, 2262.75202353, 1757.4399563, 1312.15413729,
                160.871998807, 1728.97639082, 2342.04778773, 2037.83218151,
                642.926932085, 528.301580539, 1863.59205836, 28.5365363394,
                623.07691339, 3799.86728189, 97.9153652396, 1184.56277166,
                4311.55945802, 91.3815558524, 337.08531561, 716.108650974,
                9.8802695592, 393.601651419, 2052.93701803, 35.1914829007,
                566.294446379, 2164.10365741, 31.2861603289, 0.00519990875458,
                0.0317126196777, 0.152721894284, 0.112067971908,
                0.158007178759, 0.181269098788, 0.010676652669, 0.433596301372,
                0.175455345668, 0.013016978806, 0.434643362013, 0.359175518897,
                0.0214229824982, 18.6265089573, 2.06803508288, 25.0941539507,
                0.0290628277852, 0.995506567128, 1.02838432033, 2.19556951898,
                0.0950211339582, 0.093436891305, 0.203007308904,
                0.00434149608136, 0.00352270188921, 0.00959668564148, 0.0, 0.0,
                0.0, 0.0, 0.0, 0.0171455782373, 0.000246378358914,
                0.000246373116992, 0.0, 17355.3928633, 17298.5867446, 0.0, 0.0,
                0.0, 0.000246376550094, 1825.73496434, 0.00514181322312,
                0.00511408917708, 0.0, 2.38418579102e-07, 0.0, 0.0, 0.0,
                6.76987012183e-19, 0.0, 0.0, 0.00607777508278, 62.6460368858,
                19.4451050235, 0.0, 62.6460368858, 0.0206862416792,
                642931.690171, 1.78813934326e-07, 0.0, 0.0, 0.0, 0.0, 0.0,
                12.84568112
            ]
        ]

        min_ref = [
            [
                1.02, 18.2528, 2.71844, 0.0, -4.37326e-13, 0.0, -8.74653e-13,
                0.0, -3.57812e-13, 0.295914, 0.0, 0.0, 0.0, -0.163887, 0.10136,
                -0.0705254, -20387.8, -4770.09, -3219.08, -8557.29, -331.309,
                -3094.91, -8273.69, -10273.5, -1914.08, -1927.65, 1908.95,
                14.4236, -2336.55, -15279.6, -307.368, -3830.56, -7509.66,
                -154.559, -1508.59, 559.788, -7.70657, -505.606, -6453.2,
                -113.679, -1734.36, -3971.15, -52.0381, -0.0103338, -0.093089,
                -0.280412, -0.170996, 0.0414103, -3.35387, 86.3581, -1.38289,
                -3.61419, 86.3357, -0.771033, -3.6373, 86.3418, -88.9843,
                -13.8366, -203.745, -0.80437, -2.58734, -0.0269182, -4.64975,
                0.0696768, 0.342503, -0.0503314, 0.00624713, 0.00382888,
                -0.00087769, 0.0, 0.0, 0.0, 0.0, 0.0, 0.00716154, 0.311282,
                -0.316718, 0.0, -2.24362e+07, 2.22475e+07, 0.0, 5.13464e+06,
                0.0, -0.693718, -1.00068e+07, -5.94435, 5.88228, 0.0, 1.43117,
                0.0, 0.0, 0.0, -1.96412e-18, 0.0, 0.0, 0.13194, -397.661,
                -179.295, 0.0, -397.661, -0.190739, -2.7327e+06, 0.94, 0.0,
                0.0, 0.0, 0.0, 0.0, 19.3039
            ],
            [
                1.02, 18.2528, 2.71844, 0.0, -4.37326e-13, 0.0, -8.74653e-13,
                0.0, -3.57812e-13, 0.295914, 0.0, 0.0, 0.0, -0.0786841,
                0.052737, -0.0416812, -20387.8, -4770.09, -3219.08, -8557.29,
                -331.309, -3094.91, -8273.69, -10273.5, -1914.08, -1927.65,
                1908.95, 14.4236, -2336.55, -15279.6, -307.368, -3830.56,
                -7509.66, -154.559, -1508.59, 559.788, -7.70657, -505.606,
                -6453.2, -113.679, -1734.36, -3971.15, -52.0381, -0.0103338,
                -0.093089, -0.280412, -0.170996, 0.0414103, -3.35387, 86.3581,
                -1.38289, -3.61419, 86.3357, -0.771033, -3.6373, 86.3418,
                -88.9843, -13.8366, -203.745, -0.0582635, 0.618724, -0.90401,
                -2.7911, 0.436152, 0.290172, 0.147358, 0.00412495, 0.00295085,
                -0.00239838, 0.0, 0.0, 0.0, 0.0, 0.0, 0.00323438, 0.311282,
                -0.316718, 0.0, -2.24362e+07, 2.22475e+07, 0.0, 5.13464e+06,
                0.0, -0.693718, -1.00068e+07, -5.94435, 5.88228, 0.0, 1.43117,
                0.0, 0.0, 0.0, -1.96412e-18, 0.0, 0.0, 0.13194, -397.661,
                -179.295, 0.0, -397.661, -0.190739, -2.7327e+06, 0.94, 0.0,
                0.0, 0.0, 0.0, 0.0, 19.3039
            ],
            [
                1.02, 18.2528, 2.71844, 0.0, -4.37326e-13, 0.0, -8.74653e-13,
                0.0, -3.57812e-13, 0.295914, 0.0, 0.0, 0.0, -0.020951,
                0.0971278, -0.0560079, -20387.8, -4770.09, -3219.08, -8557.29,
                -331.309, -3094.91, -8273.69, -10273.5, -1914.08, -1927.65,
                1908.95, 14.4236, -2336.55, -15279.6, -307.368, -3830.56,
                -7509.66, -154.559, -1508.59, 559.788, -7.70657, -505.606,
                -6453.2, -113.679, -1734.36, -3971.15, -52.0381, -0.0103338,
                -0.093089, -0.280412, -0.170996, 0.0414103, -3.35387, 86.3581,
                -1.38289, -3.61419, 86.3357, -0.771033, -3.6373, 86.3418,
                -88.9843, -13.8366, -203.745, -0.0530781, 0.461831, -0.272344,
                -2.18937, 0.428871, 0.344658, 0.211512, 0.0052319, 0.0040271,
                -0.00574167, 0.0, 0.0, 0.0, 0.0, 0.0, 0.00633216, 0.311282,
                -0.316718, 0.0, -2.24362e+07, 2.22475e+07, 0.0, 5.13464e+06,
                0.0, -0.693718, -1.00068e+07, -5.94435, 5.88228, 0.0, 1.43117,
                0.0, 0.0, 0.0, -1.96412e-18, 0.0, 0.0, 0.13194, -397.661,
                -179.295, 0.0, -397.661, -0.190739, -2.7327e+06, 0.94, 0.0,
                0.0, 0.0, 0.0, 0.0, 19.3039
            ]
        ]

        m12_ref = [
            [
                3.34676773271, 59.7548542476, 0.468059943101, nan,
                7.76083600193e-13, nan, 1.49054185128e-12, nan,
                5.62240977778e-13, 0.0248237883755, nan, nan, nan,
                0.214395394717, 0.143972797391, 0.164388856447, 23175.7579878,
                8263.14369097, 5629.17003676, 4144.20611741, 598.314219059,
                5506.35573909, 7120.33780651, 7408.99315106, 3919.978416,
                2002.69311878, 6421.48847582, 116.400749013, 2322.37864321,
                12700.9957402, 283.781644151, 4139.58768945, 14634.4856958,
                287.905841024, 1263.10491073, 2599.44022781, 42.4278111763,
                1310.31010198, 5982.42125634, 118.97185467, 1783.03402345,
                7017.21799324, 108.920729664, 0.017825860875, 0.0764152462997,
                0.515002924131, 0.411861132403, 0.606506071365, 0.624728509324,
                0.0371483988949, 1.20104703452, 0.576028926024,
                0.0458456186893, 1.27743259762, 1.02915696571, 0.0638579250184,
                51.3860015957, 5.78773035326, 70.463754011, 0.772368825253,
                4.46989677658, 3.09977639807, 8.32214929559, 0.419068094375,
                0.296971698047, 0.722744001694, 0.00882688351975,
                0.0127246329558, 0.0263877197342, nan, nan, nan, nan, nan,
                0.0448986227494, 0.0010587898629, 0.00105881494617, nan,
                74317.6676684, 74065.1727613, nan, nan, nan, 0.00105881494617,
                9995.68097918, 0.0223128089364, 0.0222036427514, nan, nan, nan,
                nan, nan, 1.87259744285e-18, nan, nan, 0.0181154282518,
                810.407157775, 260.90408433, nan, 810.407157775,
                0.277556892867, 3920433.62154, nan, nan, nan, nan, nan, nan,
                38.0249079495
            ],
            [
                3.34676773271, 59.7548542476, 0.468059943101, nan,
                7.76083600193e-13, nan, 1.49054185128e-12, nan,
                5.62240977778e-13, 0.0248237883755, nan, nan, nan,
                0.206887549082, 0.386371713228, 0.13328230517, 23175.7579878,
                8263.14369097, 5629.17003676, 4144.20611741, 598.314219059,
                5506.35573909, 7120.33780651, 7408.99315106, 3919.978416,
                2002.69311878, 6421.48847582, 116.400749013, 2322.37864321,
                12700.9957402, 283.781644151, 4139.58768945, 14634.4856958,
                287.905841024, 1263.10491073, 2599.44022781, 42.4278111763,
                1310.31010198, 5982.42125634, 118.97185467, 1783.03402345,
                7017.21799324, 108.920729664, 0.017825860875, 0.0764152462997,
                0.515002924131, 0.411861132403, 0.606506071365, 0.624728509324,
                0.0371483988949, 1.20104703452, 0.576028926024,
                0.0458456186893, 1.27743259762, 1.02915696571, 0.0638579250184,
                51.3860015957, 5.78773035326, 70.463754011, 0.313304240049,
                3.29159645251, 3.98032516206, 7.2300707241, 0.317039631799,
                0.361070772872, 0.629128964369, 0.0134177222875,
                0.0141452199232, 0.0295225026225, nan, nan, nan, nan, nan,
                0.0659000592328, 0.0010587898629, 0.00105881494617, nan,
                74317.6676684, 74065.1727613, nan, nan, nan, 0.00105881494617,
                9995.68097918, 0.0223128089364, 0.0222036427514, nan, nan, nan,
                nan, nan, 1.87259744285e-18, nan, nan, 0.0181154282518,
                810.407157775, 260.90408433, nan, 810.407157775,
                0.277556892867, 3920433.62154, nan, nan, nan, nan, nan, nan,
                38.0249079495
            ],
            [
                3.34676773271, 59.7548542476, 0.468059943101, nan,
                7.76083600193e-13, nan, 1.49054185128e-12, nan,
                5.62240977778e-13, 0.0248237883755, nan, nan, nan,
                0.10360011273, 0.152019126971, 0.0618277615999, 23175.7579878,
                8263.14369097, 5629.17003676, 4144.20611741, 598.314219059,
                5506.35573909, 7120.33780651, 7408.99315106, 3919.978416,
                2002.69311878, 6421.48847582, 116.400749013, 2322.37864321,
                12700.9957402, 283.781644151, 4139.58768945, 14634.4856958,
                287.905841024, 1263.10491073, 2599.44022781, 42.4278111763,
                1310.31010198, 5982.42125634, 118.97185467, 1783.03402345,
                7017.21799324, 108.920729664, 0.017825860875, 0.0764152462997,
                0.515002924131, 0.411861132403, 0.606506071365, 0.624728509324,
                0.0371483988949, 1.20104703452, 0.576028926024,
                0.0458456186893, 1.27743259762, 1.02915696571, 0.0638579250184,
                51.3860015957, 5.78773035326, 70.463754011, 0.127498417605,
                3.86710462969, 3.42210684433, 7.35967487136, 0.362446030724,
                0.292646731593, 0.660302374728, 0.0162588393672,
                0.0133652432195, 0.0340428561448, nan, nan, nan, nan, nan,
                0.047025988233, 0.0010587898629, 0.00105881494617, nan,
                74317.6676684, 74065.1727613, nan, nan, nan, 0.00105881494617,
                9995.68097918, 0.0223128089364, 0.0222036427514, nan, nan, nan,
                nan, nan, 1.87259744285e-18, nan, nan, 0.0181154282518,
                810.407157775, 260.90408433, nan, 810.407157775,
                0.277556892867, 3920433.62154, nan, nan, nan, nan, nan, nan,
                38.0249079495
            ]
        ]

        for icase, case in enumerate(opt_tags):
            case['[run_dir]'] = ''
            writer = HAWC2InputWriter()
            writer.vartrees = reader.vartrees
            writer.vartrees.aero.ae_filename = 'data/' + case[
                '[Case id.]'] + '_ae.dat'
            writer.vartrees.aero.pc_filename = 'data/' + case[
                '[Case id.]'] + '_pc.dat'
            writer.case_id = case['[case_id]']
            writer.vartrees.tags2var(case)
            writer.execute()

            wrapper = HAWC2Wrapper()
            wrapper.copyback_results = False
            wrapper.hawc2bin = 'HAWC2mb.exe'
            wrapper.log_directory = case['[log_dir]']
            wrapper.case_id = writer.case_id
            wrapper.verbose = False
            wrapper.compute()

            config = {}
            config['neq'] = 4
            config['no_bins'] = 46
            config['m'] = [12]
            output = HAWC2OutputBase(config)
            output.execute(case)

            self.compare_lists(output.stats['min'], min_ref[icase])
            self.compare_lists(output.stats['std'], std_ref[icase])
            self.compare_lists([eq[:1] for eq in output.eq], m12_ref[icase])
예제 #6
0
    def __init__(self,
                 config,
                 dlcs_folder,
                 dlcs_fext='xls',
                 cssize=None,
                 pfsize=None):
        super(HAWC2AeroElasticSolver, self).__init__()

        if cssize is not None:
            print 'Warning: cssize should be set in config["structural_sections"]'
            config['structural_sections'] = cssize

        if pfsize is not None:
            print 'Warning: pfsize should be set in config["aerodynamic_sections"]'
            config['aerodynamic_sections'] = pfsize

        # check that the config is ok
        self._check_config(config)

        # load cases and their tags
        dlcs = dlcdefs.excel_stabcon(dlcs_folder, fext=dlcs_fext, silent=True)
        self.ncases = len(dlcs)
        if self.ncases == 0:
            raise RuntimeError(
                'Something went wrong when reading the DLCs, ncases=0!')

        promote = []
        if config['with_tsr']:
            promote.append('tsr')

        if config['with_structure']:
            promote.append('blade_beam_structure')

        if config['with_geom']:
            var = [
                's', 'x', 'y', 'z', 'rot_x', 'rot_y', 'rot_z', 'chord',
                'rthick', 'p_le'
            ]
            for v in var:
                promote.append(v)
            promote.append('blade_length')

        if 'with_aero_coeffs' in config.keys():
            if config['with_aero_coeffs']:
                promote.append('airfoildata:blend_var')
                for i in range(config['naero_coeffs']):
                    promote.extend([
                        'airfoildata:aoa%02d' % i,
                        'airfoildata:cl%02d' % i,
                        'airfoildata:cd%02d' % i,
                        'airfoildata:cm%02d' % i
                    ])

        # Add outputs
        agg_promo = []
        for stat in config['HAWC2Outputs']['stat_list']:
            name = 'stat_' + stat
            agg_promo.append(name)
        for m in config['HAWC2Outputs']['m']:
            name = 'fatigue_m%i' % m
            agg_promo.append(name)

        if 'ch_envelope' in config['HAWC2Outputs'].keys():
            for isec in range(config['structural_sections']):
                name = 'blade_loads_envelope_sec%03d' % isec
                agg_promo.append(name)

        self.add('aggregate',
                 OutputsAggregator(config, len(dlcs)),
                 promotes=agg_promo)

        pg = self.add('pg', ParallelGroup(), promotes=promote)

        for icase, case in enumerate(dlcs):
            case_id = case['[case_id]'].replace('-', '_')
            pg.add(case_id, HAWC2Workflow(config, case), promotes=promote)

            self.connect('pg.%s.outputs_statistics' % case_id,
                         'aggregate.outputs_statistics_%d' % icase)
            self.connect('pg.%s.outputs_fatigue' % case_id,
                         'aggregate.outputs_fatigue_%d' % icase)
            if 'ch_envelope' in config['HAWC2Outputs'].keys():
                self.connect('pg.%s.outputs_envelope' % case_id,
                             'aggregate.outputs_envelope_%d' % icase)