コード例 #1
0
ファイル: abaqus.py プロジェクト: kangwonlee/mechpy
 def xplot_history(self, s, x):
     """plots the historys based on a list
     x = 'Reaction force: RF1 at Node 58 in NSET SET-NODE-BOTTOM'
     
     Building the input from info from the odb
     
     
     """
     sName = self.myOdbDat.steps.keys()[s]
     xy1 = xyPlot.XYDataFromHistory(
         odb=self.myOdbDat,
         outputVariableName=x,
         steps=(sName, ),
     )
     xy1 = butterworthFilter(xyData=xy1, cutoffFrequency=0.1)
     c1 = session.Curve(xyData=xy1)
     self.chart.setValues(curvesToPlot=(c1, ), )
     self.myVp.setValues(displayedObject=self.xyp)
     chartName = self.xyp.charts.keys()[0]
     self.chart = self.xyp.charts[chartName]
     path_filename = '%s_Xplot_step-%s_x-%s.png' % \
         (self.myOdbDat.name.replace('.odb',''), sName, x.split(':')[1].split(' ')[1])
     print(path_filename)
     # fname = self.myOdbDat.name.replace('.odb','')+'_Xplot_step-'+sName+'_'+x.split(':')[1].split(' ')[1]+'.png'
     #session.printToFile(fileName=fname, format=PNG, canvasObjects=(self.myVp, ))
     self.myVp.setValues(height=250, width=350)
     try:
         session.printToFile(path_filename, PNG, (self.myVp, ))
         print('%s saved' % path_filename)
     except:
         print('failed to save %s' % path_filename)
コード例 #2
0
ファイル: abaqus.py プロジェクト: nagordon/mechpy
 def xplot_history(self, s, x):
     """plots the historys based on a list
     x = 'Reaction force: RF1 at Node 58 in NSET SET-NODE-BOTTOM'
     
     Building the input from info from the odb
     
     
     """
     sName = self.myOdbDat.steps.keys()[s]
     xy1 = xyPlot.XYDataFromHistory(odb=self.myOdbDat,
                                     outputVariableName=x,
                                     steps=(sName, ), )
     xy1 = butterworthFilter(xyData=xy1, cutoffFrequency=0.1)
     c1 = session.Curve(xyData=xy1)
     self.chart.setValues(curvesToPlot=(c1, ), )
     self.myVp.setValues(displayedObject=self.xyp)
     chartName = self.xyp.charts.keys()[0]
     self.chart = self.xyp.charts[chartName]
     path_filename = '%s_Xplot_step-%s_x-%s.png' % \
         (self.myOdbDat.name.replace('.odb',''), sName, x.split(':')[1].split(' ')[1])
     print(path_filename)
     # fname = self.myOdbDat.name.replace('.odb','')+'_Xplot_step-'+sName+'_'+x.split(':')[1].split(' ')[1]+'.png'
     #session.printToFile(fileName=fname, format=PNG, canvasObjects=(self.myVp, ))
     self.myVp.setValues(height=250, width=350)
     try:
         session.printToFile(path_filename, PNG, (self.myVp,))
         print('%s saved' % path_filename)
     except:
         print('failed to save %s' % path_filename)
コード例 #3
0
ファイル: InterfaceUtils.py プロジェクト: kkxuxu/AbqPlugins
def printCurrentVp():
    
    from abaqus import session, getInputs
    from abaqusConstants import PNG
    name = getInputs( (('File name:', ''),),
                      'Print current viewport to PNG file')[0]
    vp = session.viewports[session.currentViewportName]
    session.printToFile(fileName=name, format=PNG, canvasObjects=(vp,))
コード例 #4
0
ファイル: abaqus.py プロジェクト: nagordon/mechpy
 def png_undeformed(self,v='Iso1'):
     """create a png of the mesh"""
     self.VP_edit(0, 0, '', '', '',   '', v,   ON,    OFF,    0,  0)
     path_filename = '%s_Undeformed_%s.png' % (self.myOdbDat.name.replace('.odb',''),v)
     try:
         session.printToFile(path_filename, PNG, (self.myVp,))
         print('%s saved' % path_filename)
     except:
         print('failed to save %s' % path_filename)
コード例 #5
0
ファイル: abaqus.py プロジェクト: kangwonlee/mechpy
 def png_undeformed(self, v='Iso1'):
     """create a png of the mesh"""
     self.VP_edit(0, 0, '', '', '', '', v, ON, OFF, 0, 0)
     path_filename = '%s_Undeformed_%s.png' % (self.myOdbDat.name.replace(
         '.odb', ''), v)
     try:
         session.printToFile(path_filename, PNG, (self.myVp, ))
         print('%s saved' % path_filename)
     except:
         print('failed to save %s' % path_filename)
コード例 #6
0
def printLBmodes():
    from abaqus import session
    from abaqusConstants import DPI_1200, EXTRA_FINE, OFF, PNG

    vp = session.viewports[session.currentViewportName]
    session.psOptions.setValues(logo=OFF,
                                resolution=DPI_1200,
                                shadingQuality=EXTRA_FINE)
    session.printOptions.setValues(reduceColors=False)
    for i in xrange(1,51):
        vp.odbDisplay.setFrame(step=0, frame=i)
        session.printToFile(fileName='mode %02d.png'%i,
                             format=PNG,
                             canvasObjects=(vp,))
コード例 #7
0
def printLBmodes():
    from abaqus import session
    from abaqusConstants import DPI_1200, EXTRA_FINE, OFF, PNG

    vp = session.viewports[session.currentViewportName]
    session.psOptions.setValues(logo=OFF,
                                resolution=DPI_1200,
                                shadingQuality=EXTRA_FINE)
    session.printOptions.setValues(reduceColors=False)
    for i in xrange(1, 51):
        vp.odbDisplay.setFrame(step=0, frame=i)
        session.printToFile(fileName='mode %02d.png' % i,
                            format=PNG,
                            canvasObjects=(vp, ))
コード例 #8
0
def print_png(filename):
    """Print a png file from the current viewport

    Parameters
    ----------
    filename : str
        The name of the output png file.

    """
    from abaqus import session
    from abaqusConstants import PNG

    viewport=session.viewports[session.currentViewportName]
    session.printToFile(fileName=filename,
                         format=PNG,
                         canvasObjects=(viewport,))
コード例 #9
0
def print_png(filename):
    """Print a png file from the current viewport

    Parameters
    ----------
    filename : str
        The name of the output png file.

    """
    from abaqus import session
    from abaqusConstants import PNG

    viewport = session.viewports[session.currentViewportName]
    session.printToFile(fileName=filename,
                        format=PNG,
                        canvasObjects=(viewport, ))
コード例 #10
0
ファイル: abaqus.py プロジェクト: nagordon/mechpy
 def png_save(self):
     """
         Captures images based on field outputs
     """
     o = self.myVp.odbDisplay.primaryVariable[0]
     c = self.myVp.odbDisplay.primaryVariable[5]
     f = self.myVp.odbDisplay.fieldFrame[1]
     s = self.myVp.odbDisplay.fieldSteps[0][0]
     v = self.myView
     cs = '' if self.myVp.odbDisplay.basicOptions.transformationType == DEFAULT else self.myVp.odbDisplay.basicOptions.datumCsys.name[1:]
     path_filename = '%s_step-%s_frame-%i_%s_%s_%s_%s.png' % (self.myOdbDat.name.replace('.odb',''),s,f,o,c,cs,v)
     try:
         session.printToFile(path_filename, PNG, (self.myVp,))
         print('%s saved' % path_filename)
     except:
         print('failed to save %s' % path_filename)
コード例 #11
0
ファイル: abaqus.py プロジェクト: kangwonlee/mechpy
 def png_save(self):
     """
         Captures images based on field outputs
     """
     o = self.myVp.odbDisplay.primaryVariable[0]
     c = self.myVp.odbDisplay.primaryVariable[5]
     f = self.myVp.odbDisplay.fieldFrame[1]
     s = self.myVp.odbDisplay.fieldSteps[0][0]
     v = self.myView
     cs = '' if self.myVp.odbDisplay.basicOptions.transformationType == DEFAULT else self.myVp.odbDisplay.basicOptions.datumCsys.name[
         1:]
     path_filename = '%s_step-%s_frame-%i_%s_%s_%s_%s.png' % (
         self.myOdbDat.name.replace('.odb', ''), s, f, o, c, cs, v)
     try:
         session.printToFile(path_filename, PNG, (self.myVp, ))
         print('%s saved' % path_filename)
     except:
         print('failed to save %s' % path_filename)
コード例 #12
0
ファイル: abaqus.py プロジェクト: kangwonlee/mechpy
 def simple_png_save(self, path_filename):
     try:
         session.printToFile(path_filename, PNG, (self.myVp, ))
         print('%s saved' % path_filename)
     except:
         print('failed to save %s' % path_filename)
