2 2 GfsPoisson GfsBox GfsGEdge {} {
  Time { iend = 1 }
  PhysicalParams { L = M_PI }
  MetricLonLat M 1.
  Refine LEVEL

  GModule hypre
  ApproxProjectionParams { tolerance = 1e-30 nitermin = CYCLE nitermax = CYCLE }

  Global {
      #include <gsl/gsl_sf.h>
      @link -lgsl -lgslcblas

      double fact (double n) {
        if (n <= 1)
      	  return 1.;
    	else
	  return n*fact(n - 1.);
      }

      double legendre (int l, int m, double x) {
	  if (m < 0) 
	      return pow(-1.,fabs(m))*fact(l-fabs(m))/fact(l+fabs(m))*
	      gsl_sf_legendre_Plm (l, fabs(m), x);
	  else
	      return gsl_sf_legendre_Plm (l, m, x);
      }

      double spherical_harmonic_re (int l, int m, double X, double Y) {
	  return sqrt((2*l+1)/(4*M_PI)*fact(l-m)/fact(l+m))*
	  legendre (l, m, sin(Y/180*M_PI))*cos(m*X/180*M_PI);
      }
  }

  Init { } { 
      Div = -4*(4+1)*spherical_harmonic_re (4, 2, x, y) 
      Sol = spherical_harmonic_re (4, 2, x, y)
  }

  OutputTime { istep = 1 } {
    awk '{if ($2 == 1) print CYCLE, $8;}' >> time
  }
  OutputProjectionStats { start = end } {
    awk '{if ($1 == "residual.infty:") print CYCLE, $3, $4;}' >> proj
  }
  OutputErrorNorm { start = end } {
    awk '{print LEVEL, $5, $7, $9}' >> error 
  } { v = P } {
    s = Sol
    v = E
    unbiased = 1
  }
  OutputSimulation { start = end } end-SOLVER-LEVEL.gfs
}
GfsBox {}
GfsBox {}
1 2 right
2 1 right