Group Abstract Group Abstract

Message Boards Message Boards

NDSolve for a heat differential equation with periodic boundary conditions?

I’m solving the heat differential equation in the steady state with a periodic temperature distribution along one side of the simulation volume (the notebook is attached).

Using NDSolve, I got very bad spatial resolution, i.e., the contour plot looks quite rough and not nice. Does anyone know how I can increase the resolution so that the plot looks nice? I suspect there is an option to increase the number of points.

I also would like to use periodic boundary conditions along the x-axis. So far I have terminated the simulation volume by Dirichlet boundary conditions after a finite number of periods, while the real-world temperature grating is entirely periodic along the x-direction. Any ideas?

Thanks, Markus

Attachments:
POSTED BY: Markus Schmidt
6 Replies

Just as a remark:

... so that people can really see the periodic temperature distribution.

So how about this:

img = ImageCrop@
   ContourPlot[ufun[x, z], {x, z} \[Element] mesh, MaxRecursion -> 4, 
     Contours -> 30, ColorFunction -> "BlueGreenYellow",
    Frame -> False, PlotRangePadding -> 0, ImageSize -> 600];
ParametricPlot3D[{Cos[\[Phi]], Sin[\[Phi]], z}, {\[Phi], 0, 2 Pi}, {z,
   0, 0.0001}, PlotStyle -> Texture[img], Mesh -> None, 
 BoxRatios -> {1, 1, 1.5}, Ticks -> {None, None, Automatic}]

giving:

enter image description here

Regards -- Henrik

POSTED BY: Henrik Schachner
Attachments:
POSTED BY: Tim Laska
Attachments:
POSTED BY: Tim Laska

Great idea, thank you again.

Just as a side note: The solution shown in your plot is asymmetric along the x-axis, which is strange since it is there is nothing physical enforcing this. I shifted everything by lambda/2 in x-direction, and now it looks correct. enter image description here

Thanks again,

Markus

POSTED BY: Markus Schmidt

Hi Markus,

You could just define a function that shifts the contour plot and then seam them together with Show. For example:

cp[i_, n_] := 
  ContourPlot[
   ufun[x - 2*\[CapitalLambda] i, z], {x, 2*\[CapitalLambda]*i, 
    2*\[CapitalLambda]*(i + 1)}, {z, 0, Lz}, MaxRecursion -> 4, 
   Contours -> 30, ColorFunction -> "BlueGreenYellow", 
   FrameStyle -> Directive[Black, Thickness[0.003]], 
   LabelStyle -> Directive[Black, 10], 
   FrameLabel -> {"x [m]", "z [m]"} , 
   PlotRange -> {{0, 2 * \[CapitalLambda] * (n)}, {0, Lz}}];
nplts = 5;
Show[Table[cp[i, nplts], {i, 0, nplts - 1}]]

5 Contour Plots

Best regards and Happy New Year!

Tim

POSTED BY: Tim Laska

Hi Tim.

This is really nice and exactly what I wanted, thanx.

Is there a simple way to plot multiple periods of the distribution in contourplot? Let's say I would like to plot five periods so that people can really see the periodic temperature distribution.

Best,

Markus

POSTED BY: Markus Schmidt
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard