Marc & Structures
Course index

Save your progress

Enter your email and we will send a secure sign-in link. There is no password and the first link creates your account.

Automated capstone project

Parametric sweeps, CSV output, acceptance criteria, and reproducibility

On this page
  1. Objectives
  2. Prerequisites and downloads
  3. How to use this lesson
  4. Session map
  5. Prediction — Three heights, three decisions
  6. Mental model — Automate the decision, not just the calculation
  7. Step 1 — Define inputs and criteria
  8. Step 2 — Sweep with *DO and no residual state
  9. Step 3 — CSV as a decision table
  10. Step 4 — Select the smallest suitable design
  11. Bug hunt
  12. Verifiable challenge — Four designs, two runs
  13. Self-assessment
  14. Learning evidence
  15. Exit checklist
  16. Technical traceability

In M08, you converted the model into reusable macros. In M09, you will complete the core path by automating the design decision: sweep several heights with *DO, consolidate a decision CSV, and select the smallest acceptable section without touching the GUI.

Your mission

You will evaluate at least three beam heights, validate each case against theory, and automatically choose the smallest beam_h alternative that satisfies deflection, stress, and equilibrium requirements.

Guiding question: can the script decide for you unambiguously?

Objectives

After completing M09, you will be able to:

  • Orchestrate a parametric sweep with *DO and arrays.
  • Rebuild the model in each iteration without residual state.
  • Distinguish validation_pass (M07–M08) from feasible (design limits).
  • Consolidate one CSV as a decision table.
  • Automatically select the acceptable design with the smallest section.
  • Demonstrate reproducibility in two clean runs.
  • Document assumptions, validation, and limitations in a brief report.

Prerequisites and downloads

  • M08: driver with build, solve, and extract submacros.
  • M07: deflection, interior-stress, and equilibrium tolerances.
  • M01: analytical references and design limits (uy_limit, stress_limit).

How to use this lesson

PathDurationCoverage
First win30–35 minPrediction, three-height sweep, and first automatic selection.
Complete70–75 minAlso: bug hunt, four-design challenge, report, and completion of the core path.

Session map

  1. Mission: objectives, downloads, and prediction for three heights.
  2. Mental model: automate the decision, not just the calculation.
  3. Demonstration: criteria, residual-state-free sweep, CSV, and selection.
  4. Bug hunt: residual state, mixed verdicts, and incorrect selection.
  5. Challenge: four designs and reproducibility in two clean runs.
  6. Mastery: final test completing the M00–M09 core path.

Prediction — Three heights, three decisions

With b = 0.05 m, L = 1 m, E = 210 GPa, and F = −1000 N:

I = b·h³/12
uy_ref = F·L³/(3·E·I)
sigma_ref = F·(0.8L)·(h/2)/I   ! interior section
Caseh (m)mesh_h (m)|uy_ref| (mm)σ_ref (MPa)Acceptable (analytical)
10.080.040.74415.0no (> 0.25 mm)
20.100.050.3819.6no
30.120.060.2206.9yes

The analytical prediction already rejects the first two designs. The FE sweep must confirm this with validation_pass and mark only case 3 as feasible.

Mental model — Automate the decision, not just the calculation

Parametric sweep, validation, feasibility filter, and selection of the smallest suitable design
Figure 1. validation_pass and feasible answer different questions.

A sweep that only prints contours does not automate decisions. You need a table with explicit verdicts and a selection rule that is readable in the script: the smallest acceptable beam_h.

Step 1 — Define inputs and criteria

beam_l=1.0
beam_b=0.05
young=210E9
tip_force=-1000
uy_limit=0.00025      ! 0.25 mm
stress_limit=150E6    ! 150 MPa
n_cases=3

Document SI units and limits before the *DO. FE validation criteria (deflection versus analytical result, equilibrium) remain those from M07–M08; design criteria (uy_limit, stress_limit) are additional.

Step 2 — Sweep with *DO and no residual state

*DO,case_id,1,n_cases
  ! set beam_h and mesh_h = h/2
  /INPUT,09_build,mac,,,,1
  /INPUT,09_solve,mac,,,,1
  /INPUT,09_extract,mac,,,,1
  ! store results in arrays
*ENDDO

Each iteration must rebuild the geometry and mesh. In 09_build.mac, clear the previous mesh with VCLEAR and VDELE before creating a new BLOCK. Without that cleanup, the second case fails with “Volume is meshed and cannot be changed.”

Height-versus-deflection plot with a 0.25 mm limit
Figure 2. The physical trend (|uy| decreases as h increases) is an independent check.

Step 3 — CSV as a decision table

*CFOPEN,m09_results,csv
*VWRITE
('case_id,beam_h,...,validation_pass,feasible')
*DO,i,1,n_cases
  *VWRITE,i,h_store(i),...,val_pass_store(i),feasible_store(i)
*ENDDO
*CFCLOS

