1 0 GfsSimulationMoving GfsBox GfsGEdge {} {
  Time { end = 0.8 }
  Refine {
      if (fabs(y) < 0.02 && x > 0.38 && x < 0.42)
	  return 11;
      if (fabs(y) < 0.35 && x > 0.3 && x < 0.5)
	  return 8;
      return 5;
  }

  SolidMoving { istep = 1 } cylinder.gts { tx = 0.4 scale = 0.025 } { level = 11 }

  # Set the boundary condition on the solid object.
  # The velocity is imposed
  SurfaceBc U Dirichlet -1.

  # Adapt the mesh using the vorticity criterion at every timestep
  AdaptVorticity { istep = 1 } { maxlevel = (x > 0.5 - t ? 9 : 10) cmax = 1e-2 }

  SourceViscosity 3.125e-5

  OutputSimulation { start = end } end.gfs 
  OutputSolidForce { istep = 1 } forces.dat

  EventScript { start = end } {
      cat <<EOF | gnuplot 2>&1 | awk '{if ($1 == "400") print $0;}'
           f(x)= a*cos(b*(x+c))
           a = 0.00525
           b = 110.49
           c = 0.611
           fit [0.5:] f(x) 'forces.dat' u 1:6 via a,b,c
           print "400 ", b/(2*pi)*0.0125       
EOF
  }
}
GfsBox {
    right = BoundaryOutflow 
}