Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

xbeam/sharpy load ramping in nonlinearstatic solver #191

Open
wants to merge 7 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
128 changes: 128 additions & 0 deletions cases/models_generator/examples/#goland_wing.py#
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
import numpy as np
import os
import sys
import importlib
import cases.models_generator.gen_main as gm
import sharpy.utils.algebra as algebra
importlib.reload(gm)
from functools import partial

#############################
# Read goland wing from docs #
#############################
split_path = [sys.path[i].split('/') for i in [0,1,2]]
for i in range(len(split_path)):
if 'sharpy' in split_path[i]:
ind = i
break

sharpy_dir = sys.path[ind]
# path2goland = sharpy_dir + '/docs/source/content/example_notebooks/cases'
# goland_files = os.listdir(path2goland)
# for i in goland_files:
# if 'goland' in i and 'sharpy' in i:
# goland_sharpy = i
# elif 'goland' in i and 'fem' in i:
# goland_fem = i
# elif 'goland' in i and 'aero' in i:
# goland_aero = i

# goland = gm.Sharpy_data(['read_structure','read_aero','simulation'])
# goland.read_structure(path2goland+'/'+goland_fem)
# goland.read_aero(path2goland+'/'+goland_aero)
# goland.read_sim(path2goland+'/'+goland_sharpy)

# aeroelasticity parameters
main_ea = 0.33
main_cg = 0.43
sigma = 1
c_ref = 1.8288
ea, ga = 1e9, 1e9
gj = 0.987581e6
eiy = 9.77221e6
eiz = 1e2 * eiy
base_stiffness = np.diag([ea, ga, ga, sigma * gj, sigma * eiy, eiz])
stiffness = np.zeros((1, 6, 6))
stiffness[0] = base_stiffness
m_unit = 35.71
j_tors = 8.64
pos_cg_b = np.array([0., c_ref * (main_cg - main_ea), 0.])
m_chi_cg = algebra.skew(m_unit * pos_cg_b)
mass = np.zeros((1, 6, 6))
mass[0, :, :] = np.diag([m_unit, m_unit, m_unit,
j_tors, .1 * j_tors, .9 * j_tors])
mass[0, :3, 3:] = m_chi_cg
mass[0, 3:, :3] = -m_chi_cg
# goland.fem['stiffness_db'] = stiffness
# goland.fem['mass_db'] = mass
# goland.aero['elastic_axis']
# .
# .
# .

g1c = dict()
g1c['workflow'] = ['create_structure','create_aero']
g1c['geometry'] = {'length':6.096,
'num_node':9,
'direction':None,
'node0':[0., 0., 0.],
'sweep':0.,
'dihedral':0.}
g1c['fem'] = {'stiffness_db':stiffness,
'mass_db':mass,
'frame_of_reference_delta':[-1.,0.,0.]}
g1c['aero'] = {'chord':c_ref,
'elastic_axis':main_ea,
'surface_m':8}

comp1 = gm.Components('wing1','sharpy',['sharpy'],g1c)
g1cm = {'wing1':g1c}
g1mm = {'model_name':'goland_b',
'model_route':'/mnt/work/Programs/runs/goland_wing',#sharpy_dir+'/cases/models_generator/examples/goland_wing',
'iterate_type': 'Full_Factorial',
'iterate_vars': {'wing1*geometry-sweep':np.linspace(15.5*np.pi/180,19.5*np.pi/180,5), #np.linspace(15*np.pi/180,20*np.pi/180,6)
'wing1*geometry-length':6.096*np.linspace(1.025,1.275,6), #6.096*np.linspace(1,1.3,7)
'wing1*aero-chord':c_ref*np.array([np.linspace(1.,1.,2),np.linspace(0.9,0.95,2)]).T},
#c_ref*np.array([np.linspace(1.,1.,3),np.linspace(0.85,1.,3)]).T}
'iterate_labels': {'label_type':'number',
'print_name_var':0}}

