0
$\begingroup$

I would like to show the current distribution in a thin cylinder in 3D. The figure below shows the open cylinder.

open cylinder

I am trying to use that figure as a texture in a 3D plot inspired by this answer.

scalarField[r_, \[Phi]_, z_] := 
  1/Pi*(z + 2*Sum[Sinh[n*z]/Cosh[n*3]/n*Cos[n*\[Phi]], {n, 1, 33}]);
contourTexture = 
  ContourPlot[
   scalarField[1, \[Phi], z], {z, \[Phi]} \[Element] 
    Rectangle[{-3, -Pi}, {3, Pi}], AspectRatio -> 1/2, Frame -> False];
streamTexture = 
  StreamPlot[{-D[scalarField[1, \[Phi], z], z], -D[
      scalarField[1, \[Phi], z], \[Phi]]}, {z, \[Phi]} \[Element] 
    Rectangle[{-3, -Pi}, {3, Pi}], AspectRatio -> 1/2, 
   Evaluated -> True, Frame -> False, StreamStyle -> Black];
rev = RevolutionPlot3D[{1, t}, {t, -3, 3}, 
   TextureCoordinateFunction -> ({#1, #2} &), 
   PlotStyle -> Texture[contourTexture + streamTexture]];
Show[rev]

The output I am getting is:

output

Two points I don't know:

  1. What to pass as TextureCoordinateFunction
  2. if the calling PlotStyle -> Texture[contourTexture + streamTexture] is correct

I have also seen this question, but I can't figure out how to adapt it.

$\endgroup$
  • $\begingroup$ related: Phase portrait on a cylinder $\endgroup$ – Kuba Jun 7 '17 at 17:04
  • $\begingroup$ Is this the result you are after? RevolutionPlot3D[{1, t}, {t, -3, 3}, TextureCoordinateFunction -> ({#4, #5} &), PlotStyle -> Texture[ Show[contourTexture, streamTexture, PlotRangePadding -> None]], Lighting -> "Neutral"] $\endgroup$ – Kuba Jun 7 '17 at 17:19
  • $\begingroup$ @Kuba that's exactly what I was after. Could you post an answer and, while at it, explain what #4 and #5 are in TextureCoordinateFunction -> ({#4, #5} &)? $\endgroup$ – Pedro H. N. Vieira Jun 7 '17 at 17:33
  • $\begingroup$ See documentation details and options for TextureCoordinateFunction. Also see: 17084 $\endgroup$ – Kuba Jun 7 '17 at 17:51

Your Answer

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

Browse other questions tagged or ask your own question.