Configure Tosca optimization. Use when user mentions design response, objective function, optimization constraint, or SIMP penalty. Base module for topology/shape optimization.
This skill covers executing topology optimization via the Tosca CLI. For authoring the .par file (design responses, objectives, constraints, frozen regions), see the tosca skill. For the complete end-to-end topology optimization workflow (geometry through results), see /abaqus-topology-optimization.
Route here when user mentions:
Route elsewhere:
.par file content (DV_TOPO, DRESP, CONSTRAINT, etc.) -> tosca skill/abaqus-topology-optimization/abaqus-topology-optimization for correct usageThe CAE optimization API (TopologyTask, ObjectiveFunction, OptimizationProcess) works correctly when used with the proper tuple format. The key pitfall: ObjectiveFunction.objectives must use 4-tuples (suppress, designResponse, weight, referenceValue). Passing a 5-tuple (e.g., with a trailing empty string) corrupts C++ state and causes segfaults/KeyErrors.
See /abaqus-topology-optimization for correct CAE API usage patterns.
For Tosca-specific features or standalone Tosca execution, the hybrid pipeline is used:
CAE Python API (noGUI) Tosca CLI
-------------------------- ---------
1. Build geometry
2. Mesh
3. Material + section
4. Assembly, step, BCs, loads
5. noPartsInputFile=ON -------> 6. Generate .par file (hand-written)
+ writeInput() 7. tosca optimize -p file.par -s abaqus
8. Output: ISO_SMOOTHING.stl
Note: Tosca .par files must be hand-written. CAE generates .par for its own optimization system, not for standalone Tosca.
Before running Tosca CLI:
.inp file (use noPartsInputFile=ON before writeInput()).par parameter file referencing the flat .inptosca command available or abaqus tosca)Tosca requires flat .inp files without *Part/*Instance/*Assembly hierarchy. Use noPartsInputFile=ON before writeInput():
mdb.models['Model-1'].setValues(noPartsInputFile=ON)
mdb.jobs[job_name].writeInput()
This produces a flat .inp directly โ no manual flattening or RP node renumbering needed.
Legacy approach: If noPartsInputFile is not available, the .inp can be flattened manually. See references/common-patterns.md Pattern 1 and Pattern 2 for the legacy flattening code.
ToscaStructure --job JOBNAME --solver abaqus --type test1
This validates the FE model and .par file without running a full optimization. Always do this first.
tosca optimize -j JOBNAME -p PARFILE -s abaqus -scpus N
Or equivalently:
ToscaStructure --job JOBNAME --solver abaqus
The .par file must reference the flattened .inp via FILE = flat.inp in its FEM_INPUT block. Both files must be in the current working directory or use absolute paths.
JOBNAME/TOSCA.OUT for CRITICAL/ERROR/WARNING messagesoptimization_report.csv for per-cycle objective and constraint valuesoptimization_status_all.csv for extended convergence metrics# Generate postprocessing report (.vtfx for visualization)
ToscaStructure --job JOBNAME --report
# Smooth results for CAD export (STL)
ToscaStructure --job JOBNAME --smooth
Tosca deletes per-cycle ODB files. To visualize stress/displacement on the optimized design, run Abaqus FEA on the last-cycle .inp from SAVE.inp/<N>/:
cd JOBNAME/SAVE.inp/<last_cycle>/
abaqus job=Optimized input=flat.inp cpus=N interactive
The last-cycle .inp includes tosca_distribution.inp with per-element density values (SIMP penalties), so the FEA runs on the actual optimized topology.
| Flag | Meaning |
|---|---|
-j JOBNAME |
Job name; Tosca creates a directory with this name |
-p PARFILE |
Path to the .par parameter file |
-s abaqus |
FE solver to use |
-scpus N |
Number of CPUs for the FE solver |
--loglevel DEBUG |
Verbose logging to TOSCA.OUT |
--loglevel_stdout INFO |
Show more detail on stdout |
--type test1 |
Check run (validate without optimizing) |
--report |
Generate postprocessing data |
--smooth |
Smooth results for CAD transfer |
For HPC clusters, see references/common-patterns.md Pattern 3 for a complete SLURM script. Key considerations:
module load abaqus/2025 (loads both Abaqus and Tosca)unset SLURM_GTIDS (prevents Abaqus MPI issues)export I_MPI_HYDRA_TOPOLIB=ipl (Intel MPI topology)ABAQUS_NUM_CPUS, ABAQUS_MESH_SIZE, etc. as environment variablesXvfb for visualization steps on headless nodesAfter optimization completes:
TOSCA.OUT shows no CRITICAL or ERROR messagesoptimization_report.csv shows objective converging.par).inp without errorsSee references/troubleshooting.md for detailed error resolution.
| Problem | Quick Fix |
|---|---|
tosca: command not found |
Check PATH, try abaqus tosca or load module |
Segfault from submit() |
Check ObjectiveFunction tuple format โ must be 4-tuple, not 5-tuple |
KeyError from writeParAndInputFiles() |
Caused by corrupted C++ state from wrong tuple format; fix ObjectiveFunction 4-tuple |
Stale .onf/.db files |
Delete JOBNAME/ directory before re-running |
| RP node collision | Renumber RP nodes with offset (see Pattern 2) |
For actual code from the working experiments, see: