예제 #1
0
for reduced_frequency in reduced_freq_domain:
    i += 1
    # reduced_frequency = 0.25
    # M, N, Mstarfact = 8, 4, 50
    M, N, Mstarfact = 12, 16, 50
    u_inf = 20
    alpha = 0
    AR = 30
    rho = 1.225

    ws = flying_wings.Goland(M=M,
                             N=N,
                             Mstar_fact=Mstarfact,
                             u_inf=u_inf,
                             alpha=alpha,
                             rho=rho,
                             aspect_ratio=AR,
                             case_name='sears',
                             route='./cases')

    gust_length = np.pi * ws.c_ref / reduced_frequency
    gust_intensity = 0.01

    N_periods = 4
    omega = reduced_frequency * 2 * u_inf / ws.c_ref
    period = 2 * np.pi / omega
    ws.physical_time = N_periods * period

    for sim_type in ['nlin', 'lin']:
예제 #2
0
import cases.templates.flying_wings as wings
import sharpy.sharpy_main

aero_type = 'lin'
ws = wings.Goland(M=4,
                  N=12,
                  Mstar_fact=10,
                  u_inf=50,
                  alpha=1.,
                  rho=1.225,
                  sweep=0,
                  physical_time=2,
                  n_surfaces=2,
                  route='cases',
                  case_name='goland_' + aero_type + '_newsolver_pred')

ws.gust_intensity = 0.01
# ws.n_tstep = 2
ws.sigma = 1

ws.clean_test_files()
ws.update_derived_params()
ws.update_aero_prop()
ws.update_fem_prop()
ws.set_default_config_dict()

ws.generate_aero_file()
ws.generate_fem_file()

