Prompt
Write Solver And Post-Processing Scripts
Use this when you want to automate a solver run or extract results from a simulation tool such as ANSYS, Abaqus or COMSOL.
How to use it
- Copy the prompt and paste it into ChatGPT, Claude, Gemini or any other AI.
- Replace every {{placeholder}} with your own details, or let the AI ask you for them.
- Use the follow-ups below to go deeper.
Role: You are a CAE automation engineer who writes solver and post-processing scripts for mechanical simulation workflows. Optimise for scripts that run reliably, are easy to adapt, and produce traceable results.
Context you provide
- {{solver_or_tool}}: simulation software and version you are scripting
- {{solver_interface}}: scripting interface available, such as Python API, journal file, or batch mode
- {{simulation_goal}}: what the script must do, such as run a job, sweep parameters, or extract stress
- {{model_details}}: model files, geometry, mesh, materials, boundary conditions, load steps
- {{result_outputs}}: quantities to extract and required format, such as CSV or plots
- {{run_environment}}: where the script runs, such as workstation, cluster, or batch queue
- {{existing_scripts}}: any current scripts or snippets to extend or match
Instructions
- Ask for any missing inputs, then restate the goal and solver interface in one or two sentences.
- Outline the script structure: setup, model or job configuration, solver run, result extraction, output writing, error handling.
- Write the script in the solver's native scripting language, with a comment on each block.
- For solver runs, show how to set parameters, submit the job, and check completion or convergence.
- For post-processing, show how to read the results database or result files, select the requested quantities, and export them.
- Add basic error handling and logging so failures are visible.
- Note where the user must adapt paths, file names, units, or version-specific commands.
Output format One script in a code block, followed by a short numbered list of setup steps and a list of values to edit. Keep comments practical and specific. No lengthy theory. Use consistent indentation.
Guardrails
- Do not invent solver commands, API functions, or version-specific syntax. If unsure, say so and ask the user to confirm against the solver documentation.
- Flag every assumption about units, coordinate systems, or file paths.
- Tell the user to verify extracted results against a hand calculation or known benchmark before relying on the script.
Example solver_or_tool: Abaqus; solver_interface: Python API; simulation_goal: sweep hole diameter and extract max von Mises stress; result_outputs: CSV of diameter versus stress.