sandbox/Maknine/DispersionInviscid.c

    Dispersion relation for the Rayleigh Taylor instability in the inviscid limit

    #include "grid/multigrid1D.h"
    #include "stabilityRT.h"
    
    /*Initialization of the fields to be solved:*/
    scalar REPhi[];
    scalar IMPhi[];
    scalar REEta[];
    scalar IMEta[];
    
    double omtol = 0.01;
    
    int main() {
    
        L0 =50.;
        
        X0 = -L0/2.;    
    
        /* Physical parameters*/
        g = 1.;
        rho1 = 1.0; rho2 = 0.7; //Density Ratio (Light/Heavy)
        mu1 = 0.0; mu2 = mu1;
    
        TOLERANCE = 1e-6;//Tolerance of the Solver
    
        int LEVEL = 14;
    
        double k0=2*pi/L0;    //Minimum Wave Numer
        double kmax=2*pi/(L0/pow(2,LEVEL)); //Max Wave Numer
        double k;
    
        init_grid (1 << LEVEL);
    
        //initial guess
        om= 1 + I;
    	
        for (double DeltaI=0.01 ;DeltaI<=1.; DeltaI *= 10) {
    	    
        for (k=k0 ;k<=kmax; k*=1.4) {
    
          /*Growthrate calculation */
          om = solve_stability_RT (REPhi, IMPhi, REEta, IMEta, DeltaI, k);
          
          fprintf(stdout, "%g %g %g %g  \n", k, DeltaI, creal(om), cimag(om));
          
    
        }
          
        fprintf(stdout, "\n");
        }
    
    }

    Results

    set xlabel 'k'
    set ylabel '{/Symbol w}_i'
    set cblabel '{/Symbol D}_I'
    set log xy
    plot "out" u 1:4:2 not w lp palette pt 7, sqrt(0.3/1.7*x) t 'sharp' w l lc 1 lw 2
    Dispersion relation (colors represent \Delta_I values) (script)
    set xlabel 'k {/Symbol D}_I'
    set ylabel '{/Symbol w}_i ({/Symbol D}_I/g)^{1/2}'
    set cblabel '{/Symbol D}_I'
    set yrange[0.1:0.8]
    plot "out" u ($1*$2):($4*sqrt($2)):2 not w p palette pt 7
    Rescaled Dispersion relation (colors represent \Delta_I values) (script)