    

 ## On this page

  

 

 # Solution classes

 Last update: 20.02.2025 

## [`Solution`](#compolyx.Solution)

### *class* compolyx.Solution(obj, parent=None)

Class to compute postprocessings of a finite element solution.

Access:

```pycon
>>> import compolyx
>>> db = compolyx.DB()
>>> model = db.models['class40.1']
>>> sol = db.models['class40.1'].add_solution(name='class40.1', path='class40.rst', format='ansys:rst')

```

#### *property* ID

Id to be displayed in Envelope solution.

#### *property* active

Activate or deactivate solution.

#### clear()

Clear all result data.

#### clear\_element\_results()

Resets the postprocessing results for each layered element.

#### clear\_failure\_criteria\_results()

Resets the failure criteria results for each layered element.

#### *property* enabled

Whether this object is currently enabled or not. Mainly defined through the current application mode pre or post.

#### export\_results\_to\_csv(definition=None, entities=\[\], file\_path=None, solution\_set=-1, solids=False, spot='all')

Exports the shell results of the selected entities to a csv file.

- **Parameters:**
    - definitions: Selected definition - CombinedFailure Criteria object or as string ‘deformations’, ‘strains’, or ‘stresses’.
    - entities: Defines the selection for the export. Can be a list of ElementSets, AnalysisPlies, or SolidModels.
    - file\_path: File name.
    - solution\_set: Solution Set for which data is requested.
    - solids: Boolean whether to take the results of the solid elements or not. Default is False (results of shells).
    - spots: Layer positions for which the results are exported. Allowed are ‘bot’, ‘mid’, ‘top’, ‘bot/top’, and ‘all’.

Export results of solid models: Choose the element set which is selected in the extrusion settings.

- **Usage:**```pycon
    >>> model = db.active_model
    >>> model.solutions['Solution.1'].export_results_to_csv( definition='stresses', entities=[model.element_sets['BULKHEAD_ALL']], file_path=r'C: mp\stresses.csv', solution_set=1, solids=False, spot='bot-top')
    
    ```

#### *property* ext\_id

Id of corresponding Solution in external solution (ComponentID).

#### *property* format

File format string. Choose one of ‘abaqus:inp’,’ansys:cdb’, or ‘nastran:f06’.

#### *property* has\_element\_temperatures

Boolean flag if element nodal temperatures are read from the rst file.

#### *property* has\_progressive\_damage

Boolean flag if progressive\_damage data are read from the rst file.

#### load()

Load result data from file.

#### *property* load\_factor

Optional load factor within substep of non-linear solution where the nodal solution should be taken from. Only valid for ‘nastran:f06’ format. Becomes (False,0) if not defined.

#### *property* path

Path to the data file.

#### *property* path2

Path to the data file.

#### *property* plots

Container with PostProcessing Plots.

#### query(definition, options={'eval\_ins': False}, position='centroid', selection='all', entity=None, entities=None, spot=None, component=None, rosette=None, simulate=False, solution\_set=-1)

Query results from the solution.

