Register to reply 
Derivative discretization with fixed boundary condition 
Share this thread: 
#1
Sep2313, 08:31 AM

P: 11

Hi all,
It may be a trivial question. But, if I have a PDE of variable u(x,t)  [itex]\dot{u} = f(u,\partial_x{u},..)[/itex] with boundary condition : [itex]u(0,t) = u(L,t) =0.[/itex]  Now I need to calculate [itex]\partial_x{u}[/itex] for that can I define the discretisation differently only on the boundary (forward / backward)? And inside the domain(1D) I am using central difference for the perpose. Does doing this introduce any inconsistencies in the process? Or if there is any other standard method of doing this... please let me know. Regards. 


#2
Sep2313, 12:35 PM

Engineering
Sci Advisor
HW Helper
Thanks
P: 7,285

See here for better ways to do it: http://www.scientificpython.net/1/po...rentways.html (these should be in any good book on FD methods). 


#3
Sep2313, 08:43 PM

Mentor
P: 5,388

One way of doing this is to use a fictitious point at L + Δx in the discretized central difference version of the partial derivative of u with respect to x in the boundary condition. You then substitute this discretized relationship involving the fictitious point into your discretized PDE. This preserves the second order accuracy at the boundary.



#4
Sep2413, 04:32 AM

P: 11

Derivative discretization with fixed boundary condition
@ AlephZero >>
Thanks for the reference. I will describe a bit what I did for the completeness of the thread and also to clear misconceptions if I have got any in this regard. To calculate [itex]\partial_x{u} [/itex] at boundaries I use >>  [itex]\partial_x{u} = \frac{u(x+2h)+4u(x+h)3u(x)}{2h} + O(h^2) [/itex] at x=0 and [itex]\partial_x{u} = \frac{3u(x)4u(xh)+u(x2h)}{2h} + O(h^2) [/itex] at x=L and [itex]\partial_x{u} = \frac{u(x+h)u(xh)}{2h} + O(h^2) [/itex] for all 0<x<L  So all the discretization schemes are now second order accurate. @Chestermiller >> The 'ghost' points you refer to is useful if I have a condition like >> [itex]\partial_x{u} =0 [/itex]. But for the mentioned case its not clear to me what values I should take at the ghost points? because I don't have any condition on boundary value of the derivative. So I think using second order forward and backward FD at the boundaries with first order central FD inside is appropriate. Please let me know if I am missing something. Regards, Deb. 


#5
Sep2413, 06:30 AM

Mentor
P: 5,388




#6
Sep2413, 07:07 AM

P: 11

Regards. 


#7
Sep2413, 07:36 AM

Mentor
P: 5,388

Chet 


#8
Sep2413, 07:59 AM

P: 11

Also there is another small confusion..
say I have an eq like this >>  [itex]\dot{u} = \partial_x{f(\partial_x{u})} [/itex] and if my BC now is >> [itex]\partial_x{u} = 0[/itex] at both ends for all time.  Now I will use the 'ghost point' method to calculate du/dx at the ends. I will just make(in case i use central FD) >>  u(1)=u(1) and u(n1) = u(n+1) this will give me du/dx =0 on boundary(i.e. for u(0) and u(n)) all the time. But when I again calculate df/dx I will use the previously discussed method >> at boundaries. Am I right? 


#9
Sep2413, 11:36 AM

Mentor
P: 5,388

Chet 


#10
Sep2413, 12:11 PM

P: 11

@ Chestermiller
I will get back to this tomorrow, I got what you said... actually you are right I also have df/dx values at boundary....as I have du/dx. I will explain in details my equations and what I am getting. goodbye till then. 


#11
Sep2413, 03:15 PM

Engineering
Sci Advisor
HW Helper
Thanks
P: 7,285

You can write two equations that include the "ghost point". One is the finite difference approximation to your PDE at the boundary point. The other is the finite difference approximation for the derivative at the boundary. Then, you can eliminate the ghost point from those two equations algebraically, or you can solve the problem numerically including both the ghost points and the extra equations. That is the third method in the link I gave. It may or may not give "better answers" than the second method  it depends on the particular equation and boundary conditions. (The link seems to say the third method will always give better answers than the second  but I'm not convinced about that). 


Register to reply 
Related Discussions  
What does this boundary condition mean?  Classical Physics  4  
Types of boundary condition  Differential Equations  0  
Boundary Condition  Calculus & Beyond Homework  7  
Boundary conditions for wave fixed at one end  Advanced Physics Homework  1  
SHO with a fixed boundary  Advanced Physics Homework  1 