2
$\begingroup$

first time poster in this site.

I am trying to create a small program to make a graph of the Carnot cycle.

For isothermals I am simply trying to look for points where P*V would give the same Temperature so that I can display an isothermal curve.

However, I am having absolutely no luck with trying to plot an adiabatic curve. I know I want a steeper curve, but thats about it. Is there some sort of simpler way to draw out an adiabatic curve? Can I set any variable constant and try to draw the curve like an isotherm?

Any information is appreciated.

        //ISOTHERMS
//i = x axis; j = y axis;
// for values 1 - 350
// plot y values from isothermal equation -- P*V = constant T
// j = k/i

 int k1 = 5000;
 //int k1 = 1500;
    //int k1 = 15000;
       //int k2 = 20000;
       int k2 = 15000;
       //int k2 = 30000;

  g.setColor(Color.red);
  for( int i = 1; i < 350; i++) 
  {
    int j1 = k1/i;
    int j2 = k2/i;
    //if(j1 < 350) 
        g.drawLine(i+50, j1+50, i+50, j1+50);
    //if(j2 < 350) 
        g.drawLine(i+50, j2+50, i+50, j2+50);

  }

    //ADIABATS
  //P*V^gamma = constant T
  double gamma = 1.67;

 for( int m = 1; m < 500; m++) 
 {

   // int h1 = (int) (1400000/(Math.pow(m,1.97)));
   int h1 = (int) (1000000/(Math.pow(m,2)));
    //int h2 = (int) (3500000/(Math.pow(m,1.97)));
   int h2 = (int) (2400000/(Math.pow(m,2)));
    //if(j1 < 350) 
    g.setColor(Color.blue);
        g.drawLine(m+50, h1+50, m+50, h1+50);
    //if(j2 < 350) 
        g.drawLine(m+50, h2+50, m+50, h2+50);



  }

test for drawing isotherms and adiabats

$\endgroup$
0
$\begingroup$

$PV^{\gamma}=Const$, where $\gamma = C_p/C_v$

$\endgroup$
  • $\begingroup$ Bear with me, but am I applying the exponent to (P*V) or only one of the two? so if i choose a monatomic and gamma is 1.67, do I write (x *y)^1.67 = Const? Also, since I have to tell the program to draw the points when the equation equals the constant in question, i'm having difficulty finding even a constant to attempt drawing. $\endgroup$ – lralvare Feb 26 '16 at 19:03
  • $\begingroup$ To get the constant, substitute the P and V at the end of the isothermal step. $\endgroup$ – Chet Miller Feb 26 '16 at 19:16
  • $\begingroup$ If I wanted to write P in terms of V; would I write it as something like... P = (Const/V)^(- gamma ) ? I have to write it this way in the program to make the plot points cleaner. $\endgroup$ – lralvare Feb 29 '16 at 9:31
  • $\begingroup$ made an attempt, though I'm sure I didn't do the correct equation with game since the adiabatic slopes taper off too quickly i think with greater X (volume). $\endgroup$ – lralvare Feb 29 '16 at 10:10
  • $\begingroup$ I have no idea what you are saying. $P=P_1(V_1/V)^{\gamma}$ $\endgroup$ – Chet Miller Feb 29 '16 at 12:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.