Skip to main content
34 events
when toggle format what by license comment
S Mar 20 at 23:05 history bounty ended CommunityBot
S Mar 20 at 23:05 history notice removed CommunityBot
Mar 18 at 21:52 vote accept FriendlyNeighborhoodEngineer
Mar 18 at 21:52 comment added FriendlyNeighborhoodEngineer Sorry, I made a mistake and you are correct. The spatial step really is 0.002. Dont know how I got the 0.0017. I also agree with your answer. There is simply a big difference between a nonsmooth continuous functioan and a discontinuous one. Im glad the FDM can also be used for nonsmooth functions sometimes. Thank you for your time and effort!
Mar 18 at 20:39 comment added Rigel @NikolaRistic are you sure about those numbers? Apologies if I ask again, I'm telling you why I doubt. In your previous post, the first plot should have $\Delta x = 1/500 \neq 0.0017$. Also, it looking at the plot, it seems that the second one has much denser x points. My hypothesis is that you increased the x points in the second plot ant kept the same $\Delta t$. If this is correct, then I believe I found another issue in your previous post. But we can have a separate chat about that, in case you are still interested in that question.
Mar 18 at 20:27 answer added Rigel timeline score: 3
Mar 18 at 19:17 comment added whpowell96 This may be one of those scenarios where the dispersion term in the finite difference error term cancels out if $\frac{\Delta t}{\Delta x}=1$ and we get higher order convergence than expected
Mar 18 at 18:12 history edited FriendlyNeighborhoodEngineer CC BY-SA 4.0
added 511 characters in body
Mar 18 at 17:57 comment added FriendlyNeighborhoodEngineer In the previous question, $t_{max}$ was $2.5$ and $x_{max}$ was $1$. Also, $nt$ was $1250$ and $nx$ was $500$. So $\Delta t$ was $0.0020$ and so was $\Delta x$. This is for the second set of plots. For the first set of plots, $\Delta t$ was $9.6154e-04$ and $\Delta x$ was $0.0017$. Here $v_0$ is $0.5$. However, I doubt that the value of $v_0$ is important because the wave function can be divided with it to get almost the same set of equations. The difference is the new function would be equal to $1$ at $x=0, t=0$. I will add the plot :D
Mar 18 at 8:36 comment added Rigel Sorry, I was watching again your previous post and I am not fully convinced anymore by the explanation I was giving in the previous comments. Do you remember what $\Delta$ t you used in the second set of plots in scicomp.stackexchange.com/questions/43433/… ? (in the first set it was approx 1/1000, right?). Also, what is the value of $v_0$ here? Lastly, can you also add the plot of the difference between the numerical and analytical solution? This would allow better assess what kind of numerical errors you have here. Thanks!
Mar 16 at 3:48 comment added timur I don't think the decay rate of Fourier modes is enough to explain this dramatic difference. As Rigel pointed out, the other problem has $1/k$ decay, whereas here we have $1/k^2$.
Mar 15 at 21:43 comment added FriendlyNeighborhoodEngineer I actually never did a Fourier transformation of a function with two variables. I need to check first how to do it. However, I am guessing it is just taking the Fourier transform with respect to one variable and then once more with respect to the second variable. Hopefully, then I just need to do a surface plot of circular frequency and wave numbers with respect to the magnitude of the resultant complex function. Once I do it, I will write it in the answer. Though, if you manage also to do it and write it in the answer, I would gladly accept it.
Mar 15 at 19:07 comment added Rigel Indeed, let's take a triangle wave as a representative of a non smooth, yet continuous, function. The amplitude of its components drops proportionally to the inverse of the square of the frequency. Instead, taking a square wave as representative of a discontinuous function, you'll notice that the amplitude of the components drops as the inverse of the frequency (i.e. significantly slower than the triangle wave components).
Mar 15 at 18:23 comment added Rigel Did you consieder doing a fourier analysis on your solution? Based on the accepted answer to the previous question you linked, I would guess the reason is that you have a significantly lower amount of energy in the high frequency components of your solution, this time. This would explain why you don't see oscillations, despite your FD scheme is dispersive. If I find some time I'll write down a complete answer to this post.
Mar 14 at 9:46 history edited FriendlyNeighborhoodEngineer CC BY-SA 4.0
deleted 3 characters in body
Mar 14 at 8:49 comment added FriendlyNeighborhoodEngineer @timur Ofcourse. I calculated the ghost node the following way. From $(5)$ I first I wrote $$mu_{xx}+u_x = m(U_{i,j+1} + U_{i,j-1} - 2 U_{i,j})/ \Delta x^2 + (U_{i,j+1} - U_{i,j-1}) / (2 \Delta x)=0 \ (\mathrm{Eq} \ 1)$$. The ghost node is $g=U_{i,j-1}$, where the index $j$ is equal to one since Matlab indexing starts from one. From $(\mathrm{Eq}\ 1)$ I simply wrote $U_{i,j-1}$ in terms of $U_{i,j}$ and $U_{i,j+1}$ and that's how I implemented the boundary condition $(5)$.
Mar 13 at 22:49 comment added timur @NikolaRistic: Thanks! Can you please explain how you implemented the boundary condition (5) numerically?
Mar 13 at 21:30 history edited FriendlyNeighborhoodEngineer CC BY-SA 4.0
added 38 characters in body
Mar 13 at 18:57 history edited FriendlyNeighborhoodEngineer CC BY-SA 4.0
added 1197 characters in body
Mar 13 at 18:54 comment added FriendlyNeighborhoodEngineer @timur It just seems like that, but it really is exponential. I posted a snippet showing that I really do calculate the function using exponentials.
Mar 13 at 18:53 comment added FriendlyNeighborhoodEngineer @ConvexHull Thank you for the good suggestion. It did give an interesting result. I posted it in the edit of my question.
Mar 13 at 18:49 history edited FriendlyNeighborhoodEngineer CC BY-SA 4.0
added 2616 characters in body
Mar 13 at 17:12 comment added timur Your exact solution is exponential, but the plots look like (piecewise) linear in x?
Mar 13 at 9:03 comment added ConvexHull @NikolaRistic I think you should visualize the derivative of your solution. In particular, it is consistent with your claim of using discontinuous initial conditions. Otherwise you would compare apples with oranges.
S Mar 12 at 21:12 history bounty started FriendlyNeighborhoodEngineer
S Mar 12 at 21:12 history notice added FriendlyNeighborhoodEngineer Draw attention
Mar 12 at 21:10 comment added FriendlyNeighborhoodEngineer I think you mean the $L_2$ norm, right? The energy-summation by parts can tell me the stability condition, but I am not sure how it can show me that there will be no dispersion. If you actually do mean the infinity norm, I do not know how can I do that (or how it would help me understand this phenomenon). Can you elaborate please?
Mar 12 at 14:57 comment added Dan Doe Did you check convergence, i.e., the error in infinity norm when increasing spatial resolution / drecrease time step? Does that match your expectations?
Mar 12 at 11:39 comment added FriendlyNeighborhoodEngineer Checked it. Indeed, plotting numerical and analytical solution.
Mar 12 at 11:20 comment added NNN Having made more than my fair share of mistakes, could you check if you are indeed plotting the numerical and analytical solution? Or perhaps, are you plotting the analytical solution twice?
Mar 10 at 23:41 comment added FriendlyNeighborhoodEngineer I edited my answer. It was the 5-point central difference stencil. Also, I agree with you on the derivative part. However, if $u_t$ is discontinuous, then also $u_{tt}$ and $u_{xx}$ should be discontinuous. I know I am integrating twice in time, but I am also differentiating twice in space which I am not sure why gives a good result. I don't know why differentiating twice in space doesn't produce a problem.
Mar 10 at 23:37 history edited FriendlyNeighborhoodEngineer CC BY-SA 4.0
added 238 characters in body
Mar 10 at 21:36 comment added Daniel Shapero You haven't said what numerical scheme you used and that could make a huge difference. To address at least one part of your question, there's a big difference between having a 0th-order and 1st-order time derivative being discontinuous.
Mar 10 at 17:36 history asked FriendlyNeighborhoodEngineer CC BY-SA 4.0