udfGetFbdData()
Return data from a flexible body set.
Syntax
fbdData = udfGetFbdData( udfHd, cmdName, dataName ) ;
Type
AcuSolve User-Defined Function Global
Parameters
- udfHd
- The opaque handle (pointer) which was passed to the user function.
- cmdName (string)
- Name of the FLEXIBLE_BODY command.
- dataName (integer)
- Symbolic name of the requested data.
- UDF_FBD_PREV_DISPLACEMENT
- Displacement at step n.
- UDF_FBD_PREV_VELOCITY
- Velocity at step n.
- UDF_FBD_CURR_DISPLACEMENT
- Displacement at step n+1.
- UDF_FBD_CURR_VELOCITY
- Velocity at step n+1.
- UDF_FBD_INTERNAL_FORCE
- Projection of fluid forces on the body.
- UDF_FBD_EXTERNAL_FORCE
- User-given external forces.
Return Value
- fbdData (real)
- Pointer to one dimensional real array of the requested data. The dimension of the array is num_modes (as given by the FLEXIBLE_BODY command) for all values of dataName.
Description
This routine returns data from a flexible body model. For
example,
char* name ; /* name of the UDF */
Integer i ; /* a running index */
Real* disp ; /* displacement (curr or prev) */
Real* dispC ; /* next displacement */
Real* vel ; /* velocity (curr or prev) */
Real* velC ; /* next velocity */
Real* extForce ; /* external force */
Real* intForce ; /* internal force */
name = udfGetName( udfHd ) ;
dispC = outVec ;
velC = outVec + nItems ;
/* If the first time step */
if ( udfFirstStep(udfHd) ) {
disp = udfGetFbdData( udfHd, name, UDF_FBD_CURR_DISPLACEMENT ) ;
vel = udfGetFbdData( udfHd, name, UDF_FBD_CURR_VELOCITY ) ;
for ( i = 0 ; i < nItems ; i++ ) {
dispC[i] = disp[i] ;
velC[i] = vel[i] ;
}
return ;
}
/* Otherwise, get the data from the external program */
intForce = udfGetFbdData( udfHd, name, UDF_FBD_INTERNAL_FORCE ) ;
extForce = udfGetFbdData( udfHd, name, UDF_FBD_EXTERNAL_FORCE ) ;
disp = udfGetFbdData( udfHd, name, UDF_FBD_PREV_DISPLACEMENT ) ;
vel = udfGetFbdData( udfHd, name, UDF_FBD_PREV_VELOCITY ) ;
for ( i = 0 ; i < nItems ; i++ ) {
dispC[i] = ... ;
velC[i] = ... ;
}
Errors
- This routine expects a valid udfHd.
- cmdName must be a valid name.
- dataName must be one of the values given above.