Пример #1
0
    def initialise(self, data, custom_settings=None):
        self.data = data

        if custom_settings is None:
            self.settings = data.settings[self.solver_id]
        else:
            self.settings = custom_settings

        settings.to_custom_types(self.settings,
                                 self.settings_types,
                                 self.settings_default,
                                 no_ctype=True)

        self.num_evals = self.settings['num_evals']

        stability_folder_path = self.settings[
            'folder'] + '/' + self.data.settings['SHARPy'][
                'case'] + '/stability'
        if not os.path.exists(stability_folder_path):
            os.makedirs(stability_folder_path)
        self.folder = stability_folder_path

        if not os.path.exists(stability_folder_path):
            os.makedirs(stability_folder_path)

        if self.settings['print_info']:
            cout.cout_wrap('Dynamical System Eigenvalues')
            eigenvalue_description_file = stability_folder_path + '/eigenvaluetable.txt'
            self.eigenvalue_table = modalutils.EigenvalueTable(
                filename=eigenvalue_description_file)

        # Output dict
        self.data.linear.stability = dict()
Пример #2
0
    def initialise(self, data, custom_settings=None):
        self.data = data
        if custom_settings is None:
            self.settings = data.settings[self.solver_id]
        else:
            self.settings = custom_settings
        settings.to_custom_types(self.settings,
                                 self.settings_types,
                                 self.settings_default)

        self.rigid_body_motion = self.settings['rigid_body_modes'].value

        self.data.ts = len(self.data.structure.timestep_info) - 1
        if self.settings['use_custom_timestep'].value > -1:
            self.data.ts = self.settings['use_custom_timestep'].value

        # load info from dyn dictionary
        self.data.structure.add_unsteady_information(
                                            self.data.structure.dyn_dict,
                                            self.data.ts)

        # create folder for containing files if necessary
        if not os.path.exists(self.settings['folder']):
            os.makedirs(self.settings['folder'])
        self.folder = (self.settings['folder'] + '/' +
                       self.data.settings['SHARPy']['case'] +
                       '/beam_modal_analysis/')
        if not os.path.exists(self.folder):
            os.makedirs(self.folder)
        self.filename_freq = (self.folder +
                              'tstep' + ("%06d" % self.data.ts) +
                              '_ModalFrequencies.dat')
        self.filename_damp = (self.folder +
                              'tstep' + ("%06d" % self.data.ts) +
                              '_ModalDamping.dat')
        self.filename_shapes = (self.folder +
                                'tstep' + ("%06d" % self.data.ts) +
                                '_ModalShape')

        if self.settings['print_info']:
            cout.cout_wrap('Structural eigenvalues')
            # self.eigenvalue_table = cout.TablePrinter(7, 12, ['d', 'f', 'f', 'f', 'f', 'f', 'f'])
            # self.eigenvalue_table.print_header(['mode', 'eval_real', 'eval_imag', 'freq_n (Hz)', 'freq_d (Hz)',
            #                                     'damping', 'period (s)'])
            self.eigenvalue_table = modalutils.EigenvalueTable()
            self.eigenvalue_table.print_header(self.eigenvalue_table.headers)