%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% Name: plotMHDTime.m
% Author: J. Kristoffer Hultgren
%
% Description:
%
% Plots the Hybrid model data wrt time in orbit.
%
% Input:  dataM - MHD model data
%         r     - Radius of orbit
%
% Output: -
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

function plotMHDTime(dataM,r)

global CO;

kJ = 1.38*10^-23;   % J/K
keV =8.62*10^-5;    % eV/K

Mrho = dataM(:,5);
Mp = dataM(:,12);
MT = Mp./(kJ.*Mrho).*keV;

P = 2*pi*sqrt(r^3/(CO.G*CO.M))/60/60;   % Period of orbit

figure('name','MHD')

TH = linspace(0,360,max(size(dataM)));

subplot(4,1,1), plot(TH,MT,'r')
title('MHD')
ylabel('Temperature (eV)')
grid on
hold on

subplot(4,1,2), plot(TH,Mrho.*10^-6,'b')
ylabel('Ion density (cm^{-3})')
grid on
hold on

subplot(4,1,3), plot(TH,Mp,'g')
grid on
xlabel('\theta (grad)')
ylabel('Pressure (Pa)')
axes('position',[.13  .2  .775  .0001])
axis([0 P*40/36 0 0001])
xlabel('Time (h)')