Only the driver writes the CSV. If each submacro writes its own file, the last iteration overwrites the preceding ones and the selection loses its meaning.

Step 4 — Select the smallest suitable design

selected_case=0
selected_h=0
*DO,i,1,n_cases
  *IF,feasible_store(i),EQ,1,THEN
    *IF,selected_case,EQ,0,THEN
      selected_case=i
      selected_h=h_store(i)
    *ELSE
      *IF,h_store(i),LT,selected_h,THEN
        selected_case=i
        selected_h=h_store(i)
      *ENDIF
    *ENDIF
  *ENDIF
*ENDDO

For the base sweep, the expected selection is selected_case=3, selected_h=0.12 m. Also check the trend: |uy(i+1)| < |uy(i)| as height increases.

Bug hunt

Open 09_bug_hunt.mac. It contains five common parametric-sweep defects:

ErrorSymptomCheckCauseMinimum fix
1Impossible topologyNode countsNo rebuild between casesVCLEAR + VDELE in build
2Single-row CSVOutput fileCSV written in extractWrite only from the driver
3h=0.08 selectedfeasibleConfused with validation_passFilter by design limits
4Inconsistent loop/STATUS,PARM/CLEAR inside *DOClear geometry, not the session
5h=0.14 selectedselected_hLargest acceptable height chosenmin(beam_h) with feasible=1

Verifiable challenge — Four designs, two runs

Run the base sweep twice from clean sessions and compare m09_results.csv. Then add a fourth design without duplicating construction or solution blocks:

/CLEAR,START
/FILNAME,m09_challenge,1
/UNITS,SI
n_cases=4
/INPUT,09_parametric_core,mac

The fourth case (h = 0.14 m) is also analytically acceptable, but the selection must remain h = 0.12 m because it is the smallest suitable section.

Self-assessment

>What is the difference between validation_pass and feasible?

validation_pass confirms that the FE model is consistent (topology, equilibrium, analytical comparison). feasible adds the deflection and stress design limits.

Why rebuild the model in each iteration?

Because accumulated geometry or residual selections contaminate later cases and break sweep reproducibility.

Which design should the base sweep select?

Case 3, h = 0.12 m: it is the first to satisfy |uy| ≤ 0.25 mm and is the smallest acceptable height among the three evaluated.

Where should m09_results.csv be written?

In the driver, after the sweep completes. A single write point prevents partial overwrites.

What do you check in addition to the design limits?

The physical trend: as h increases, tip deflection magnitude must decrease.

Learning evidence

  • 09_parametric_study.mac driver with a three-design sweep.
  • 09_build, 09_solve, and 09_extract submacros.
  • m09_results.csv with validation_pass, feasible, and selection.
  • Completed height–displacement plot and brief report.
  • Reproducibility demonstrated in two clean runs.
  • Four-design challenge with consistent selection (h = 0.12 m).

Exit checklist

  • ☐ I documented inputs, units, and design limits.
  • ☐ I implemented a *DO sweep without residual state.
  • ☐ I distinguished validation_pass from feasible.
  • ☐ I wrote one consolidated CSV from the driver.
  • ☐ I selected the acceptable min(beam_h).
  • ☐ I verified the physical deflection trend.
  • ☐ I repeated the run from a clean session.
  • ☐ I completed the brief project report.

Technical traceability

This lesson uses the 2024 R1 Command Reference for *DO, *DIM, *CFOPEN, *VWRITE, and /INPUT, and inherits validation tolerances from M07–M08. Validated in MAPDL Student 2025 R2 (v252) with KEYOPT(2)=3.

Completing the core path

After completing M09, you will have covered M00–M09: from the first reproducible simulation to an automated project with a verifiable decision. Specializations M10–M17 expand the physics and advanced techniques, but the course's core path ends here.

Show that you can do it without hints

You need at least 80% and every critical check correct. You can retry without a limit; each attempt gives you a focused review path.

8 checks

Competency

Automate design decisions through verifiable parametric sweeping.

Expected evidence

≥3 cases with study_passes=1, selected_h=0,12 m and CSV reproducible in 2 clean runs.

Save mastery across devices

Enter your email to receive a secure link. Your account stores only progress, attempts, and scores.

1.A case has validation_pass=1 but feasible=0. What does it imply? Critical
2.Where should m09_results.csv be written? Critical
3.Enter theoretical |uy_ref| (m) for h=0.12 m with F=−1000 N, L=1 m, b=0.05 m, and E=210 GPa. Critical
m
4.The second sweep case fails with 'Volume is meshed'. What is the minimum correction? Critical
5.For the base sweep (3 designs), which selected_case does the contract expect? Critical
case
6.With four designs (h=0.14 also acceptable), which selected_h should the script choose?
7.A design meets deflection but its mesh failed convergence. Is it feasible? Retrieval M04
8.Two alternatives are feasible. What makes choosing the smaller one defensible? Retrieval M06

The assessment is scored and progress is saved in this browser.