sandbox/Maknine/DispersionInviscidST.c

    Dispersion relation for the Rayleigh Taylor instability in the inviscid limit with surface tension

    #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 =200.;
        
        X0 = -L0/2.;    
    
        /* Physical parameters*/
        g = 1.;
        rho1 = 1.0; rho2 = 0.7; //Density Ratio (Light/Heavy)
        mu1 = 0.0; mu2 = mu1;
        sigma = 0.1;
    
        TOLERANCE = 1e-6;//Tolerance of the Solver
    
        int LEVEL = 14;
    
        double k0=2*pi/L0;    //Minimum Wave Numer
        double kmax=1.7; //Max Wave Numer
        double k;
    unused variable ‘lsigma’ [-Wunused-variable]
        double lsigma = sqrt(sigma/((rho1 - rho2)*g));
        init_grid (1 << LEVEL);
    
        //initial guess
        om= 1 + I;
    	
        for (double DeltaI=0.1 ;DeltaI<=10.; DeltaI *= 2) {
    	    
        for (k=k0 ;k<=kmax; k*=1.1) {
    
          /*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'
    plot "out" u 1:4:2 not w lp palette pt 7, sqrt(0.3/1.7*x-0.1*x**3/1.7) t 'sharp' w l lc 2 lw 2
    Dispersion relation (colors represent \Delta_I values) (script)