g1sm = {'sharpy': {'simulation_input':None,
'default_module':'sharpy.routines.flutter',
'default_solution':'sol_145',
'default_solution_vars': {'panels_wake':8*5,
'num_modes':5,
'rho':1.02,
'u_inf':0.01,
'c_ref':1.8288,
'folder':'./runs',
'velocity_analysis':[70,220,150],
'rom_algorithm':'mimo_rational_arnoldi',
'rom_size':6,
'flow':['BeamLoader',
'AerogridLoader',
'StaticCoupled',
'AerogridPlot',
'Modal',
'LinearAssembler',
'AsymptoticStability',
'PickleData'],
'AerogridPlot':{'folder':'./runs',
'include_rbm': 'off',
'include_applied_forces': 'off',
'minus_m_star': 0},
'PickleData': {'folder':'./runs'},
'LinearAssembler':{'linear_system_settings':{'aero_settings':{'use_sparse':False,
'rom_method':[],
'rom_method_settings':{'Balanced':{'algorithm':'FrequencyLimited'}}},
'beam_settings':{'modal_projection': 'off',
'inout_coords': 'nodes'}},
'inout_coordinates':'nodes'}},
'default_sharpy':{},
'model_route':None}}

g1 = gm.Model('sharpy',['sharpy'], model_dict=g1mm, components_dict=g1cm,
simulation_dict=g1sm)

g1.run()

130 changes: 130 additions & 0 deletions cases/models_generator/examples/a320wing.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
import numpy as np
import os
import sys
import pdb
import importlib
import cases.models_generator.gen_main as gm
from cases.models_generator.gen_utils import node2aero, get_chord
import sharpy.utils.algebra as algebra
importlib.reload(gm)

split_path = [sys.path[i].split('/') for i in range(len(sys.path))]
for i in range(len(split_path)):
if 'sharpy' in split_path[i]:
ind = i
break
sharpy_dir = sys.path[ind]
# aeroelasticity parameters
main_ea = 0.33
main_cg = 0.43
sigma = 1

# other
c_ref = 1.8288

ea, ga = 1e9, 1e9
gj = 0.987581e6
eiy = 9.77221e6
eiz = 1e2 * eiy
base_stiffness = np.diag([ea, ga, ga, sigma * gj, sigma * eiy, eiz])
stiffness1 = np.zeros((1, 6, 6))
stiffness1[0] = base_stiffness
m_unit = 35.71
j_tors = 8.64
pos_cg_b = np.array([0., c_ref * (main_cg - main_ea), 0.])
m_chi_cg = algebra.skew(m_unit * pos_cg_b)
mass1 = np.zeros((1, 6, 6))
mass1[0, :, :] = np.diag([m_unit, m_unit, m_unit,
j_tors, .1 * j_tors, .9 * j_tors])
mass1[0, :3, 3:] = m_chi_cg
mass1[0, 3:, :3] = -m_chi_cg

stiffness2 = stiffness1*0.9
mass2 = mass1*0.9

chord01 = 6.5
ea01 = 0.4
sweep1 = np.pi/180*20
num_node1 = 7
lenght1 = 6.
dl1 = lenght1/num_node1
ledge01 = np.array([-chord01*ea01,0.,0.])
ledge1 = [np.array([dl1*i*np.sin(sweep1), dl1*i*np.cos(sweep1), 0.]) for i in range(num_node1)]
ledge1 = np.array(ledge1) + ledge01
beam1 = [np.array([dl1*i*np.sin(sweep1), dl1*i*np.cos(sweep1), 0.]) for i in range(num_node1)]
beam1 = np.array(beam1)
tedge1 = [np.array([(1.-ea01)*chord01, dl1*i*np.cos(sweep1), 0.]) for i in range(num_node1)]
tedge1 = np.array(tedge1)
ea1, chord1 = get_chord(ledge1, tedge1, beam1)
ea1, chord1 = node2aero(ea1,chord1)
g1c = dict()

