HyperWorks Solvers

DIFSUB

DIFSUB

Previous topic Next topic No expanding text in this topic  

DIFSUB

Previous topic Next topic JavaScript is required for expanding text JavaScript is required for the print function  

Subroutine Type

Modeling

Definition

Used to calculate a differential equation value for a control DIFF entity.

Use

A control diff statement based on a user-defined differential equation:

 

<Control_Diff

    label               = "Diff/301001"

    id                  = "301001"

    is_implicit         = "FALSE"

    ic                  = "0."

    ic_dot              = "0."

    is_static_hold      = "FALSE"

    type                = "USERSUB"

    usrsub_param_string = "USER(30102020,30101010)"

    usrsub_dll_name     = "NULL"

 />

Calling Syntax

Fortran

SUBROUTINE DIFSUB (ID, TIME, PAR, NPAR, DFLAG, IFLAG, VALUE)

 

C

void STDCALL DIFSUB (int *id, double *time, double *par, int *npar, int *dflag, int *iflag, double *value)

 

Python

def DIFSUB(id, time, par, npar, dflag, iflag):

    return value

 

MATLAB

function value = DIFSUB(id, time, par, npar, dflag, iflag)

Input Arguments

[integer] ID

The differential equation element identifier.

 

[double precision] TIME

The current simulation time.

 

[double precision] PAR

An array that contains the constant arguments from the list provided in the user-defined statement.

 

[integer] NPAR

The number of entries in the PAR array.

 

[logical] DFLAG

The differencing flag set to true when the solver evaluates the partial derivatives.

 

[logical] IFLAG

The initialization flag.

Output Values

[double precision] VALUE

The double precision value that contains the value of the differential equation.

Example

def DIFSUB(id, time, par, npar, dflag, iflag):

    ipar = 2*[0]

    ipar[0] = int(par[0])

    ipar[1] = int(par[1])

    [dz, errflg] = py_sysfnc("DZ", ipar)

    py_errmes(errflg, "Error calling SYSFNC for DZ"id"STOP")

    ipar = 1*[0]

    ipar[0] = id

    [dif, errflg] = py_sysfnc("DIF", ipar)

    py_errmes(errflg, "Error calling SYSFNC for DIF"id"STOP")

    value = dz-dif

    return value

See Also:

Modeling Subroutines