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

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)

Attributes

ID
[integer]
The flexible modal force element identifier.
TIME
[double precision]
The current simulation time.
PAR
[double precision]
An array that contains the constant arguments from the list provided in the user defined statement.
NPAR
[integer]
The number of entries in the PAR array.
DFLAG
[logical]
The differencing flag.
IFLAG
[logical]
The initialization flag.
MODLOADS
[double precision]
An array that contains the modal loads.
NMODES
[integer]
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.
NCASES
[integer]
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

SCALE
[double precision]
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.
ICASE
[integer]
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.
LOADVEC
[double precision]
A double precision vector array that contains the computed modal loads.

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 sin ( 2 π t ) + 0.1 sin ( 6 π t ) 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

  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: (1)
    F m = i = 1 i = n c a s e s s c a l e i ( q , t ) × m o d l o a d s i

    where,

    F m is the modal force

    s c a l e i ( q , t ) 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).

    m o d l o a d 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:
      1. The load case id, ICASE
      2. 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 = s c a l e ( q , t ) × m o d l o a d 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 = s c a l e ( q , t ) i f i ( t ) × m o d l o a d s i

      where, f ( t ) 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.