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; Vtosub 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 contains the ID of the VTORQUE statement requesting information from VTOSUB. From the identifier, Adams Solver automatically recognizes other information (such as the par argument) that is available in the corresponding statement. |
time | A double-precision variable through which Adams Solver conveys the current simulation time. |
par | A double-precision array of constants taken in order from the USER parenthetical list of the VTORQUE statement. |
npar | An integer variable that indicates the number of constants you specify in the USER parenthetical list. The primary purpose of the npar argument is to provide VTOSUB with the number of values stored in the par array. |
dflag | A logical variable that Adams Solver sets to true when it calls VTOSUB to evaluate the partial derivatives of the specified functions. Otherwise, Adams Solver sets the dflag argument to false. |
iflag | An integer variable that Adams Solver sets to indicate why the routine is being called: ![]() Adams Solver sets iflag to 3 when it needs the functional dependency of the user-defined variable. The functional dependencies are set with the same calls to the SYSARY and SYSFNC utility subroutines that are made to compute the value of the user-defined variable. If iflag is 0, Adams Solver computes the value of the user-written variable. 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 declare your dependencies when Adams Solver sets iflag to true, and compute the subroutine's value when Adams Solver sets iflag to false. |
result | A double-precision array of length 3 that returns the x-, y-, and z-components of the VTORQUE. |
Tip: | If the SYSARY or SYSFNC utility subroutines are called to access angular displacements, the values returned by these may contain discontinuities. To avoid the discontinuities, use the RCNVRT utility subroutine to convert the rotational angles from Euler angles to some other coordinate system that does not encounter a singularity. |
Caution: | ■When the iflag argument is not zero, you must make all the same calls to SYSARY and SYSFNC as are made to compute the component values of VTORQUE. This ensures that Adams Solver has the proper functional dependencies. In general, failure to account for dependencies in the VTORQUE components may make it difficult for Adams Solver to converge to a solution and/or may force Adams Solver to take small integration steps, potentially causing large increases in execution time. ■When the iflag argument is not zero, SYSARY and SYSFNC return zero values for system and user-defined variables. When you execute Adams Solver, computations that divide by these values result in fatal errors. You should check for nonzero values or ensure the iflag argument is set to zero before dividing by these values. |