2

The 1D wave equation is $$\frac{\partial^2 u(x,t)}{\partial t^2} = c^2 \frac{\partial^2 u(x,t)}{\partial x^2}$$ where $c$ is the wave speed, $c^2=E/\rho$, $E$ is the Young's modulus and $\rho$ is the density of the material. See the link. I want to analyze the physics in this video of longitudinal wave. When a mass impacts one end of a long rod with the material properties of $E$ and $\rho$ at $x=0$, longitudinal waves will be generated. Please note the $\textbf{initial conditions}$: $$v(x,t)=\dot{u}(x,t)=0$$ $$u(x,0)=0$$ where $v(x,t)$ represents the particle velocity in the medium. The $u(x,t)$ should be zero at time $t=0$.

Note that for any given time $0<t_1< L/c$, the longitudinal waves will travel to $$x_1=c\cdot t_1$$ For $x\geq x_1$, it is required that $$v(x,t_1)=0$$ $$u(x,t_1)=0$$ The waves will travel through the rod to the other end. Assume the length of the rod is $L$. The wave speed is $c$. At time $t=L/c$ the waves will reach $x=L$. Depending on the conditions and the other end, the waves can change and then be reflected.

  1. Free end condition. That is to say, there is nothing in contact with the other end (That is $x=L$). The particle in the medium can move in the free end. What will happen when the wave reaches there?
  2. Fixed end condition. In this condition, the particles in the medium at the fixed end cannot move. The particle velocity in the fixed end is strictly zero when the waves travel $x=L$. What will happen in the fixed end?

How should I analyze the two case scenarios for the 1D wave equation in Mathematica? I want to see how $u(x,t)$ will vary over $t$ and $x$.

Thank you very much!

Edited on 10/07/2022: Using the solution from Ulrich Neumann, the following animation presents the results.I have a question. Why will the $u(x,t)$ increase over time? I did not expect that.

Solution by Ulrich

fhk
  • 95
  • 5
  • I'm afraid your b.c. at $x=0$ isn't a proper modeling for the scene in the video, see this post for more info: https://mathematica.stackexchange.com/a/71945/1871 Something like $u(0,t)=\sin ^{30}(t)$ (this is just an example) may be a better choice. – xzczd Oct 06 '22 at 03:59
  • Have a look here for various boundary conditions and examples for the wave equation – user21 Oct 06 '22 at 04:01
  • You significantly changed your question without notification! My answer still describes the wave for the original problem u[0,t]==0, Derivative[0,1][u][x,t]==0 and impact at x==0! – Ulrich Neumann Oct 07 '22 at 06:44
  • @UlrichNeumann Thanks for your help. Is you current solution applicable for the free end condition? What will be appropriate boundary condition for fixed end condition? – fhk Oct 07 '22 at 14:29
  • @fhk Yes it is with free end condition. Inside NDSolveValu[...] you'll find the condition (*u[t,1]\[Equal]0,*) for fixed end. Remove comment and you get solution for fixed end. – Ulrich Neumann Oct 07 '22 at 14:42
  • @fhk With free end condition the impact must lead to a movement! – Ulrich Neumann Oct 07 '22 at 15:05

2 Answers2

1

If I understand your question right, you are considering a rod, with an

impact Derivative[0,1][u][t,0]==DiracDelte[t] at x==0

and

boundary condition u[t,1]==0 or Derivative[0,1][u][t,1]==0 at x==1!

Analytical solution might be described using GreenFunction , unfortunately Mathematica doesn't solve.

Remains the numerical solution:

The impact should be modelled by a numerical approximation UnitTriangle[t/(eps/2) - 1] (2/eps),eps<<1 of the DiracDelta -function. Additionally I introduced a small damping to smooth simulation results.

For the free end condition Derivative[ 0, 1][u][t, 1]==0 try

eps = 1/10 ;
U = NDSolveValue[{Derivative[2, 0][u][t, x] -Derivative[ 0, 2][u][t, x] + 2 /100 Derivative[1, 0][u][t, x] == 
UnitTriangle[t/(eps/2) - 1] 2/eps NeumannValue[1, x ==0],(*u[t,1]\[Equal]0,*)Derivative[1, 0][u][0, x] == 0, u[0, x] == 0}, 
u, {t, 0, 5}, {x, 0, 1}   , 
Method -> {"MethodOfLines", "TemporalVariable" -> t,"SpatialDiscretization" -> {"FiniteElement" ,"MeshOptions"-> { "MaxCellMeasure" -> 1/50} }}  , MaxStepSize -> eps/10]

