Previous section-----Next section

2.5.1 SolveMech

The SolveMech command is used without arguments to seek a single solution to the mechanism model, with all of the current values of any user-defined variables in the model. When SolveMech seeks a solution, what it is really trying to do is numerically find the location and orientation of each of the bodies in the model at which all of the constraints are satisfied.

Mech's runtime command.

Time Dependence

Most mechanism models have some dependency on time that is specified (by default) by the symbol T. When T appears in a mechanism model, the model's location becomes explicitly a function of time, a technique that must be used in the velocity and acceleration portions of the analysis. It is not necessary to have any dependency on T in a model used only for location analysis, but it is customary to make the primary driving expression a function of T anyway.

The symbol for time.

SolveMech has several special invocations that are useful for finding a solution or many solutions at a range of values of T.

More arguments for SolveMech.

The 2D crankshaft-piston model is used to demonstrate the various forms of SolveMech. When this example was first used in Section 1.2, the symbol crankangle was used to specify the rotation of the crankshaft. Now crankangle is replaced with  so that the rotation of the crankshaft is a function of time. Thus, the crankshaft has an angular velocity of one revolution per second.

This loads the Modeler2D package.

Here is the crankshaft-piston model with a time-dependent driver.

Now, instead of changing the value of crankangle to drive the model the value of time is changed directly with SolveMech.

This runs the model at 1/10 turn of the crankshaft.

This seeks 3 solutions from 0 to 0.5 turns, inclusive.

The unusual form of the iteration specifier in SolveMech is very useful if an even spread of data is desired, with a few particular data points specified in between. For example, the following example generates six solution points with the points T = 0., 0.223, and 0.3 included, and the other three points spread so as to fill the gaps as evenly as possible.

This seeks 6 solution points, including T = 0.223

Initial Guesses at Runtime

Setting initial guesses with SolveMech.

The primary reason for passing rules into SolveMech, instead of just specifying the value of time, is to accelerate the solution process. The supplied rules may be known to be very good initial guesses, such as rules obtained from a prior run with a slightly different value for a parameter.

This calls SolveMech with a list of guesses. The value of time T = 0.2 is pulled from the guesses.