In this script, you can initially set the model name and input file name. You can then define the different load cases as a list of dictionaries, each dictionary containing the name of the load case and the offset values for each direction.
from abaqus import *
from abaqusConstants import *
from odbAccess import *
import csv
# Define the model name and file names
modelName = 'myModel'
inputFile = modelName + '.inp'
outputFile = modelName + '.odb'
stressFile = modelName + '_stress.csv'
strainFile = modelName + '_strain.csv'
# Define the different load cases
loadCases = [{'name': 'Uniaxial X', 'ux': 1.0, 'uy': 0.0},
{'name': 'Uniaxial Y', 'ux': 0.0, 'uy': 1.0},
{'name': 'Shear XY', 'ux': 1.0, 'uy': 1.0}]
# Initialize the Abaqus model and create a new job
myModel = mdb.Model(name=modelName)
myJob = mdb.Job(name=modelName, model=modelName)
# Read in the input file
myModel = mdb.models[modelName]
myModel.File(r'%s' % inputFile)
# Loop over the different load cases
for loadCase in loadCases:
# Set the boundary conditions
stepName = loadCase['name']
myModel.rootAssembly.Set(name='all_nodes', nodes=myModel.rootAssembly.instances['PART-1-1'].nodes)
myModel.DisplacementBC(name='BC-1', createStepName=stepName, region=myModel.rootAssembly.sets['all_nodes'],
u1=loadCase['ux'], u2=loadCase['uy'])
# Submit the job and wait for it to complete
myJob.setValues(name=stepName)
myJob.submit()
myJob.waitForCompletion()
# Open the output database and extract stress and strain components
myOdb = openOdb(outputFile)
myStep = myOdb.steps[stepName]
myFrame = myStep.frames[-1]
stress = myFrame.fieldOutputs['S'].getSubset(region=myModel.rootAssembly.sets['all_nodes'])
strain = myFrame.fieldOutputs['LE'].getSubset(region=myModel.rootAssembly.sets['all_nodes'])
# Write the stress and strain components to CSV files
with open(stressFile, mode='a') as file:
writer = csv.writer(file, delimiter=',', quotechar='"', quoting=csv.QUOTE_MINIMAL)
writer.writerow([stepName] + [s.data for s in stress.values])
with open(strainFile, mode='a') as file:
writer = csv.writer(file, delimiter=',', quotechar='"', quoting=csv.QUOTE_MINIMAL)
writer.writerow([stepName] + [e.data for e in strain.values])
# Close the output database
myOdb.close()
In Abaqus, if you want to apply a linear load to a 3D body, you can do so by applying a concentrated force at an RP tied to the desired edge of its body.
For example, you need to apply a linear load of 10kN/m to a 2m edge.
You need to set an RP near the desired edge Apply the load Then create a coupling between the RP and the edge The RP must be the control point and the edge is the slave Now the total force acting on the edge is (10kN/m) * 2m = 20 kN Apply therefore a concentrated force of 20 kN at RP.
This is a way to apply a linear load to a 3D body. Alternatively, you can formulate your model with planar elements and then apply the linear load directly from module load in Abaqus CAE Let me know how it goes.
In this script, you can initially set the model name and input file name. You can then define the different load cases as a list of dictionaries, each dictionary containing the name of the load case and the offset values for each direction.
For 3D model
In Abaqus, if you want to apply a linear load to a 3D body, you can do so by applying a concentrated force at an RP tied to the desired edge of its body.
For example, you need to apply a linear load of 10kN/m to a 2m edge.
You need to set an RP near the desired edge Apply the load Then create a coupling between the RP and the edge The RP must be the control point and the edge is the slave Now the total force acting on the edge is (10kN/m) * 2m = 20 kN Apply therefore a concentrated force of 20 kN at RP.
This is a way to apply a linear load to a 3D body. Alternatively, you can formulate your model with planar elements and then apply the linear load directly from module load in Abaqus CAE Let me know how it goes.