02.04.2013 Views

Welcome to Adams/Solver Subroutines - Kxcad.net

Welcome to Adams/Solver Subroutines - Kxcad.net

Welcome to Adams/Solver Subroutines - Kxcad.net

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

228<br />

<strong>Adams</strong>/<strong>Solver</strong><br />

FORTRAN - Pro<strong>to</strong>type<br />

A sample structure for VARSUB is shown next. The comments explain how the subroutine works.<br />

SUBROUTINE VARSUB ( ID, TIME, PAR, NPAR, DFLAG,<br />

& IFLAG, VALUE )<br />

C<br />

C === Type and dimension statements ===================<br />

C<br />

C<br />

C - External variable definitions ---------<br />

C<br />

INTEGER ID<br />

DOUBLE PRECISION TIME<br />

DOUBLE PRECISION PAR( * )<br />

INTEGER NPAR<br />

LOGICAL DFLAG<br />

LOGICAL IFLAG<br />

DOUBLE PRECISION VALUE<br />

C<br />

C ID Identifier of calling VARIABLE statement<br />

C TIME Current time<br />

C PAR Array of passed statement parameters<br />

C NPAR Number of passed parameters<br />

C DFLAG Differencing flag<br />

C IFLAG Initialization pass flag<br />

C VALUE The VARIABLE value returned <strong>to</strong> ADAMS<br />

C<br />

C - Local variable definitions -----------<br />

C<br />

...<br />

C<br />

C === Executable code =================================<br />

C<br />

C Assign parameters <strong>to</strong> readable variable names<br />

C<br />

...<br />

C<br />

C Call SYSFNC and/or SYSARY <strong>to</strong> collect information for<br />

C calculations below. Note: if IFLAG is true, these<br />

C calls are actually setting functional dependencies.<br />

C<br />

CALL SYSFNC ( ... )<br />

C<br />

CALL ERRMES ( ... )<br />

C<br />

C Repeat for all required SYSFN<br />

C or SYSARY calls<br />

C<br />

...<br />

C<br />

IF( IFLAG ) THEN

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!