def saveAll(self, feProblem, combContainer, setCalc, fConvIntForc=1.0, analysisToPerform=defaultAnalysis): '''Write internal forces, displacements, .., for each combination :param feProblem: XC finite element problem to deal with. :param setCalc: set of entities for which the verification is going to be performed :param fConvIntForc: conversion factor between the unit of force in which the calculation is performed and that one desired for the displaying of internal forces (The use of this factor won't be allowed in future versions) ''' if fConvIntForc != 1.0: lmsg.warning('fConvIntForc= ' + fConvIntForc + 'conversion factor between units is DEPRECATED') preprocessor = feProblem.getPreprocessor loadCombinations = preprocessor.getLoadHandler.getLoadCombinations #Putting combinations inside XC. loadCombinations = self.dumpCombinations(combContainer, loadCombinations) elemSet = setCalc.getElements nodSet = setCalc.getNodes fNameInfForc = self.getInternalForcesFileName() fNameDispl = self.getDisplacementsFileName() os.system("rm -f " + fNameInfForc) #Clear obsolete files. os.system("rm -f " + fNameDispl) fIntF = open(fNameInfForc, "a") fDisp = open(fNameDispl, "a") fIntF.write(" Comb. , Elem. , Sect. , N , Vy , Vz , T , My , Mz \n") fDisp.write(" Comb. , Node , Ux , Uy , Uz , ROTx , ROTy , ROTz \n") fIntF.close() fDisp.close() for key in loadCombinations.getKeys(): comb = loadCombinations[key] feProblem.getPreprocessor.resetLoadCase() comb.addToDomain() #Combination to analyze. #Solution result = analysisToPerform(feProblem) #Writing results. fIntF = open(fNameInfForc, "a") fDisp = open(fNameDispl, "a") eif.exportInternalForces(comb.getName, elemSet, fIntF) edisp.exportDisplacements(comb.getName, nodSet, fDisp) fIntF.close() fDisp.close() comb.removeFromDomain() #Remove combination from the model.
def saveAll(self,feProblem,combContainer,setCalc,fConvIntForc= 1.0,analysisToPerform= defaultAnalysis,lstSteelBeams=None): '''Write internal forces, displacements, .., for each combination :param feProblem: XC finite element problem to deal with. :param setCalc: set of entities for which the verification is going to be performed :param fConvIntForc: conversion factor between the unit of force in which the calculation is performed and that one desired for the displaying of internal forces (The use of this factor won't be allowed in future versions) :param lstSteelBeams: list of steel beams to analyze (defaults to None) ''' if fConvIntForc != 1.0: lmsg.warning('fConvIntForc= ' + fConvIntForc + 'conversion factor between units is DEPRECATED' ) preprocessor= feProblem.getPreprocessor loadCombinations= preprocessor.getLoadHandler.getLoadCombinations #Putting combinations inside XC. loadCombinations= self.dumpCombinations(combContainer,loadCombinations) elemSet= setCalc.getElements nodSet= setCalc.getNodes fNameInfForc= self.getInternalForcesFileName() fNameDispl= self.getDisplacementsFileName() os.system("rm -f " + fNameInfForc) #Clear obsolete files. os.system("rm -f " + fNameDispl) fIntF= open(fNameInfForc,"a") fDisp= open(fNameDispl,"a") if lstSteelBeams: fIntF.write(" Comb. , Elem. , Sect. , N , Vy , Vz , T , My , Mz ,chiLT\n") else: fIntF.write(" Comb. , Elem. , Sect. , N , Vy , Vz , T , My , Mz \n") fDisp.write(" Comb. , Node , Ux , Uy , Uz , ROTx , ROTy , ROTz \n") fIntF.close() fDisp.close() for key in loadCombinations.getKeys(): comb= loadCombinations[key] feProblem.getPreprocessor.resetLoadCase() comb.addToDomain() #Combination to analyze. #Solution result= analysisToPerform(feProblem) if lstSteelBeams: for sb in lstSteelBeams: sb.updateLateralBucklingReductionFactor() #Writing results. fIntF= open(fNameInfForc,"a") fDisp= open(fNameDispl,"a") eif.exportInternalForces(comb.getName,elemSet,fIntF) edisp.exportDisplacements(comb.getName,nodSet,fDisp) fIntF.close() fDisp.close() comb.removeFromDomain() #Remove combination from the model.
nElems = f1.getNumElements #We add the load case to domain. lPatterns.addToDomain(lp0.name) # Solution procedure analisis = predefined_solutions.simple_static_linear(feProblem) analOk = analisis.analyze(1) f1 = preprocessor.getSets.getSet("f1") from postprocess.reports import export_internal_forces setTotal = preprocessor.getSets["total"] fName = "/tmp/test_export_shell_internal_forces.txt" f = open(fName, "w") export_internal_forces.exportInternalForces("test", setTotal.getElements, f) f.close() mean = [ internal_forces.CrossSectionInternalForces(), internal_forces.CrossSectionInternalForces() ] nCols = len(mean) nRows = 0 import csv cr = csv.reader(open(fName, "rb")) for row in cr: nRows += 1 sectionIndex = eval(row[2]) mean[sectionIndex] += internal_forces.CrossSectionInternalForces( eval(row[3]), eval(row[4]), eval(row[5]), eval(row[6]), eval(row[7]),