#include "grid/multigrid.h"#include "navier-stokes/centered.h"
int main(){ origin (-0.5, -0.5); init_grid (64); const face vector muc[] = {1e-3,1e-3}; mu = muc; DT = 0.1; CFL = 0.8; run();}u.t[top] = dirichlet(1);u.t[bottom] = dirichlet(0);u.t[left] = dirichlet(0);u.t[right] = dirichlet(0);u.n[top] = dirichlet(0);u.n[bottom] = dirichlet(0);u.n[left] = dirichlet(0);u.n[right] = dirichlet(0);
scalar un[];event logfile (t += 0.1; i <= 10000) { double du = change (u.x, un); if (i > 0 && du < 1e-5) return 1; /* stop */ fprintf (stderr, "%f %d %g\n", t, i, du);}event profiles (t = end){ FILE *fp = fopen("uxProf", "w"); for (double y = -0.5; y <= 0.5; y += 0.01) fprintf (fp, "%f\t%g\n", y, interpolate (u.x, 0, y)); fprintf(fp,"\n"); fclose (fp);}0.390000 1e+300.400000 1e+300.410000 1e+300.420000 1e+300.430000 1e+300.440000 1e+300.450000 1e+300.460000 1e+300.470000 1e+300.480000 1e+300.490000 1e+30
71950.410000 0.4259150.420000 0.4355080.430000 0.4459630.440000 0.4645780.450000 0.4938450.460000 0.5351870.470000 0.6150630.480000 0.7166790.490000 0.852193
80000 1e+300.490000 1e+30event profiles (t = end){ scalar * vname={u.x}; int n =0; float start_p=-0.5; float end_p=0.5; float delta_p=0.01;
n=fabs(end_p-start_p)/delta_p; coord a[n];
for (int i = 0; i < n; i++){ double y = start_p + i * delta_p; a[i].x=0; a[i].y=y; a[i].z=0; } int len_l=list_len(vname); double v[n*len_l]; interpolate_array(vname, a, n, v, false); FILE *fp = fopen("uyProf", "w"); // for (double y = -0.5; y <= 0.5; y += 0.01) for ( int i = 0; i<n; i++) fprintf (fp, "%f\t%g\n", a[i].y, v[i]); fprintf(fp,"\n"); fclose (fp);}if (pid() == 0){
...
//Some code only the "root" carries out
...
}