# Cyclic Analysis#

This example creates a bladed disc using parametric geometry of a cyclic sector and then runs a modal analysis on that cyclic sector. We then post-process the results using the legacy MAPDL reader and finally generate another cyclic model using our parametric modeler.

Our first task is to create a simple cyclic model with 7 sectors.

First, start MAPDL as a service.

```# sphinx_gallery_thumbnail_number = 3

import numpy as np
import pyvista as pv

from ansys.mapdl.core import launch_mapdl

mapdl = launch_mapdl()
```

## Create the Cyclic Sector#

Create a single “sector” of our cyclic model.

```def gen_sector(mapdl, sectors):
"""Generate a single sector within MAPDL."""

# thickness
thickness = 0.003  # meters
arc_end = 2 * np.pi / sectors
arc_cent = arc_end / 2

arc = pv.CircularArc(
)

# interior circle
kp_center = [0, 0, 0]

# exterior circle in (M)

# solve for angle to get same arc.length at the end
cent_ang = arc.length / out_rad / 2

# interior circle
kp_beg_outer = [
0,
]
kp_end_outer = [
0,
]

mapdl.prep7()
mapdl.k(0, *kp_center)
mapdl.k(0, *kp_begin)
mapdl.k(0, *kp_end)
mapdl.k(0, *kp_beg_outer)
mapdl.k(0, *kp_end_outer)

# inner arc
mapdl.l(1, 2)  # left line
mapdl.l(1, 3)  # right line
lnum_inter = mapdl.l(2, 3)  # internal line
mapdl.al("all")

lnum = [lnum_inter, mapdl.l(4, 5), mapdl.l(2, 4), mapdl.l(3, 5)]
mapdl.al(*lnum)

# extrude the model in the Z direction by ``thickness``
mapdl.vext("all", dz=thickness)

# generate a single sector of a 7 sector model
sectors = 7
gen_sector(mapdl, sectors)

# Volume plot
mapdl.vplot()
```

## Make the Model Cyclic#

Make the model cyclic by running `Mapdl.cyclic()`

Note how the number of sectors matches

```output = mapdl.cyclic()
print(f"Expected Sectors: {sectors}")
print(output)
```
```Expected Sectors: 7
USE EXISTING MODEL FOR CYCLIC SYMMETRY

******************************************************
****** COMPUTED QUANTITIES ***************************
******************************************************
*  NUMBER OF SECTORS =                  7            *
*  SECTOR ANGLE =                  51.429            *
*  CYCLIC COORDINATE SYSTEM =           1            *
*  EDGE COMPONENTS CONTAIN AREAS                     *
*  LOW  EDGE COMPONENT = CYCLIC_M01L       MATCHED   *
*  HIGH EDGE COMPONENT = CYCLIC_M01H                 *
******************************************************
```

## Generate the mesh#

Generate the finite element mesh using quadritic hexahedrals, SOLID186.

```# element size of 0.01
esize = 0.001

mapdl.et(1, 186)
mapdl.esize(esize)
mapdl.vsweep("all")

# plot the finite element mesh
mapdl.eplot()
```

## Apply Material Properties#

```# Define a material (nominal steel in SI)
mapdl.mp("EX", 1, 210e9)  # Elastic moduli in Pa (kg/(m*s**2))
mapdl.mp("DENS", 1, 7800)  # Density in kg/m3
mapdl.mp("NUXY", 1, 0.3)  # Poisson's Ratio

# apply it to all elements
mapdl.emodif("ALL", "MAT", 1)
```
```MODIFY ALL SELECTED ELEMENTS TO HAVE  MAT  =         1
```

## Run the Modal Analysis#

Let’s get the first 10 modes. Note that this will actually compute `(sectors/2)*nmode` based on the cyclic boundary conditions.