ws.config['SHARPy']['flow'] = [
    'BeamLoader',
예제 #3
0
    def set_up_test_case(self, aero_type, predictor, sparse, integration_order):

        # aero_type = 'lin'
        global case_name
        case_name = 'goland_' + aero_type + '_'+'P%g_S%g_I%g' %(predictor, sparse, integration_order)
        ws = wings.Goland(M=12,
                          N=4,
                          Mstar_fact=50,
                          u_inf=50,
                          alpha=1.,
                          rho=1.225,
                          sweep=0,
                          physical_time=0.1,
                          n_surfaces=2,
                          route='cases',
                          case_name=case_name)

        # Other test parameters
        ws.gust_intensity = 0.01
        ws.sigma = 1
        ws.dt_factor = 1

        ws.clean_test_files()
        ws.update_derived_params()
        ws.update_aero_prop()
        ws.update_fem_prop()
        ws.set_default_config_dict()

        ws.generate_aero_file()
        ws.generate_fem_file()

        ws.config['SHARPy']['flow'] = ['BeamLoader', 'AerogridLoader',
                                       'StaticCoupled',
                                       'DynamicCoupled']
        ws.config['SHARPy']['write_screen'] = 'off'

        # Remove newmark damping from structural solver settings
        ws.config['DynamicCoupled']['structural_solver_settings']['newmark_damp'] = 0

        if aero_type == 'lin':
            ws.config['DynamicCoupled']['aero_solver'] = 'StepLinearUVLM'
            ws.config['DynamicCoupled']['aero_solver_settings'] = {'dt': ws.dt,
                                                                   'remove_predictor': predictor,
                                                                   'use_sparse': sparse,
                                                                   'integr_order': integration_order,
                                                                   'velocity_field_generator': 'GustVelocityField',
                                                                   'velocity_field_input': {'u_inf': ws.u_inf,
                                                                                            'u_inf_direction': [1., 0.,
                                                                                                                0.],
                                                                                            'gust_shape': 'continuous_sin',
                                                                                            'offset': 2.,
                                                                                            'gust_parameters': {'gust_length': 2.,
                                                                                                                'gust_intensity': ws.gust_intensity
                                                                                                                                  * ws.u_inf,
                                                                                                                'span': ws.main_chord * ws.aspect_ratio}}}
        else:
            ws.config['DynamicCoupled']['aero_solver'] = 'StepUvlm'
            ws.config['DynamicCoupled']['aero_solver_settings'] = {
                'print_info': 'off',
                'horseshoe': True,
                'num_cores': 4,
                'n_rollup': 100,
                'convection_scheme': 0,
                'rollup_dt': ws.dt,
                'rollup_aic_refresh': 1,
                'rollup_tolerance': 1e-4,
                'velocity_field_generator': 'GustVelocityField',
                'velocity_field_input': {'u_inf': ws.u_inf,
                                         'u_inf_direction': [1., 0, 0],
                                         'gust_shape': 'continuous_sin',
                                         'gust_length': ws.gust_length,
                                         'gust_intensity': ws.gust_intensity * ws.u_inf,
                                         'offset': 2.0,
                                         'span': ws.main_chord * ws.aspect_ratio},
                'rho': ws.rho,
                'n_time_steps': ws.n_tstep,
                'dt': ws.dt,
                'gamma_dot_filtering': 0,
                'track_body': True,
                'track_body_number': -1}
            ws.config['DynamicCoupled']['include_unsteady_force_contribution'] = 'on'
        # Update settings file
        ws.config.write()

        self.case_name = ws.case_name
        self.case_route = ws.route
        self.ws = ws
        self.dt = ws.dt
예제 #4
0
case_name = 'goland'
case_nlin_info = 'M%dN%dMs%d_nmodes%d' % (M, N, M_star_fact, num_modes)
case_rom_info = 'rom_MIMORA_r%d_sig%04d_%04dj' % (
    r, frequency_continuous_k[0].real * 1000,
    frequency_continuous_k[0].imag * 1000)
fig_folder = './figures/'
os.system('mkdir -p %s' % fig_folder)

# SHARPy nonlinear reference solution
ws = wings.Goland(
    M=M,
    N=N,
    Mstar_fact=M_star_fact,
    u_inf=u_inf,
    alpha=alpha_deg,
    beta=0,
    # aspect_ratio=32,
    rho=rho,
    sweep=0,
    physical_time=2,
    n_surfaces=2,
    route='cases',
    case_name=case_name)

ws.gust_intensity = 0.01
ws.sigma = 1

ws.clean_test_files()
ws.update_derived_params()
ws.update_aero_prop()
ws.n_tstep = 20
ws.update_fem_prop()
예제 #5
0
for ii in range(Npoints):

	### update parameters
	tplparams=(int(np.round(100*AlphaInfVecDeg[ii])),
				int(np.round(100*AlphaVecDeg[ii])),
			   int(np.round(100*SideVecDeg[ii])) ,
			   int(np.round(100*RollVecDeg[ii])) )
	case_here=case_main+'_ainf%.4da%.4ds%.4dr%.4d'%tplparams 
	route_here=route_main
	os.system('mkdir -p %s'%(route_here,))


	### ------------------------------------------------------ Build wing model
	ws=flying_wings.Goland( M=M,N=N,Mstar_fact=Mstar_fact,n_surfaces=Nsurf,
								u_inf=u_inf,
								alpha=AlphaVecDeg[ii],
								beta=-SideVecDeg[ii],
								route=route_here,
								case_name=case_here)
	# updte wind direction
	quat_wind=algebra.euler2quat(-np.pi/180.*np.array([0.,AlphaInfVecDeg[ii],0.]))
	u_inf_dir=np.dot( algebra.quat2rotation(quat_wind),np.array([1.,0.,0.]))

	ws.main_ea-=.25/M
	ws.main_cg-=.25/M

	ws.root_airfoil_P = 4
	ws.root_airfoil_M = 2
	ws.tip_airfoil_P = 4
	ws.tip_airfoil_M = 2

	ws.clean_test_files()
예제 #6
0
# Case Admin
case_route = os.path.abspath('.')
results_folder = case_route + '/res/'
fig_folder = case_route + '/figs/'
os.system('mkdir -p %s' % results_folder)
os.system('mkdir -p %s' % fig_folder)
case_name = 'sears_uinf%04d_AR%02d_M%dN%dMs%d_KR%d_sp%i' % (
    u_inf, AR, M, N, MstarFact, krylov_r, use_sparse)

# Wing model
ws = wings.Goland(M=M,
                  N=N,
                  Mstar_fact=MstarFact,
                  n_surfaces=nsurf,
                  u_inf=u_inf,
                  rho=rho,
                  alpha=alpha_deg,
                  aspect_ratio=AR,
                  route=results_folder,
                  case_name=case_name)

ws.main_ea = main_ea
ws.clean_test_files()
ws.update_derived_params()
ws.generate_fem_file()
ws.generate_aero_file()

# Solution settings

ws.set_default_config_dict()
ws.config['SHARPy']['flow'] = [
예제 #7
0
# ------------------------------------------------ Build solution at UinfVec[0]
# This is used for creating the reference (normalised) UVLM


### Reference geometrically-exact solution (linearisation & scaling point)
u_inf=Uinf0
case_here=case_main+'_a%.4d_uinf%.4d'%( int(np.round(100*Alpha0Deg)), 10*u_inf)
route_here=route_main+'a%.4d/'%int(np.round(100*Alpha0Deg))
os.system('mkdir -p %s'%(route_here,))

# Build wing model
ws=flying_wings.Goland(M=M,N=N,Mstar_fact=Mstar_fact,
						n_surfaces=Nsurf,
						alpha=Alpha0Deg,
						roll=Roll0Deg,
						RollNodes=RollNodes,
					    u_inf=u_inf,
					    route=route_here,
					    case_name=case_here)

ws.clean_test_files()
ws.update_derived_params()
ws.generate_fem_file()
ws.generate_aero_file()

# solution flow
ws.set_default_config_dict()
ws.config['SHARPy']['flow']=[
	'BeamLoader', 'AerogridLoader', 'StaticUvlm', 'Modal', 'SaveData']
ws.config['SaveData']={'folder': route_here}
ws.config['LinearUvlm'] = {	'dt': ws.dt,
예제 #8
0
    def setUp(self):
        # Problem Set up
        u_inf = 1.
        alpha_deg = 0.
        rho = 1.02
        num_modes = 4

        # Lattice Discretisation
        M = 4
        N = 8
        M_star_fact = 1

        # Linear UVLM settings
        integration_order = 2
        remove_predictor = False
        use_sparse = False

        # Case Admin - Create results folders
        case_name = 'goland_cs'
        case_nlin_info = 'M%dN%dMs%d_nmodes%d' % (M, N, M_star_fact, num_modes)
        case_name += case_nlin_info

        self.route_test_dir = os.path.abspath(
            os.path.dirname(os.path.realpath(__file__)))
        fig_folder = self.route_test_dir + '/figures/'
        os.makedirs(fig_folder, exist_ok=True)

        # SHARPy nonlinear reference solution
        ws = wings.Goland(M=M,
                          N=N,
                          Mstar_fact=M_star_fact,
                          u_inf=u_inf,
                          alpha=alpha_deg,
                          rho=rho,
                          sweep=0,
                          physical_time=2,
                          n_surfaces=2,
                          route=self.route_test_dir + '/cases',
                          case_name=case_name)

        ws.gust_intensity = 0.01
        ws.sigma = 1
        ws.horseshoe = True

        ws.clean_test_files()
        ws.update_derived_params()
        ws.set_default_config_dict()

        ws.generate_aero_file()
        ws.generate_fem_file()

        ws.config['SHARPy'] = {
            'flow': [
                'BeamLoader',
                'AerogridLoader',
                'StaticCoupled',
                'AerogridPlot',
                'BeamPlot',
                'Modal',
                'LinearAssembler',
                'FrequencyResponse',
            ],
            'case':
            ws.case_name,
            'route':
            ws.route,
            'write_screen':
            'off',
            'write_log':
            'on',
            'log_folder':
            self.route_test_dir + '/output/' + ws.case_name + '/',
            'log_file':
            ws.case_name + '.log'
        }

        ws.config['BeamLoader'] = {'unsteady': 'off', 'orientation': ws.quat}

        ws.config['AerogridLoader'] = {
            'unsteady': 'off',
            'aligned_grid': 'on',
            'mstar': 1,
            'freestream_dir': ws.u_inf_direction
        }

        ws.config['StaticUvlm'] = {
            'rho': ws.rho,
            'velocity_field_generator': 'SteadyVelocityField',
            'velocity_field_input': {
                'u_inf': ws.u_inf,
                'u_inf_direction': ws.u_inf_direction
            },
            'rollup_dt': ws.dt,
            'print_info': 'on',
            'horseshoe': 'off',
            'num_cores': 4,
            'n_rollup': 0,
            'rollup_aic_refresh': 0,
            'rollup_tolerance': 1e-4
        }

        ws.config['StaticCoupled'] = {
            'print_info': 'on',
            'max_iter': 200,
            'n_load_steps': 1,
            'tolerance': 1e-10,
            'relaxation_factor': 0.,
            'aero_solver': 'StaticUvlm',
            'aero_solver_settings': {
                'rho': ws.rho,
                'print_info': 'off',
                'horseshoe': 'off',
                'num_cores': 4,
                'n_rollup': 0,
                'rollup_dt': ws.dt,
                'rollup_aic_refresh': 1,
                'rollup_tolerance': 1e-4,
                'velocity_field_generator': 'SteadyVelocityField',
                'velocity_field_input': {
                    'u_inf': ws.u_inf,
                    'u_inf_direction': ws.u_inf_direction
                }
            },
            'structural_solver': 'NonLinearStatic',
            'structural_solver_settings': {
                'print_info': 'off',
                'max_iterations': 150,
                'num_load_steps': 4,
                'delta_curved': 1e-1,
                'min_delta': 1e-10,
                'gravity_on': 'on',
                'gravity': 9.754
            }
        }

        ws.config['AerogridPlot'] = {
            'folder': self.route_test_dir + '/output/',
            'include_rbm': 'off',
            'include_applied_forces': 'on',
            'minus_m_star': 0
        }

        ws.config['AeroForcesCalculator'] = {
            'folder': self.route_test_dir + '/output/forces',
            'write_text_file': 'on',
            'text_file_name': ws.case_name + '_aeroforces.csv',
            'screen_output': 'on',
            'unsteady': 'off'
        }

        ws.config['BeamPlot'] = {
            'folder': self.route_test_dir + '/output/',
            'include_rbm': 'off',
            'include_applied_forces': 'on'
        }

        ws.config['BeamCsvOutput'] = {
            'folder': self.route_test_dir + '/output/',
            'output_pos': 'on',
            'output_psi': 'on',
            'screen_output': 'on'
        }

        ws.config['Modal'] = {
            'folder': self.route_test_dir + '/output/',
            'NumLambda': 20,
            'rigid_body_modes': 'off',
            'print_matrices': 'on',
            'keep_linear_matrices': 'on',
            'write_dat': 'off',
            'rigid_modes_cg': 'off',
            'continuous_eigenvalues': 'off',
            'dt': 0,
            'plot_eigenvalues': False,
            'max_rotation_deg': 15.,
            'max_displacement': 0.15,
            'write_modes_vtk': True,
            'use_undamped_modes': True
        }

        ws.config['LinearAssembler'] = {
            'linear_system': 'LinearAeroelastic',
            'linear_system_settings': {
                'beam_settings': {
                    'modal_projection': 'on',
                    'inout_coords': 'modes',
                    'discrete_time': 'on',
                    'newmark_damp': 0.5e-4,
                    'discr_method': 'newmark',
                    'dt': ws.dt,
                    'proj_modes': 'undamped',
                    'use_euler': 'off',
                    'num_modes': num_modes,
                    'print_info': 'on',
                    'gravity': 'on',
                    'remove_sym_modes': 'on',
                    'remove_dofs': []
                },
                'aero_settings': {
                    'dt': ws.dt,
                    'ScalingDict': {
                        'length': 0.5 * ws.c_ref,
                        'speed': u_inf,
                        'density': rho
                    },
                    'integr_order': integration_order,
                    'density': ws.rho,
                    'remove_predictor': remove_predictor,
                    'use_sparse': use_sparse,
                    'rigid_body_motion': 'off',
                    'use_euler': 'off',
                    'remove_inputs': ['u_gust'],
                },
                'rigid_body_motion': False
            }
        }

        ws.config['LinDynamicSim'] = {
            'dt': ws.dt,
            'n_tsteps': ws.n_tstep,
            'sys_id': 'LinearAeroelastic',
            'postprocessors': ['BeamPlot', 'AerogridPlot'],
            'postprocessors_settings': {
                'AerogridPlot': {
                    'u_inf': ws.u_inf,
                    'folder': self.route_test_dir + '/output/',
                    'include_rbm': 'on',
                    'include_applied_forces': 'on',
                    'minus_m_star': 0
                },
                'BeamPlot': {
                    'folder': ws.route + '/output/',
                    'include_rbm': 'on',
                    'include_applied_forces': 'on'
                }
            }
        }

        ws.config['FrequencyResponse'] = {
            'compute_fom': 'on',
            'quick_plot': 'off',
            'folder': self.route_test_dir + '/output/',
            'frequency_unit': 'k',
            'frequency_bounds': [0.0001, 1.0],
        }

        self.ws = ws