# DDF (or ECF)

Derived data functions (DDFs) allow for two principal types of usage:

• Analysis, where a summary of a data set is collected
• Synthesis, where that summary is reincorporated with the original data set to make new fields.

The technique is described in a journal publication here (in this paper, a DDF is called by the more correct name of Equivalence Class Function or ECF). The purpose of this page is to describe how to use DDFs in VisIt and also the shortcomings of its implementation.

# Basics of a VisIt DDF

A DDF is a function which summarizes some input data set. The function is defined over a domain and that domain is discretized into a regular mesh. The mesh may be of arbitrary dimension (1D, 2D, 3D, 4D, etc). Each dimension of the mesh comes from a field on the input. The range of the function (referred to as the codomain) also comes from a field of the mesh.

By way of example, consider an input that has temperature, pressure, and density defined on it. A DDF could then be defined as a 2D mesh, over temperature and density, and the codomain over pressure. The 2D mesh would be a regular grid. One dimension of the grid would span temperature and the other density. The value on each cell of the grid would be a pressure. The input data set may have regions with the same temperature and density, but different pressures. Since the DDF is a function, it must map a given temperature-density pair to a unique value. So an operator is applied to all of the possible pressure values. Examples of operators are min, max, sum, average, and standard deviation.

# How to use DDFs in VisIt

DDFs are only available through VisIt's command line interface. For more information about using the command line interface, click here. To make a DDF, you first create a plot and draw it, usually a Pseudocolor plot.

After this, constructing a DDF is a three step process:

• Set up the DDF attributes
• Tell VisIt to create the DDF
• Apply the DDF to the original data set (optional)

## Set up the DDF attributes

Setting up the DDF must be done through the CLI.

You start by instantiating the attributes.

```>>> c = ConstructDDFAttributes()
```

You then give the DDF a name, which will be used for reference later.

```>>> c.ddfName = "myDDF"
```

Next, you state what variable will define the DDFs domain.

```>>> c.varnames = ("pressure", "temperature")
```

Then you say what ranges you want to consider of the domain.

```>>> c.ranges = (pressure-min, pressure-max, temperature-min, temperature-max)
```

Next you say what the resolution of the mesh that defines the domain should be.

```>>> c.numSamples = (number-of-points-for-pressure, number-of-points-for-temperature)
```

Then you say what the codomain is.

```>>> c.codomainName = "density"
```

Finally, you pick an operator for reducing multiple data points in the same cell to a single value.

```>>> c.statisticalOperator = c.Average  # Average, Minimum, Maximum, StandardDeviation, Variance, Sum, Count
```

## Constructing the DDF

You construct the DDF with:

```>>> ConstructDDF(c)
```

This will make a DDF of the active plot. A file will be created that contains the DDF values. If it is 1D, it will create a file with a curve, "DDF_NAME".ultra. If it is 2D or 3D, it will create a file with a rectilinear grid, "DDF_NAME".vtk.

## Applying to the original data set

You can apply your DDF to the original data set using expressions. This can be done either with the GUI or with the CLI. The expression is "apply_ddf( meshname, myDDF)" where myDDF is the name of the DDF you created and "meshname" is the name of your mesh. Note that applying a DDF in this manner is rarely interesting. The expression as posed will simply map the DDF value onto the mesh. To do something interesting, you often need to involve other fields on the input mesh. With our previous example, we have a codomain of average density. So an interesting application may be to look at "density - apply_ddf(meshname, myDDF)" in that case.

# Caveats

• DDFs are a beta (alpha?) feature.
• Many applications involve using spatial coordinates. DDFs focus around fields. You can easily rectify this by creating an expression involving the coordinates of the mesh.
• DDFs only work if all fields have the same centering (node-centered or cell-centered). If the centering does not match, you will need to recenter data to use DDFs. (The expression "recenter" will do this.)
• The resolution of the DDF's mesh should be fairly small. The mesh of the DDF will fully reside in primary memory.
• DDFs do work in parallel.
• If your compute engine dies, all knowledge of the DDF goes away and you have to call ConstructDDF again.
• There is a known bug with defining new expressions. If you define an expression and then call ConstructDDF, the ConstructDDF routine will not be able to access the expression. However, if you define the expression, make a plot, and then call ConstructDDF, it will work fine.