Skip to main content

"How 2 win at PyBake"/"Ansys codefests the EZ way" Part 2

| 06.20.2024

Part 2: Materials & Cross-sections

In Part 1 we outlined the problem posed by the codefest and in Part 2 we'll begin to simplify the problem and examine how to make intelligent decisions in order to do so, starting with selecting the optimal material(s) to use!

We have 16 materials to choose from, but is there any single one that is better than all the others? To suit our needs the material needs to have:

  • high yield strength
  • low density
  • low price per kg

Let's make a simple metric to rank our materials by and prioritise these properties.

a = (density * price)/yield

The lower the value of a the better. We'll also convert the yield strength to MPa to make the numbers a bit nicer. Once evaluated our metric should have the units of "millions of dollars per newton-metre". For example, Steel has density 7850 kg/m^3, yield strength 330 MPa and price per kg of 1.2. So Steel's suitability metric will be...

7850 * 1.2 / 330 = 28.55

which is pretty good. But is it the best? (No.)

If we look at all the materials we have, there is a clear winner, which isn't actually all that surprising if you think about it.

The winner is... Pine!

Pine is the "best" material available! With a suitability metric of 12.5 it's strong, it's cheap, it's flexible. Interestingly, however, Steel and Oak, aren't that far behind. Of course, there should be the caveat here that it is the "best" material if you're only going to use one material. The problem will, however, let you use different materials for individual beams and each beam will be in a different scenario meaning there may well be optimal materials for each beam. For our purposes, however, we don't want to have to put in too much effort; this is the quick and dirty solution after all! So, we can happily use Pine for everything.

But the best material is only one piece of the puzzle. Next is the beam cross-section.

Cross-section

There are four available cross-sections, but which is best? Let's run the default simulation but keep the material constant (Steel) and adjust the cross-section such that the mass remains the same. The base design uses steel rods that are 15 cm in radius.

  • Volume of 1 rod, of length 1m = 1 * pi * 0.15 * 0.15 = 0.07 m^3
  • For cylinders let's set the inner radius to be 0.15 m
  • For Rectangle tubes let's set the cross-section to be square and the thicknesses of all four sides to be the same.
    • I.e. W1 = W2 = W and t1 = t2 = t3 = t4 = t
  • And let's set the area of the outer square to be 2 * A, where A is the starting area.
    • I.e. W^2 = 2A
cross-section Equivalent Dimensions
CIRCLE r = 0.15 m
RECTANGLE 0.27 m x 0.27 m
CYLINDER r1 = 0.15 m, r2 = 0.21
RECTANGLETUBE W = 0.38 m, t = 0.11 m

Plotting the results of the suggested design with each of these sets of dimensions we can get an idea of the best cross-section (whichever produces the lowest stresses).

Cylinder

Circle

Rectangle

Rectangle tube

It appears that the tubes are best! It is hard to say if the rectangular tube or the cylindrical tube is better, but the cylindrical tube requires fewer inputs and this is the lazy solution, so let's use that!

Result so far...

OK let's build a simple design with the decisions we've made so far.

  • best material -> Pine
  • best cross-section -> Cylinder
  • best dimensions(?) -> 0.15, 0.21
  • Cost = $5854

Does the bridge survive? Unfortunately not... But not by much! Only a few beams broke; they are listed below.

Beam Failures: 18 out of 190
Beam 3:   5   -   6   -> 155.917 % of yield - BREAK
Beam 15:  17   -  18   -> 101.544 % of yield - BREAK
Beam 28:  30   -  31   -> 106.351 % of yield - BREAK
Beam 37:  39   -  40   -> 107.678 % of yield - BREAK
Beam 50:  52   -  53   -> 102.075 % of yield - BREAK
Beam 62:  64   -  65   -> 145.21 % of yield - BREAK
Beam 79:  89   -  90   -> 115.845 % of yield - BREAK
Beam 80:  90   -  91   -> 100.199 % of yield - BREAK
Beam 95:  105  - 5007  -> 100.083 % of yield - BREAK
Beam 106:  189  -  190  -> 115.887 % of yield - BREAK
Beam 107:  190  -  191  -> 100.44 % of yield - BREAK
Beam 122:  205  - 5022  -> 105.192 % of yield - BREAK
Beam 143:  60   -  410  -> 115.809 % of yield - BREAK
Beam 144:  410  -  411  -> 104.441 % of yield - BREAK
Beam 162:  428  -  199  -> 102.721 % of yield - BREAK
Beam 163:  10   -  510  -> 113.874 % of yield - BREAK
Beam 164:  510  -  511  -> 102.725 % of yield - BREAK
Beam 182:  528  -  99   -> 100.195 % of yield - BREAK

********BRIDGE BREAKS*********

The largest stresses experienced were only ~150% of what the beams could take, which is pretty good! Otherwise most of the beams were well within capacity. But how can we reduce the cost of the bridge and make it stronger at the same time?

Find out in Part 3 (coming June 24)!