2
$\begingroup$

I want to draw

$$G=G(P,T)=-k*T(1+\log{\frac{(V-1)T^{3/2}}{\Phi}})-\frac{a}{V}+P*V$$

but $V$ is an implicit function of $P$ and $T$, which is $(P+\frac{a}{V^2})(V-b)=k*T$

I tried to solve for $V$ and then substitute it in the first equation, but my plot doesn't look as I want it to. It has a region that can't be drawn, as shown in the image below. How can I fix it?

Code:

gasG[T_, P_, G_] = -T (1 + Log[(V - b)/Φ T^(3/2)]) - a/V + P*v - G;
a = 1.5;
b = 2;
Φ = 1;
k = 1;
V = Solve[(P + a/V^2)(V-b) == k*T, V]

ContourPlot3D[gasG[T, P, G] == 0, {T, 0, 8/27*a/b*2}, {P, 0, a/(27 b^2)*2}, {G, -5, 2}]

contour plot

$\endgroup$
  • $\begingroup$ Welcome to Mathematica.SE! I suggest that: 1) You take the introductory Tour now! 2) When you see good questions and answers, vote them up by clicking the gray triangles, because the credibility of the system is based on the reputation gained by users sharing their knowledge. Also, please remember to accept the answer, if any, that solves your problem, by clicking the checkmark sign! 3) As you receive help, try to give it too, by answering questions in your area of expertise. $\endgroup$ – bbgodfrey Mar 11 '15 at 1:35
  • $\begingroup$ Please edit your question to include the code that you used to create the figure. Be sure that it is in InputForm. $\endgroup$ – bbgodfrey Mar 11 '15 at 1:36
  • $\begingroup$ G is independent of P so you can plot it directly as G(V,T)? $\endgroup$ – Algohi Mar 11 '15 at 1:46
  • $\begingroup$ Oh,sorry,I miss PV term behind.and I add it up now. $\endgroup$ – justfly007 Mar 11 '15 at 2:09
4
$\begingroup$

The question's code contains a few typographical errors, which I hope that corrected accurately. The upper limits on T and P in ContourPlot3D may be incorrect as well. Here is what I solved:

gasG = -T (1 + Log[(V - b)/Φ T^(3/2)]) - a/V + P*V - G;
a = 1.5;
b = 2;
Φ = 1;
k = 1;
ans = Solve[(P + a/V^2) (V - b) == k*T, V][[3]]

(* {V -> (0.3333333333333333*(2.*P + T))/P - (0.13228342099734997*(18.*P - 4.*(2.*P + T)^2))/
   (P*(108.*P^2 + 32.*P^3 - 27.*P*T + 48.*P^2*T + 24.*P*T^2 + 4.*T^3 + 
   9.*Sqrt[18.*P^3 + 96.*P^4 + 128.*P^5 - 120.*P^3*T + 192.*P^4*T - 3.*P^2*T^2 + 
      96.*P^3*T^2 + 16.*P^2*T^3])^(1/3)) + 
   (0.20998684164914552*(108.*P^2 + 32.*P^3 - 27.*P*T + 48.*P^2*T + 24.*P*T^2 + 4.*T^3 + 
   9.*Sqrt[18.*P^3 + 96.*P^4 + 128.*P^5 - 120.*P^3*T + 192.*P^4*T - 3.*P^2*T^2 + 
      96.*P^3*T^2 + 16.*P^2*T^3])^(1/3))/P} *)

The third root of Solve is chosen, because it is real.

ContourPlot3D[Evaluate[Simplify[gasG /. ans]] == 0, {T, 0, (8 a 2)/(27 b)}, 
  {P, 0, (a 2)/(27 b^2)}, {G, -5, 2}]

enter image description here

The break in the surface is due to a branch cut in the cube-root in V.

Addendum

A curve similar (apart from scale factors) to the one cited in the OP's comment below is provided by

ContourPlot[Evaluate[Simplify[gasG /. G -> 0 /. ans]], {T, 0, (8 a 2)/(27 b)},
 {P, 0, (a 2)/(27 b^2)}, Contours -> 0, PlotRange -> All, PlotPoints -> 50, MaxRecursion -> 2]

enter image description here

$\endgroup$
  • $\begingroup$ thank you very much to correct my question! are there any method to draw it completely? what I mean is that V should be constrained by $(P+\frac{a}{V^2})(V-b)=kT$ $\endgroup$ – justfly007 Mar 11 '15 at 4:59
  • $\begingroup$ What do you mean by constrained and by draw completely? $\endgroup$ – bbgodfrey Mar 11 '15 at 13:12
  • $\begingroup$ when solve V algebraically, and choose the real root as its result,it looses some generality. $\endgroup$ – justfly007 Mar 11 '15 at 14:30
  • $\begingroup$ ContourPlot3D cannot plot the complex roots, although it can plot the absolute value, real part, etc. If you chose one of these, then all three branches could be plotted. However, the added branches probably are not physical. $\endgroup$ – bbgodfrey Mar 11 '15 at 14:59
  • $\begingroup$ the real one is physical,the other two are not.I'm trying to repeat the fifth picture of this paper:arxiv.org/pdf/1205.0559v2.pdf. $\endgroup$ – justfly007 Mar 12 '15 at 2:59

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.