Plot3D[Evaluate[ U[t, x]], {x, 0, 1}, {t, 0, 5} , PlotPoints ->100,MeshFunctions -> {#2 &}, PlotRange -> All]

enter image description here

Plot shows the waves for differnt times and also the global movement of the free rod !

Add u[t,1]==0 for the second end condition.

addendum fixed end

eps = 1/10 ; tsim = 5;
Uf = NDSolveValue[{Derivative[2, 0][u][t, x] - 
     Derivative[ 0, 2][u][t, x] + 
     2  10^-2 Derivative[1, 0][u][t, x] == 
    UnitTriangle[t/(eps/2) - 1] 2/eps NeumannValue[1, x == 0],  
   u[t, 1] == 0,   
    Derivative[1, 0][u][0, x] == 0, u[0, x] == 0}, 
  u, {t, 0, tsim}, {x, 0, 1}   , 
  Method -> {"MethodOfLines", "TemporalVariable" -> t, 
    "SpatialDiscretization" -> {"FiniteElement" , 
      "MeshOptions" -> { "MaxCellMeasure" -> 1/50} }}  , 
  MaxStepSize -> eps/10]

list = Table[Plot[Uf[t, x], {x, 0, 1}, PlotRange -> {-1, 1}], {t,Subdivide[0, tsim, 100]}]; ListAnimate[list]

enter image description here

Ulrich Neumann
  • 53,729
  • 2
  • 23
  • 55
  • Excellent! Can you explain the coefficients in the PDE? In NDSolveValue[], you define the PDE. 1. What does "2/100" mean in the PDE? 2. If I want to specify an initial particle velocity at x==0, how should I do? 3. Why does we still need some coefficient in the right hand side of the PDE? – fhk Oct 07 '22 at 16:46
  • @fhk Righthandside describes the impact and 2 /100 Derivative[1, 0][u][t, x] is a small damping – Ulrich Neumann Oct 07 '22 at 18:36
  • @fhk You need to know velocity and mass of the particle – Ulrich Neumann Oct 07 '22 at 18:37
  • The boundary condition for free end $u_x(t,x)=0$ was not enforced at $x=1$. I do not see '''Derivative[0,1][u][t,1]==0 at x==1!''' in your code. It still produces the results. – fhk Oct 08 '22 at 02:39
  • @fhk Condition for free end is implicitly included in the first part of my answer. You could add an additional NeumannValue[0, x ==1] – Ulrich Neumann Oct 08 '22 at 09:06
  • On the RHS of PDE, you use Neumann B.C. to define the impulse. The Neumann B.C. is essentially $u_x(t,x)$. 1. How is Neumann B.C related to a given velocity $v_0$ or a given force $f$ at $x=0$? 2. Can you provide a reference about the B.C. or I.C. for wave equation? I would like to learn more about it. Thanks a lot for your help! – fhk Oct 08 '22 at 18:58
  • What is the advantage of introducing a damping component in the system? – fhk Oct 08 '22 at 19:07
  • One more question: After $U(t,x)$ is obtained, how can I evaluate the time derivative to get $U_t(t,x)$? Thanks. – fhk Oct 09 '22 at 03:59
  • Derivative[1,0][U][t,x] – Ulrich Neumann Oct 09 '22 at 08:15
  • Thanks for your help. How can I input a initial velocity $v_0$ at $x=0$ as one of the initial conditions? – fhk Oct 09 '22 at 14:53
  • @fhk The initial velocity depends on the size of factor of UnitTriangle[t/(eps/2) - 1] 2/eps. Actual setting 1 leads to a velocity 1 of the rod. Probably the factor equals v0! – Ulrich Neumann Oct 09 '22 at 16:58
1

This is an incorrect solution for the fixed end condition where $u(L,t)=0$:

define some parameters:

c = 500;
L = 5;
t0 = 0.1;
U = NDSolveValue[{
   D[u[t, x], {t, 2}] == c^2 D[u[t, x], {x, 2}],
   u[0, x] == 0,
   u[t, 0] == Sin[80 \[Pi] t],
   u[t, L] == 0},
  u, {t, 0, t0}, {x, 0, L}]

Show the results:

list = Table[
   Plot[U[t, x], {x, 0, L}, PlotRange -> {-1, 1}], {t, 0, t0, 0.003}];
ListAnimate[list]

enter image description here

fhk
  • 95
  • 5
  • An impact at x==0&&t==0 causes a wave, starting from x==0 and travelling in positive x-direction. Your "solution" doesn't show this effect! – Ulrich Neumann Oct 07 '22 at 07:11
  • I agree well. Please propose some initial conditions or boundary conditions. How should we fix this problem? – fhk Oct 07 '22 at 13:45
  • See my answer including the Boundaryconditions and NeumannValue ! – Ulrich Neumann Oct 07 '22 at 14:13
  • As it’s currently written, your answer is unclear. Please [edit] to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers in the help center. – Community Oct 08 '22 at 02:56