Pforce

Model ElementPforce defined in a MotionSolve expression.

Class Name

Pforce

Description

The generalized force acts on all the coordinates involved in the definition of the constraint.

Pforce is available in three different implementations.

Attribute Summary

Name Property Modifiable by command? Designable?
id Int ()    
label Str () Yes  
penalty Double () Yes FD Only
penalty1 Double () Yes FD Only
unilateral Bool () Yes  
smoothing_factor Double () Yes FD Only
function Function ("PFOSUB") Yes  
routine Routine ()    
active Bool () Yes  

Usage

#1. Constraint defined in a MotionSolve expression 
Pforce (function=expressionString, penalty=double, optional_attributes)

#2. Constraint defined in a compiled DLL
Pforce (function= userString, penalty=double, routine=string, optional_attributes)

#3. Constraint defined in a Python/Matlab script
Pforce (function= userString, penalty=double, routine=functionPointer, optional_attributes)

Attributes

Pforce defined in a MotionSolve expression
function
String defining a valid MotionSolve expression.
Specifies the MotionSolve expression that defines the Pforce. Any valid run-time MotionSolve expression can be provided as input.
The function attribute is mandatory.
penalty
Double
Specifies a penalty factor to be used in calculating the restoring force that is used to enforce that the algebraic constraint is always zero.
The attribute routine is mandatory.
Range of values: penalty ≥ 0.
Pforce defined in a compiled DLL
function
String defining a valid user function MotionSolve expression.
The list of parameters that are passed from the data file to the user-defined subroutine where the Pforce is defined.
The function attribute is mandatory.
penalty
Double
Specifies a penalty factor to be used in calculating the restoring force that is used to enforce that the algebraic constraint is always zero.
The attribute penalty is mandatory.
Range of values: penalty ≥ 0.
routine
String
Specifies an alternative name for the user subroutine. The name consists of two pieces of information, separated by "::". The first is the pathname to the shared library containing the function that computes the response of the user-defined Variable. The second is the name of the function in the shared library that does the computation.
  • "/staff/Altair/ engine.dll is the DLL
  • "myPforce" is the function within this DLL that performs the calculations
The attribute routine is optional.
When not specified, routine defaults to PFOSUB.
An example is: routine="/staff/Altair/engine.dll::myPforce"
Pforce defined in a Python function
function
String defining a valid user function MotionSolve expression.
The list of parameters that are passed from the data file to the user-defined subroutine where the Pforce is defined.
The function attribute is mandatory.
penalty
Double
Specifies a penalty factor to be used in calculating the restoring force that is used to enforce that the algebraic constraint is always zero.
The attribute penalty is mandatory.
Range of values: penalty ≥ 0.
routine
Pointer to a callable function in Python.
An example is: routine=myPforce
  • myPforce is a Python function or method that can be called from wherever the model resides.
The attribute routine is optional.
When not specified, routine defaults to PFOSUB.
Optional attributes - Available to all variants
id
Integer
Specifies the element identification number. This number must be unique among all the Pforce objects in the model.
This attribute is optional. MotionSolve will automatically create an ID when one is not specified.
Range of values: id > 0
label
String
Specifies the name of the Pforce object.
This attribute is optional. When not specified, MotionSolve will create a label for you.
penalty1
Double
Specifies a second penalty factor to be used in calculating the restoring force that is used to enforce that the time derivative of the algebraic constraint.
The attribute penalty1 is optional. When not specified, penalty1 defaults to 0.0.
Range of values: penalty1 ≥ 0.
unilateral
Boolean
Select one from True and False.
  • True indicates an inequality constraint (unilateral)
  • False indicates an equality constraint (bilateral) is being specified.
The attribute unilateral is optional.
It defaults to False when not specified.
smoothing_factor
Double
The penalty force due to a unilateral constraint is ramped up in a smooth manner using a STEP function. This specifies the x-value at which the smoothing is completed.
The attribute smoothing_factor is optional. When not specified, smoothing_factor defaults to 0.0.
Range of values: smoothing_factor ≥ 0.
active
Bool
Select one from True or False.
  • True indicates that the element is active in the model and it affects the behavior of the system
  • False indicates that the element is inactive in the model and it does not affect the behavior of the system. It is almost as if the entity was removed from the model, of course with the exception that can be turned "ON" when desirable.
The attribute active is optional. When not specified, active defaults to True.

Example

  1. Particle sliding on a catenary.
    XML Syntax
    <Force_Penalty
        id       = "1"
        label    = "Particle on a catenary"
        type     = "Expression"
        expr     = "dy (9) - cosh(dx(9))"
        penalty  = "1E4"
        penalty1 = "1E2"
    />
    Python Syntax
    pf1 = Pforce (label="particle sliding on a catenary", function=
    "dy(9)-cosh(dx(9))", penalty=1e4, penalty1=1e2)
  2. Enforce movement of a point P such that it moves in the region 1+x < = y
    XML Syntax
    <Force_Penalty
        id               = "10"
        label            = "Enforce 1+x < y"
        type             = "EXPRESSION"
        expr             = "1 + dx(10) - dy(10)"
        penalty          = "1E4"
        penalty1         = "1E2"
        unilateral       = "True"
        smoothing_factor = "1.0"
    />
    Python Syntax
    pf2 = Pforce (label="Enforce 1+x < = y", function="1+dx(10)-dy(10)", penalty=1e4, penalty1=1e2, unilateral=True, smoothing_factor=1)
  3. Enforce movement of a point P such that it moves in the region 1+x < = z and 1-x ≤ z
    XML Syntax
    <Force_Penalty
        id               = "1"
        label            = "Enforce 1+x <=z"
        type             = "EXPRESSION"
        expr             = "1+dx(10)-dz(10)"
        penalty          = "1E4"
        penalty1         = "1E2"
        unilateral       = "True"
        smoothing_factor = "1.0"
    />
    <Force_Penalty
        id               = "2"
        label            = "Enforce 1-x <=z"
        type             = "EXPRESSION"
        expr             = "1-dx(10)-dz(10)"
        penalty          = "1E4"
        penalty1         = "1E2"
        unilateral       = "True"
        smoothing_factor = "1.0"
    />
    Python Syntax
    pf3 = Pforce (label="Enforce 1+x < = z", function="1+dx(10)-dz(10)", penalty=1e4, penalty1=1e2, unilateral=True, smoothing_factor=1)
    
    pf4 = Pforce (label="Enforce 1-x < = z", function="1-dx(10)-dz(10)", penalty=1e4, penalty1=1e2, unilateral=True, smoothing_factor=1)

Comments

  1. See Properties for an explanation about what properties are, why they are used, and how you can extend these.
  2. For a more detailed explanation about Pforce, see Force: Penalty.