# FTLE Operator

The analysis of time-dependent dynamical systems can be done with the Lagrangian Coherent Structures (LCS) Operator. On this page, we show how to use the LCS operator in both VisIt's command-line interface (CLI) and VisIt's graphical user interface (GUI). In both cases, we demonstrate FTLE usage on a known, analytic problem. This problem comes from an excellent tutorial on Lagrangian Coherent Structures.

The steps for the CLI example and the GUI example are independent; readers can focus on whichever section(s) interests them.

##  Data generation

We reproduce the simple (time-independent) example from section 7 of the Lagrangian Coherent Structures | LCS tutorial, with Epsilon=0.

An input grid is required. We use a trivial 2D Cartesian grid in ASCII VTK format. Simply copy the 7 lines below in a text file called ftle_input.vtk:

```# vtk DataFile Version 3.0
vtk output
ASCII
DATASET STRUCTURED_POINTS
DIMENSIONS 101 51 1
SPACING 0.02 0.02 1
ORIGIN 0 0 0
```

This VTK file represents a grid with Spatial Extents [0, 2, 0, 1] to fit the example's requirements. We will define the vector field on this mesh differently in the CLI and in the GUI.

###  CLI generation of vector field

In the CLI, we create a vector field with two components, u and v, defining the following expressions:

```DefineVectorExpression("velocity", "{u,v}")
DefineScalarExpression("u", "-3.141592*1*sin(3.141592*coord(mesh)[0])*cos(3.141592*coord(mesh)[1])")
DefineScalarExpression("v", "3.141592*1*cos(3.141592*coord(mesh)[0])*sin(3.141592*coord(mesh)[1])")
DefineScalarExpression("vel_mag", "magnitude(velocity)")```

###  GUI generation of vector field

1. In the main GUI, bring up the Expressions window via Controls->Expressions (left image)
2. In the Expressions window, make an expressions (right image):
• Name: velocity
• Type: Vector Mesh Variable
• Definition: {-3.141592*1*sin(3.141592*coord(mesh)[0])*cos(3.141592*coord(mesh)[1]), 3.141592*1*cos(3.141592*coord(mesh)[0])*sin(3.141592*coord(mesh)[1])}

##  CLI example

We plot both the velocity glyphs and the LCS output with the code:

```OpenDatabase("ftle_input.vtk")

opAtts = LCSAttributes()
opAtts.sourceType = opAtts.NativeMesh  # NativeMesh, RegularGrid
opAtts.integrationDirection = opAtts.Forward  # Forward, Backward
SetOperatorOptions(opAtts)
DrawPlots()

# Set the view
view = View2DAttributes()
view.windowCoords = (0, 2, 0, 1)
view.viewportCoords = (0.2, 0.95, 0.15, 0.95)
view.fullFrameActivationMode = view.Auto  # On, Off, Auto
view.fullFrameAutoThreshold = 100
view.xScale = view.LINEAR  # LINEAR, LOG
view.yScale = view.LINEAR  # LINEAR, LOG
view.windowValid = 1
SetView2D(view)```

##  GUI Example

The FTLE operator creates a new scalar field from a vector field. This is different from many operators in VisIt; most operators transform data and do not create new fields on the data set.

The scalar field automatically appears in the drop down menu. Make a Pseudocolor plot of operators/FTLE/velocity:

This variable requires the FTLE operator to be added. Note that VisIt adds the operator automatically:

Click draw and you will see the FTLE plot: