Message Boards Message Boards

1
|
7543 Views
|
4 Replies
|
4 Total Likes
View groups...
Share
Share this post:

Finite Elements: how to impose periodic boundary conditions

Posted 10 years ago

Hi dear community,

I am beginning to work with finite elements and I am interested on creating 3D structures and solving the equations of mechanical balance but with periodic boundary conditions on the 3D region. By that I mean that the displacement, e.g., on the right and left face of a cube should be the same (as for all corresponding faces). I am not sure on how to impose this. Do you have any idea? A simple 2D example would be enough, sorry for not delivering it myself. Thank you

Mauricio

POSTED BY: Mauricio Lobos
4 Replies

There is another thing about the periodic boundary conditions. The examples I showed above lives on a torus due to its periodic boundary conditions. So if you solve the equation

sols = NDSolve[{D[u[x, y, t], {t, 2}] == 
    0.1 (D[u[x, y, t], {x, 2}] + D[u[x, y, t], {y, 2}]), 
   u[x, y, 0] == Sin[2 Pi*(x + y)], D[u[x, y, t], t] == 0 /. t -> 0., 
   u[0, y, t] == u[1, y, t], u[x, 0, t] == u[x, 1, t]}, 
  u, {x, 0, 1}, {y, 0, 1}, {t, 0, 12}]

then export the frames:

frames = For[k = 7.5, k <= 9.5, k = k + 0.075, 
   Export["~/Desktop/Movie/frame" <> ToString[1000*k] <> ".gif", 
    ParametricPlot3D[{(2 + Cos[v]) Cos[u], (2 + Cos[v]) Sin[u], 
      Sin[v]}, {u, 0, 2 Pi}, {v, 0, 2 Pi}, Mesh -> None, 
     TextureCoordinateFunction -> ({#1, #2} &), Boxed -> False, 
     Axes -> False, 
     PlotStyle -> 
      Texture[ImageCrop[
        Image[ContourPlot[u[x, y, k] /. sols, {x, 0, 1}, {y, 0, 1}, 
          Contours -> 150, ContourLines -> False, 
          ImagePadding -> False, Frame -> False, 
          PlotRange -> {-1.1, 1.1}, 
          ColorFunctionScaling -> False]], {{14, 360 - 14}, {14, 
          360 - 14}}]]]]];

you get something like this:

enter image description here

which should actually move.

Cheers, Marco

POSTED BY: Marco Thiel

Hi Marco,

thank you very much, I though it could not be that easy with the new finite elements since I do not know if that works with the new DirichletConditions. It seems that using FEM I have to specifically impose the conditions on the boundary since the following code does not properly work

Needs["NDSolve`FEM`"]
Region = ImplicitRegion[
   0 <= x <= 5
    && 0 <= y <= 10
   , {x, y}
   ];
op = -Laplacian[u[x, y], {x, y}] - 20;
BCs = {
   DirichletCondition[u[x, y] == 0, x == 0 && 8 <= y <= 10]
   , DirichletCondition[u[0, y] == u[5, y], 0 <= y <= 10]
   , DirichletCondition[u[x, 0] == u[x, 10], 0 <= x <= 5]
   };
uif = NDSolveValue[{op == 0, BCs}, u, Element[{x, y}, Region]];
plot = ContourPlot[uif[x, y], Element[{x, y}, Region], 
  ColorFunction -> "Temperature", AspectRatio -> Automatic, 
  FrameLabel -> {"x", "y"}]

enter image description here

POSTED BY: Mauricio Lobos

And here is the same in 2D.

sols2 = NDSolve[{D[u[x, y, t], {t, 2}] == 
    0.1 (D[u[x, y, t], {x, 2}] + D[u[x, y, t], {y, 2}]), 
   u[x, y, 0] == Sin[2 Pi *(x + y)/5.], 
   D[u[x, y, t], t] == 0 /. t -> 0., u[0, y, t] == u[5, y, t], 
   u[x, 0, t] == u[x, 5, t]}, u, {x, 0, 5}, {y, 0, 5}, {t, 0, 30}]

Then you can run

frames = Table[
  Plot3D[u[x, y, t] /. sols2, {x, 0, 5}, {y, 0, 5}, 
   PlotRange -> {All, All, {-1, 1}}], {t, 0, 20, 0.5}]

and use

ListAnimate[frames]

to produce this animation

enter image description here

Cheers,

Marco

POSTED BY: Marco Thiel

Hi,

not sure whether this is what you want but on the excellent documentation for NDSolve under "Details" you can see from point number 12 how it is done:

http://reference.wolfram.com/language/ref/NDSolve.html

My 1 dimensional (in space) attempt looks like this:

sols = NDSolve[{D[u[x, t], {t, 2}] == 0.1 D[u[x, t], {x, 2}], 
   u[x, 0] == Sin[2 Pi *x/5.], D[u[x, t], t] == 0 /. t -> 0., 
   u[0, t] == u[5, t]}, u[x, t], {x, 0, 5}, {t, 0, 30}]

and then

Plot3D[u[x, t] /. sols, {x, 0, 5}, {t, 0, 30}, PlotRange -> All]

which gives

enter image description here

Cheers, M.

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

Group Abstract Group Abstract