g1c['wing_r1'] = {'workflow':['create_structure', 'create_aero'],
'fem': {'stiffness_db':stiffness1,
'mass_db':mass1,
'coordinates':beam1,
'frame_of_reference_delta':[-1, 0., 0.]},
'aero': {'chord':chord1,
'elastic_axis':ea1,
'surface_m':8}
}
g1c['wing_r2'] = {'workflow':['create_structure', 'create_aero'],
'geometry': {'length':14.,
'num_node':15,
'direction':None,
'node0':[0., 0., 0.],
'sweep':sweep1,
'dihedral':0.},
'fem': {'stiffness_db':stiffness2,
'mass_db':mass2,
'frame_of_reference_delta':[-1, 0., 0.]},
'aero': {'chord':[chord1[-1,1],1.6],
'elastic_axis':ea1[-1,1],
'surface_m':8}
}

g1c['wing_l1'] = {'symmetric': {'component':'wing_r1'}}
g1c['wing_l2'] = {'symmetric': {'component':'wing_r2'}}

g1mm = {'model_name':'A320mock',
'model_route':sharpy_dir+'/cases/models_generator/examples/wing_plantform',
'iterate_type': 'DoE', # Full_Factorial
'iterate_vars': {'wing_r2*geometry-sweep':np.linspace(sweep1,sweep1*1.5,2),
'wing_r2*geometry-length':np.linspace(14,18.,2)},
'iterate_labels': {'label_type':'number',
'print_name_var':0},
'assembly': {'include_aero':1,
'default_settings': 1, #beam_number and aero surface and
#surface_distribution
#selected by default one
#per component
'wing_r1':{'upstream_component':'',
'node_in_upstream':0},
'wing_r2':{'boundary_connection':0,
'upstream_component':'wing_r1',
'node_in_upstream':num_node1-1},
'wing_l1':{'upstream_component':'wing_r1',
'node_in_upstream':0},
'wing_l2':{'boundary_connection':0,
'upstream_component':'wing_l1',
'node_in_upstream':num_node1-1},
}
}

g1sm = {'sharpy': {'simulation_input':None,
'default_module':'sharpy.routines.roms',
'default_solution':'sol_500',
'default_solution_vars': {'panels_wake':8*3,
'num_modes':20,
'rho': 1.225,
'u_inf':1.,
'c_ref':3
},
'default_sharpy':{},
'model_route':None}}

g1 = gm.Model('sharpy',['sharpy'], model_dict=g1mm, components_dict=g1c,
simulation_dict=g1sm)
#g1.build()
g1.run()

127 changes: 127 additions & 0 deletions cases/models_generator/examples/goland_wing.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
import numpy as np
import os
import sys
import importlib
import cases.models_generator.gen_main as gm
import sharpy.utils.algebra as algebra
importlib.reload(gm)
from functools import partial

#############################
# Read goland wing from docs #
#############################
split_path = [sys.path[i].split('/') for i in [0,1,2]]
for i in range(len(split_path)):
if 'sharpy' in split_path[i]:
ind = i
break

sharpy_dir = sys.path[ind]
# path2goland = sharpy_dir + '/docs/source/content/example_notebooks/cases'
# goland_files = os.listdir(path2goland)
# for i in goland_files:
# if 'goland' in i and 'sharpy' in i:
# goland_sharpy = i
# elif 'goland' in i and 'fem' in i:
# goland_fem = i
# elif 'goland' in i and 'aero' in i:
# goland_aero = i

# goland = gm.Sharpy_data(['read_structure','read_aero','simulation'])
# goland.read_structure(path2goland+'/'+goland_fem)
# goland.read_aero(path2goland+'/'+goland_aero)
# goland.read_sim(path2goland+'/'+goland_sharpy)