```output = mapdl.modal_analysis(nmode=10, freqb=1)
print(output)
```
```*** NOTE ***                            CP =      42.844   TIME= 06:12:35
There is no title defined for this analysis.

*** WARNING ***                         CP =      42.859   TIME= 06:12:35
No constraints have been defined using the D command.

GENERATE CYCLIC SYMMETRY CONSTRAINT EQUATIONS

*** WARNING ***                         CP =      42.885   TIME= 06:12:35
There is no high edge node in a position to match low edge node 2515
(location error = 4.55E-04, maximum for all nodes).  Cyclic symmetry
constraint equations will be generated between the sector edges using
a mapping procedure similar to the CEINTF command.  This may reduce
solution accuracy, especially near the sector edges.

NUMBER OF CONSTRAINT EQUATIONS GENERATED=   363
(USING THE UNMATCHED NODES ALGORITHM)

*****  MAPDL SOLVE    COMMAND  *****

*** SELECTION OF ELEMENT TECHNOLOGIES FOR APPLICABLE ELEMENTS ***
---GIVE SUGGESTIONS ONLY---

ELEMENT TYPE         1 IS SOLID186. KEYOPT(2) IS ALREADY SET AS SUGGESTED.

*** MAPDL - ENGINEERING ANALYSIS SYSTEM  RELEASE                  22.2     ***
Ansys Mechanical Enterprise
00000000  VERSION=LINUX x64     06:12:35  AUG 03, 2022 CP=     42.911

S O L U T I O N   O P T I O N S

PROBLEM DIMENSIONALITY. . . . . . . . . . . . .3-D
CYCLIC SYMMETRY SECTOR ANGLE. . . . . . . . . .   51.429     DEGREES
DEGREES OF FREEDOM. . . . . . UX   UY   UZ
ANALYSIS TYPE . . . . . . . . . . . . . . . . .MODAL
EXTRACTION METHOD. . . . . . . . . . . . . .BLOCK LANCZOS
NUMBER OF MODES TO EXTRACT. . . . . . . . . . .    10
USE CYCLIC MODES IN SUBSEQUENT MSUP ANALYSIS. .YES
SHIFT POINT . . . . . . . . . . . . . . . . . .  1.0000
GLOBALLY ASSEMBLED MATRIX . . . . . . . . . . .SYMMETRIC
NUMBER OF MODES TO EXPAND . . . . . . . . . . .    10
ELEMENT RESULTS CALCULATION . . . . . . . . . .OFF

*** NOTE ***                            CP =      42.917   TIME= 06:12:35
The conditions for direct assembly have been met.  No .emat or .erot
files will be produced.

L O A D   S T E P   O P T I O N S

LOAD STEP NUMBER. . . . . . . . . . . . . . . .     1
CYCLIC SYMMETRY HARMONIC INDEX. . . . . . . . .     0
THERMAL STRAINS INCLUDED IN THE LOAD VECTOR . .   YES
PRINT OUTPUT CONTROLS . . . . . . . . . . . . .NO PRINTOUT
DATABASE OUTPUT CONTROLS. . . . . . . . . . . .ALL DATA WRITTEN

**** CENTER OF MASS, MASS, AND MASS MOMENTS OF INERTIA ****

CALCULATIONS ASSUME ELEMENT MASS AT ELEMENT CENTROID

TOTAL MASS =  0.19205E-01

MOM. OF INERTIA         MOM. OF INERTIA

XC =  0.25304E-01      IXX =   0.3686E-05      IXX =   0.7910E-06
YC =  0.12186E-01      IYY =   0.1533E-04      IYY =   0.2994E-05
ZC =  0.15000E-02      IZZ =   0.1891E-04      IZZ =   0.3759E-05
IXY =  -0.7303E-05      IXY =  -0.1381E-05
IYZ =  -0.3510E-06      IYZ =   0.1421E-19
IZX =  -0.7290E-06      IZX =   0.2680E-19

*** MASS SUMMARY BY ELEMENT TYPE ***

TYPE      MASS
1  0.192050E-01

Range of element maximum matrix coefficients in global coordinates
Maximum = 266915922 at element 2609.
Minimum = 162779585 at element 2500.

*** ELEMENT MATRIX FORMULATION TIMES
TYPE    NUMBER   ENAME      TOTAL CP  AVE CP

1      2628  SOLID186      0.712   0.000271
Time at end of element matrix formulation CP = 43.460186.

BLOCK LANCZOS CALCULATION OF UP TO    10 EIGENVECTORS.
NUMBER OF EQUATIONS              =        21235
MAXIMUM WAVEFRONT                =          297
MAXIMUM MODES STORED             =           10
MINIMUM EIGENVALUE               =  0.10000E+01
MAXIMUM EIGENVALUE               =  0.10000E+31

Memory allocated for solver              =   120.824 MB
Memory required for in-core solution     =   115.150 MB
Memory required for out-of-core solution =    43.305 MB

*** NOTE ***                            CP =      44.677   TIME= 06:12:36
The Sparse Matrix Solver used by the Block Lanczos eigensolver is
currently running in the in-core memory mode.  This memory mode uses
the most amount of memory in order to avoid using the hard drive as
much as possible, which most often results in the fastest solution
time.  This mode is recommended if enough physical memory is present
to accommodate all of the solver data.

Process memory required for in-core LANCZOS Workspace             =     82.136147 MB
Process memory required for out-of-core LANCZOS Workspace         =     2.427132 MB

*** MAPDL - ENGINEERING ANALYSIS SYSTEM  RELEASE                  22.2     ***
Ansys Mechanical Enterprise
00000000  VERSION=LINUX x64     06:12:37  AUG 03, 2022 CP=     46.120

*** FREQUENCIES FROM BLOCK LANCZOS ITERATION ***

MODE    FREQUENCY (HERTZ)

FREQUENCY RANGE REQUESTED=   10 MODES ABOVE   1.00000     HERTZ

1     1754.791683421
2     9255.393089282
3     10975.87828792
4     11515.67526142
5     21840.50585156
6     26925.16425414
7     33190.75920729
8     34449.58525845
9     38317.00890877
10     56181.40454186

***** PARTICIPATION FACTOR AND MODAL MASS CALCULATION *****   HARMONIC INDEX=    0

GLOBAL                GLOBAL      PARTICIPATION
MODE   FREQUENCY    DIRECTION       FACTOR      EFFECTIVE MASS   MODAL MASS
1   1754.79         UZ        -0.12738E-09     0.16225E-19      7.0000
ROTZ        -0.14905E-11     0.22215E-23
2   9255.39         UZ        -0.58546E-09     0.34276E-18      7.0000
ROTZ         0.75073E-10     0.56360E-20
3   10975.9         UZ         0.94060E-08     0.88473E-16      7.0000
ROTZ         0.17181E-10     0.29519E-21
4   11515.7         UZ         0.24273E-08     0.58916E-17      7.0000
ROTZ         0.15158E-09     0.22978E-19
5   21840.5         UZ         0.10198E-08     0.10399E-17      7.0000
ROTZ         0.27019E-10     0.73005E-21
6   26925.2         UZ        -0.27639E-08     0.76389E-17      7.0000
ROTZ        -0.33024E-10     0.10906E-20
7   33190.8         UZ         0.11671E-08     0.13621E-17      7.0000
ROTZ        -0.79708E-11     0.63533E-22
8   34449.6         UZ         0.52649E-09     0.27719E-18      7.0000
ROTZ         0.11888E-10     0.14133E-21
9   38317.0         UZ         0.11993E-08     0.14383E-17      7.0000
ROTZ         0.11649E-10     0.13570E-21
10   56181.4         UZ         0.58696E-09     0.34452E-18      7.0000
ROTZ         0.84692E-11     0.71727E-22

*** MAPDL BINARY FILE STATISTICS
BUFFER SIZE USED= 16384
32.312 MB WRITTEN ON ASSEMBLED MATRIX FILE: file.full
2.062 MB WRITTEN ON MODAL MATRIX FILE: file.mode
1.125 MB WRITTEN ON RESULTS FILE: file.rst

GENERATE CYCLIC SYMMETRY CONSTRAINT EQUATIONS

NUMBER OF CONSTRAINT EQUATIONS GENERATED=   740
(USING THE UNMATCHED NODES ALGORITHM)

*****  MAPDL SOLVE    COMMAND  *****

*** MAPDL - ENGINEERING ANALYSIS SYSTEM  RELEASE                  22.2     ***
Ansys Mechanical Enterprise
00000000  VERSION=LINUX x64     06:12:37  AUG 03, 2022 CP=     46.256

L O A D   S T E P   O P T I O N S

LOAD STEP NUMBER. . . . . . . . . . . . . . . .     2
CYCLIC SYMMETRY HARMONIC INDEX. . . . . . . . .     1
THERMAL STRAINS INCLUDED IN THE LOAD VECTOR . .   YES
PRINT OUTPUT CONTROLS . . . . . . . . . . . . .NO PRINTOUT
DATABASE OUTPUT CONTROLS. . . . . . . . . . . .ALL DATA WRITTEN

BLOCK LANCZOS CALCULATION OF UP TO    10 EIGENVECTORS.
NUMBER OF EQUATIONS              =        42470
MAXIMUM WAVEFRONT                =          384
MAXIMUM MODES STORED             =           10
MINIMUM EIGENVALUE               =  0.10000E+01
MAXIMUM EIGENVALUE               =  0.10000E+31

Memory allocated for solver              =   260.334 MB
Memory required for in-core solution     =   248.099 MB
Memory required for out-of-core solution =    86.160 MB

*** NOTE ***                            CP =      48.359   TIME= 06:12:38
The Sparse Matrix Solver used by the Block Lanczos eigensolver is
currently running in the in-core memory mode.  This memory mode uses
the most amount of memory in order to avoid using the hard drive as
much as possible, which most often results in the fastest solution
time.  This mode is recommended if enough physical memory is present
to accommodate all of the solver data.

*** WARNING ***                         CP =      49.386   TIME= 06:12:39
The eigenproblem is ill-conditioned (relative residual from test linear
solve: 1.032642E-03).  The accuracy of the solution may not be
satisfactory.  Modifying the initial value of the frequency shift
(FREQB in the MODOPT command) or changing the boundary conditions of
the model might solve the problem.

Process memory required for in-core LANCZOS Workspace             =     163.789284 MB
Process memory required for out-of-core LANCZOS Workspace         =     4.371254 MB

*** MAPDL - ENGINEERING ANALYSIS SYSTEM  RELEASE                  22.2     ***
Ansys Mechanical Enterprise
00000000  VERSION=LINUX x64     06:12:39  AUG 03, 2022 CP=     50.980

*** FREQUENCIES FROM BLOCK LANCZOS ITERATION ***

MODE    FREQUENCY (HERTZ)

FREQUENCY RANGE REQUESTED=   10 MODES ABOVE   1.00000     HERTZ

1     4016.683048009
2     4016.683054549
3     4064.737840654
4     4064.737844265
5     10313.66920797
6     10313.66926230
7     14213.07124266
8     14213.07125304
9     19293.02903989
10     19293.02904375

***** PARTICIPATION FACTOR AND MODAL MASS CALCULATION *****   HARMONIC INDEX=    1

GLOBAL                GLOBAL      PARTICIPATION
MODE   FREQUENCY    DIRECTION       FACTOR      EFFECTIVE MASS   MODAL MASS
11   4016.68         UX         0.27368E-05     0.74903E-11      3.5000
UY         0.27293E-05     0.74493E-11
ROTX         0.17010E-03     0.28934E-07
ROTY         0.14615E-05     0.21360E-11
12   4016.68         UX        -0.31524E-06     0.99374E-13      3.5000
UY        -0.31423E-06     0.98743E-13
ROTX         0.14554E-05     0.21183E-11
ROTY        -0.17011E-03     0.28937E-07
13   4064.74         UX        -0.33203E-01     0.11024E-02      3.5000
UY         0.11449         0.13107E-01
ROTX        -0.17174E-03     0.29495E-07
ROTY        -0.49791E-04     0.24791E-08
14   4064.74         UX        -0.11447         0.13104E-01      3.5000
UY        -0.33219E-01     0.11035E-02
ROTX         0.49830E-04     0.24831E-08
ROTY        -0.17171E-03     0.29486E-07
15   10313.7         UX         0.16163E-05     0.26124E-11      3.5000
UY         0.16158E-05     0.26109E-11
ROTX         0.53721E-03     0.28860E-06
ROTY         0.45311E-04     0.20531E-08
16   10313.7         UX         0.48429E-07     0.23454E-14      3.5000
UY         0.48647E-07     0.23665E-14
ROTX        -0.45307E-04     0.20527E-08
ROTY         0.53722E-03     0.28860E-06
17   14213.1         UX        -0.40616E-05     0.16497E-10      3.5000
UY        -0.40615E-05     0.16496E-10
ROTX         0.17385E-03     0.30224E-07
ROTY        -0.36345E-04     0.13210E-08
18   14213.1         UX         0.12698E-05     0.16125E-11      3.5000
UY         0.12694E-05     0.16114E-11
ROTX        -0.36338E-04     0.13205E-08
ROTY        -0.17384E-03     0.30219E-07
19   19293.0         UX        -0.28583E-02     0.81699E-05      3.5000
UY        -0.95532E-01     0.91264E-02
ROTX         0.14331E-03     0.20537E-07
ROTY        -0.42956E-05     0.18452E-10
20   19293.0         UX         0.95523E-01     0.91247E-02      3.5000
UY        -0.28513E-02     0.81299E-05
ROTX         0.42781E-05     0.18302E-10
ROTY         0.14328E-03     0.20530E-07

GENERATE CYCLIC SYMMETRY CONSTRAINT EQUATIONS

NUMBER OF CONSTRAINT EQUATIONS GENERATED=   726
(USING THE UNMATCHED NODES ALGORITHM)

*****  MAPDL SOLVE    COMMAND  *****

*** MAPDL - ENGINEERING ANALYSIS SYSTEM  RELEASE                  22.2     ***
Ansys Mechanical Enterprise
00000000  VERSION=LINUX x64     06:12:40  AUG 03, 2022 CP=     51.101

L O A D   S T E P   O P T I O N S

LOAD STEP NUMBER. . . . . . . . . . . . . . . .     3
CYCLIC SYMMETRY HARMONIC INDEX. . . . . . . . .     2
THERMAL STRAINS INCLUDED IN THE LOAD VECTOR . .   YES
PRINT OUTPUT CONTROLS . . . . . . . . . . . . .NO PRINTOUT
DATABASE OUTPUT CONTROLS. . . . . . . . . . . .ALL DATA WRITTEN

BLOCK LANCZOS CALCULATION OF UP TO    10 EIGENVECTORS.
NUMBER OF EQUATIONS              =        42456
MAXIMUM WAVEFRONT                =          384
MAXIMUM MODES STORED             =           10
MINIMUM EIGENVALUE               =  0.10000E+01
MAXIMUM EIGENVALUE               =  0.10000E+31

Memory allocated for solver              =   262.569 MB
Memory required for in-core solution     =   250.227 MB
Memory required for out-of-core solution =    87.450 MB

*** NOTE ***                            CP =      53.195   TIME= 06:12:41
The Sparse Matrix Solver used by the Block Lanczos eigensolver is
currently running in the in-core memory mode.  This memory mode uses
the most amount of memory in order to avoid using the hard drive as
much as possible, which most often results in the fastest solution
time.  This mode is recommended if enough physical memory is present
to accommodate all of the solver data.

Process memory required for in-core LANCZOS Workspace             =     163.735451 MB
Process memory required for out-of-core LANCZOS Workspace         =     4.369972 MB

*** MAPDL - ENGINEERING ANALYSIS SYSTEM  RELEASE                  22.2     ***
Ansys Mechanical Enterprise
00000000  VERSION=LINUX x64     06:12:42  AUG 03, 2022 CP=     55.340

*** FREQUENCIES FROM BLOCK LANCZOS ITERATION ***

MODE    FREQUENCY (HERTZ)

FREQUENCY RANGE REQUESTED=   10 MODES ABOVE   1.00000     HERTZ

1     1057.627660263
2     1057.627660279
3     3380.551787122
4     3380.551787123
5     6319.916392199
6     6319.916392208
7     10091.69582739
8     10091.69582740
9     18041.48697678
10     18041.48697678

***** MODAL MASS CALCULATION *****   HARMONIC INDEX=    2

MODE   FREQUENCY       MODAL MASS
21   1057.63           3.5000
22   1057.63           3.5000
23   3380.55           3.5000
24   3380.55           3.5000
25   6319.92           3.5000
26   6319.92           3.5000
27   10091.7           3.5000
28   10091.7           3.5000
29   18041.5           3.5000
30   18041.5           3.5000

GENERATE CYCLIC SYMMETRY CONSTRAINT EQUATIONS

NUMBER OF CONSTRAINT EQUATIONS GENERATED=   726
(USING THE UNMATCHED NODES ALGORITHM)

*****  MAPDL SOLVE    COMMAND  *****

*** MAPDL - ENGINEERING ANALYSIS SYSTEM  RELEASE                  22.2     ***
Ansys Mechanical Enterprise
00000000  VERSION=LINUX x64     06:12:42  AUG 03, 2022 CP=     55.395

L O A D   S T E P   O P T I O N S

LOAD STEP NUMBER. . . . . . . . . . . . . . . .     4
CYCLIC SYMMETRY HARMONIC INDEX. . . . . . . . .     3
THERMAL STRAINS INCLUDED IN THE LOAD VECTOR . .   YES
PRINT OUTPUT CONTROLS . . . . . . . . . . . . .NO PRINTOUT
DATABASE OUTPUT CONTROLS. . . . . . . . . . . .ALL DATA WRITTEN

BLOCK LANCZOS CALCULATION OF UP TO    10 EIGENVECTORS.
NUMBER OF EQUATIONS              =        42456
MAXIMUM WAVEFRONT                =          384
MAXIMUM MODES STORED             =           10
MINIMUM EIGENVALUE               =  0.10000E+01
MAXIMUM EIGENVALUE               =  0.10000E+31

Memory allocated for solver              =   262.569 MB
Memory required for in-core solution     =   250.227 MB
Memory required for out-of-core solution =    87.450 MB

*** NOTE ***                            CP =      57.484   TIME= 06:12:43
The Sparse Matrix Solver used by the Block Lanczos eigensolver is
currently running in the in-core memory mode.  This memory mode uses
the most amount of memory in order to avoid using the hard drive as
much as possible, which most often results in the fastest solution
time.  This mode is recommended if enough physical memory is present
to accommodate all of the solver data.

Process memory required for in-core LANCZOS Workspace             =     163.735451 MB
Process memory required for out-of-core LANCZOS Workspace         =     4.369972 MB

*** MAPDL - ENGINEERING ANALYSIS SYSTEM  RELEASE                  22.2     ***
Ansys Mechanical Enterprise
00000000  VERSION=LINUX x64     06:12:44  AUG 03, 2022 CP=     59.647

*** FREQUENCIES FROM BLOCK LANCZOS ITERATION ***

MODE    FREQUENCY (HERTZ)

FREQUENCY RANGE REQUESTED=   10 MODES ABOVE   1.00000     HERTZ

1     1193.652629340
2     1193.652629358
3     3319.553821209
4     3319.553821212
5     7336.402568777
6     7336.402568784
7     9979.988874667
8     9979.988874671
9     19188.49510780
10     19188.49510780

***** MODAL MASS CALCULATION *****   HARMONIC INDEX=    3

MODE   FREQUENCY       MODAL MASS
31   1193.65           3.5000
32   1193.65           3.5000
33   3319.55           3.5000
34   3319.55           3.5000
35   7336.40           3.5000
36   7336.40           3.5000
37   9979.99           3.5000
38   9979.99           3.5000
39   19188.5           3.5000
40   19188.5           3.5000
```

