UserComponents

Functions and constants relating to UserComponents

Functions

UserComponents constants

Name Description
UBMS This constant is deprecated in version 21.0. It is only provided to keep old scripts working. We strongly advise against using it in new scripts. Support may be removed in future versions.
Beam scalar. Use Component.UBMS instead  [deprecated]
UBMV This constant is deprecated in version 21.0. It is only provided to keep old scripts working. We strongly advise against using it in new scripts. Support may be removed in future versions.
Beam vector. Use Component.UBMV instead  [deprecated]
UNOS This constant is deprecated in version 21.0. It is only provided to keep old scripts working. We strongly advise against using it in new scripts. Support may be removed in future versions.
Node scalar. Use Component.UNOS instead  [deprecated]
UNOV This constant is deprecated in version 21.0. It is only provided to keep old scripts working. We strongly advise against using it in new scripts. Support may be removed in future versions.
Node vector. Use Component.UNOV instead  [deprecated]
USSS This constant is deprecated in version 21.0. It is only provided to keep old scripts working. We strongly advise against using it in new scripts. Support may be removed in future versions.
Solid and shell scalar. Use Component.USSS instead  [deprecated]
USST This constant is deprecated in version 21.0. It is only provided to keep old scripts working. We strongly advise against using it in new scripts. Support may be removed in future versions.
Solid and shell tensor. Use Component.USST instead  [deprecated]

Constants for Component Type

Name Description
U_BEAM This constant is deprecated in version 21.0. It is only provided to keep old scripts working. We strongly advise against using it in new scripts. Support may be removed in future versions.
User-defined beam component. Use Component.BEAM instead  [deprecated]
U_NODE This constant is deprecated in version 21.0. It is only provided to keep old scripts working. We strongly advise against using it in new scripts. Support may be removed in future versions.
User-defined nodal component. Use Component.NODE instead  [deprecated]
U_OTHR This constant is deprecated in version 21.0. It is only provided to keep old scripts working. We strongly advise against using it in new scripts. Support may be removed in future versions.
User-defined other (LSDA) component. Use Component.OTHER instead  [deprecated]
U_SOSH This constant is deprecated in version 21.0. It is only provided to keep old scripts working. We strongly advise against using it in new scripts. Support may be removed in future versions.
User-defined solid, shell and thick shell component. Use Component.SOLID_SHELL_TSHELL instead  [deprecated]

Constants for Data Type

Name Description
U_SCALAR This constant is deprecated in version 21.0. It is only provided to keep old scripts working. We strongly advise against using it in new scripts. Support may be removed in future versions.
Scalar data (1 value). Use Component.SCALAR instead  [deprecated]
U_TENSOR This constant is deprecated in version 21.0. It is only provided to keep old scripts working. We strongly advise against using it in new scripts. Support may be removed in future versions.
Tensor data (6 values). Use Component.TENSOR instead  [deprecated]
U_VECTOR This constant is deprecated in version 21.0. It is only provided to keep old scripts working. We strongly advise against using it in new scripts. Support may be removed in future versions.
Vector data (3 values). Use Component.VECTOR instead  [deprecated]

Constants for Existing

Name Description
RENAME This constant is deprecated in version 21.0. It is only provided to keep old scripts working. We strongly advise against using it in new scripts. Support may be removed in future versions.
Rename. Use Component.RENAME instead  [deprecated]
REPLACE This constant is deprecated in version 21.0. It is only provided to keep old scripts working. We strongly advise against using it in new scripts. Support may be removed in future versions.
Replace. Use Component.REPLACE instead  [deprecated]

Constants for Location

Name Description
IN_CORE This constant is deprecated in version 21.0. It is only provided to keep old scripts working. We strongly advise against using it in new scripts. Support may be removed in future versions.
held in memory. Use Component.IN_CORE instead  [deprecated]

Details of functions

CreateUbinComponent(component_name[string], component_type[integer], data_type[integer], if_existing[integer], dispose (optional)[integer], location (optional)[integer or string]) [static]

Description

Create a new user-defined binary (UBIN) component

Note that user-defined components are "program wide", so once created the data "slots" exist in all models. Data values that are not populated will return a value of zero.

