Cyclic Result Class#
- class ansys.mapdl.reader.cyclic_reader.CyclicResult(filename, read_mesh: bool = True)
Adds cyclic functionality to the result class
- animate_nodal_displacement(rnum, comp='norm', displacement_factor=0.1, n_frames=180, add_text=True, loop=True, movie_filename=None, **kwargs)
Animate nodal solution.
Assumes nodal solution is a displacement array from a modal solution.
- Parameters:
rnum (int or list) – Cumulative result number with zero based indexing, or a list containing (step, substep) of the requested result.
comp (str, optional) – Component of displacement to display. Options are ‘x’, ‘y’, ‘z’, or ‘norm’, which correspond to the x , y, z, or the normalized direction
(x**2 + y**2 + z**2)**0.5
displacement_factor (float, optional) – Increases or decreases displacement by a factor.
n_frames (int, optional) – Number of “frames” between each full cycle.
show_phase (bool, optional) – Shows the phase at each frame.
add_text (bool, optional) – Includes result information at the top left-hand corner of the plot. Set font size with the
font_size
parameter.interpolate_before_map (bool, optional) – Leaving this at default generally results in a better plot.
movie_filename (str, optional) – Filename of the movie to open. Filename should end in mp4, but other filetypes may be supported. See
imagio.get_writer
. A single loop of the mode will be recorded.kwargs (optional keyword arguments, optional) – See
pyvista.plot()
for additional keyword arguments.
Examples
Generate a movie of a mode shape while plotting off-screen.
>>> from ansys.mapdl.reader import read_binary >>> rst = read_binary("academic_rotor.rst") >>> rst.animate_nodal_displacement( ... (3, 2), ... displacement_factor=0.02, ... movie_filename="movie.mp4", ... off_screen=True ... )
- animate_nodal_solution(rnum, comp='norm', displacement_factor=0.1, n_frames=180, add_text=True, loop=True, movie_filename=None, **kwargs)
Animate nodal solution.
Assumes nodal solution is a displacement array from a modal solution.
- Parameters:
rnum (int or list) – Cumulative result number with zero based indexing, or a list containing (step, substep) of the requested result.
comp (str, optional) – Component of displacement to display. Options are ‘x’, ‘y’, ‘z’, or ‘norm’, which correspond to the x , y, z, or the normalized direction
(x**2 + y**2 + z**2)**0.5
displacement_factor (float, optional) – Increases or decreases displacement by a factor.
n_frames (int, optional) – Number of “frames” between each full cycle.
show_phase (bool, optional) – Shows the phase at each frame.
add_text (bool, optional) – Includes result information at the top left-hand corner of the plot. Set font size with the
font_size
parameter.interpolate_before_map (bool, optional) – Leaving this at default generally results in a better plot.
movie_filename (str, optional) – Filename of the movie to open. Filename should end in mp4, but other filetypes may be supported. See
imagio.get_writer
. A single loop of the mode will be recorded.kwargs (optional keyword arguments, optional) – See
pyvista.plot()
for additional keyword arguments.
Examples
Generate a movie of a mode shape while plotting off-screen.
>>> from ansys.mapdl.reader import read_binary >>> rst = read_binary("academic_rotor.rst") >>> rst.animate_nodal_displacement( ... (3, 2), ... displacement_factor=0.02, ... movie_filename="movie.mp4", ... off_screen=True ... )
- property full_rotor
UnstructuredGrid of the full replicated rotor
- harmonic_index_to_cumulative(hindex, mode)
Converts a harmonic index and a 0 index mode number to a cumulative result index.
Harmonic indices are stored as positive and negative pairs for modes other than 0 and N/nsectors.
- property harmonic_indices
Harmonic indices of the result file.
Harmonic index is simply the Nodal Diameter of the mode. This is defined as the number of complete sine waves that pass through the circumference.
Examples
>>> rst.harmonic_indices array([ 0, 0, 0, 0, 0, 0, -1, 1, -1, 1, 1, -1, -2, 2, -2, 2, -2, 2, 3, 3, 3, 3, 3, 3], dtype=int32)
- property mode_table
Unique modes for cyclic results
- nodal_displacement(rnum, phase=0, full_rotor=False, as_complex=False)
Return the DOF solution for each node in the global cartesian coordinate system.
- Parameters:
rnum (int or list) – Cumulative result number with zero based indexing, or a list containing (step, substep) of the requested result.
phase (float, optional) – Phase to rotate sector result in radians.
full_rotor (bool, optional) – Expands the single sector solution for the full rotor. Sectors are rotated counter-clockwise about the axis of rotation. Default False.
as_complex (bool, optional) – Returns result as a complex number, otherwise as the real part rotated by phase. Default False.
- Returns:
nnum (numpy.ndarray) – Node numbers of master sector.
result (numpy.ndarray) – Result is (nnod x numdof), nnod is the number of nodes in a sector and numdof is the number of degrees of freedom. When full_rotor is True the array will be (nSector x nnod x numdof).
Examples
Visualize the 1st nodal diameter mode.
>>> from ansys.mapdl import reader as pymapdl_reader >>> from ansys.mapdl.reader import examples >>> result = examples.download_academic_rotor() >>> result.nodal_solution((2, 1))
Same result but uses Python (zero based) cumulative indexing
>>> result.nodal_solution(2)
Notes
Somewhere between v15.0 and v18.2 ANSYS stopped writing the duplicate sector to the result file and instead records results in pairs (i.e. harmonic index 1, -1).
- nodal_elastic_strain(rnum, phase=0, as_complex=False, full_rotor=False)
Nodal component elastic strains. This record contains strains in the order X, Y, Z, XY, YZ, XZ, EQV.
Elastic strains can be can be nodal values extrapolated from the integration points or values at the integration points moved to the nodes.
- Parameters:
rnum (int or list) – Cumulative result number with zero based indexing, or a list containing (step, substep) of the requested result.
phase (float) – Phase adjustment of the stress in radians.
as_complex (bool, optional) – Reports stress as a complex result. Real and imaginary stresses correspond to the stress of the main and repeated sector. Stress can be “rotated” using the phase parameter.
full_rotor (bool, optional) – Expands the results to the full rotor when True. Default False.
- Returns:
nodenum (numpy.ndarray) – Node numbers of the result.
elastic_strain (numpy.ndarray) – Nodal component elastic strains. Array is in the order X, Y, Z, XY, YZ, XZ, EQV.
Examples
Load the nodal elastic strain for the first result.
>>> nnum, elastic_strain = rst.nodal_stress(0)
Notes
Nodes without a strain will be NAN.
- nodal_plastic_strain(rnum, phase=0, as_complex=False, full_rotor=False)
Nodal component plastic strains. This record contains strains in the order X, Y, Z, XY, YZ, XZ, EQV.
Plastic strains can be can be nodal values extrapolated from the integration points or values at the integration points moved to the nodes.
- Parameters:
rnum (int or list) – Cumulative result number with zero based indexing, or a list containing (step, substep) of the requested result.
phase (float) – Phase adjustment of the stress in degrees.
as_complex (bool, optional) – Reports stress as a complex result. Real and imaginary stresses correspond to the stress of the main and repeated sector. Stress can be “rotated” using the phase parameter.
full_rotor (bool, optional) – Expands the results to the full rotor when True. Default False.
- Returns:
nodenum (numpy.ndarray) – Node numbers of the result.
plastic_strain (numpy.ndarray) – Nodal component plastic strains. Array is in the order X, Y, Z, XY, YZ, XZ, EQV.
Examples
Load the nodal plastic strain for the first result.
>>> nnum, plastic_strain = rst.nodal_stress(0)
Notes
Nodes without a strain will be NAN.
- nodal_solution(rnum, phase=0, full_rotor=False, as_complex=False)
Return the DOF solution for each node in the global cartesian coordinate system.
- Parameters:
rnum (int or list) – Cumulative result number with zero based indexing, or a list containing (step, substep) of the requested result.
phase (float, optional) – Phase to rotate sector result in radians.
full_rotor (bool, optional) – Expands the single sector solution for the full rotor. Sectors are rotated counter-clockwise about the axis of rotation. Default False.
as_complex (bool, optional) – Returns result as a complex number, otherwise as the real part rotated by phase. Default False.
- Returns:
nnum (numpy.ndarray) – Node numbers of master sector.
result (numpy.ndarray) – Result is (nnod x numdof), nnod is the number of nodes in a sector and numdof is the number of degrees of freedom. When full_rotor is True the array will be (nSector x nnod x numdof).
Examples
Visualize the 1st nodal diameter mode.
>>> from ansys.mapdl import reader as pymapdl_reader >>> from ansys.mapdl.reader import examples >>> result = examples.download_academic_rotor() >>> result.nodal_solution((2, 1))
Same result but uses Python (zero based) cumulative indexing
>>> result.nodal_solution(2)
Notes
Somewhere between v15.0 and v18.2 ANSYS stopped writing the duplicate sector to the result file and instead records results in pairs (i.e. harmonic index 1, -1).
- nodal_stress(rnum, phase=0, as_complex=False, full_rotor=False)
Retrieves the component stresses for each node in the solution.
The order of the results corresponds to the sorted node numbering.
Computes the nodal stress by averaging the stress for each element at each node. Due to the discontinuities across elements, stresses will vary based on the element they are evaluated from.
- Parameters:
rnum (int or list) – Cumulative result number with zero based indexing, or a list containing (step, substep) of the requested result.
phase (float) – Phase adjustment of the stress in degrees.
as_complex (bool, optional) – Reports stress as a complex result. Real and imaginary stresses correspond to the stress of the main and repeated sector. Stress can be “rotated” using the phase parameter.
full_rotor (bool, optional) – Expands the results to the full rotor when True. Default False.
- Returns:
nodenum (numpy.ndarray) – Node numbers of the result.
stress (numpy.ndarray) – Stresses at Sx Sy Sz Sxy Syz Sxz averaged at each corner node. For the corresponding node numbers, see where result is the result object.
Examples
>>> nnum, stress = rst.nodal_stress(0)
Notes
Nodes without a stress value will be NAN.
- nodal_temperature(rnum, full_rotor=False)
Retrieves the temperature for each node in the solution.
The order of the results corresponds to the sorted node numbering.
Equivalent MAPDL commands: PRNSOL, TEMP PRNSOL, BFE
- Parameters:
- Returns:
nnum (numpy.ndarray) – Node numbers of the result.
temperature (numpy.ndarray) – Temperature at each node.
Examples
>>> nnum, stress = rst.nodal_temperature(0)
- nodal_thermal_strain(rnum, phase=0, as_complex=False, full_rotor=False)
Nodal component thermal strains. This record contains strains in the order X, Y, Z, XY, YZ, XZ, EQV, and eswell (element swelling strain). Thermal strains are always values at the integration points moved to the nodes.
- Parameters:
rnum (int or list) – Cumulative result number with zero based indexing, or a list containing (step, substep) of the requested result.
phase (float) – Phase adjustment of the stress in degrees.
as_complex (bool, optional) – Reports stress as a complex result. Real and imaginary stresses correspond to the stress of the main and repeated sector. Stress can be “rotated” using the phase parameter.
full_rotor (bool, optional) – Expands the results to the full rotor when True. Default False.
- Returns:
nodenum (numpy.ndarray) – Node numbers of the result.
thermal_strain (np.ndarray) – Nodal component plastic strains. Array is in the order X, Y, Z, XY, YZ, XZ, EQV, ESWELL
Examples
Load the nodal thermal strain for the first result.
>>> nnum, thermal_strain = rst.nodal_thermal_strain(0)
Notes
Nodes without a strain will be NAN.
- plot(**kwargs)
Plot the full rotor geometry.
- Parameters:
kwargs (keyword arguments) – Additional keyword arguments. See
help(pyvista.plot)
- Returns:
cpos – List of camera position, focal point, and view up.
- Return type:
Examples
>>> from ansys.mapdl.reader import examples >>> rst = examples.download_academic_rotor() >>> rst.plot()
Save a screenshot of the rotor
>>> rst.plot(screenshot='rotor.png')
- plot_nodal_elastic_strain(rnum, comp=None, phase=0, full_rotor=True, show_displacement=False, displacement_factor=1, node_components=None, element_components=None, sel_type_all=True, add_text=True, overlay_wireframe=False, treat_nan_as_zero=False, **kwargs)
Plot nodal elastic strain.
- Parameters:
rnum (int or list) – Cumulative result number with zero based indexing, or a list containing (step, substep) of the requested result.
comp (str, optional) – Elastic strain component to display. Available options: -
"X"
-"Y"
-"Z"
-"XY"
-"YZ"
-"XZ"
phase (float, optional) – Phase angle of the modal result in radians. Only valid when full_rotor is True. Default 0
full_rotor (bool, optional) – Expand the sector solution to the full rotor.
show_displacement (bool, optional) – Deforms mesh according to the result.
displacement_factor (float, optional) – Increases or decreases displacement by a factor.
node_components (list, optional) – Accepts either a string or a list strings of node components to plot. For example:
['MY_COMPONENT', 'MY_OTHER_COMPONENT]
element_components (list, optional) – Accepts either a string or a list strings of element components to plot. For example:
['MY_COMPONENT', 'MY_OTHER_COMPONENT]
sel_type_all (bool, optional) – If node_components is specified, plots those elements containing all nodes of the component. Default
True
.treat_nan_as_zero (bool, optional) – Treat NAN values (i.e. stresses at midside nodes) as zero when plotting.
- Returns:
cpos – Camera position from vtk render window.
- Return type:
Examples
Plot nodal elastic strain for an academic rotor.
>>> result.plot_nodal_elastic_strain(0, 'X')
- plot_nodal_plastic_strain(rnum, comp=None, phase=0, full_rotor=True, show_displacement=False, displacement_factor=1, node_components=None, element_components=None, sel_type_all=True, add_text=True, overlay_wireframe=False, treat_nan_as_zero=False, **kwargs)
Plot nodal plastic strain.
- Parameters:
rnum (int or list) – Cumulative result number with zero based indexing, or a list containing (step, substep) of the requested result.
comp (str, optional) – Plastic strain component to display. Available options: -
"X"
-"Y"
-"Z"
-"XY"
-"YZ"
-"XZ"
phase (float, optional) – Phase angle of the modal result in radians. Only valid when full_rotor is True. Default 0
full_rotor (bool, optional) – Expand the sector solution to the full rotor.
show_displacement (bool, optional) – Deforms mesh according to the result.
displacement_factor (float, optional) – Increases or decreases displacement by a factor.
node_components (list, optional) – Accepts either a string or a list strings of node components to plot. For example:
['MY_COMPONENT', 'MY_OTHER_COMPONENT]
element_components (list, optional) – Accepts either a string or a list strings of element components to plot. For example:
['MY_COMPONENT', 'MY_OTHER_COMPONENT]
sel_type_all (bool, optional) – If node_components is specified, plots those elements containing all nodes of the component. Default
True
.treat_nan_as_zero (bool, optional) – Treat NAN values (i.e. stresses at midside nodes) as zero when plotting.
- Returns:
cpos – Camera position from vtk render window.
- Return type:
Examples
Plot nodal plastic strain for an academic rotor
>>> result.plot_nodal_plastic_strain(0)
- plot_nodal_solution(rnum, comp='norm', phase=0, full_rotor=True, show_displacement=False, displacement_factor=1.0, node_components=None, element_components=None, overlay_wireframe=False, add_text=True, sel_type_all=True, treat_nan_as_zero=False, **kwargs)
Plot the nodal solution (generally displacement).
- Parameters:
rnum (int or list) – Cumulative result number with zero based indexing, or a list containing (step, substep) of the requested result.
comp (str, optional) – Display component to display. Options are ‘x’, ‘y’, ‘z’, and ‘norm’, corresponding to the x direction, y direction, z direction, and the normalized direction:
(x**2 + y**2 + z**2)**0.5
full_rotor (bool, optional) – Expand sector solution to full rotor.
phase (float, optional) – Phase angle of the modal result in radians. Only valid when full_rotor is True. Default 0
node_components (list, optional) – Accepts either a string or a list strings of node components to plot. For example:
['MY_COMPONENT', 'MY_OTHER_COMPONENT]
element_components (list, optional) – Accepts either a string or a list strings of element components to plot. For example:
['MY_COMPONENT', 'MY_OTHER_COMPONENT]
sel_type_all (bool, optional) – If node_components is specified, plots those elements containing all nodes of the component. Default
True
.treat_nan_as_zero (bool, optional) – Treat NAN values (i.e. stresses at midside nodes) as zero when plotting.
- Returns:
cpos – Camera position from vtk render window.
- Return type:
Examples
Plot the displacement of the first cyclic result.
>>> result.plot_nodal_solution(0)
- plot_nodal_stress(rnum, comp=None, phase=0, full_rotor=True, show_displacement=False, displacement_factor=1, node_components=None, element_components=None, overlay_wireframe=False, add_text=True, sel_type_all=True, treat_nan_as_zero=False, **kwargs)
Plot nodal stress of a given component
- Parameters:
rnum (int or list) – Cumulative result number with zero based indexing, or a list containing (step, substep) of the requested result.
comp (str, optional) – Stress component to display. Available options: -
"X"
-"Y"
-"Z"
-"XY"
-"YZ"
-"XZ"
phase (float, optional) – Phase angle of the modal result in radians. Only valid when full_rotor is True. Default 0
full_rotor (bool, optional) – Expand the sector solution to the full rotor.
show_displacement (bool, optional) – Deforms mesh according to the result.
displacement_factor (float, optional) – Increases or decreases displacement by a factor.
node_components (list, optional) – Accepts either a string or a list strings of node components to plot. For example:
['MY_COMPONENT', 'MY_OTHER_COMPONENT]
element_components (list, optional) – Accepts either a string or a list strings of element components to plot. For example:
['MY_COMPONENT', 'MY_OTHER_COMPONENT]
sel_type_all (bool, optional) – If node_components is specified, plots those elements containing all nodes of the component. Default
True
.treat_nan_as_zero (bool, optional) – Treat NAN values (i.e. stresses at midside nodes) as zero when plotting.
- Returns:
cpos – Camera position from vtk render window.
- Return type:
Examples
Plot the
"Z"
nodal stress of the first cyclic result.>>> result.plot_nodal_stress(0, comp="Z")
- plot_nodal_temperature(rnum, phase=0, full_rotor=True, show_displacement=False, displacement_factor=1.0, node_components=None, overlay_wireframe=False, add_text=True, element_components=None, sel_type_all=True, treat_nan_as_zero=False, **kwargs)
Plot the nodal temperature.
- Parameters:
rnum (int or list) – Cumulative result number with zero based indexing, or a list containing (step, substep) of the requested result.
full_rotor (bool, optional) – Expand the sector solution and plot the full rotor.
phase (float, optional) – Phase angle of the modal result in radians. Only valid when full_rotor is True. Default 0
node_components (list, optional) – Accepts either a string or a list strings of node components to plot. For example:
['MY_COMPONENT', 'MY_OTHER_COMPONENT]
element_components (list, optional) – Accepts either a string or a list strings of element components to plot. For example:
['MY_COMPONENT', 'MY_OTHER_COMPONENT]
sel_type_all (bool, optional) – If node_components is specified, plots those elements containing all nodes of the component. Default
True
.treat_nan_as_zero (bool, optional) – Treat NAN values (i.e. stresses at midside nodes) as zero when plotting.
- Returns:
cpos – Camera position from vtk render window.
- Return type:
Examples
Plot the nodal temperature of a rotor for the first result.
>>> result.plot_nodal_temperature(0)
- plot_nodal_thermal_strain(rnum, comp=None, phase=0, full_rotor=True, show_displacement=False, displacement_factor=1, node_components=None, element_components=None, sel_type_all=True, add_text=True, overlay_wireframe=False, treat_nan_as_zero=False, **kwargs)
Plot nodal thermal strain.
- Parameters:
rnum (int or list) – Cumulative result number with zero based indexing, or a list containing (step, substep) of the requested result.
comp (str, optional) – Thermal strain component to display. Available options: -
"X"
-"Y"
-"Z"
-"XY"
-"YZ"
-"XZ"
-"EQV"
-"ESWELL"
(element swelling strain)phase (float, optional) – Phase angle of the modal result in radians. Only valid when full_rotor is True. Default 0.
full_rotor (bool, optional) – Expand the sector solution to the full rotor.
show_displacement (bool, optional) – Deforms mesh according to the result.
displacement_factor (float, optional) – Increases or decreases displacement by a factor.
node_components (list, optional) – Accepts either a string or a list strings of node components to plot. For example:
['MY_COMPONENT', 'MY_OTHER_COMPONENT]
element_components (list, optional) – Accepts either a string or a list strings of element components to plot. For example:
['MY_COMPONENT', 'MY_OTHER_COMPONENT]
sel_type_all (bool, optional) – If node_components is specified, plots those elements containing all nodes of the component. Default
True
.treat_nan_as_zero (bool, optional) – Treat NAN values (i.e. stresses at midside nodes) as zero when plotting.
- Returns:
cpos – Camera position from vtk render window.
- Return type:
Examples
Plot nodal thermal strain for an academic rotor
>>> rst.plot_nodal_thermal_strain(0)
- plot_principal_nodal_stress(rnum, comp=None, phase=0, full_rotor=True, show_displacement=False, displacement_factor=1, node_components=None, element_components=None, sel_type_all=True, add_text=True, overlay_wireframe=False, treat_nan_as_zero=False, **kwargs)
Plot the nodal principal stress.
- Parameters:
rnum (int or list) – Cumulative result number with zero based indexing, or a list containing (step, substep) of the requested result.
comp (string) –
Stress component to plot. S1, S2, S3 principal stresses, SINT stress intensity, and SEQV equivalent stress.
Stress type must be a string from the following list:
['S1', 'S2', 'S3', 'SINT', 'SEQV']
phase (float, optional) – Phase angle of the modal result in radians. Only valid when full_rotor is True. Default 0
full_rotor (bool, optional) – Expand sector solution to full rotor.
show_displacement (bool, optional) – Deforms mesh according to the result.
displacement_factor (float, optional) – Increases or decreases displacement by a factor.
node_components (list, optional) – Accepts either a string or a list strings of node components to plot. For example:
['MY_COMPONENT', 'MY_OTHER_COMPONENT]
sel_type_all (bool, optional) – If node_components is specified, plots those elements containing all nodes of the component. Default
True
.treat_nan_as_zero (bool, optional) – Treat NAN values (i.e. stresses at midside nodes) as zero when plotting.
kwargs (keyword arguments) – Additional keyword arguments. See
help(pyvista.plot)
- Returns:
cpos – VTK camera position.
- Return type:
Examples
Plot the von Mises stress of the first cyclic result.
>>> result.plot_principal_nodal_stress(0, comp='SEQV')
- plot_sectors(**kwargs)
Plot the full rotor and individually color the sectors.
- Parameters:
kwargs (keyword arguments) – Additional keyword arguments. See
help(pyvista.plot)
Examples
>>> from ansys.mapdl.reader import examples >>> rst = examples.download_academic_rotor() >>> rst.plot_sectors()
Save a screenshot of the sectors
>>> rst.plot_sectors(screenshot='sectors.png')
- principal_nodal_stress(rnum, phase=0, as_complex=False, full_rotor=False)
Computes the principal component stresses for each node in the solution.
- Parameters:
rnum (int or list) – Cumulative result number with zero based indexing, or a list containing (step, substep) of the requested result.
phase (float) – Phase adjustment of the stress in degrees.
as_complex (bool, optional) – Returns result as a complex number, otherwise as the real part rotated by phase. Default False.
full_rotor (bool, optional) – Expand sector solution to full rotor.
- Returns:
nodenum (numpy.ndarray) – Node numbers of the result.
pstress (numpy.ndarray) – Principal stresses, stress intensity, and equivalent stress. [sigma1, sigma2, sigma3, sint, seqv]
Notes
ANSYS equivalent of: PRNSOL, S, PRIN
which returns: S1, S2, S3 principal stresses, SINT stress intensity, and SEQV equivalent stress.
- save_as_vtk(filename, rsets=None, result_types=['ENS'], progress_bar=True, expand_cyclic=True, merge_sectors=True)
Writes results to a vtk readable file.
Nodal results will always be written.
The file extension will select the type of writer to use.
'.vtk'
will use the legacy writer, while'.vtu'
will select the VTK XML writer.- Parameters:
filename (str, pathlib.Path) – Filename of grid to be written. The file extension will select the type of writer to use.
'.vtk'
will use the legacy writer, while'.vtu'
will select the VTK XML writer.rsets (collections.Iterable) – List of result sets to write. For example
range(3)
or [0].result_types (list) –
Result type to write. For example
['ENF', 'ENS']
List of some or all of the following:EMS: misc. data
ENF: nodal forces
ENS: nodal stresses
ENG: volume and energies
EGR: nodal gradients
EEL: elastic strains
EPL: plastic strains
ECR: creep strains
ETH: thermal strains
EUL: euler angles
EFX: nodal fluxes
ELF: local forces
EMN: misc. non-sum values
ECD: element current densities
ENL: nodal nonlinear data
EHC: calculated heat generations
EPT: element temperatures
ESF: element surface stresses
EDI: diffusion strains
ETB: ETABLE items
ECT: contact data
EXY: integration point locations
EBA: back stresses
ESV: state variables
MNL: material nonlinear record
progress_bar (bool, optional) – Display a progress bar using
tqdm
.expand_cyclic (bool, default: True.) – When
True
, expands cyclic results by writing out the result as a full cyclic result rather than as a single cyclic sector.merge_sectors (bool, default: False) – When
expand_cyclic
is True and this parameter isTrue
, sectors will be merged to create one unified grid. Set this toFalse
to not merge nodes between sectors.
Notes
Nodal solutions are stored within the
point_data
attribute of the unstructured grid and can be accessed after reading in the result with pyvista with:>>> grid.point_data pyvista DataSetAttributes Association : POINT Active Scalars : Nodal stresses (0, -2)-2 Active Vectors : None Active Texture : None Active Normals : None Contains arrays : Nodal solution (0, 0) float64 (18864, 3) Nodal stresses (0, 0) float64 (18864, 6) Nodal solution (1, 0) float64 (18864, 3) Nodal stresses (1, 0) float64 (18864, 6) Nodal solution (0, -1) float64 (18864, 3) Nodal stresses (0, -1) float64 (18864, 6) Nodal solution (0, 1) float64 (18864, 3) Nodal stresses (0, 1) float64 (18864, 6)
See the examples section for more details.
Examples
Write nodal results as a binary vtk file. Larger file size, loads quickly.
>>> rst.save_as_vtk('results.vtk')
Write using the xml writer. This file is more compressed compressed but will load slower.
>>> rst.save_as_vtk('results.vtu')
Write only nodal and elastic strain for the first result:
>>> rst.save_as_vtk('results.vtk', [0], ['EEL', 'EPL'])
Write only nodal results (i.e. displacements) for the first result:
>>> rst.save_as_vtk('results.vtk', [0], [])
Read in the results using
pyvista.read()
. Plot the ‘Z’ component of the first mode’s -2 nodal diameter nodal displacement.>>> import pyvista as pv >>> grid = pv.read('results.vtk') >>> grid.plot(scalars="Nodal solution (0, -2)", component=2)
Do not merge sectors when saving the results and separate sectors into multiple blocks within pyvista.
>>> rst.save_as_vtk('results.vtk', merge_sectors=False) >>> grid = pv.read('results.vtk') >>> mblock = grid.split_bodies()