%  This script specifies nondimensional input parameters and calls the
%  function hurrprofile.m. Inputs are chi, nondimensional subsidence
%  velocity, wc, precipitation % efficiency, ep, and nondimensional outer
%  radius, ro
%  December, 2021
%--------------------------------------------------------------------------
chi=0.2;
wc=0.02;
ep=0.5;
ro=0.5;
%--------------------------------------------------------------------------
[V,w,Mc,S,SS,r,rm,imatch ] = hurrprofile(chi,wc,ep,ro);
if sum(isnan(V)) ~= 0
    return
end    
%
w(imatch:end)=100*w(imatch:end);
Mc(imatch:end)=100*Mc(imatch:end);
ng=3;
while ng > 0
    ng=menu('Graphs','Stop','Azimuthal velocity', ...
        'Vertical velocity and mass Flux','Moist static energies');
    if ng == 1
        return
    elseif ng == 2
        plot(r,V,'linewidth',1);
        ylab='V';
        tit='Azimuthal Velocity';
    elseif ng == 3
        plot(r(1:imatch-1),w(1:imatch-1),'b',r(1:imatch-1),Mc(1:imatch-1),'r','linewidth',1);
        hold on
        plot(r(imatch-1:imatch),w(imatch-1:imatch),':b',r(imatch-1:imatch),Mc(imatch-1:imatch),':r','linewidth',1);
        plot(r(imatch:end),w(imatch:end),'--b',r(imatch:end),Mc(imatch:end),'--r','linewidth',1);
        hold off
        ylab='w,M_c';  
        legend('Vertical velocity','Mass flux')
        tit=[{'Vertical velocity and convective mass flux'};{'(dashed denotes multiplication by 100)'}];   
    elseif ng == 4
        plot(r,S,r,SS,'linewidth',1);
        ylab='MSE';  
        legend('PBL MSE','Saturation MSE')
        tit='Moist Static Energies';
    end
    set(gca,'fontsize',13,'fontweight','bold')
    xlabel('Radius')
    ylabel(ylab,'rotation',0)
    title(tit)
end    
