# GfsInitVorticity

GfsInitVorticity uses the given vorticity distribution to compute the corresponding velocity field. Due to limitations in the type of boundary conditions for the stream-function–vorticity equation, the vorticity field given as argument must vanish before reaching the boundaries of the domain (i.e. it must have a compact support), unless periodic boundary conditions are used (and the vorticity distribution is itself periodic, of course).

The syntax in parameter files depends on whether the 2D or 3D solver is used.

In 2D:

``` [ GfsGenericInit ] [ GfsFunction ]
```

where the GfsFunction is the (z-component of the) vorticity field.

In 3D:

``` [ GfsGenericInit ] [ GfsFunction ] [ GfsFunction ] [ GfsFunction ]
```

where the GfsFunctions are the x-, y- and z-components of the vorticity field.

### Examples

• Coalescence of a pair of Gaussian vortices (Gerris logo)
• ```    InitVorticity {} {
/* We use nested functions for simplicity (this will not work on MACOSX) */
double vortex (double xc, double yc, double r) {
double r2 = (x - xc)*(x - xc) + (y - yc)*(y - yc);
return 2.*M_PI*exp (- 2.*r2/(r*r));
}
double r = 0.01, theta = 30.*M_PI/180.;
return vortex (-r*sin(theta), r*cos(theta), 0.01) +
vortex (r*sin(theta), -r*cos(theta), 0.01);
}
```

• Convergence for the three-way vortex merging problem
• ```  InitVorticity {} {
double vortex (double xo, double yo, double s) {
double r = sqrt ((x - xo)*(x - xo) + (y - yo)*(y - yo));
return s*(1. + tanh (100.*(0.03 - r)))/2.;
}
return vortex (0., 0., -150.) +
vortex (0.09, 0., 50.) +
vortex (-0.045, 0.0779422863406, 50.) +
vortex (-0.045, -0.0779422863406, 50.);
}
```