Note: | Use mixed case names for the Adams subroutine names when using the C style interface. For the default subroutine name capitalize the first letter and have the remaining letters lower case; Motsub for example. Doing this ensures that Adams Solver correctly distinguishes a C style subroutine from Fortran and calls with the appropriate interface. |

id | An integer variable that provides the identifier of the MOTION statement requesting information from MOTSUB. From the identifier, Adams Solver automatically knows other information (such as the par argument) available in the corresponding statement. |
iflag | An integer variable that Adams Solver sets to indicate why the routine is being called: ![]() When iflag is 0 Adams Solver calling to compute the value of the user-written variable. When iflag is set to 1 or 3 do any initializations that your subroutine requires. When your user-defined subroutine has static data that needs to be saved and restored to support the Adams Solver commands Save and Reload, then call the serialization functions for your data when iflag is set to 7, and the un-serialization functions when iflag is set to 9. Note: In simple subroutines where serializing data is not needed, you can declare iflag as a logical variable. In this case you can do any initializations when Adams Solver sets iflag to true, and compute the subroutine's value when Adams Solver sets iflag to false. |
iord | An input integer variable indicating the order of the time derivative that Adams Solver requires at different points in the analysis. When the motion is a displacement, Adams Solver, at various times, calls MOTSUB with IORD set to 0, 1, or 2, requesting the displacement value and its first and second time derivatives, respectively. When the motion is a velocity, Adams Solver only calls MOTSUB with IORD set to 0 or 1, and returns the velocity value and its time derivative, respectively. The second time derivative, a velocity motion, is never required. When the motion is an acceleration, Adams Solver only uses IORD set to 0. No time derivatives of the function used in the MOTSUB for an acceleration motion are needed. |
npar | An integer variable that indicates the number of constants specified in the USER parenthetical list. The primary purpose of npar is to provide MOTSUB with the number of values stored in the par array. |
par | A double-precision array of constants taken in order from the USER parenthetical list of the MOTION statement. |
time | A double-precision variable through which Adams Solver conveys the current simulation time. |
value | A double-precision variable that returns the zeroth, first, or second derivative of the motion of the I marker with respect to the J marker. These derivatives represent the displacement, velocity, and acceleration of the motion, respectively. The value of IORD indicates which derivative of motion value must return. |
Caution: | ■Define the motion only as a function of time. Don't make calls to the SYSARY and SYSFNC utility subroutines to access other system variables or to access user-defined variables. ■Make sure the first and second derivatives MOTSUB returns for displacement are correct. ■If the CUBSPL utility subroutine or any of the Adams Solver utility subroutines are used, do not forget to involve the derivatives returned by these subroutines when the MOTSUB derivatives are evaluated. ■Avoid conditional branching that results in discontinuous accelerations, velocities, or displacements. ■Make sure MOTSUB uses length units to define translational displacements and their derivatives, and radians to define rotational displacements and their derivatives. |