# aeroelasticity parameters
main_ea = 0.33
main_cg = 0.43
sigma = 1
c_ref = 1.8288
ea, ga = 1e9, 1e9
gj = 0.987581e6
eiy = 9.77221e6
eiz = 1e2 * eiy
base_stiffness = np.diag([ea, ga, ga, sigma * gj, sigma * eiy, eiz])
stiffness = np.zeros((1, 6, 6))
stiffness[0] = base_stiffness
m_unit = 35.71
j_tors = 8.64
pos_cg_b = np.array([0., c_ref * (main_cg - main_ea), 0.])
m_chi_cg = algebra.skew(m_unit * pos_cg_b)
mass = np.zeros((1, 6, 6))
mass[0, :, :] = np.diag([m_unit, m_unit, m_unit,
j_tors, .1 * j_tors, .9 * j_tors])
mass[0, :3, 3:] = m_chi_cg
mass[0, 3:, :3] = -m_chi_cg
# goland.fem['stiffness_db'] = stiffness
# goland.fem['mass_db'] = mass
# goland.aero['elastic_axis']
# .
# .
# .

g1c = dict()
g1c['workflow'] = ['create_structure','create_aero']
g1c['geometry'] = {'length':6.096,
'num_node':9,
'direction':None,
'node0':[0., 0., 0.],
'sweep':0.,
'dihedral':0.}
g1c['fem'] = {'stiffness_db':stiffness,
'mass_db':mass,
'frame_of_reference_delta':[-1.,0.,0.]}
g1c['aero'] = {'chord':c_ref,
'elastic_axis':main_ea,
'surface_m':8}

comp1 = gm.Components('wing1','sharpy',['sharpy'],g1c)
g1cm = {'wing1':g1c}
g1mm = {'model_name':'goland_b',
'model_route':'/mnt/work/Programs/runs/goland_wing',#sharpy_dir+'/cases/models_generator/examples/goland_wing',
'iterate_type': 'Full_Factorial',
'iterate_vars': {'wing1*geometry-sweep':np.linspace(15.5*np.pi/180,19.5*np.pi/180,5), #np.linspace(15*np.pi/180,20*np.pi/180,6)
'wing1*geometry-length':6.096*np.linspace(1.025,1.275,6), #6.096*np.linspace(1,1.3,7)
'wing1*aero-chord':c_ref*np.array([np.linspace(1.,1.,2),np.linspace(0.9,0.95,2)]).T},
#c_ref*np.array([np.linspace(1.,1.,3),np.linspace(0.85,1.,3)]).T}
'iterate_labels': {'label_type':'number',
'print_name_var':0}}

g1sm = {'sharpy': {'simulation_input':None,
'default_module':'sharpy.routines.flutter',
'default_solution':'sol_145',
'default_solution_vars': {'panels_wake':8*5,
'num_modes':5,
'rho':1.02,
'u_inf':0.01,
'c_ref':1.8288,
'folder':'./runs',
'velocity_analysis':[70,220,150],
'rom_algorithm':'mimo_rational_arnoldi',
'rom_size':6,
'flow':['BeamLoader',
'AerogridLoader',
'StaticCoupled',
'AerogridPlot',
'Modal',
'LinearAssembler',
'AsymptoticStability',
'PickleData'],
'AerogridPlot':{'folder':'./runs',
'include_rbm': 'off',
'include_applied_forces': 'off',
'minus_m_star': 0},
'PickleData': {'folder':'./runs'},
'LinearAssembler':{'linear_system_settings':{'aero_settings':{'use_sparse':False,
'rom_method':[],
'rom_method_settings':{'Balanced':{'algorithm':'FrequencyLimited'}}},
'beam_settings':{'modal_projection': 'off',
'inout_coords': 'nodes'}},
'inout_coordinates':'nodes'}},
'default_sharpy':{},
'model_route':None}}

g1 = gm.Model('sharpy',['sharpy'], model_dict=g1mm, components_dict=g1cm,
simulation_dict=g1sm)
g1.run()

Loading