コード例 #13
0
ファイル: abaqus.py プロジェクト: nagordon/mechpy
 def simple_png_save(self, path_filename):
     try:
         session.printToFile(path_filename, PNG, (self.myVp,))
         print('%s saved' % path_filename)
     except:
         print('failed to save %s' % path_filename)
コード例 #14
0
    title=OFF,
    state=ON,
    compass=OFF,
    legend=ON,
    legendPosition=(75, 95),
    legendBox=OFF,
    legendFont='-*-verdana-medium-r-normal-*-*-120-*-*-p-*-*-*',
    statePosition=(1, 15),
    titleFont='-*-verdana-medium-r-normal-*-*-120-*-*-p-*-*-*',
    stateFont='-*-verdana-medium-r-normal-*-*-120-*-*-p-*-*-*')

# saving undeformed image
myViewport.odbDisplay.display.setValues(plotState=(UNDEFORMED, ))
path_filename = '%s_%s' % (myOdb.name.replace('.odb', ''), v)
try:
    session.printToFile(path_filename, PNG, (myViewport, ))
    print('saving %s' % path_filename)
except:
    pass

# save stress plots
v = 'Iso'
o = 'S'
c = 'S11'
s = 0
f = -1
myViewport.odbDisplay.display.setValues(plotState=(CONTOURS_ON_DEF, ))
myViewport.odbDisplay.setFrame(step=s, frame=f)

