Welcome to Adams/Solver Subroutines - Kxcad.net
Welcome to Adams/Solver Subroutines - Kxcad.net
Welcome to Adams/Solver Subroutines - Kxcad.net
You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
Input Arguments<br />
<strong>Welcome</strong> <strong>to</strong> <strong>Adams</strong>/<strong>Solver</strong> <strong>Subroutines</strong><br />
dflag A logical variable that <strong>Adams</strong>/<strong>Solver</strong> sets <strong>to</strong> true when it calls DIFSUB <strong>to</strong><br />
evaluate partial derivatives of the function. Otherwise, <strong>Adams</strong>/<strong>Solver</strong> sets<br />
dflag <strong>to</strong> false.<br />
id An integer variable that provides the identifier of the DIFF statement<br />
requesting information from the DIFSUB. From the identifier,<br />
<strong>Adams</strong>/<strong>Solver</strong> au<strong>to</strong>matically knows other information (such as the par<br />
argument) available in the corresponding statement.<br />
iflag A logical variable that <strong>Adams</strong>/<strong>Solver</strong> sets <strong>to</strong> true when it needs the<br />
functional dependency of the user-defined variable. The functional<br />
dependencies are set with the same calls <strong>to</strong> the SYSARY and SYSFNC<br />
utility subroutines that are made <strong>to</strong> compute the value of the user-defined<br />
variable. If iflag is false, <strong>Adams</strong>/<strong>Solver</strong> computes the value of the userwritten<br />
variable.<br />
npar An integer variable that indicates the number of constants specified in the<br />
USER parenthetical list. The primary purpose of npar is <strong>to</strong> provide the<br />
DIFSUB evaluation subroutine with the number of values s<strong>to</strong>red in the par<br />
array.<br />
par A double-precision array of constants taken in order from the USER<br />
parenthetical list of the DIFF statement.<br />
time A double-precision variable through which <strong>Adams</strong>/<strong>Solver</strong> conveys the<br />
current simulation time.<br />
Output Argument<br />
value A double-precision variable that returns the value of the differential<br />
equation. If the equation is in the explicit form, value contains the<br />
derivative. If the equation is in the implicit form, value contains the residual<br />
(that is, the error relative <strong>to</strong> zero) of the implicit equation. In this case, value<br />
can be a function of the dependent variable and its time derivative.<br />
Extended Definition<br />
A DIFF statement with a function expression is sufficient for defining most user-defined differential<br />
equations. However, if the expression becomes lengthy and awkward or if the definition of the equation<br />
requires additional features of FORTRAN-77, you should use the FUNCTION=USER() argument in the<br />
DIFF statement, and write a DIFSUB evaluation subroutine <strong>to</strong> define the differential equation.<br />
DIFSUB allows you <strong>to</strong> define a differential equation for a variable either explicitly or implicitly:<br />
• In an explicit definition, the derivative of the variable is evaluated on the right side of a<br />
FORTRAN-77 assignment statement.<br />
157