## Get the Results of the Cyclic Modal Analysis#

Visualize a traveling wave from the modal analysis.

For more details, see Validation of a Modal Work Approach for Forced Response Analysis of Bladed Disks, or the Cyclic Symmetry Analysis Guide

Note

This uses the legacy result reader, which will be deprecated at some point in favor of DPF, but we can use this for now for some great animations.

For more details regarding cyclic result post processing, see: - Understanding Nodal Diameters from a Cyclic Model Analysis - Modal Cyclic Symmetry Example

```# grab the result object from MAPDL
result = mapdl.result
print(result)
```
```PyMAPDL Result
Units       : User Defined
Version     : 22.2
Cyclic      : True
Result Sets : 40
Nodes       : 7204
Elements    : 1314

Available Results:
NSL : Nodal displacements
```

## List the Table of Harmonic Indices#

This is the table of harmonic indices. This table provides the corresponding harmonic index for each cumulative mode.

```print("C. Index   Harmonic Index")
for i, hindex in zip(range(result.n_results), result.harmonic_indices):
print(f"{i:3d}      {hindex:3d}")
```
```C. Index   Harmonic Index
0        0
1        0
2        0
3        0
4        0
5        0
6        0
7        0
8        0
9        0
10        1
11       -1
12       -1
13        1
14       -1
15        1
16        1
17       -1
18       -1
19        1
20        2
21       -2
22        2
23       -2
24       -2
25        2
26        2
27       -2
28       -2
29        2
30        3
31       -3
32        3
33       -3
34       -3
35        3
36        3
37       -3
38       -3
39        3
```

