""" Abaqus Example Manual script to create the model and the optimization attributes for the sizing optimization of a gear shift control holder. The script is run using File -> Run Script in Abaqus/CAE. In order to successfully run holder_sizing_optimization.py the user must have holder.inp in the working directory. """ from abaqus import * from abaqusConstants import * import regionToolset #Define the current viewport # curViewportName=session.currentViewportName curViewport=session.viewports[curViewportName] #Import of the model input file # try: mdb.ModelFromInputFile(name='holder', inputFileName='holder.inp') except: msg = "The input file (holder.inp) was not found in the working directory." raise ValueError(msg) model=mdb.models['holder'] #create a new sizing optimization task a = mdb.models['holder'].rootAssembly region=a.sets['DESIGN_ALL'] mdb.models['holder'].SizingTask(name='holder-sizing-optimization', region=region, freezeLoadRegions=OFF) #strain energy design response for step 1 mdb.models['holder'].optimizationTasks['holder-sizing-optimization'].SingleTermDesignResponse( name='strain-energy-step-1', region=MODEL, identifier='STRAIN_ENERGY', drivingRegion=None, operation=SUM, stepOptions=(( 'Step-1', '', ALL, ALL, 'holder'), )) #strain energy design response for step 2 mdb.models['holder'].optimizationTasks['holder-sizing-optimization'].SingleTermDesignResponse( name='strain-energy-step-2', region=MODEL, identifier='STRAIN_ENERGY', drivingRegion=None, operation=SUM, stepOptions=(( 'Step-2', '', ALL, ALL, 'holder'), )) #node set for displacement design response ##a = mdb.models['holder'].rootAssembly ##n1 = a.instances['PART-1-1'].nodes ##nodes1 = n1[4:5] ##a.Set(nodes=nodes1, name='nset-disp') ##region1=a.sets['nset-disp'] ## ###x displacement for node 5 in step 1 ##mdb.models['holder'].optimizationTasks['holder-sizing-optimization'].SingleTermDesignResponse( ## name='x-disp-step-1', region=region1, identifier='DISP_X', ## drivingRegion=None, operation=SUM, stepOptions=(( ## 'Step-1', '', ALL, ALL, 'holder'), )) ## ###x displacement for node 5 in step 2 ##mdb.models['holder'].optimizationTasks['holder-sizing-optimization'].SingleTermDesignResponse( ## name='x-disp-step-2', region=region1, identifier='DISP_X', ## drivingRegion=None, operation=SUM, stepOptions=(( ## 'Step-2', '', ALL, ALL, 'holder'), )) ## ###y displacement for node 5 in step 1 ##mdb.models['holder'].optimizationTasks['holder-sizing-optimization'].SingleTermDesignResponse( ## name='y-disp-step-1', region=region1, identifier='DISP_Y', ## drivingRegion=None, operation=SUM, stepOptions=(( ## 'Step-1', '', ALL, ALL, 'holder'), )) ## ###y displacement for node 5 in step 2 ##mdb.models['holder'].optimizationTasks['holder-sizing-optimization'].SingleTermDesignResponse( ## name='y-disp-step-2', region=region1, identifier='DISP_Y', ## drivingRegion=None, operation=SUM, stepOptions=(( ## 'Step-2', '', ALL, ALL, 'holder'), )) ## ###z displacement for node 5 in step 1 ##mdb.models['holder'].optimizationTasks['holder-sizing-optimization'].SingleTermDesignResponse( ## name='z-disp-step-1', region=region1, identifier='DISP_Z', ## drivingRegion=None, operation=SUM, stepOptions=(( ## 'Step-1', '', ALL, ALL, 'holder'), )) ## ###z displacement for node 5 in step 2 ##mdb.models['holder'].optimizationTasks['holder-sizing-optimization'].SingleTermDesignResponse( ## name='z-disp-step-2', region=region1, identifier='DISP_Z', ## drivingRegion=None, operation=SUM, stepOptions=(( ## 'Step-2', '', ALL, ALL, 'holder'), )) #volume design response mdb.models['holder'].optimizationTasks['holder-sizing-optimization'].SingleTermDesignResponse( name='volume', region=MODEL, identifier='VOLUME', drivingRegion=None, operation=SUM, stepOptions=()) #objective function minmax mdb.models['holder'].optimizationTasks['holder-sizing-optimization'].ObjectiveFunction( name='minmax-strain-energy', target=MINIMIZE_MAXIMUM, objectives=((OFF, 'strain-energy-step-1', 1.0, 0.0, ''), (OFF, 'strain-energy-step-2', 1.0, 0.0, ''))) #volume constraint mdb.models['holder'].optimizationTasks['holder-sizing-optimization'].OptimizationConstraint( name='volume-constraint', designResponse='volume', restrictionMethod=RELATIVE_LESS_THAN_EQUAL, restrictionValue=1.0) #geometric restriction thickness control a = mdb.models['holder'].rootAssembly region=a.sets['DESIGN_ALL'] mdb.models['holder'].optimizationTasks['holder-sizing-optimization'].SizingThickControl( name='thickness-control-restriction', region=region, thicknessRestrictionBy=VALUE, minThickness=0.1, maxThickness=3.0) #create optimization process mdb.OptimizationProcess(name='holder-sizing-optimization', model='holder', task='holder-sizing-optimization', description='', prototypeJob='holder-sizing-optimization-Job', maxDesignCycle=15, odbMergeFrequency=2, dataSaveFrequency=OPT_DATASAVE_SPECIFY_CYCLE) mdb.optimizationProcesses['holder-sizing-optimization'].Job(name='holder-sizing-optimization-Job', model='holder', atTime=None, waitMinutes=0, waitHours=0, queue=None, memory=90, memoryUnits=PERCENTAGE, getMemoryFromAnalysis=True, multiprocessingMode=DEFAULT, numCpus=1, numGPUs=0)