use PDL;
use PDL::Constants qw(PI E);
# Breakdown voltage calculation using Paschen's Law
# and the coefficients for air at fab pressure. 
sub paschenVB {
	# $p = pressure in kilo-Pascals, 1 atm = 101.325 kPa
	# $d = gap in meters
	my ($p, $d) = @_;
	my $Vb; # Vb is breakdown voltage in volts
	my $gamma_se = 2204.21513347591;
	my $A = 112.50; # kPa-cm
	my $B = 2727.50; # V/(kPa-cm)
	$A = $A/100.0;
	$B = $B*100.0;
	$Vb = ($B*$p*$d) / (log($A*$p*$d) - log(log(1 + 1 / $gamma_se)));
	
	return($Vb);
}

1;