Skip to content

Commit

Permalink
0616
Browse files Browse the repository at this point in the history
  • Loading branch information
tian50 committed Jun 16, 2021
1 parent 6878d6b commit 057ad12
Show file tree
Hide file tree
Showing 23 changed files with 123,098 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
1.3.0

- Added logging and timing functions
- Added a new io function for reading VABS failure analysis results
- Updated the BeamProperty class
- Updated the readVABSOutHomo function for the latest VABS output format

Expand Down
5 changes: 5 additions & 0 deletions msgpi/analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,9 @@ def solve(sg_xml, analysis, ppcmd, solver, timeout=30, scrnout=True, logger=None
logger.info('reading results...')
if timer:
timer.start()
if solver == 'vabs':
return miovabs.readVABSOut(sg_in, analysis, scrnout)

if analysis == 'h':
if solver == 'vabs':
bp = miovabs.readVABSOutHomo(sg_in + '.K')
Expand Down Expand Up @@ -146,6 +149,8 @@ def run(input_name, analysis, solver, smdim, scrnout=True, logger=None):
if solver == 'vabs':
# solver = solver + 'iii'
cmd = ['VABSIII', input_name]
if analysis == 'fi' or analysis == 3:
cmd.append('3')
elif solver == 'swiftcomp':
cmd = ['SwiftComp', input_name]

Expand Down
58 changes: 58 additions & 0 deletions msgpi/io/iovabs.py
Original file line number Diff line number Diff line change
Expand Up @@ -509,6 +509,64 @@ def readVABSOutHomo(fn, scrnout=True):
return bp









def readVABSOutStrengthRatio(fn_in):
lines = []
sr_min = None
with open(fn_in, 'r') as fin:
for i, line in enumerate(fin):
if (line.strip() == ''):
continue
lines.append(line)
# initial failure indices and strength ratios
if (line.strip().startswith('The sectional strength ratio is')):
line = line.strip().split()
tmp_id = line.index('existing')
sr_min = float(line[tmp_id - 1])
lines.pop()


# initial failure indices and strength ratios
fis = []
srs = []
for line in lines:
line = line.strip().split()
# results.append([int(line[0]), float(line[1]), float(line[2])])
fis.append(float(line[1]))
srs.append(float(line[2]))
return fis, srs, sr_min









def readVABSOut(fn_in, analysis=0, scrnout=True):
if analysis == 0 or analysis == 'h':
# Read homogenization results
return readVABSOutHomo(fn_in+'.k', scrnout)
elif analysis == 1 or analysis == 2 or analysis == 'd':
pass
elif analysis == 3 or analysis == 'fi':
return readVABSOutStrengthRatio(fn_in+'.fi')









# ====================================================================
#
#
Expand Down
Loading

0 comments on commit 057ad12

Please sign in to comment.