User Tools

Site Tools


wiki:sns:snsscript:perform_geometry_optimization


Performing geometry optimization with SnSScript

This document highlights one of the powerful possibilities that Scan&Solve has to offer: geometry optimization. Essentially, the following process will be automated:

1. Create a simple geometry

2. Define loads and restraints

3. Run Scan&Solve, and check a point for a given stress value

4. Change the geometry and check the stress again

Example 1: Basic optimization of hollow cylinder in bending

The following example uses a model of a hollow cyllindrical beam. The model is restained on one end, and is loaded with a shear force on the other end which causes bending to occur.

Let's say that the outer radius of the beam was specified to be 5 cm. We also want to change the inside radius of the cylinder in order to use less material. The limiting factor has been chosen to be a von Mises stress value located near the restrained face. We will use SnSScript to find this value, and then use Rhinoscript to change the geometry of the cylinder.

For illustrative purposes, the optimization script moves the geometry in order to allow for all of the solution steps to be displayed side-by-side to note changes in size and stress solution. In practice, this is likely not necessary, and the previous step can simply be deleted.

Rhinoscript Example

Try it now! You can copy the following script into a file name of your choosing, with the .rvb file extension, and then run this script in a new Rhino document. Make sure to choose the Centimeters unit system in order to get the same results as below.

cyllinder_optimization_script.rvb

Download the above file and run using Rhinoscript. It will generate the same results seen below.

Result

cyllinder_optimization.jpg

Example 2: Finding optimal load geometry

In this example, we will find the optimum load direction for a given solid geometry. We will consider an angle iron made of steel, fixed at one end, with a bending load applied to one end. The bending load will be a vector quantity with a direction, and will initially point in the x-direction. We want to vary the direction of the load in the x-y plane to find the direction (angle) that produces the smallest and largest deflections.

This process is essentially the same as finding an object's maximum and minimum cross sectional moment's of inertia about a changing axis. For the angle iron cross section, we expect the minimum moment of inertia to occur along it's axis of symmetry, and the maximum to be located 90 degrees away from the axis of symmetry. To find the orientation with the lowest deflection, the following script will use a golden section algorithm.

The golden search algorithm is similar in structure to the binary search (or half-interval search). However, the golden search uses roughly half the computational resources per iteration, because only one of the two interior values need be re-evaluated. Check out the script below:

Golden Section Optimization Script

The above script can be edited in RhinoEdit. As written, the script is set to find the angle which causes minimum displacement. However, the algorithm can be changed to find maximum displacement by reversing the sign of the optimization function. In this case, the optimization function is the function defined in the script totalDisplacement. So, multiplying the output of the function by -1 will cause the script to produce the angle causing maximum displacement.

Not only can the script be modified to search for both maximum and minimum locations, but the script could also be changed and used for any general, unimodal optimization problem. The optimization function, input parameters, geometry specification, restraints and loads would all need to be modified, but the core golden section algorithm could be re-used.

References

wiki/sns/snsscript/perform_geometry_optimization.txt · Last modified: 2017/07/17 10:52 by claire