Skip to content

Commit

Permalink
Set to version 5.1.4
Browse files Browse the repository at this point in the history
Bug on cylinder bending stresses.
  • Loading branch information
audunarn committed Mar 1, 2024
1 parent 839b629 commit 17cdaa8
Show file tree
Hide file tree
Showing 5 changed files with 110 additions and 53 deletions.
2 changes: 1 addition & 1 deletion __init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# __init__.py
# Project information.
__title__ = 'ANYstructure'
__version__ = '5.1.3'
__version__ = '5.1.4'
__author__ = 'Audun Arnesen Nyhus'
__license__ = 'MIT'
5 changes: 3 additions & 2 deletions anystruct/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -387,8 +387,9 @@ def __init__(self, calculation_domain: str = 'Unstiffened shell'):
:type calculation_domain: str
'''
super().__init__()
assert calculation_domain in self.geotypes, 'Geometry type must be either of: '+ str(self.geotypes)
assert calculation_domain in self.geotypes, 'Geometry type must be either of: ' + str(self.geotypes)
self._load_type = 'Stress' if 'panel' in calculation_domain else 'Force'

self._calculation_domain = calculation_domain + ' (' + self._load_type + ' input)'
self._CylinderMain = CylinderAndCurvedPlate()
self._CylinderMain.geometry = CylinderAndCurvedPlate.geomeries_map_no_input_spec[calculation_domain]
Expand Down Expand Up @@ -656,7 +657,7 @@ def set_longitudinal_stiffener(self, hw: float = 260, tw: float = 12, bf: float
self._CylinderMain.LongStfObj.b = bf
self._CylinderMain.LongStfObj.tf = tf
self._CylinderMain.LongStfObj.stiffener_type = 'L-bulb' if stf_type in ['hp HP HP-bulb bulb'] else stf_type
self._CylinderMain.LongStfObj.s = spacing
self._CylinderMain.LongStfObj.spacing = spacing
self._CylinderMain.LongStfObj.t = self._CylinderMain.ShellObj.thk

def set_ring_stiffener(self, hw: float = 260, tw: float = 12, bf: float = 49,
Expand Down
145 changes: 99 additions & 46 deletions anystruct/buckling_calc_external.py
Original file line number Diff line number Diff line change
@@ -1,47 +1,100 @@
from api import CylStru
import pandas as pd
import numpy as np
# Not used in releases

def get_stresses(file = 'C:\DNV\RTHfisk\stress_results.txt'):
pd_data = pd.read_csv(file,header=0, sep=r'\t', engine='python', na_values = 'N/A')
pd_data.columns = [val.strip() for val in pd_data.columns.values]
# for val in pd_data.iterrows():
# print(val[1])
# quit()
return pd_data


def calc_buckling(stresses):
res_list = list()
for val in stresses.iterrows():

my_cyl = CylStru(calculation_domain='Unstiffened panel')
my_cyl.set_stresses(sasd=val[1].SIGMX/1e6, tQsd=abs(val[1].TAUMXY)/1e6, shsd=val[1].SIGMY/1e6)
my_cyl.set_material(mat_yield=355, emodule=210000, material_factor=1, poisson=0.3)
my_cyl.set_imperfection()
my_cyl.set_fabrication_method()
my_cyl.set_end_cap_pressure_included_in_stress(is_included=True)
my_cyl.set_uls_or_als(kind='ALS')
#my_cyl.set_exclude_ring_stiffener()
#my_cyl.set_length_between_girder(val=8000)
my_cyl.set_panel_spacing(val=3140)
my_cyl.set_shell_geometry(radius=1000,thickness=1000*val[1].Thickness, tot_length_of_shell=8500,
distance_between_rings=8500)
#my_cyl.set_longitudinal_stiffener(hw=260, tw=23, bf=49, tf=28, spacing=680)
#my_cyl.set_ring_girder(hw=500, tw=15, bf=200, tf=25, stf_type='T', spacing=700)
my_cyl.set_shell_buckling_parmeters()
results = my_cyl.get_buckling_results()
res_list.append((val[1].Case, val[1]['X-coord'], val[1]['Y-coord'], val[1]['Z-coord'],
val[1].Thickness, val[1].SIGMX, val[1].SIGMY, val[1].TAUMXY, val[1].Element,
results['Unstiffened shell']))

final_pd = pd.DataFrame(res_list, columns=['Load case', 'x', 'y', 'z', 'thk', 'sigx', 'sigy', 'tauxy',
'Element', 'UF'])
final_pd.to_csv(r'C:\DNV\RTHfisk\buckling_res.csv')

def read_generated_csv(file = r'C:\DNV\RTHfisk\|.csv'):
data = pd.read_csv(file, index_col=0)
return data
if __name__ == '__main__':
#stresses = read_generated_csv()
stresses = get_stresses()
buckling = calc_buckling(stresses=stresses)
# from api import CylStru
# import pandas as pd
#
# def get_stresses(file = 'C:\DNV\RTHfisk\stress_results.txt'):
# if 'txt' in file:
# pd_data = pd.read_csv(file,header=0, sep=r'\t', engine='python', na_values = 'N/A')
# pd_data.columns = [val.strip() for val in pd_data.columns.values]
# else:
# pd_data = pd.read_excel(file)
# # for val in pd_data.iterrows():
# # print(val[1])
# # quit()
# return pd_data
#
# def calc_buckling_single(val):
#
# my_cyl = CylStru(calculation_domain='Longitudinal Stiffened panel')
# my_cyl.set_stresses(smsd=val[1].SIGMX / 1e6, tQsd=abs(val[1].TAUMXY) / 1e6, shsd=val[1].SIGMY / 1e6)
# my_cyl.set_material(mat_yield=355, emodule=210000, material_factor=1.1, poisson=0.3)
# my_cyl.set_imperfection()
# my_cyl.set_fabrication_method()
# my_cyl.set_end_cap_pressure_included_in_stress(is_included=True)
# my_cyl.set_uls_or_als(kind='ULS')
# # my_cyl.set_exclude_ring_stiffener()
# my_cyl.set_length_between_girder(val=3300)
# my_cyl.set_panel_spacing(val=680)
# my_cyl.set_shell_geometry(radius=13000 / 2, thickness=1000 * val[1].Thickness, tot_length_of_shell=30000,
# distance_between_rings=3300)
# my_cyl.set_longitudinal_stiffener(hw=260, tw=12, bf=49, tf=28, spacing=680)
# # my_cyl.set_ring_girder(hw=500, tw=15, bf=200, tf=25, stf_type='T', spacing=700)
# my_cyl.set_shell_buckling_parmeters()
# results = my_cyl.get_buckling_results()
# scan_idx = tuple(val[1].ScanIndex.split(','))[1].replace(' ','')
# return [scan_idx, val[1]['X-coord'], val[1]['Y-coord'], val[1]['Z-coord'],
# val[1].Thickness, val[1].SIGMX, val[1].SIGMY, val[1].TAUMXY, val[1].Element,
# results['Unstiffened shell'], results['Longitudinal stiffened shell'], results['Ring stiffened shell'],
# max([val for val in [results['Unstiffened shell'], results['Longitudinal stiffened shell'],
# results['Ring stiffened shell']] if val is not None])]
#
# def calc_buckling(stresses):
# res_list = list()
# for val in stresses.iterrows():
#
# my_cyl = CylStru(calculation_domain='Longitudinal Stiffened shell')
# my_cyl.set_stresses(sasd=val[1].SIGMX/1e6, tQsd=abs(val[1].TAUMXY)/1e6, shsd=val[1].SIGMY/1e6)
# my_cyl.set_material(mat_yield=355, emodule=210000, material_factor=1.1, poisson=0.3)
# my_cyl.set_imperfection()
# my_cyl.set_fabrication_method()
# my_cyl.set_end_cap_pressure_included_in_stress(is_included=True)
# my_cyl.set_uls_or_als(kind='ULS')
# #my_cyl.set_exclude_ring_stiffener()
# #my_cyl.set_length_between_girder(val=8000)
# my_cyl.set_panel_spacing(val=680)
# my_cyl.set_shell_geometry(radius=13000/2,thickness=1000*val[1].Thickness, tot_length_of_shell=30000,
# distance_between_rings=3300)
# my_cyl.set_longitudinal_stiffener(hw=260, tw=23, bf=49, tf=28, spacing=680)
# #my_cyl.set_ring_girder(hw=500, tw=15, bf=200, tf=25, stf_type='T', spacing=700)
# my_cyl.set_shell_buckling_parmeters()
# results = my_cyl.get_buckling_results()
# res_list.append((val[1].Case, val[1]['X-coord'], val[1]['Y-coord'], val[1]['Z-coord'],
# val[1].Thickness, val[1].SIGMX, val[1].SIGMY, val[1].TAUMXY, val[1].Element,
# results['Unstiffened shell']))
#
# final_pd = pd.DataFrame(res_list, columns=['Load case', 'x', 'y', 'z', 'Thickness', 'SIGMX', 'SIGMY', 'TAUMXY',
# 'Element', 'UF'])
# final_pd.to_csv(r'C:\DNV\RTHfisk\buckling_res.csv')
#
# def read_generated_csv(file = r'C:\DNV\RTHfisk\|.csv'):
# data = pd.read_csv(file, index_col=0)
# return data
#
# def calc_cyl_buckling_from_folder(folder, files, add_to_file_name: str = ''):
# reslist = list()
# for file in files:
# stress_file = get_stresses(folder + file)
# for stress in stress_file.iterrows():
# this_result = calc_buckling_single(stress)
# element = this_result[8]
# this_result.insert(0, file)
# this_result.insert(0, str(element)+ '_' + file)
# reslist.append(tuple(this_result))
#
# all_res = pd.DataFrame(reslist, columns=['id', 'File', 'ScanIndex', 'x', 'y', 'z', 'thk', 'SIGMX', 'SIGMY',
# 'TAUMXY', 'Element', 'Unstiffened shell', 'Longitudinal stiffened shell',
# 'Ring stiffened shell', 'Max UF'])
# all_res.to_excel(folder + 'buckling_results' + add_to_file_name+'.xlsx')
#
#
# if __name__ == '__main__':
# #stresses = read_generated_csv()
# # stresses = get_stresses()
# # buckling = calc_buckling(stresses=stresses)
#
# folder = 'C:\DNV\Workspaces\\OV15MW_Disc25m\\GenieeGen2_Det_NoCone\\Analysis_max_min_1\\'
# files = ['Dstress_TAUXY_absmax', 'Dstress_SIGMY_max', 'Dstress_SIGMY_min', 'Dstress_SIGMX_max', 'Dstress_SIGMX_min']
# files = [file + '.txt' for file in files]
# calc_cyl_buckling_from_folder(folder, files, add_to_file_name='_bending')
9 changes: 6 additions & 3 deletions anystruct/calc_structure.py
Original file line number Diff line number Diff line change
Expand Up @@ -3287,7 +3287,9 @@ def unstiffened_shell(self, conical = False, shell_data = None):
fy = self._mat_yield/1e6
sasd = self._sasd/1e6
smsd = self._smsd/1e6

tsd = abs(self._tTsd/1e6+self._tQsd/1e6)

psd = self._psd/1e6

if self._RingStf is None:
Expand All @@ -3297,6 +3299,7 @@ def unstiffened_shell(self, conical = False, shell_data = None):

provide_data = dict()


'''
Selections for: Type of Structure Geometry:
1 Unstiffened shell (Force input)
Expand All @@ -3319,8 +3322,9 @@ def unstiffened_shell(self, conical = False, shell_data = None):
sxsd = min(sasd, sasd+smsd, sasd-smsd)

if smsd < 0:
smsd = -smsd
sm0sd = -smsd
smsd = abs(smsd)
sm0sd = abs(smsd)

else:
if geometry in [2, 6]:
smsd = 0
Expand Down Expand Up @@ -3493,7 +3497,6 @@ def table_3_2(chk):
else:
lambda_s_pow = (fy/sjsd) * (sa0sd/fEax + sm0sd/fEbend + sh0sd/fEh_used + tsd/fEt_used)


lambda_s = math.sqrt(lambda_s_pow)
fks = fy/math.sqrt(1+math.pow(lambda_s,4 ))

Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def readme():
name='ANYstructure', # Required
url = 'https://github.com/audunarn/ANYstructure',
entry_points={"console_scripts": ['ANYstructure = anystruct.__main__:main']},
version='5.1.3', # Required
version='5.1.4', # Required
license='MIT',
description='A plate field optimization tool for offshore structures calculated according to DNV standards',
long_description = readme(),
Expand Down

0 comments on commit 17cdaa8

Please sign in to comment.