コード例 #1
0
ファイル: stepuvlm.py プロジェクト: ljnpu/sharpy-1
    def run(self,
            aero_tstep=None,
            structure_tstep=None,
            convect_wake=True,
            dt=None,
            t=None):

        if aero_tstep is None:
            aero_tstep = self.data.aero.timestep_info[-1]
        if structure_tstep is None:
            structure_tstep = self.data.structure.timestep_info[-1]
        if dt is None:
            dt = self.settings['dt'].value
        if t is None:
            t = self.data.ts * dt

        # generate uext
        self.velocity_generator.generate(
            {
                'zeta': aero_tstep.zeta,
                'override': True,
                't': t,
                'ts': self.data.ts,
                'dt': dt,
                'for_pos': structure_tstep.for_pos
            }, aero_tstep.u_ext)
        if self.settings['convection_scheme'].value > 1 and convect_wake:
            # generate uext_star
            self.velocity_generator.generate(
                {
                    'zeta': aero_tstep.zeta_star,
                    'override': True,
                    'ts': self.data.ts,
                    'dt': dt,
                    't': t,
                    'for_pos': structure_tstep.for_pos
                }, aero_tstep.u_ext_star)

        # previous_ts = max(len(self.data.aero.timestep_info) - 1, 0) - 1
        # previous_ts = -1
        # print('previous_step max circulation: %f' % previous_aero_tstep.gamma[0].min())
        # print('current step max circulation: %f' % aero_tstep.gamma[0].min())
        uvlmlib.uvlm_solver(self.data.ts,
                            aero_tstep,
                            structure_tstep,
                            self.settings,
                            convect_wake=convect_wake,
                            dt=dt)
        # print('current step max unsforce: %f' % aero_tstep.dynamic_forces[0].max())

        # calculate unsteady (added mass) forces:
        self.data.aero.compute_gamma_dot(dt, aero_tstep,
                                         self.data.aero.timestep_info[-3:-1])
        uvlmlib.uvlm_calculate_unsteady_forces(aero_tstep,
                                               structure_tstep,
                                               self.settings,
                                               convect_wake=convect_wake,
                                               dt=dt)
        return self.data
コード例 #2
0
ファイル: shwuvlm.py プロジェクト: petebachant/sharpy
    def run(self,
            aero_tstep=None,
            structure_tstep=None,
            convect_wake=False,
            dt=None,
            t=None,
            unsteady_contribution=False):

        # Checks
        if convect_wake:
            sys.exit("ERROR: convect_wake should be set to False")

        if aero_tstep is None:
            aero_tstep = self.data.aero.timestep_info[-1]
        if structure_tstep is None:
            structure_tstep = self.data.structure.timestep_info[-1]
        if dt is None:
            dt = self.settings['dt'].value
        if t is None:
            t = self.data.ts*dt

        # generate uext
        self.velocity_generator.generate({'zeta': aero_tstep.zeta,
                                          'override': True,
                                          't': t,
                                          'ts': self.data.ts,
                                          'dt': dt,
                                          'for_pos': structure_tstep.for_pos},
                                         aero_tstep.u_ext)
        # if self.settings['convection_scheme'].value > 1 and convect_wake:
        #     # generate uext_star
        #     self.velocity_generator.generate({'zeta': aero_tstep.zeta_star,
        #                                       'override': True,
        #                                       'ts': self.data.ts,
        #                                       'dt': dt,
        #                                       't': t,
        #                                       'for_pos': structure_tstep.for_pos},
        #                                      aero_tstep.u_ext_star)

        # previous_ts = max(len(self.data.aero.timestep_info) - 1, 0) - 1
        # previous_ts = -1
        # print('previous_step max circulation: %f' % previous_aero_tstep.gamma[0].min())
        # print('current step max circulation: %f' % aero_tstep.gamma[0].min())
        uvlmlib.shw_solver(self.data.ts,
                            aero_tstep,
                            structure_tstep,
                            self.settings,
                            convect_wake=False,
                            dt=dt)
        # print('current step max unsforce: %f' % aero_tstep.dynamic_forces[0].max())

        if unsteady_contribution:
            # calculate unsteady (added mass) forces:
            self.data.aero.compute_gamma_dot(dt, aero_tstep, self.data.aero.timestep_info[-3:])
            if self.settings['gamma_dot_filtering'].value > 0:
                self.filter_gamma_dot(aero_tstep, self.data.aero.timestep_info, self.settings['gamma_dot_filtering'].value)
            uvlmlib.uvlm_calculate_unsteady_forces(aero_tstep,
                                                   structure_tstep,
                                                   self.settings,
                                                   convect_wake=convect_wake,
                                                   dt=dt)
        else:
            for i_surf in range(len(aero_tstep.gamma)):
                aero_tstep.gamma_dot[i_surf][:] = 0.0

        return self.data
コード例 #3
0
ファイル: stepuvlm.py プロジェクト: outoforderdev/sharpy
    def run(self,
            aero_tstep=None,
            structure_tstep=None,
            convect_wake=True,
            dt=None,
            t=None,
            unsteady_contribution=False):
        """
        Runs a step of the aerodynamics as implemented in UVLM.
        """

        if aero_tstep is None:
            aero_tstep = self.data.aero.timestep_info[-1]
        if structure_tstep is None:
            structure_tstep = self.data.structure.timestep_info[-1]
        if dt is None:
            dt = self.settings['dt'].value
        if t is None:
            t = self.data.ts * dt

        if not aero_tstep.zeta:
            return self.data

        # generate uext
        self.velocity_generator.generate(
            {
                'zeta': aero_tstep.zeta,
                'override': True,
                't': t,
                'ts': self.data.ts,
                'dt': dt,
                'for_pos': structure_tstep.for_pos
            }, aero_tstep.u_ext)
        if self.settings['convection_scheme'].value > 1 and convect_wake:
            # generate uext_star
            self.velocity_generator.generate(
                {
                    'zeta': aero_tstep.zeta_star,
                    'override': True,
                    'ts': self.data.ts,
                    'dt': dt,
                    't': t,
                    'for_pos': structure_tstep.for_pos
                }, aero_tstep.u_ext_star)

        uvlmlib.uvlm_solver(self.data.ts,
                            aero_tstep,
                            structure_tstep,
                            self.settings,
                            convect_wake=convect_wake,
                            dt=dt)

        if unsteady_contribution:
            # calculate unsteady (added mass) forces:
            self.data.aero.compute_gamma_dot(dt, aero_tstep,
                                             self.data.aero.timestep_info[-3:])
            if self.settings['gamma_dot_filtering'] is None:
                self.filter_gamma_dot(aero_tstep, self.data.aero.timestep_info,
                                      None)
            elif self.settings['gamma_dot_filtering'].value > 0:
                self.filter_gamma_dot(
                    aero_tstep, self.data.aero.timestep_info,
                    self.settings['gamma_dot_filtering'].value)
            uvlmlib.uvlm_calculate_unsteady_forces(aero_tstep,
                                                   structure_tstep,
                                                   self.settings,
                                                   convect_wake=convect_wake,
                                                   dt=dt)
        else:
            for i_surf in range(len(aero_tstep.gamma)):
                aero_tstep.gamma_dot[i_surf][:] = 0.0

        return self.data