sandbox/bugs/karman.c

    Source file crashes the compiler

    This is due to the formatting of vectors without spaces, see below.

    #include "navier-stokes/mac.h"
    #include "tracer.h"
    
    /*so passive tracer is here, but I guess it just for show, nothing to do with twophase*/
    
    
    scalar f[];
    scalar * tracers = {f};
    /*injection on the RIGHT (I flipped the website's description)*/
    
    u.n[right]=dirichlet(1.);
    p[right]=neumann(0.);
    data definition has no type or storage class
    type defaults to ‘int’ in declaration of ‘pf’ [-Wimplicit-int]
    ISO C forbids zero-size array ‘pf’ [-Wpedantic]
    pf[right]=neumann(0.);
    f[right]=dirichlet(y<0);
    
    /*outflows*/
    u.n[left]=neumann(0.);
    p[left]=dirichlet(0.);
    conflicting types for ‘pf’
    pf[left]=dirichlet(0.);
    
    /*condition for the (yet nonexistant) cylinder*/
    bid cylinder;
    u.t[cylinder]=dirichlet(0.);
    
    /*I think it's init*/
    event init(t=0){
      mask ( y >  0.5 ? top:
            y < -0.5 ? bottom:
            sq(x)+sq(y) < sq(0.0625) ? cylinder: none);
      
    #if 1 // this crashes the preprocessor...
      const face vector muc[]={0.0007825,0.00078125};
    #else // ... while this does not
      const face vector muc[] = {0.0007825,0.00078125};
    #endif
    ‘mu’ undeclared (first use in this function)
      mu=muc;
      foreach() {
        u.x[]=-1.;
        f[]=0.;
      }
      boundary({f});
    }
    ‘mgu’ undeclared (first use in this function)
    event logfile(i++){fprintf(stderr,"%d %g %d %d \n",i,t,mgp.i,mgu.i);}
    
    event adapt (i++) {adapt_wavelet ({u,f}, (double[]){3e-2,3e-2,3e-2}, 9, 4);}
    
    /*domain shape*/
    int main() {
      L0=8.;
      origin(-0.5,-L0/2.);
      N=512;
      run();
    }