MFOSUB
ModelingUsed 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
Userdefined 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)
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 Python code that can be used to define the scale expression for a case ID. In this example, the scale is defined as $1+0.2\mathrm{sin}\left(2\pi t\right)+0.1\mathrm{sin}\left(6\pi t\right)$ 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
 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:
(1) $${F}_{m}={\displaystyle \sum _{i=1}^{i=ncases}scal{e}_{i}\left(q,t\right)\times modload{s}_{i}}$$where,
${F}_{m}$ is the modal force
$scal{e}_{i}\left(q,t\right)$ 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).
$modload{s}_{i}$ 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.(2) $${F}_{m,i}=scale\left(q,t\right)\times modload{s}_{i}$$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.
(3) $${F}_{m}=scale\left(q,t\right){\displaystyle \sum _{i}{f}_{i}\left(t\right)\times modload{s}_{i}}$$where, $f\left(t\right)$ is 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.
 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: