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.

194<br />

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

Use<br />

Corresponding Command<br />

Calling Sequence<br />

SUBROUTINE SAVSUB(iunit, errflg)<br />

Input Arguments<br />

iunit An integer variable that contains the FORTRAN IO unit of the<br />

<strong>Adams</strong>/<strong>Solver</strong> save file. <strong>Adams</strong>/<strong>Solver</strong> opens the save file as sequential and<br />

unformatted. You may s<strong>to</strong>re data in the save file by writing it <strong>to</strong> this unit<br />

with an unformatted FORTRAN WRITE statement.<br />

Output Argument<br />

errflg A logical variable that indicates <strong>to</strong> <strong>Adams</strong>/<strong>Solver</strong> that an error has<br />

occurred while saving user data. If you set errflg <strong>to</strong> true, <strong>Adams</strong>/<strong>Solver</strong><br />

writes an error message <strong>to</strong> the screen and <strong>to</strong> the message file.<br />

Tip: The most straightforward way <strong>to</strong> reinitialize user-written subroutines might be <strong>to</strong> collect<br />

the necessary variables in a COMMON block, use SAVSUB <strong>to</strong> write them <strong>to</strong> the save file,<br />

and RELSUB <strong>to</strong> read them back from the save file.<br />

Caution: RELSUB must read data from the save file in the same order in which SAVSUB wrote the<br />

data.<br />

Structure<br />

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

SUBROUTINE SAVSUB(IUNIT, ERRFLG)<br />

C<br />

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

C<br />

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

C<br />

INTEGER IUNIT<br />

LOGICAL ERRFLG<br />

C<br />

C IUNIT FORTRAN IO unit attached <strong>to</strong> Save File<br />

C ERRLFG used <strong>to</strong> signal problems back <strong>to</strong> ADAMS<br />

C

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

Saved successfully!

Ooh no, something went wrong!