Skip to content
This repository has been archived by the owner on Nov 27, 2023. It is now read-only.

Commit

Permalink
Converter: adding quick and dirty elastodyn 2 hawc2
Browse files Browse the repository at this point in the history
  • Loading branch information
ebranlard committed Jun 16, 2023
1 parent ec1d90a commit 0c4ea8f
Show file tree
Hide file tree
Showing 5 changed files with 1,045 additions and 47 deletions.
25 changes: 14 additions & 11 deletions pyFAST/converters/beamDynToHawc2.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
from pyFAST.converters.beam import ComputeStiffnessProps, TransformCrossSectionMatrix

from .beam import *
from .hawc2 import dfstructure2stfile


def arc_length(points):
Expand Down Expand Up @@ -141,17 +142,19 @@ def beamDynToHawc2(BD_mainfile, BD_bladefile, H2_htcfile=None, H2_stfile=None, b
pass
if verbose:
print('Writing: ',H2_stfile)
with open(H2_stfile, 'w') as f:
f.write('%i ; number of sets, Nset\n' % 1)
f.write('-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\n')
f.write('#%i ; set number\n' % 1)
if FPM:
cols=['r_[m]','m_[kg/m]','x_cg_[m]','y_cg_[m]','ri_x_[m]','ri_y_[m]','pitch_[deg]','x_e_[m]','y_e_[m]','K11','K12','K13','K14','K15','K16','K22','K23','K24','K25','K26','K33','K34','K35','K36','K44','K45','K46','K55','K56','K66']
else:
cols=['r_[m]','m_[kg/m]','x_cg_[m]','y_cg_[m]','ri_x_[m]','ri_y_[m]', 'x_sh_[m]','y_sh_[m]','E_[N/m^2]','G_[N/m^2]','I_x_[m^4]','I_y_[m^4]','I_p_[m^4]','k_x_[-]','k_y_[-]','A_[m^2]','pitch_[deg]','x_e_[m]','y_e_[m]']
f.write('\t'.join(['{:20s}'.format(s) for s in cols])+'\n')
f.write('$%i %i\n' % (1, dfStructure.shape[0]))
f.write('\n'.join('\t'.join('%19.13e' %x for x in y) for y in dfStructure.values))

dfstructure2stfile(dfStructure, H2_stfile)
#with open(H2_stfile, 'w') as f:
# f.write('%i ; number of sets, Nset\n' % 1)
# f.write('-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\n')
# f.write('#%i ; set number\n' % 1)
# if FPM:
# cols=['r_[m]','m_[kg/m]','x_cg_[m]','y_cg_[m]','ri_x_[m]','ri_y_[m]','pitch_[deg]','x_e_[m]','y_e_[m]','K11','K12','K13','K14','K15','K16','K22','K23','K24','K25','K26','K33','K34','K35','K36','K44','K45','K46','K55','K56','K66']
# else:
# cols=['r_[m]','m_[kg/m]','x_cg_[m]','y_cg_[m]','ri_x_[m]','ri_y_[m]', 'x_sh_[m]','y_sh_[m]','E_[N/m^2]','G_[N/m^2]','I_x_[m^4]','I_y_[m^4]','I_p_[m^4]','k_x_[-]','k_y_[-]','A_[m^2]','pitch_[deg]','x_e_[m]','y_e_[m]']
# f.write('\t'.join(['{:20s}'.format(s) for s in cols])+'\n')
# f.write('$%i %i\n' % (1, dfStructure.shape[0]))
# f.write('\n'.join('\t'.join('%19.13e' %x for x in y) for y in dfStructure.values))

# --- Rewrite htc file
if H2_htcfile is not None:
Expand Down
Loading

0 comments on commit 0c4ea8f

Please sign in to comment.