## Generate an Animation of a Traveling Wave#

Here’s the nodal diameter 1 of first bend on our cyclic analysis.

We can get the first mode (generally first bend for a bladed rotor) for nodal diameter 1 with:

`mode_num = np.nonzero(result.harmonic_indices == 1)[0][0]`

```pv.global_theme.background = "w"

_ = result.animate_nodal_displacement(
11,
displacement_factor=5e-4,
movie_filename="traveling_wave11.gif",
n_frames=30,
off_screen=True,
loop=False,
show_scalar_bar=False,
cmap="jet",
)
```

And here’s 1st torsional for nodal diameter 3.

```_ = result.animate_nodal_displacement(
36,
displacement_factor=2e-4,
movie_filename="traveling_wave36.gif",
n_frames=30,
off_screen=True,
loop=False,
show_scalar_bar=False,
cmap="jet",
)
```

## Parametric Geometry#

Since our geometry creation is scripted, we can create a structure with any number of “sectors”. Let’s make a more interesting one with 20 sectors.

First, be sure to clear MAPDL so we start from scratch.

```mapdl.clear()
mapdl.prep7()

# Generate a single sector of a 20 sector model
gen_sector(mapdl, 20)

# make it cyclic
mapdl.cyclic()

# Mesh it
esize = 0.001
mapdl.et(1, 186)
mapdl.esize(esize)
mapdl.vsweep("all")

# apply materials
mapdl.mp("EX", 1, 210e9)  # Elastic moduli in Pa (kg/(m*s**2))
mapdl.mp("DENS", 1, 7800)  # Density in kg/m3
mapdl.mp("NUXY", 1, 0.3)  # Poisson's Ratio
mapdl.emodif("ALL", "MAT", 1)

# Run the modal analysis
output = mapdl.modal_analysis(nmode=6, freqb=1)

# grab the result object from MAPDL
result = mapdl.result
print(result)
```
```PyMAPDL Result
Units       : User Defined
Version     : 22.2
Cyclic      : True
Result Sets : 66
Nodes       : 3496
Elements    : 579

Available Results:
NSL : Nodal displacements
```

## List the Table of Harmonic Indices#

Note how the harmonic indices of these modes goes up to 10, or N/2 where N is the number of sectors.

```print("C. Index   Harmonic Index")
for i, hindex in zip(range(result.n_results), result.harmonic_indices):
print(f"{i:3d}    {hindex:3d}")
```
```C. Index   Harmonic Index
0      0
1      0
2      0
3      0
4      0
5      0
6     -1
7      1
8      1
9     -1
10      1
11     -1
12      2
13     -2
14      2
15     -2
16      2
17     -2
18      3
19     -3
20      3
21     -3
22      3
23     -3
24      4
25     -4
26      4
27     -4
28      4
29     -4
30     -5
31      5
32     -5
33      5
34     -5
35      5
36      6
37     -6
38      6
39     -6
40      6
41     -6
42      7
43     -7
44      7
45     -7
46      7
47     -7
48      8
49     -8
50      8
51     -8
52      8
53     -8
54      9
55     -9
56      9
57     -9
58      9
59     -9
60     10
61     10
62     10
63     10
64     10
65     10
```

## Plot First Bend for Nodal Diameter 2#

Note how you can clearly see two nodal lines for this mode shape since it’s nodal diameter 2.

```result.plot_nodal_displacement(
)
```

## Animate First Bend for Nodal Diameter 2#

Let’s end this example by animating mode 12, which corresponds to first bend for the 2nd nodal diameter of this example model.

```_ = result.animate_nodal_displacement(
12,
displacement_factor=2e-4,
movie_filename="traveling_wave12.gif",
n_frames=30,
off_screen=True,
loop=False,