jobName = AdaptiveJobName except: # Error thrown because file does not exist. If lastIter > 1, this means the analysis # completed before the max number allowed. Decrease lastIter and try opening again. logger.info( 'ERROR: Error in reading results of %s.\n' % AdaptiveJobName) lastIter -= 1 os.chdir(solverDir) # Invoke post processing # Spawn new Python process by calling the post-processing script along with necessary arguments. os.system("abaqus cae noGUI=" + os.path.join( cad_library.META_PATH, "bin", "CAD", postprocessingScript) + " -- " + "-o " + jobName + ".odb " + "-p " + "..\\" + analysisMetaDataXML + " -m " + "..\\..\\" + requestedMetricsXML + " -j " + "..\\..\\" + testbench_manifest) elif args.modal: # Modal analyses use a different, older post-processing method as the output ODB is analyzed different. ABQ_CompletePostProcess.afterJobModal(jobName, analysisStepName) if __name__ == "__main__": logger = cad_library.setuplogger('AbaqusCmd') # Initialize logger try: main() except: # Overarching try, catch. Used to handle any unexpected errors. cad_library.exitwitherror('An unknown exception occurred.', -1, 'AbaqusMain.py')
exit(1) return odb, metaDataFile, reqMetricsFile, resultsJson, adamsrun # =================================================================================================== # =================================================================================================== # START # if __name__ == '__main__': global gVersion if not os.path.isdir('log'): os.makedirs('log') gLogger = cad_library.setuplogger('ABQ_CompletePostProcess') odbName, metaDataFilePath, reqMetricsFilePath, resultsJsonPath, adams = ParseArgs( ) componentList = ComputedMetricsSummary.ParseMetaDataFile( metaDataFilePath, odbName, adams) reqMetrics = ComputedMetricsSummary.ParseReqMetricsFile( reqMetricsFilePath, componentList) CalculateMetrics(odbName, componentList, reqMetrics) computedValuesXml = ComputedMetricsSummary.WriteXMLFile(componentList) ComputedMetricsSummary.WriteMetric2File(componentList) UpdateReportJson_CAD.update_manifest(resultsJsonPath, computedValuesXml) if adams: utility_functions.CopyOrDeleteResults(odbName, resultsJsonPath, True) else: utility_functions.CopyOrDeleteResults(odbName, resultsJsonPath)
i += 1 metaDataFile = os.path.join(os.getcwd(), argList[i]) elif argList[i][:2] == '-m': i += 1 reqMetricsFile = os.path.join(os.getcwd(), argList[i]) elif argList[i][:2] == '-j': i += 1 resultsJson = os.path.join(os.getcwd(), argList[i]) elif argList[i][:2] == '-e': i += 1 elementMap = os.path.join(os.getcwd(), argList[i]) i += 1 if not any([frd, metaDataFile, reqMetricsFile, resultsJson, elementMap]): exit(1) return frd, metaDataFile, reqMetricsFile, resultsJson, elementMap if __name__ == '__main__': if not os.path.isdir('log'): os.makedirs('log') gLogger = cad_library.setuplogger('CalculixPostProcess.log') frdName, metaDataFilePath, reqMetricsFilePath, resultsJsonPath, elementMapPath = ParseArgs() componentList = ComputedMetricsSummary.ParseMetaDataFile(metaDataFilePath, frdName, False) reqMetrics = ComputedMetricsSummary.ParseReqMetricsFile(reqMetricsFilePath, componentList) CalculateMetrics(frdName, componentList, reqMetricsFilePath, elementMapPath) computedValuesXml = ComputedMetricsSummary.WriteXMLFile(componentList) ComputedMetricsSummary.WriteMetric2File(componentList) UpdateReportJson_CAD.update_manifest(resultsJsonPath, computedValuesXml) utility_functions.CopyOrDeleteResults(frdName, resultsJsonPath)
i += 1 if not any([odb, metaDataFile, reqMetricsFile, resultsJson]): exit(1) return odb, metaDataFile, reqMetricsFile, resultsJson, adamsrun # =================================================================================================== # =================================================================================================== # START # if __name__ == '__main__': global gVersion if not os.path.isdir('log'): os.makedirs('log') gLogger = cad_library.setuplogger('ABQ_CompletePostProcess') odbName, metaDataFilePath, reqMetricsFilePath, resultsJsonPath, adams = ParseArgs() componentList = ComputedMetricsSummary.ParseMetaDataFile(metaDataFilePath, odbName, adams) reqMetrics = ComputedMetricsSummary.ParseReqMetricsFile(reqMetricsFilePath, componentList) CalculateMetrics(odbName, componentList, reqMetrics) computedValuesXml = ComputedMetricsSummary.WriteXMLFile(componentList) ComputedMetricsSummary.WriteMetric2File(componentList) UpdateReportJson_CAD.update_manifest(resultsJsonPath, computedValuesXml) if adams: utility_functions.CopyOrDeleteResults(odbName, resultsJsonPath, True) else: utility_functions.CopyOrDeleteResults(odbName, resultsJsonPath)
while lastIter > 0 and check == 0: try: AdaptiveJobName = "Adaptivity-1-iter" + str(lastIter) odbAccess.openOdb(path=AdaptiveJobName + '.odb') check = 1 jobName = AdaptiveJobName except: # Error thrown because file does not exist. If lastIter > 1, this means the analysis # completed before the max number allowed. Decrease lastIter and try opening again. logger.info('ERROR: Error in reading results of %s.\n' % AdaptiveJobName) lastIter -= 1 os.chdir(solverDir) # Invoke post processing # Spawn new Python process by calling the post-processing script along with necessary arguments. os.system("abaqus cae noGUI=" + os.path.join(cad_library.META_PATH, "bin", "CAD", postprocessingScript) + " -- " + "-o " + jobName + ".odb " + "-p " + "..\\" + analysisMetaDataXML + " -m " + "..\\..\\" + requestedMetricsXML + " -j " + "..\\..\\" + testbench_manifest) elif args.modal: # Modal analyses use a different, older post-processing method as the output ODB is analyzed different. ABQ_CompletePostProcess.afterJobModal(jobName, analysisStepName) if __name__ == "__main__": logger = cad_library.setuplogger('AbaqusCmd') # Initialize logger try: main() except: # Overarching try, catch. Used to handle any unexpected errors. cad_library.exitwitherror('An unknown exception occurred.', -1, 'AbaqusMain.py')