myViewport.odbDisplay.setPrimaryVariable(
    variableLabel=o,
コード例 #15
0
def TrackModel(Tielength,Tiedepth,lin,dz,nt,minmod,modmean,SDincr,nSDi,nrepeat,railgeom,maxsteps,numsteps,loadtype,meshsize,APBC):
	StatLoad=RailLoaderw2.StaticLoading()
	PLoad=StatLoad[2]['Max Stress']
	a=StatLoad[2]['Major Axis']
	b=StatLoad[2]['Minor Axis']
	if maxsteps == True:
		stepsno=Paracalc.stepsnum(lin,nt,dz) #Number of load steps
	else:
		stepsno=numsteps
	RL=2*lin*(nt-1) #Length of the rail
	Pr=0.22
	l1=114.30 #side tie width
	l2=228.6 #middle tie width
	z1=[2*i*lin-l1 for i in range(1,nt-1)] # translation distances for the middle tie
	z2=2*lin*(nt-1)-l1 #Translation distance for the side tie
	ztr=[0]+z1+[z2] #Translation distances for crossties
	px1=-Tielength/2.0 #half length of the tie
	px2=-px1
	py1=0.0
	py2=-Tiedepth #depth of the tie
	stE0=0.0
	dim=[l1,l2,z1,z2,px1,px2,py1,py2,ztr]
	ConcrE=RandomStiff_Generator.RandomStiffGen(nt,modmean,stE0,minmod)
	density=2.4e-09
	addmat=[ConcrE,Pr,density]
	meshsize=6.0

	#Cross-ties partition parameters
	v=(5.0,-50.0,5.0) # Location of the part (pick one point of the part)
	ch1=-169.80 #First depth of the partition
	ch2=-8.0 # Second depth of the partition
	nSDi=2 #number of moduli standard deviations increments
	nrepeat=1

	#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
	#Rail Modelling data
	if railgeom=='Rectangular':
		myModel=railModelsu2.rectRail(nt,dz,stepsno,loadtype,meshsize)
	elif railgeom=='Exact':
		myModel=railModelsu2.realRail(nt,dz,stepsno,loadtype,meshsize)
	## Insert crossties models
	myTies=Crosstiesprt.crosstiesPrep(myModel,nt,dim,addmat, meshsize)
	# Creating tie constraints
					##Apply tie constraints to each tie and the rail
	for i in range(nt):
		myModel.rootAssembly.Surface(name='m_RailSurf', side1Faces=
			myModel.rootAssembly.instances['RailInst'].faces.findAt(((dim[4]/10.0, dim[6], (dim[0]/2.0+dim[8][i])), ), ))
		myModel.rootAssembly.Surface(name='s_TieSurf'+str(i), side1Faces=
			myModel.rootAssembly.instances['Ties'+str(i)].faces.findAt(
			((dim[4]/2.0, dim[6], (dim[0]/2.0+dim[8][i])), ), ))
		myModel.Tie(adjust=ON, master=	myModel.rootAssembly.surfaces['m_RailSurf'], name=
			'Constraint-'+str(i), positionToleranceMethod=COMPUTED, slave=
			mdb.models['SimTrack0'].rootAssembly.surfaces['s_TieSurf'+str(i)], thickness=ON, 
			tieRotations=ON)
	if APBC==True:
		RailLoaderw2.applyperiodicBC(myModel,'Set-1','Set-2','Set-3')
	myViewport = session.Viewport(name='Viewport for Rail track',
		origin=(10, 10), width=150, height=100)

	myViewport.setValues(displayedObject=myModel.rootAssembly)

	myViewport.assemblyDisplay.setValues(renderStyle=SHADED)
	session.viewports['Viewport for Rail track'].makeCurrent()
	session.viewports['Viewport for Rail track'].maximize()
	if railgeom=='Rectangular':
		session.printToFile(
			fileName='C:/Users/celestink/abaqus_plugins/myrailroad/rectarail.png', 
			format=PNG, canvasObjects=(session.viewports['Viewport for Rail track'], ))
	elif railgeom=='Exact':
		session.printToFile(
			fileName='C:/Users/celestink/abaqus_plugins/myrailroad/realrail.png', 
			format=PNG, canvasObjects=(session.viewports['Viewport for Rail track'], ))
	myModel.fieldOutputRequests['F-Output-1'].setValues(variables=(
								'S', 'MISES', 'MISESMAX', 'TRIAX', 'MISESONLY', 'E', 'PE', 'PEEQ', 'PEMAG', 
								'EE', 'LE', 'U', 'RF', 'CF', 'CSTRESS', 'CDISP'))
	##Create Job output for the first model
	mdb.Job(atTime=None, contactPrint=OFF, description='', echoPrint=OFF, 
		explicitPrecision=SINGLE, getMemoryFromAnalysis=True, historyPrint=OFF, 
		memory=90, memoryUnits=PERCENTAGE, model='SimTrack0', modelPrint=OFF, 
		multiprocessingMode=DEFAULT, name='SimTrack0', nodalOutputPrecision=SINGLE, 
		numCpus=1, queue=None, scratch='', type=ANALYSIS, userSubroutine='',waitHours=0, waitMinutes=0)	
	mdb.jobs['SimTrack0'].writeInput(consistencyChecking=OFF)
	
	# Generate other models with standard deviation higher than 0 and repeated nrepeat times
	def multiRandTrack(nSDi,nt,nrepeat,SDincr,Modelname,Materialname):
		for SDi in range(1,nSDi): 
			stE=stE0+SDincr*SDi
			f = open('tieModuli_SD_Incr_'+str(SDi)+'.txt', 'w')
		
			for Nrand in range(nrepeat):
				ln=nrepeat*SDi+Nrand+1
				ConcrE=RandomStiff_Generator.RandomStiffGen(nt,modmean,stE,minmod)
				[f.write(str(ConcrE[i])+'\n') for i in range(nt)]
				mdb.Model(name=Modelname+str(ln), objectToCopy=myModel)
				mdb.models[Modelname+str(ln)].rootAssembly.regenerate()
				for i in range(nt):
					mdb.models[Modelname+str(ln)].materials[Materialname+str(i)].elastic.setValues(
						table=((ConcrE[i], Pr), ))		
					#Set Field output requests
				myModel.fieldOutputRequests['F-Output-1'].setValues(variables=(
								'S', 'MISES', 'MISESMAX', 'TRIAX', 'MISESONLY', 'E', 'PE', 'PEEQ', 'PEMAG', 
								'EE', 'LE', 'U', 'RF', 'CF', 'CSTRESS', 'CDISP'))
			
				mdb.Job(atTime=None, contactPrint=OFF, description='', echoPrint=OFF, 
					explicitPrecision=SINGLE, getMemoryFromAnalysis=True, historyPrint=OFF, 
					memory=90, memoryUnits=PERCENTAGE, model=Modelname+str(ln), modelPrint=OFF, 
					multiprocessingMode=DEFAULT, name=Modelname+str(ln), nodalOutputPrecision=SINGLE, 
					numCpus=1, queue=None, scratch='', type=ANALYSIS, userSubroutine='',waitHours=0, waitMinutes=0)	
				mdb.jobs[Modelname+str(ln)].writeInput(consistencyChecking=OFF)
			
			f.close()
	multiRandTrack(nSDi,nt,nrepeat,SDincr,'SimTrack','concrete ties')