General

General

How to use *DEFINE_FUNCTION and *DEFINE_CURVE_FUNCTION for applying loads?

    • FAQFAQ
      Participant

      LS-DYNA offers a number of keywords for imposing loads on structures. For example, *LOAD_NODE_OPTION can be used for applying nodal forces and moments, *LOAD_SEGMENT_OPTION can be used for defining distributed loads over segments, while *LOAD_RIGID_BODY can be used for applying a concentrated force or moment at the center of mass of a rigid body. The load value is usually specified as a function of time through a load curve (*DEFINE_CURVE) that is referenced by the field LCID. However, this may not be convenient when a load is described by an analytical function of time or if the load also depends on other variables, such as the nodal coordinates. In such cases, the load can be specified by referencing a *DEFINE_FUNCTION or a *DEFINE_CURVE_FUNCTION card through the field LCID. As explained in the manual, *DEFINE_FUNCTION can be referenced by a limited number of keywords between which the arguments of the function can differ. For example, in *LOAD_NODE, the *DEFINE_FUNCTION card can be used with 7 arguments, namely the time, the three current coordinates of the node, and the three initial coordinates of the node at which the load is applied. On the other hand, in *LOAD_SEGMENT, the function has 10 arguments: the time, the current and initial coordinates at the segment centroid, and the three translational velocities at the segment centroid. Unless stated otherwise, the function arguments should be included in the correct order as stated in the manual. One of the common usages of *DEFINE_FUNCTION in *LOAD_SEGMENT is the application of hydrostatic or soil pressure. The example below applies a nodal force at nodes 2 and 4 which is proportional to the resultant displacement at node 2 and node 4, respectively. *LOAD_NODE_SET 1,1,1,1.0 *SET_NODE_LIST 1 2,4 *DEFINE_FUNCTION 1 f(t,x,y,z,x0,y0,z0)=-5.0*sqrt((x-x0)*(x-x0)+ (y-y0)*(y-y0)+(z-z0)*(z-z0)) Functions that cannot be described with a simple arithmetic expression can be provided in the form of a script instead. The script is written in a C-like programming language and needs to be appended in the *DEFINE_FUNCTION card as shown below. The following example is used for applying a force that is equal to the product of a constant k times the X displacement at the node if this product is negative, else the force is set equal to zero. *DEFINE_FUNCTION 1 float force(float t, float x, float y, float z, float x0, float y0, float z0) { float result, k; k = 5.0; result = -k*(x-x0); if (result >= 0.0) result = 0.0; return result; } *DEFINE_CURVE_FUNCTION can be used in place of *DEFINE_CURVE. The curve-function can reference other curve definitions, kinematic and force response quantities, intrinsic functions, and other quantities that are listed in the Manual Vol I. To output the value of the curve, *DATABASE_CURVOUT can be used. The curve-function below is interpreted as follows. The function contains an expression that has a component proportional to the X displacement at node 2 and a second component proportional to the X velocity at the same node. The applied force is set equal to the result of the expression if that is negative, otherwise the applied force is set equal to zero. *LOAD_NODE 2,1,1,1.0 *DEFINE_CURVE_FUNCTION 1 IF(-5.0*DX(2)-0.01*VX(2),-5.0*DX(2)-0.01*VX(2),0.0,0.0)