# LCS Double Gyre Example

The Integral Curve system allows for the computation of LCS structures using a variety techniques developed by George Haller and his group at ETH Zürich. Haller proposed that the ridges of FTLE are indicators of hyperbolic LCS (repelling and attracting). More recent research by Haller's group has focused a mathematical description of LCS In two dimensional flows, hyperbolic LCSs turn out to be stationary curves of the averaged material shear while elliptic LCSs are stationary curves of the averaged strain. The LCS operator coupled with the Integral Curve (Hyperbolic LCS) and Limit Cycle (Elliptical LCS) operators provide a mechanism calculate these structures and have been developed in cooperation between the VisIt PICS team and the Haller Group.

For complete details on computing elliptical LCS (closed orbits) and hyperbolic LCS (stretch and shrink lines) see the following paper: K. Onu, F. Huhn, & G. Haller, LCS Tool: A Computational platform for Lagrangian coherent structures, J. of Computational Science, 7 (2015) 26-36, http://georgehaller.com/reprints/lcstool.pdf

The analysis of time-dependent dynamical systems can be done with the Lagrangian Coherent Structures (LCS) Operator. On this page, we demonstrate LCS usage on a known analytic problem, the double gyre. The double gyre is a model consisting of two counter rotating sinusoidal vortices with a harmonically oscillating line in-between. Mathematically is can be described as the following:

dx/dt = -πA sin[π f(x, t)] cos(πy),

dy/dt = πA cos[π f(x, t)] sin(πy) ∂f(x, t)/∂x,

f(x, t) = € sin(ωt)x^2 + [1 − 2€ sin(ωt)] x.

## Data generation

If you have built the PICS_Tester database reader one can load the the database found in test data directory: data/pics_test_data/ftle_double_gyre.pics. This database describes the double gyre system using the follow format:

```DOUBLE_GYRE
#
# Number of time steps
# Simulation start time
# Total simulation time
#
# Number of blocks in each direction
#
# Number of cells X
# Number of cells Y
# Number of cells Z
#
# Bounds X - if zero will default 1
# Bounds Y - if zero will default 1
# Bounds Z - if zero will default 1
#
# Double Gyre variable A
# Double Gyre variable epsilon
# Double Gyre variable period (i.e. ω = 2π / period)
#
250  0.0  10.0  1 200 100 1    2.0 1.0 0.0    0.25 0.25 1.0
```

For our example the temporal domain is t ∈ [0, 10], ∆t = 0.04 and the spatial domain is x ∈ [0, 2], y ∈ [0, 1], ∆x = ∆y 0.01 with

A = 0.25,

€ = 0.25,

period = 1 (ω = 2π).

## Plot generation

Unlike most plots where one selects the variable under the particular plot when using the PICS code one must create an operator based plot. That is because most operators transform the data whereas the PICS operators create new data (i.e. the PICS operators take a vector field and create a scalar field). To create a LCS operator based plot one selects: Add-> Pseudocolor -> operators -> LCS -> velocity as shown below:

The selecting velocity variable requires the LCS operator to be added and is done automatically by VisIt:

## LCS Operator FTLE parameters

Next the applicable LCS operator parameters via the GUI. For this case, we increase the resolution from the original mesh and use an auxiliary grid so to obtain finer detail while integrating until t=5.0. At the same time the double gyre data is time varying so path lines are created while fixing the starting be at t=0.

LCS Operator - Integration Tab

```Source type: Regular Grid
Resolution: 401 201 1

Auxiliary Gris: 2D Spacing: 0.005

Step length: 0.001

Operator type: Lyapunov Exponent
Eigen Value: Largest

Limit maximum advection time i.e. FTLE: selected, Time:  5
Maximum number of steps: 100000000
```

LCS Operator - Appearance Tab

```Path lines: selected
Override starting time: selected, Time: 0
Mesh is static over time (fast, be special purpose): selected
```

The above parameters result in a FTLE plot:

## LCS Operator shrink line parameters

To compute repelling hyperbolic LCSs (shrink lines) copy the FTLE plot from above and add an integral curve operator:

Change the LCS operator parameters to create the smallest eigen vectors.

LCS Operator - Integration Tab - Termination

```Operator type: Eigen Vector
Eigen Value: Smallest
```

LCS Operator - Appearance Tab - Seed generation

When creating the smallest Eigen vectors the LCS operator will also create a series of seeds points based maximal regional values from the largest Eigen values. These seeds are then passed down to the Integral Curve operator as "Field Data" and used to compute repelling hyperbolic LCSs (shrink lines). For this example when generating the seed points none of the default parameters need to be changed but are noted for clarity:

```Threshold limit: 0.1
Boundary limit: 0.1
Maximum numer of seeds: 20
```

## IC Operator shrink line parameters

Using the eigen vectors from the LCS operator with the integral curve operator is no different than computing other integral curves with one exception, the eigen vectors must be directionless.

IC Operator - Integration Tab

```Source type: Field Data (retrieve the points created by the upstream LCS operator).

Integration direction: Both directionless
Step length: 0.0001

Maximum numer of steps: 50000
```

The seed point values will be filled in when the operator is executed.

Drawing the plot results in the following seeds points:

IC Operator - Integration Tab - Source

```Have 9 max seed points
1.13279     0.98  0.585  0
1.12991     0.92  0.665  0
1.12925     1.025  0.495  0
1.12773     1.055  0.39  0
1.12685     1.07  0.275  0
1.12569     0.9  0.85  0
1.12519     0.865  0.75  0
1.12356     0.995  0.895  0
1.07474     1.075  0.105  0
```

Each seed point which represents a maximal location along the FTLE ridge line is used to integrate through the smallest directionless eigen vector field resulting in following plot of the repelling LCSs (shrink lines) :

All of the shrink lines defined lay along the FTLE ridge line. The lines stop where the FTLE ridgeline makes a sharp bend due to oriented "nulls" in the vector field. That is due to numerical issues caused by the mesh resolution the interpolated vector value is close to zero.

Changing the LCS mesh resolution to ∆x = ∆y = 0.00125 allows the integral curve fully integrate along the ridgeline. It also results in a smoother shrink line.

A similar operation using the largest eigen vectors and seeds from the smallest eigen values can be used to create attracting LCSs (stretch lines).

Note: the algorithm for generating the seeds points is currently experimental. Those wishing to generate shrink and stretch lines should use the generated seeds points as a guidelines.

## LCS Operator closed λ lines parameters

To compute and detect elliptical LCSs (closed λ lines) copy the FTLE plot from above and add the limit cycle operator:

Change the LCS operator parameters to create the positive λ shear eigen vectors.

LCS Operator - Integration Tab - Termination

```Operator type: Eigen Vector
Eigen Value: Lambda Shear Pos.
Lambda Value: 0.97
```

## Limit Cycle Operator closed λ lines parameters

To find limit cycles one creates seeds along a line (Poincare section) and evaluates the first return map (Poincare map) onto this section. An integral curve returning to its starting point is a λ line (an elliptic LCS).

Limit Cycle Operator - Integration Tab

```Source type: Line
Start: 1.0564 0.667238 0
End: 1.51521 0.553799 0

Samples along line: 500
```

Using the λ eigen vectors from the LCS operator with the limit cycle operator also requires eigen vectors be directionless.

Limit Cycle Operator - Integration Tab

```Integration direction: Both directionless
Step length: 0.0001

Maximum numer of steps: 50000
```

To control the search one can define the cycle tolerance and the number of iterations.

Limit Cycle Operator - Appearance Tab - Limit cycle search

```Cycle Tolerance: 1e-06
Maximum iterations: 10
```

To create the λ lines on the other gyre clone the above plot and make the following changes:

LCS Operator - Integration Tab - Termination

```Lambda Value: 0.97
```

Limit Cycle Operator - Integration Tab - Source

```Start:0.55 0.55 0
End: 0.1 0.1 0
```

It is possible to see the signed return distances for the λ lines (Poincare map) obtained for an elliptic LCS. The λ lines occur at the zero crossing. Copy the first limit cycle plot and check the following:

Limit Cycle Operator - Appearance Tab - Limit cycle search

```Show the signed return distances for the first iteration: Checked
```