- **Parameters:**
    - definition: The postprocess definition defines what results are evaluated. Can be given as CombinedFailureCriteria object or as string such as ‘strains’, ‘stresses’, ‘laminate\_forces’, ‘deformations’, ‘temperatures’, or ‘progressive\_damage’.
    - options: Dict with the additional options used to fully configure the definition. 
        - stresses: options = {“eval\_ins”:True} to enable the interlaminar normal stress evaluation for shells.
    - position: Position where data is queried: 
        - nodal, centroid, element\_nodal, integration\_point, or element\_results.
    - selection: The selection set determines the selected nodes and elements. Can be given as string ‘sel0’ - ‘sel5’ or ‘all’, or can be given as ObjectSelection object such as model.selection or scene.active\_set.
    - entity: Entity for which results are evaluated. Currently supported: Analysis ply or analysis ply vertex.
    - entities: If a list of entities is given, the query will also compute and return a list of results, with one array for each entity.
    - spot: Used to identify bot, mid or top when querying layered shells.
    - component: Components to query. Valid components for 
        - DEFORMATION 
            - x, y, z, usum, rotx, roty, rotz -&gt; (nx1).
            - all -&gt; (nx6), translations, rotations -&gt; (nx3).
        - STRAIN 
            - e1, e2, e3, e12, e23, e13, eI, eII, eII, von\_mises -&gt; (nx1).
            - all -&gt; (nx6), principals -&gt; (nx3).
        - STRESS 
            - s1, s2, s3, s12, s23, s13, sI, sII, sII -&gt; (nx1).
            - all -&gt; (nx6), principals -&gt; (nx3).
        - FAILURE CRITERIA 
            - irf (Inverse reserve factor), rf (Reserve factor), mos (Margin of safety) -&gt; (nx1).
            - fm (Failure mode) -&gt;(n x string(size&lt;=4))
            - li (Layer index) -&gt;(n x 1) (Only available for element queries where no entity is given.).
        - LAMINATE FORCES 
            - all -&gt; (nx8).
        - PROGRESSIVE DAMAGE 
            - status (damage status), ft, fc (fiber tensile/compressive) -&gt;(nx1).
            - mt, mc (matrix tensile/compressive), s (shear) -&gt;(nx1).
            - sed (energy dissipated per unit volume), sedv (energy per unit volume due to viscous damping) -&gt;(nx1).
    - rosette: If a rosette is given, the results are evaluated with respect to this coordinate system (not recommended for non-linear results).
    - simulate: Whether the query is only simulated to test if it will return data. If this flag is set the query(…) function will only return 0 or 1.
    - solution\_set: Identifier of the queried solution. -1 identifies the last available Set.
- **Usage:**```pycon
    >>> solution.query(definition='laminate_forces',position='centroid',selection='sel0',component='all',rosette=model.rosetttes['Rosette.1'],solution_set=-1)
    >>> solution.query(definition=model.defintions['FailureCriteria'], position='centroid', selection='sel0', component='irf',solution_set=-1)
    >>> solution.query(definition='stresses', position='element_results', selection='sel0', component='s3',solution_set=-1)
    
    ```

#### *property* read\_stresses\_strains

True if the stresses and strains are to be read from rst file. Only valid for ‘ansys:rst’ format.

#### *property* recompute\_iss\_of\_solids

Use laminate-based computation method to recalculate the interlaminar shear stress distribution.

#### *property* renumbering\_mapping\_paths

Path of the assembly renumbering files.

#### serialize()

Serialize to Python string.

#### *property* set

Result set to be read. Only valid for ‘ansys:rst’ format.

#### *property* solution\_dict

The time or frequency dictionary used in the solution plots GUI.

#### *property* subcase

Optional subcase to read. Only valid for ‘nastran:f06’ format. Becomes (False,0) if not defined.

#### *property* time\_or\_frequency

The time or frequency associated with the active set.

#### *property* use\_felyx\_to\_compute\_pp\_results

True if the stresses and strains are to be computed by felyx. If the stresses and strains are read from .rst file, nothing is computed.

#### *property* use\_solid\_results

Allows to visualize the postprocessing results of layered solid models on the ‘Layered Solid Reference Surface’.

## [`EnvelopeSolution`](#compolyx.EnvelopeSolution)

### *class* compolyx.EnvelopeSolution(graph, obj, parent=None)

#### add\_solution\_set(solution, sset=-1)

Add solution set to solution sets of Envelope Solution.

- **Parameters:**
    - solution: Solution object.
    - sset: Solution set (default: -1).

#### clear\_solution\_sets()

Clear Solution Sets of Envelope Solution.

#### *property* enabled

Whether this object is currently enabled or not. Mainly defined through the current application mode pre or post.

#### remove\_solution\_set(solution, sset=-1)

Remove solution set from solution sets of Envelope Solution.

- **Parameters:**
    - solution: Solution object.
    - sset: Solution set (default: -1).