MFOSUB
ModelingCalculate 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"
/>
Format
- Fortran Calling Syntax
-
SUBROUTINE MFOSUB (ID, TIME, PAR, NPAR, DFLAG, IFLAG, RESULTS, MODLOADS, NMODES, NCASES, SCALE, ICASE, LOADVEC)
- C/C++ Calling Syntax
-
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)
- Python Calling Syntax
- Not supported.
- MATLAB Calling Syntax
- Not supported.
Attributes
- ID
- [integer]
- TIME
- [double precision]
- PAR
- [double precision]
- NPAR
- [integer]
- DFLAG
- [logical]
- IFLAG
- [logical]
- MODLOADS
- [double precision]
- NMODES
- [integer]
- NCASES
- [integer]
Output
- SCALE
- [double precision]
- ICASE
- [integer]
- LOADVEC
- [double precision]
Example
The following example lists sample C/C++ 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];
}
}
Comments
- Use MFOSUB to define the 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 modal load corresponding to case i, and is the modal load corresponding to case i. The scale factor can be a function of model states (q) and time (t).
- You can define a MFOSUB in the following 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 can 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 can 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 can 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.
where, is a function of time only.
- Define the modal force:
Defining the modal force directly using MFOSUB is not supported in the current version of MotionSolve.
- Define scale factor for a modal load case: