# batch_postprocess.py import os from odbAccess import * odb_folder = './simulation_results/' output_lines = []

# beam_plugin.py from abaqusConstants import * from abaqusGui import * import os class BeamPlugin(AFXDataDialog): def (self, form): AFXDataDialog. init (self, form, 'Parametric Beam', BUTTON_OK | BUTTON_CANCEL) AFXTextField(self, 8, 'Length (mm)', form.lengthKw) AFXTextField(self, 8, 'Force (N)', form.forceKw)

# Assign mesh size part = mdb.models[modelName].parts['Beam'] part.seedPart(size=size, deviationFactor=0.1) part.generateMesh()

Scripting enables automated parametric studies without manual GUI interaction. 5. Example 3: Automating Mesh Convergence Study Goal: Refine mesh iteratively and track stress at a critical point.

for filename in os.listdir(odb_folder): if filename.endswith('.odb'): odb_path = os.path.join(odb_folder, filename) odb = openOdb(path=odb_path)

Save as cantilever_beam.py and run from Abaqus command line. 4. Example 2: Material Parameter Sweep (Loop Over Young’s Modulus) Goal: Run multiple analyses with varying material stiffness and collect max displacement.

# Extract von Mises stress at fixed coordinates odb = openOdb(jobName + '.odb') frame = odb.steps['ApplyLoad'].frames[-1] stress = frame.fieldOutputs['S'] # Find stress at (length, 0) – tip tip_value = None for val in stress.values: if abs(val.nodeLabel - some_node_label) < 1e-3: # simplified tip_value = val.mises break results.append((size, tip_value)) odb.close() print("Mesh convergence data:", results)

# Submit job jobName = f'Job_Mesh_size' job = mdb.Job(name=jobName, model=modelName) job.submit() job.waitForCompletion()

# Get last step, last frame step = odb.steps.values()[-1] frame = step.frames[-1] # Reaction force (RF) rf_field = frame.fieldOutputs['RF'] total_RF = sum([value.data[1] for value in rf_field.values]) # Y-direction sum output_lines.append(f"filename, Total RF = total_RF:.2f") odb.close() with open('reaction_forces.csv', 'w') as f: f.write("ODB_File, Total_RF_Y\n") f.write("\n".join(output_lines))

# Run job jobName = f'Job_E_int(E)' myJob = mdb.Job(name=jobName, model=modelName) myJob.submit() myJob.waitForCompletion()

print("Batch post-processing done.") Goal: Build a simple dialog to input beam length and force.

You've successfully subscribed to TROLOG
Great! Next, complete checkout for full access to TROLOG
Welcome back! You've successfully signed in.
Unable to sign you in. Please try again.
Success! Your account is fully activated, you now have access to all content.
Success! Your billing info is updated.
Billing info update failed.