![]() | (1) |
![]() | (2) |
![]() | (3) |
![]() | (4) |
![]() | (5) |




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. Doing this ensures that Adams Solver correctly distinguishes a C style subroutine from Fortran and calls with the appropriate interface. |

id | An integer variable containing the ID of the GSE statement requesting information from the GSE subroutine. From the identifier, Adams Solver automatically recognizes other information (such as the PAR argument) that is associated with that GSE statement. |
time | A double-precision variable containing the current simulation time. |
par | A double-precision array containing the constant parameters taken in order from the USER parenthetical list in the GSE statement. |
npar | An integer variable containing the number of constants in the Function=USER(...) parenthetical list in the GSE statement. The primary purpose is to provide the subroutine with the number of entries in the par array. |
dflag | The DFLAG argument should be ignored. It is present only to provide backward compatibility for the GSE API. Do not use this argument as a logical flag for computing partial derivatives. Instead, always use the utility subroutine ADAMS_NEEDS_PARTIALS. Using DFLAG will give incorrect results. |
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. |
ns | An integer variable containing the number of continuous states in the GSE; taken from the NS argument to the GSE statement. |
xdot | A double-precision array of dimension NS, containing the derivatives of the state xc. |
id | An integer variable containing the ID of the GSE statement requesting information from the GSE subroutine. From the identifier, Adams Solver automatically recognizes other information (such as the PAR argument) that is associated with that GSE statement. |
time | A double-precision variable containing the current simulation time. |
par | A double-precision array containing the constant parameters taken in order from the USER parenthetical list in the GSE statement. |
npar | An integer variable containing the number of constants in the Function=USER(...) parenthetical list in the GSE statement. The primary purpose is to provide the subroutine with the number of entries in the Par array. |
dflag | The DFLAG argument should be ignored. It is present only to provide backward compatibility for the GSE API. |
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. |
nd | An integer variable containing the number of discrete states in the GSE; taken from the ND argument to the GSE statement. |
XdPlus1 | A double-precision array of dimension ND, containing the value of the GSE discrete states at time T=Tn+1. |
id | An integer variable containing the ID of the GSE statement requesting information from the GSE subroutine. From the identifier, Adams Solver automatically recognizes other information (such as the par argument) that is associated with that GSE statement. |
time | A double-precision variable containing the current simulation time. |
par | A double-precision array containing the constant parameters taken in order from the USER parenthetical list in the GSE statement. |
npar | An integer variable containing the number of constants in the Function=USER(...) parenthetical list in the GSE statement. The primary purpose is to provide the subroutine with the number of entries in the PAR array. |
dflag | The DFLAG argument should be ignored. It is present only to provide backward compatibility for the GSE API. Do not use this argument as a logical flag for computing partial derivatives. Instead, always use the utility subroutine ADAMS_NEEDS_PARTIALS. Using DFLAG will give incorrect results. |
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. |
no | An integer variable containing the number of outputs in the GSE; taken from the NO argument to the GSE statement. |
Y | A double-precision array of dimension NO, containing the value of the GSE at the current simulation time. |
id | An integer variable that gives the identifier of the GSE statement requesting information from the GSE subroutine. From the identifier, Adams Solver automatically recognizes other information (such as the Par argument) that is associated with that GSE statement. |
time | A double-precision variable containing the current simulation time. |
par | A double-precision array containing the constant parameters taken in order from the USER parenthetical list in the GSE statement. |
npar | An integer variable containing the number of constants in the Function=USER(...) parenthetical list in the GSE statement. The primary purpose is to provide the subroutine with the number of entries in the Par array. |
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. |
sample_step | A double-precision scalar, containing the sample step (that is, the difference between the next sample time, and the current simulation). |