HyperWorks Solvers

Pforce

Pforce

Previous topic Next topic No expanding text in this topic  

Pforce

Previous topic Next topic JavaScript is required for expanding text JavaScript is required for the print function  

Model Element

Class Name

Pforce

Description

Pforce defines a penalty force whose purpose is to maintain a “soft” constraint in the system.  This means that when the constraint is satisfied, there is no penalty force.  However, if the constraint is violated, a penalty force that tries to reduce the violation is generated.  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?

id    

Int ()

 

label

Str ()

penalty        

Double ()

penalty1      

Double ()

unilateral    

Bool ()

smoothing_factor

Double ()

function  

Function ("PFOSUB")

routine  

Routine ()

 

active

Bool ()

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)

Attribute

Description

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.

An example is: routine=”/staff/Altair/engine.dllmyPforce

”/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.

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

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 the Comments in the XML syntax section

Example

1.Particle sliding on a catenary.

XML Syntax:

 

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:

 

Python Syntax:

pf2 = Pforce (label="Enforce 1+x < = y", function="1+dx(10)-dy(10)", penalty=1e4, penalty1=1e2, unilateral=True, smoothing_factor=1)

4.Enforce movement of a point P such that it moves in the region 1+x < = z and 1-x ≤z.

XML Syntax:

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)