thegrumpys / odop

Open Design Optimization Platform (ODOP) - Coil spring design app; mechanical springs; compression spring, extension spring, torsion spring
https://www.springdesignsoftware.org
MIT License
4 stars 5 forks source link

Add eqnset tests for pathological cases #870

Closed grumpyinca closed 7 months ago

grumpyinca commented 8 months ago

Background

A general mathematical model with no or loose limits to its inputs will contain vulnerabilities to undesired behavior created by "pathological" cases. Common examples are divide-by-zero and square root of a negative number. These situations create singularities in the design space. With ODOP, there are cases where a search will fail to find the correct result because a singularity lies between the search start point and a known good solution.

Spring Design Example

The analysis of round wire helical coil springs provides an example for the case where coil outside diameter (OD_Free) is exactly twice the wire diameter (Wire_Dia). In this situation, the inside diameter (ID_Free) is exactly zero and the spring index (Spring_Index) is exactly one. That value of Spring_Index results in a divide-by-zero problem in the calculation of the Wahl curvature correction factor (kc). Javascript renders the result as infinity which then propagates through dependent equations. Eventually, equations involving operations like subtraction of infinities create values of NaN which propagate to additional dependent equations.

Implications for test case construction

Fine tuning of the mathematical model may be able to mitigate some of these singularities. Adding test cases that include the problematic cases is thought to be a useful tool in the development of the fine tuning.

1fifoto commented 8 months ago

Added OD_Free = 0.4 and Wire_Dia = 0.2 Pathological 001 test. There are many many more, but this is a start,

Don't forget to add eqnset tests to Extension and Torsion spring

grumpyinca commented 7 months ago

Work impacting initialState will continue as #876. Some work to extend the pathological test cases to extension and torsion remains.

1fifoto commented 7 months ago

All Eqnset tests for Torsion sets Heat_Treat to 2 to force calculation of kh and its subsequent NaNs

Merged into master, closing.