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.

C<br />

RESULT(2) = ...<br />

RESULT(3) = ...<br />

RESULT(4) = ...<br />

RESULT(5) = ...<br />

RESULT(6) = ...<br />

RETURN<br />

END<br />

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

C Style - Pro<strong>to</strong>type<br />

typedef void adams_c_GFOSUB(const struct s<strong>Adams</strong>Gforce* gfo, double<br />

TIME, int DFLAG, int IFLAG, double* RESULT);<br />

/*<br />

* GFORCE<br />

*/<br />

struct s<strong>Adams</strong>Gforce<br />

{<br />

int ID;<br />

int NPAR;<br />

const double* PAR;<br />

int I;<br />

int RM;<br />

int JFLOAT;<br />

};<br />

Examples<br />

For an example of this subroutine, see gfosub.f.<br />

GSE_DERIV, GSE_UPDATE, GSE_OUTPUT, GSE_SAMP<br />

These four subroutines are used <strong>to</strong> completely define a GSE (C++ or FORTRAN). Recall that the<br />

constitutive equations for a GSE have the form:<br />

• GSE_DERIV defines the function fc(), shown in Equation 1 above. GSE_DERIV also returns<br />

the partial derivatives:<br />

• GSE_UPDATE defines the function fd(), shown in Equation 2 above. It defines the derivative of<br />

the states that the GSE introduces. GSE_UPDATE does not return any partial derivatives.<br />

• GSE_OUTPUT defines the function g(), shown in Equation 3 above. GSE_OUTPUT also<br />

returns the partial derivatives:<br />

• GSE_SAMP defines the sampling period associated with Equation 2. The sampling period is the<br />

time between two consecutive updates. It does not need <strong>to</strong> be a constant.<br />

173

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

Saved successfully!

Ooh no, something went wrong!