5. Solution Data

Once the field is loaded, solution data is available. Individual solution data can be accessed, and the minimum and maximum values for all components can be retrieved.

5.1. Component Names

In baspl++ values contained by a Field object may be scalars, vectors, or second-order tensors. In the case of vectors and second-order tensors, values for the so-called derived components can be retrieved. Derived components are computed from the vector/tensor via pre-defined formulas. For instance, the derived component "amplitude" is obtained by computing the euclidean length of the vector value using the first three components.

A list of all component names, including the derived components can be retrieved by

f.compnames

5.2. Minimum and Maximum Values

Minimum and maximum values are computed on-demand, that is, they are computed when they are first accessed. This is transparent to the user and done this way as the computation of these values may take a few moments for large meshes and is not always required. Access is done either via the "MinMax" page of the Field editor,

or from the Python environment via

f.minmax

which is a dictionary where the keys are all component names, and the values are tuples containing the minimum and maximum values for the respective component.

5.3. Field Values

For any type of Field object, values on the element level can be inspected with the graphical user interface on the "Data" page of the Field editor. The following figure displays nodal values:

The following figure displays stress values that have been computed at the sampling points inside the element, in this case by the B2000++ Finite-Element solver:

The contents of this page can be copied and pasted into, for example, a text editor.

There are two possibilities to access solution data from within the Python environment:

  • For nodal and cell fields, the field data can be accessed by first retrieving the branch (for meshes containing only one branch this is branch 1):

    >>> br = f.branches[1]

    The "br" object is similar to a numpy.array object. It has a shape and can be manipulated:

    >>> print br.shape
    >>> print br[4] # Access the 5th value (indices start at 0)
    >>> br *= 2     # Multiply everything by 2.

    Note that this way of accessing Field data does not apply for any derived components.

  • For gradient fields (like stress and strain fields), the field data cannot be accessed directly from the Field object in Python. Instead the GradientPackage object must be used. It is instantiated for example like this

    f = Field(m, name='STRESS', case=1, cycle=249)
    g = GradientPackage(f, branch=1, element=5058)

    The GradientPackage object allows for listing all layers and component names and for retrieving the values for all sampling points inside the element for that Field:

    >>> g.layers
    [1, 2, 3, 4, 5, 6, 7, 8]
    >>> g.components
    ['Sxx', 'Sxy', 'Sxz', 'Syy', 'Syz', 'Szz', 'S1', 'S2', 'S3', 
     'SD1', 'SD2', 'SD3', 'hydrostatic', 
     'max-shear', 'max-shear-2d', 'max-shear-upper', 'octahedral', 
     'von-Mises', 'von-Mises-2d']
    >>> g.get_gradients(layer=1, compname='Sxx')
    (0.25, 0.25, 0.25, 0.25, 0.25, 0.25, 0.25, 0.25)