import java.io.*;
import javax.swing.*;
import javax.tools.*;
import java.util.*;

class kanat2
 {
  public static double kmetal(double t)
  {double T=t+273.15;
   double a=71.62587939698594-0.03447361809045638*T-7.927135678388277E-6*T*T;
  return a;
  }
  	 	   	 
  public static double Rayleigh(double t,double tinf,double d,double h) throws IOException
  { // Doğal taşınım Rayleigh sayısı
    // t derece C kanat yüzey sıcaklığı
    // tinf derece C  dış hava scaklığı
    double P=1.01325; //bar
    Gmix g=new Gmix("yashava");
   //Gas1 g=new Gas1("air");
   double tf=(t+tinf)/2.0;
   double Tf=tf+273.15;
   double T=t+273.15;  //K
   double beta=1/Tf;
   double gyc=9.806;
   double ro=g.M/g.v(Tf,P);
   double nu=g.vis(Tf)/ro;
   double alfa=g.alfa(Tf,P);
   System.out.println("t="+t+"tinf="+tinf+"tf="+tf+"vis="+g.vis(Tf)+"ro="+ro+"nu="+nu);
   System.out.println("gy="+gyc+"nu="+nu+"beta="+beta+"alfa="+alfa);
   double R=gyc*beta*(t-tinf)*d*d*d*d/h/(alfa*nu);
   return R;
  }
  
  public static double h(double t,double tinf,double h,double d,double b ) throws IOException
  {  // Doğal taşınım ısı transferi hava için
     // dik konumlu levha
  Gmix g=new Gmix("yashava");
  //Gas1 g=new Gas1("air");
  double C1=1.0/12.0;
  double C2=0.61;
  double A=b*h;
  double tf=(t+tinf)/2.0;
  double Tf=tf+273.15;
  double Pr=g.Prandtl(Tf);
  double Ra=Rayleigh(t,tinf,d,h);
  System.out.println("Ra="+Ra);
  double k=g.k(Tf);
  double Nu;
  if(Ra<1) Nu=C1*Math.pow(Ra,0.25);
  else  
  {
  double x1=Math.pow((C1*Ra),1.5);
  double x2=Math.pow(Ra,0.25);
  double x3=Math.pow(C2*x2,1.5);
	  Nu=Math.pow((1.0/x1+1.0/x3),(-2.0/3.0));
	  System.out.println("x1="+x1+"x2="+x2+"x3="+x3+"Nu="+Nu);
  }
  
  double hh=Nu*k/d;
  return hh;
  }
  

  
  public static void main(String args[]) throws IOException
  {
  double t=60;
  double tinf=20;
  double h=0.6;
  double d=2e-2;
  double b=2e-2;
  double h2=h(t,tinf,h,d,b);
  System.out.println("h="+h2);
    }
 }