Subroutine Type |
Modeling |
|||||||||
Definition |
Used to extract rigid body contact results. |
|||||||||
Use |
This subroutine can be used to extract rigid body contact results from a MotionSolve simulation which can then be used to generate an output file or process the results programmatically. |
|||||||||
|
<Force_Contact id = "303001" ... cpost_dll_name = "my_contact_post_sub" cpost_param_string = "USER(1000) " cpost_fnc_name = "CONTACTPOST" /> |
|||||||||
Calling Syntax |
FortranSUBROUTINE CONTACTPOST (ID, I_GRA_ID, J_GRA_ID, TIME, PAR, NPAR, IFLAG, ENDFLG)
Cvoid STDCALL CONTACTPOST (int *id, int *i_gra_id, int *j_gra_id, double *time, double *par, int *npar, int *iflag, int *endflg)
Pythondef CONTACTPOST(id, i_gra_id, j_gra_id, time, par, npar, iflag, endflg): |
|||||||||
Input Arguments |
[integer] ID |
The ID of the contact force modeling element (Force_Contact in XML) for which the results are desired. This argument is automatically populated and passed in by MotionSolve. |
||||||||
|
[integer] I_GRA_ID |
The ID of the I body’s graphic representation. This argument is automatically populated and passed in by MotionSolve. |
||||||||
|
[integer] J_GRA_ID |
The ID of the J body’s graphic representation. This argument is automatically populated and passed in by MotionSolve. |
||||||||
|
[double] TIME |
The current simulation time. This argument is automatically populated and passed in by MotionSolve. |
||||||||
|
[double] PAR |
An array that contains the constant arguments from the list provided in the user-defined statement. This argument is defined by the user in the model. |
||||||||
|
[integer] NPAR |
The number of entries in the PAR array. This argument is automatically populated and passed in by MotionSolve based on the size of the PAR array. |
||||||||
|
[integer] IFLAG |
The initialization flag. See Comment 3 for more details. |
||||||||
|
[integer] ENDFLG |
The end flag. See Comment 3 for more details. |
||||||||
Output Values |
None. |
|||||||||
Comments |
Further, if the I and/or J bodies defined in the contact statement refer to more than one graphics, the CONTACTPOST is called for each combination of the I graphic (I_GRA_ID) and the J graphic (J_GRA_ID).
|
|||||||||
Example |
The following example retrieves the penetration depth and total force at each time step for a simulation that models rigid body contact: <Force_Contact id = "303001" label = "Contact 0" num_i_graphics = "1" i_graphics_id = "90001" num_j_graphics = "1" j_graphics_id = "90000" cnf_type = "Impact" stiffness = "1000." exponent = "1.2" damping = "1." dmax = "0.01" cff_type = "Coulomb_Off" cpost_dll_name = "my_contact_post_sub" cpost_param_string = "USER()" cpost_fnc_name = "CONTACTPOST" /> The contents of CONTACTPOST in my_contact_post_sub are: void STDCALL CONTACTPOST (int *id, int *i_gra_id, int *j_gra_id, double *time, double *par, int *npar, int *iflag, int *endflg) { /* Input argument ---------------------------------------------------------- id Identifier of calling CONTACT statement i_gra_id Identifier of calling I_GRAPHIC j_gra_id Identifier of calling J_GRAPHIC time Time of contact par Array containing passed parameters npar Number of passed parameters */ int nof_contacts; bool errflg;
c_get_ncontacts(*id, *i_gra_id, *j_gra_id, &nof_contacts, &errflg); int ipar[4] = {30102020, 0, 0, 0}; double states[6]; int nstates; int ierr;
c_sysary("tdisp", ipar, 1, states, &nstates, &ierr); printf(" I gra %d - J gra %d time : %f nof %d \n", *i_gra_id, *j_gra_id, *time, nof_contacts); for (int i=0; i<nof_contacts; i++) { double pd; double f[3]; int n_results; c_get_contact_post(*id, *i_gra_id, *j_gra_id, "PD", i, &pd, &n_results, &errflg); c_get_contact_post(*id, *i_gra_id, *j_gra_id, "TOTAL_FORCE", i, f, &n_results, &errflg); printf(" %d PD = %f, F=[%f %f %f] z = %f \n", i, pd, f[0], f[1], f[2], states[2]); }
} |