#!bin/perl

do "parameters.pl";

# Open the file for reading.
open DATA1, "OhmicHeatingPowerTime.txt" or die "can't open file $!";
my @data1 = <DATA1>;
close (DATA1);

# Open the file for reading.
open DATA2, "maxElectronTemperature" or die "can't open file $!";
my $data2 = <DATA2>;
close (DATA2);

# Open the file for reading.
open DATA3, "Aktual_PfeifferMerkaVakua" or die "can't open file $!";
my $data3 = <DATA3>;
close (DATA3);

@row2=split(' ',$data2);
$tmax=$row2[0];
$rowmax=$row2[2];
@row1=split(' ',$data1[$rowmax]);
$Pohmax=$row1[1];
$Wmax=1/3*2*($data3/1000)*$row2[1]/0.0258*$Pi*($MinorRadius**2)*2*$Pi*$MajorRadius;
$tauE=$Wmax/($Pohmax*1000);
$tauE=$tauE*1000000; # [mikrosekundy]
$tauE=sprintf("%.1f",$tauE);

$tauENeoAlc=1.9e-21*2*($data3/1000)/0.0258/(1.38e-23*11600)*($MajorRadius**2)*$MinorRadius;  #NeoAlcator Scaling
$tauENeoAlc=$tauENeoAlc*1000000; # [mikrosekundy]
$tauENeoAlc=sprintf("%.1f",$tauENeoAlc);
$tauEITER89=0;
open CIL1, ">tauE";
print CIL1 "$tauE";
close (CIL1);
open CIL2, ">tauENeoAlc";
print CIL2 "$tauENeoAlc";
close (CIL2);
