Computational Science Asked on July 25, 2021
I am trying to understand the FDM which is a widely used method solving differential equations by using approximation below.
$$dfrac{partial u}{partial x}=dfrac{u(i+1)-u(i-1)}{2Delta x}$$
How can I apply the approximation the equation given below?
$$dfrac{d}{dx}(z(x)dfrac{d}{dx}u(x))=0$$ where $u(0)=a$ and $u(1)=b$
and $z(x)=1 $ for $0<x<0.5$, $z(x)=2 $ for $0.5<x<1$
So, after some derivation the equation becomes,
$$dfrac{z(i+1)-z(i-1)}{2Delta x}dfrac{u(i+1)-u(i-1)}{2Delta x}+z(i)dfrac{u(i+1)-2u(i)+u(i-1)}{2Delta x}=0$$
How can I handle the discontinuity at 0.5?
You're approaching this the wrong way by using the product rule of differentiation. Rather, making use of the fact that $$ frac{partial u(x_i)}{partial x} approx frac{u_{i+1/2}-u_{i-1/2}}{Delta x}, $$ the first step in finding what you need to do is to recognize that $$ z(x_i)frac{partial u(x_i)}{partial x} approx z_i frac{u_{i+1/2}-u_{i-1/2}}{Delta x} = frac{z_i u_{i+1/2}-z_i u_{i-1/2}}{Delta x}. $$
The second step is the applying the finite difference operation one more time: $$ frac{partial}{partial x} left[z(x_i)frac{partial u(x_i)}{partial x} right] approx frac{frac{z_{i+1/2} u_{i+ 1}-z_{i+1/2} u_{i}}{Delta x} - frac{z_{i-1/2} u_{i}-z_{i-1/2} u_{i-1}}{Delta x}}{Delta x}. $$ This can be simplified to the following, more familiar form: $$ frac{partial}{partial x} left[z(x_i)frac{partial u(x_i)}{partial x} right] approx frac{z_{i+1/2} u_{i+ 1}-(z_{i+1/2} +z_{i-1/2}) u_{i} + z_{i-1/2} u_{i-1}}{Delta x^2}. $$
Correct answer by Wolfgang Bangerth on July 25, 2021
There's a really nice book by Li and Ito on the immersed interface method, which was designed to solve problems like yours. Chapter 2 describes 1D problems. Basically, the finite difference method works well when the coefficients are smooth, but when they're rapidly varying or have discontinuities things can go to hell very quickly. You can make it work by being very careful to put nodes right at the interface and making special choices in your finite difference stencils.
Answered by Daniel Shapero on July 25, 2021
Get help from others!
Recent Answers
Recent Questions
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP