# ResonancesΒΆ

In this tutorial project Resonance modes of a 2D photonic crystal are computed:

The computational domain is in this case defined by a polygon of hexagonal shape with periodic boundaries:

```
Boundary {
Class = Periodic
}
```

An adaptive refinement loop is defined to reach the defined `Precision`

of the eigenvalues:

```
Project {
InfoLevel = 3
Electromagnetics {
TimeHarmonic {
ResonanceMode {
BlochVector = [0.0 3.627598728468437e+006 0.0]
FieldComponents = ElectricXY
Accuracy {
Precision = 0.001
Refinement {
MaxNumberSteps = 4
PreRefinements = 0
}
}
SelectionCriterion {
NearGuess {
Guess = 14.0e+014
NumberEigenvalues = 5
}
}
}
}
}
}
```

The required `Guess`

for the `ResonanceMode`

project is an angular frequency.
The eigenmodes with eigenvalues closest to this value will be computed.
The `BlochVector`

defines the phase advance across the periodic boundaries for the computed modes.
For computing a band diagram this value is modified in an automatic scan.

Setting `FieldComponents = ElectricXY`

yields computation of eigenmodes polarized parallel to the 2D plane in which the geometry is defined.