Skip to content

Commit

Permalink
Modified readVABSOutHomo function to work on both variable and old di…
Browse files Browse the repository at this point in the history
…c format, so that it won't cause any issue for existing code
  • Loading branch information
tfei committed Aug 26, 2020
1 parent f013c0c commit 1ff938c
Showing 1 changed file with 23 additions and 3 deletions.
26 changes: 23 additions & 3 deletions io/iovabs.py
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,8 @@ def readVABSOutHomo(fn, scrnout=True):
keywordsIndex['sc'] = lineNumber
if 'Mass Per Unit Span' in line:
sm.density = float(line.split('=')[-1].strip())
#old dic method to save density
sm.eff_props[1]['density'] = float(line.split('=')[-1].strip())
if 'Classical Stiffness Matrix' in line:
keywordsIndex['csm'] = lineNumber
if 'Classical Flexibility Matrix' in line:
Expand Down Expand Up @@ -300,13 +302,21 @@ def readVABSOutHomo(fn, scrnout=True):
sm.shear_center = [
float(linesRead[ln + 3].split()[-1]), float(linesRead[ln + 4].split()[-1])
]

#old dic method to save shear center
sm.eff_props[1]['shearcenter'] = [
float(linesRead[ln + 3].split()[-1]), float(linesRead[ln + 4].split()[-1])
]

ln = keywordsIndex['mass']
sm.mass_origin = utl.textToMatrix(linesRead[ln + 3:ln + 9])
#old dic method to save mass origin
sm.eff_props[1]['mass']['origin'] = utl.textToMatrix(linesRead[ln + 3:ln + 9])

try:
ln = keywordsIndex['massatcenter']
sm.mass_mc = utl.textToMatrix(linesRead[ln + 3:ln + 9])
#old dic method to save mass center
sm.eff_props[1]['mass']['masscenter'] = utl.textToMatrix(linesRead[ln + 3:ln + 9])
except KeyError:
sm.mass_mc = sm.mass_origin

Expand All @@ -316,6 +326,8 @@ def readVABSOutHomo(fn, scrnout=True):
try:
ln = keywordsIndex['vsm']
sm.stiffness_refined = utl.textToMatrix(linesRead[ln + 3:ln + 8])
#old dic to save valsov stiffness matrix
sm.eff_props[1]['stiffness']['refined'] = utl.textToMatrix(linesRead[ln + 3:ln + 8])
except KeyError:
if scrnout:
print('No Vlasov stiffness matrix found.')
Expand All @@ -324,6 +336,8 @@ def readVABSOutHomo(fn, scrnout=True):
try:
ln = keywordsIndex['vfm']
sm.compliance_refined = utl.textToMatrix(linesRead[ln + 3:ln + 8])
#old dic to save valsov compliance matrix
sm.eff_props[1]['compliance']['refined'] = utl.textToMatrix(linesRead[ln + 3:ln + 8])
except KeyError:
if scrnout:
print('No Vlasov flexibility matrix found.')
Expand Down Expand Up @@ -367,6 +381,8 @@ def readVABSOutHomo(fn, scrnout=True):
try:
ln = keywordsIndex['csm']
sm.stiffness = utl.textToMatrix(linesRead[ln + 3:ln + 7])
#old dic method to save classical stiffness
sm.eff_props[1]['stiffness']['classical'] = utl.textToMatrix(linesRead[ln + 3:ln + 7])
except KeyError:
if scrnout:
print('No Classical stiffness matrix found.')
Expand All @@ -376,6 +392,8 @@ def readVABSOutHomo(fn, scrnout=True):
try:
ln = keywordsIndex['cfm']
sm.compliance = utl.textToMatrix(linesRead[ln + 3:ln + 7])
#old dic method to save classical compliance
sm.eff_props[1]['compliance']['classical'] = utl.textToMatrix(linesRead[ln + 3:ln + 7])
except KeyError:
if scrnout:
print('No Classical flexibility matrix found.')
Expand All @@ -385,7 +403,8 @@ def readVABSOutHomo(fn, scrnout=True):
try:
ln = keywordsIndex['tsm']
sm.stiffness_refined = utl.textToMatrix(linesRead[ln + 3:ln + 9])
# sm.eff_props[1]['stiffness']['refined'] = utl.textToMatrix(linesRead[ln + 3:ln + 9])
#old dic method to save refined stiffness matrix
sm.eff_props[1]['stiffness']['refined'] = utl.textToMatrix(linesRead[ln + 3:ln + 9])
except KeyError:
if scrnout:
print('No timoshenko stiffness matrix found.')
Expand All @@ -394,7 +413,8 @@ def readVABSOutHomo(fn, scrnout=True):
try:
ln = keywordsIndex['tfm']
sm.compliance_refined = utl.textToMatrix(linesRead[ln + 3:ln + 9])
# sm.eff_props[1]['compliance']['refined'] = utl.textToMatrix(linesRead[ln + 3:ln + 9])
#old dic method to save refined compliance matrix
sm.eff_props[1]['compliance']['refined'] = utl.textToMatrix(linesRead[ln + 3:ln + 9])
except KeyError:
if scrnout:
print('No timoshenko flexibility matrix found.')
Expand Down

0 comments on commit 1ff938c

Please sign in to comment.