Arguments

  • component_name (string)

    A name for this component, up to 30 characters long. If the name is not unique, D3PLOT's behaviour will depend on the value of the 'if_existing' argument to this function.

  • component_type (integer)

    One of the constants

    User-defined components must fall into one of these four categories. It is not possible to have a component of a given name that contains data for more than one of these types.

  • data_type (integer)

    One of the constants

    Choose the data type that matches the information you want to store.

  • if_existing (integer)

    Action to take if UBIN component 'component_name' already exists.

    One of the constants

  • dispose (optional) (integer)

    What to do with the ".ubd" files when the model is closed or D3PLOT exits.

    One of the constants

    If this argument is ommitted or set to zero then LEAVE behaviour is used. However alternative default behaviour may be specified by setting the preference

    d3plot*ubd_file_dispose: to LEAVE or DELETE

  • location (optional) (integer or string)

    Specify where the data for this component is to be stored, one of

    If IN_CORE is used the value of 'dispose' above is ignored.

    If this argument is omitted then the default behaviour of creating .ubd files in the same directory as the analysis database files will be used. However an alternative default directory may also be specified by the preference:

    d3plot*ubd_file_location: <pathname> or IN_CORE or JOBDIR(<pathname>)

    If both <location> and this preferenceare defined then <location> in this function call takes precedence.

    Notes on pathnames:

    1. On Windows platforms forward slash / and backslash \ can be used interchangeably in pathnames. On Linux platforms you must use forward slash / only, so in a multi-system environment it is recommended that you use forward slash syntax only.
    2. If <pathname> contains white space then you must enclose the whole string in "...", for example "C:\my results".

    Returns

    integer handle for the newly created component that should be used in subsequent UBIN processing function calls. This handle should be regarded as private data and not modified in any way. In addition, if a UBIN component is created and then recreated and over-written in a script (if_existing = REPLACE) the handle from each call may be different - don't assume that is has not changed.

    Return type

    Number

    Example

    // Create a component for nodal scalar data
    var handle_1 = CreateUbinComponent("My nodal data", U_NODE, U_SCALAR, REPLACE);
    
    // Create a tensor component for solid, shell and thick shell data
    var handle_2 = CreateUbinComponent("My shell tensor data", U_SOSH, U_TENSOR, REPLACE);
    


    DeleteUbinComponent(handle[integer]) [static]

    Description

    Deletes an existing UBIN component handle. The component is deleted from memory, and any associated .ubd files cached on disk are also deleted.

    If this succeeds it returns JS_TRUE, otherwise JS_FALSE.

    Arguments

  • handle (integer)

    The handle of an existing UBIN component

    Returns

    boolean

    Return type

    Boolean

    Example

    // Delete the UBIN component handle_1
    if(!DeleteUbinComponent(handle_1))
    {
        ...deal with failure...
    }
    


    GetUbinData(handle[integer], item_type[integer], item[integer], int_pt[object | integer], state_id (optional)[integer]) [static]

    Description

    Retrieves data for type/item from a UBIN component.

    If the data has not previoulsy been written, values of 0.0 will be returned.

    Arguments

  • handle (integer)

    The handle of an existing UBIN component as returned by CreateUbinComponent().

  • item_type (integer)

    An item type constant, NODE, SOLID, SHELL, etc. This must match the underlying type of the UBIN component, thus NODE for components of type U_NODE, and so on. It is illegal to attempt to store data for a type that does not match the underlying UBIN component type thus, for example, you cannot store NODE data for a U_SOSH component.

  • item (integer)

    If +ve, the internal item number starting at 1. If -ve, the external label of the item. Internal numbers will be many times faster to process.

  • int_pt (object) | integer

    Integration point: must be a +ve layer number (lowest = 1).

    Or zero for item type / data component combinations that do not consider integration points in this context. (for example nodal displacements or beam forces).

    Or, for fully integrated elements with on plan integration points, an object with properties "ip" and "op". For a further explanation see Defining the Integration point argument in GetData().

    "Top", "Middle" and "Bottom" are not allowed in this context since "middle" is not directly readable in cases with an even number of points.

    A value of 1 should normally be used for solid elements.

    Note, from D3PLOT 11.0 onwards, the order of the integration points for SHELLS and TSHELLS is <int_pnt> 1->n: BOTTOM->TOP surface (so long as a ZTF file is present). See Section 13.8.2.2.

    Prior to this they were in the order of the integration points output by Ansys LS-DYNA, e.g. for <maxint>=3 <int_pnt> 1 was the MIDDLE surface, <int_pnt> 2 was the BOTTOM surface and <int_pnt> 3 was the TOP surface.

    Object has the following properties:

    Name Type Description
    ip integer Through thickness integration point.
    op (optional) integer On plan integration point. Defaults to the first one.

  • state_id (optional) (integer)

    State number to be used. If omitted, the current state is used.

    Returns

    real|Array of reals

    Return type

    Number

    Example

    // Retrieve an array of tensor data for solid #27, which implies that the UBIN data
    // component <handle_1> is of type U_SOSH, and that its data type is U_TENSOR.
    dvec = GetUbinData(handle_1, SOLID, 27, 1);
    sxx = dvec[0];
    szx = dvec[5];
    
    // Retrieve the scalar value of node #17, in state <istate>.
    // This implies that the UBIN component <handle_2> is of type U_NODE and its data is U_SCALAR.
    nval = GetUbinData(handle_2, NODE, 17, 0, istate);
    


    LocateUbinComponent(component_name[string]) [static]

    Description

    Locates an existing UBIN component by name and returns its handle. This is useful when a previous run has created a UBIN component and this script wishes to work with it.

    'component_name' is not case-sensitive, but an exact character match is required, so embedded white space is significant.

    If the lookup succeeds this function returns an object with with properties about the component, if it fails it returns the value JS_FALSE.

    Arguments

  • component_name (string)

    A name to search for, a character string up to 30 characters long. Component names are not case-sensitive, but searching only succeeds if an exact match is found.

    Returns

    Object with the following properties:

    Name Type Description
    ctype integer the component type, U_NODE, U_SOSH, U_BEAM or U_OTHR
    dtype integer the data type, U_SCALAR, U_VECTOR or U_TENSOR
    handle integer the integer handle of the UBIN component

    Return type

    object

    Example

    // Look for component "My nodal data" and put the result of a successful lookup in object 'udata'.
    if(udata = LocateUbinComponent("My nodal data"))
    {
        handle = udata.handle;
        ...
    }
    else
    {
        ... deal with failure
    }
    


    PutUbinData(handle[integer], item_type[integer], item[integer], int_pt[object | integer], data[real|array of reals], state_id (optional)[integer]) [static]

    Description

    Stores data for type/item in a UBIN component handle.

    This will overwrite any existing data in that "slot", which will be lost.

    Arguments

  • handle (integer)

    The handle of an existing UBIN component as returned by CreateUbinComponent().

  • item_type (integer)

    An item type constant, NODE, SOLID, SHELL etc. This must match the underlying type of the UBIN component, thus NODE for components of type U_NODE, and so on. It is illegal to attempt to store data for a type that does not match the underlying UBIN component type thus, for example, you cannot store NODE data for a U_SOSH component.

  • item (integer)

    If +ve, the internal item number starting at 1. If -ve, the external label of the item. Internal numbers will be many times faster to process.

  • int_pt (object) | integer

    Integration point: must be a +ve layer number (lowest = 1)

    Or zero for item type / data component combinations that do not consider integration points in this context (for example nodal displacements or beam forces).

    Or, for fully integrated elements with on plan integration points, an object with properties "ip" and "op". For a further explanation see Defining the Integration point argument in GetData().

    "Top", "Middle" and "Bottom" are not allowed in this context since "middle" is not directly readable in cases with an even number of points.

    A value of 1 should normally be used for solid elements.

    Note from D3PLOT 11.0 onwards, the order of the integration points for SHELLS and TSHELLS is <int_pnt> 1->n: BOTTOM->TOP surface (so long as a ZTF file is present). See Section 13.8.2.2.

    Prior to this they were in the order of the integration points output by Ansys LS-DYNA, e.g. for <maxint>=3 <int_pnt> 1 was the MIDDLE surface, <int_pnt> 2 was the BOTTOM surface and <int_pnt> 3 was the TOP surface.

    Object has the following properties:

    Name Type Description
    ip integer Through thickness integration point.
    op (optional) integer On plan integration point. Defaults to the first one.

  • data (real|array of reals)

    The data to be stored. Its format depends on the "data type" of the component:

    U_SCALAR: Scalar or array of length >=1

    U_VECTOR: Array of length >= 3

    U_TENSOR: Array of length >= 6

    The alignment of array members should be as follows:

    Vector: [X, Y, Z]

    Tensor: [XX, YY, ZZ, XY, YZ, ZX]

  • state_id (optional) (integer)

    State number to be used. If omitted, the current state is used.

    Returns

    boolean

    Return type

    Boolean

    Example

    // Write an array of tensor data for solid #27, which implies that the UBIN data component <handle_1>
    // is of type U_SOSH,and that its data type is U_TENSOR.
    dvec = new Array(6);
    dvec[XX] = sxx;
    dvec[YZ] = syz;
    PutUbinData(handle_1, SOLID, 27, 1, dvec);
    
    // Write the scalar value 19.5 for node #17, in state <istate>.
    // This implies that the UBIN component <handle_2> is of type U_NODE and its data is U_SCALAR.
    PutUbinData(handle_2, NODE, 17, 0, 19.5, istate);