Subroutine Type |
Modeling |
|
Definition |
Used to calculate the scale factor for a modal force entity. Alternatively, you may also use MFOSUB to calculate and return the distributed load shape on the flexible body. |
|
Use |
User-defined scale or load shape computed in a MFOSUB: |
|
|
<Force_FlexModal id = "1" label = "MFORCE_1" case_id = "1" flex_body_id = "30102" usrsub_param_string = "USER(1)" usrsub_dll_name = "mfosub_test" usrsub_fnc_name = "MFOSUB" force_sub = "false" /> |
|
Calling Syntax |
FortranSUBROUTINE MFOSUB (ID, TIME, PAR, NPAR, DFLAG, IFLAG, RESULTS, MODLOADS, NMODES, NCASES, SCALE, ICASE, LOADVEC) C/C++void STDCALL MFOSUB (int *id, double *time, double *par, int *npar, int *dflag, int *iflag, double *modloads, int *nmodes, int *ncases, double *scale, int *icase, double *loadvec) |
|
Input Arguments |
[integer] ID |
The flexible modal force 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. |
|
[logical] IFLAG |
The initialization flag. |
|
[double precision] MODLOADS |
An array that contains the modal loads. |
|
[integer] NMODES |
An integer value that specifies the number of modes for the flex body. This can be used to ensure that the size of the LOADVEC output matches the number of modes for the flexible body. |
|
[integer] NCASES |
An integer value that specifies the total number of load cases. If NCASES = 0, then there are no modal loads specified for this flexible body. |
Output Values |
[double precision] SCALE |
The computed scale factor which is multiplied with the modal load to generate the modal force for this flexible body. This output is not used when force_sub is set to TRUE in the corresponding Force_FlexModal statement. |
|
[integer] ICASE |
The ID of the load case that the scale factor will be applied to. Set this to the ID of the load case for which the scale factor is computed. If ICASE is set to 0, MotionSolve will obtain modal loads from the LOADVEC output. See Comments for more details. |
|
[double precision] LOADVEC |
A double precision vector array that contains the computed modal loads. |
1. | The MFOSUB can be used to define modal force on a flexible body that is dependent on system states and time. The modal force is expressed as: |
where,
is the modal force
is the scale factor for the mode load corresponding to case i. The scale factor can be a function of model states (q) and time (t).
is modal load corresponding to case i.
This can be defined in multiple ways:
Define scale factor for a modal load case
Use this method to define the scale factor when it cannot be defined by a simple MotionSolve expression or when you need to use system states to define the scale factor. You may use SYSFNC or SYSARY to access the instantaneous states during the simulation to compute the scale factor. In this case, MotionSolve expects two return values from the MFOSUB:
• | The load case id, ICASE |
• | The scale factor, SCALE |
Using this method, you are able to define the scale factor for only one load case ID or index. To use this method, set force_sub to FALSE in the corresponding Force_FlexModal model statement. MotionSolve multiplies the scale factor with the modal load for the case ID specified to obtain the modal force.
Define scale factor for multiple modal loads
Use this method to define a common scale factor for all available modal load cases. As before, you may use SYSFNC or SYSARY to access instantaneous model states only for defining the scale factor. In this case, MotionSolve expects three return values from the MFOSUB:
• | The load case ID, ICASE |
• | The scale factor, SCALE |
• | The combined modal load cases, passed in LOADVEC |
To use this method, set force_sub to FALSE in the corresponding Force_FlexModal model statement and also set ICASE to 0 in the MFOSUB. With ICASE set to 0, MotionSolve multiplies the scale factor with the combined modal load vector to obtain the modal force.
whereis a function of time only.
Define the modal force
Defining the modal force directly using the MFOSUB is not supported in the current version of MotionSolve.
The following example lists sample Python code that can be used to define the scale expression for a case ID. In this example, the scale is defined as for case ID 1. The corresponding Force_FlexModal statement is:
<Force_FlexModal
id = "1"
label = "MFORCE_1"
flex_body_id = "30102"
usrsub_param_string = "USER(1)"
usrsub_dll_name = "mfosub_test"
usrsub_fnc_name = "MFOSUB"
force_sub = "false"
/>
The MFOSUB code inside mfosub_test library is shown below:
DLLFUNC void STDCALL MFOSUB (int *id, double *time, double *par, int *npar, int *dflag, int *iflag, double *modloads, int *nmodes, int *ncases, double *scale, int *icase, double *loadvec)
{
{
*scale = 1.0+0.2*sin(double(2*PI*(*time)))+0.1*sin(double(2*PI*(*time)*3));
*icase = (int)par[0];
}
}