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

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Using the DFLAG Variable<br />

<strong>Welcome</strong> <strong>to</strong> <strong>Adams</strong>/<strong>Solver</strong> <strong>Subroutines</strong><br />

The use of the DFLAG variable with a GFOSUB is optional. It merely identifies that GFOSUB is being<br />

called <strong>to</strong> evaluate a partial derivative. One of the states on which the GFOSUB depends has been<br />

perturbed very slightly. In many situations, it is likely that major calculations in the GFOSUB are<br />

insensitive <strong>to</strong> small changes in state, and therefore, need not be recalculated.<br />

In such situations, you can structure the GFOSUB not <strong>to</strong> redo these calculations. For example, assume<br />

you are using a GFOSUB <strong>to</strong> model tire and terrain interactions. The terrain is modeled as a set of<br />

triangular patches, and the tire forces as a GFOSUB. A labor-intensive calculation in the problem is <strong>to</strong><br />

identify the patch that is in contact with the tire. Because pertubations of system states are always small<br />

when DFLAG is true, it is not necessary <strong>to</strong> recalculate the patch that is in contact with the tire.<br />

Caution: • Euler angles calculated by SYSARY or SYSFNC subroutines may be<br />

discontinuous. To avoid discontinuity, use the RCNVRT utility subroutine <strong>to</strong><br />

convert the rotational angles from Euler angles <strong>to</strong> some other rotational scheme<br />

that does not encounter discontinuity.<br />

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

• When the iflag argument is true, you must make all the calls <strong>to</strong> SYSARY and<br />

SYSFNC as are made <strong>to</strong> compute the component values of the GFORCE<br />

statement. This ensures that <strong>Adams</strong>/<strong>Solver</strong> has the proper functional dependencies.<br />

In general, failure <strong>to</strong> account for dependencies in the GFORCE components can<br />

make it difficult for <strong>Adams</strong>/<strong>Solver</strong> <strong>to</strong> converge <strong>to</strong> a solution and/or can force<br />

<strong>Adams</strong>/<strong>Solver</strong> <strong>to</strong> take small integration steps. It may increase simulation time<br />

dramatically.<br />

• When the iflag argument is true, SYSARY and SYSFNC return zero values for<br />

system and user-defined variables. Computations that divide by these values will<br />

result in fatal errors. You should check for nonzero values, or ensure the iflag<br />

argument is set <strong>to</strong> false, before dividing by these values.<br />

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

&<br />

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

IFLAG, RESULT)<br />

C<br />

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

C<br />

C Note: For a machine with 60 or more bits per word,<br />

C<br />

C<br />

substitute "REAL" for "DOUBLE PRECISION".<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 />

171

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

Saved successfully!

Ooh no, something went wrong!