5
$\begingroup$

I want to plot the Van der Waals-equations, specifically the part in which the Van der Waals loop is shown. First I tried plotting it with the Plot3D[] function, tho the upper edges are very uneven and even with MaxRecursion set to 15 I couldn't get rid of the problem.

R=8.314;
a=363.7*10^-3;
b=42.7*10^-6;
Plot3D[p, {V, 0, 0.001}, {T, 290, 320}, PlotTheme -> "Scientific", 
 PlotRange -> {0, 12000000}, AxesLabel -> {"V", "T", "p"}, 
 ImageSize -> 1100, Exclusions -> {V == 0, T == 0}, MaxRecursion -> 8,
  ViewPoint -> {0, -\[Infinity], 0}, ColorFunction -> Green]

When I used the ContourPlot3D[], I didn't had that problem.

ContourPlot3D[(R T)/(V - b) - a/V^2 == p, {V, 0, 0.001}, {T, 280, 
  340}, {p, 0, 12000000}, AxesLabel -> {"V", "T", "p"}, 
 ImageSize -> Large, AspectRatio -> 0.8]

Now I want to have a graph which a specific value for T (such graphs are called isotherms), which is plotted in the same ContourPlot3D. Also, I want to create a slider, in which I specify the value for T. I do know, that the Show[] function can be used, but don't know how to use it in this scenario since I want to plot two different things (a plane and graph) in one 3D plot.

Is there a way to to that? If yes, I'd be very thankful for your help :)


Thank you kglr! Tho does anyone understand why these uneven edges occur when using the Plot3D function and why there's a hole in the function plotted using ContourPlot3D?

uneven edges of a function plotted with Plot3D

Hole in plotted function using ContourPlot3D

$\endgroup$
5
  • $\begingroup$ the values for R,a and b? $\endgroup$
    – kglr
    Oct 16, 2019 at 9:38
  • $\begingroup$ You can take a look at Show to combine the plots and at Manipulate for the slider. $\endgroup$
    – Lukas Lang
    Oct 16, 2019 at 9:39
  • $\begingroup$ @kglr, R=8.31 :) $\endgroup$
    – Rom38
    Oct 16, 2019 at 9:39
  • $\begingroup$ Oh yes, sorry! R=8.314 a=363.7*10^(-3) b=42.7*108^(-6) $\endgroup$
    – Henri Lila
    Oct 16, 2019 at 9:49
  • $\begingroup$ thank you Henri and @Rom38. $\endgroup$
    – kglr
    Oct 16, 2019 at 10:01

1 Answer 1

7
$\begingroup$
Manipulate[
  Show[ContourPlot3D[(R T)/(V - b) - a/V^2 == p, 
   {V, 0, 0.001}, {T,  280, 340}, {p, 0, 12000000}, 
    AxesLabel -> {"V", "T", "p"}, 
    ImageSize -> Large, AspectRatio -> 0.8, 
    MeshFunctions -> {#2 &, # &, #3 &}, 
    Mesh -> {{m}, 20, 20}, 
    MeshStyle -> {Directive[Thick, Red], Automatic, Automatic}], 
   Graphics3D[{Opacity[.5], Blue, 
    InfinitePlane[{{0, m, 0}, {1, m, 0}, {1, m, 1}}]}]], 
 {m, 280, 340}]

enter image description here

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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