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.

SUBROUTINE SFOSUB (ID, TIME, PAR, NPAR, DFLAG, IFLAG, VALUE)<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 />

DOUBLE PRECISION DM, VR, V(3)<br />

INTEGER IPAR(2)<br />

LOGICAL ERRFLG, PARFLG<br />

IPAR(1)=12<br />

IPAR(2)=9<br />

CALL ADAMS_NEEDS_PARTIALS(PARFLG)<br />

CALL SYSFNC('DM', IPAR, 2, DM, ERRFLG )<br />

CALL SYSFNC('VR', IPAR, 2, VR, ERRFLG )<br />

IF(PARFLG) THEN<br />

CALL IMPACT(400.D0-DM,-VR,100D0,1.D2,1.5D0, 1D1,1.D0,1,V,ERRFLG)<br />

CALL SYSPAR('DM', IPAR, 2, V(1), 1, ERRFLG )<br />

CALL SYSPAR('VR', IPAR, 2, V(2), 1, ERRFLG )<br />

ENDIF<br />

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

CALL IMPACT(400-DM,-VR,100D0,100.0D0,1.5D0,10D0,1.0D0,0,V,ERRFLG)<br />

VALUE=-V(1)<br />

CALL ERRMES(ERRFLG,'ERROR FOR SFORCE',ID,'STOP')<br />

RETURN<br />

END<br />

Using FIESUB with SYSPAR<br />

This example, involving FIESUB, shows how SYSPAR has closed the functionality gap between<br />

GFOSUB and FIESUB. In the FORTRAN 77 version of <strong>Adams</strong>/<strong>Solver</strong>, the ability <strong>to</strong> define partial<br />

derivatives of the FIELD element in a FIESUB user subroutine gives it a computational advantage over<br />

the GFORCE force element and a GFOSUB user subroutine. The FIESUB user subroutine is defined as<br />

follows:<br />

CALL FIESUB(ID, TIME, PAR, NPAR, DISP, VELO,<br />

DFLAG, IFLAG, FIELD, DFDDIS, DFDVEL)<br />

where DISP and VELO are the displacement and velocity of the I and J markers of the field element that<br />

are input <strong>to</strong> FIESUB. FIESUB computes the 6D value of the force, FIELD. Also, when DFLAG is<br />

TRUE, you must provide the partial derivatives with respect <strong>to</strong> displacement, DFDDIS, and the partial<br />

derivatives with respect <strong>to</strong> velocity, DFDVEL. Learn more about FIELD (C++ or FORTRAN).<br />

115

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

Saved successfully!

Ooh no, something went wrong!