Derivative discretization with fixed boundary condition

In summary, the conversation discusses different methods for calculating the derivative of a variable in a PDE with boundary conditions. The use of ghost points and different discretization schemes are explored, with the conclusion that using one-sided difference formulas can provide second-order accuracy at the boundary. The issue of calculating df/dx at the boundary is also addressed.
  • #1
debsankar
11
0
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.
 
Physics news on Phys.org
  • #2
debsankar said:
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.

Yes, that's a basic problem with finite difference methods.

Does doing this introduce any inconsistencies in the process?

The difference estimates of the derivative at the interior points are second-order accurate. If you take a forwards or backwards difference using two grid points at the boundary, that is only first order accurate.

See here for better ways to do it: http://www.scientificpython.net/1/p...-finite-differences-three-different-ways.html (these should be in any good book on FD methods).
 
  • Like
Likes 1 person
  • #3
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.
 
  • Like
Likes 1 person
  • #4
@ 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(x-h)+u(x-2h)}{2h} + O(h^2) [/itex] at x=L
and
[itex]\partial_x{u} = \frac{u(x+h)-u(x-h)}{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
debsankar said:
@ 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(x-h)+u(x-2h)}{2h} + O(h^2) [/itex] at x=L
and
[itex]\partial_x{u} = \frac{u(x+h)-u(x-h)}{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.
To answer this question, I need to know more about the boundary conditions at the two ends. What are the boundary conditions in your particular problem?
 
  • #6
--------------------------------
du/dt=f(u,du/dx,..)
with boundary condition :
u(0,t)=u(L,t)=0.
--------------------------------
This is the problem the thread started with.


Regards.
 
  • #7
debsankar said:
This is the problem the thread started with.


Regards.

I'm sorry. I didn't read your original post carefully enough. I totally agree with what AlephZero said regarding using one sided difference formulas to get the normal derivative to second order accuracy.

Chet
 
  • Like
Likes 1 person
  • #8
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(n-1) = 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 >>
@ 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 ∂xu at boundaries I use >>
[itex]

\partial_x{u}=[−u(x+2h)+4u(x+h)−3u(x)]/2h +O(h^2) at x=0 \\
and \\
\partial_x{u}=[3u(x)−4u(x−h)+u(x−2h)]/2h +O(h^2) at x=L \\
and \\
\partial_x{u}=[u(x+h)−u(x−h)]/2h +O(h^2) for all 0<x<L \\

[/itex]
So all the discretization schemes are now second order accurate.
because, I cannot use ghost points for 'f' as I do not have the information of df/dx
at boundaries. Am I right?
 
  • #9
debsankar said:
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(n-1) = 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 >>

because, I cannot use ghost points for 'f' as I do not have the information of df/dx
at boundaries. Am I right?

If you are specifying df/dx at the boundary, then you know df/dx. But please do me a favor. Write out your DF approximation to the rhs of your pde above for point n, taking into account the zero flux boundary condition.

Chet
 
  • #10
@ 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
debsankar said:
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(n-1) = u(n+1)

You don't need to make that assumption.

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).
 

What is meant by "derivative discretization"?

Derivative discretization refers to the process of approximating the derivative of a continuous function at a set of discrete points. This is often done in numerical methods for solving differential equations or optimization problems.

What are fixed boundary conditions and how are they incorporated into derivative discretization?

Fixed boundary conditions are constraints that dictate the behavior of the function at the boundaries of the domain. These conditions are typically specified as fixed values or derivatives at the boundary points, and are incorporated into derivative discretization by using specific boundary approximation methods.

What are the advantages of using fixed boundary conditions in derivative discretization?

Fixed boundary conditions provide more accurate solutions in cases where the function has known behavior at the boundaries. They also allow for a more stable and efficient numerical solution process, as they help to reduce oscillations and errors at the boundaries.

What are some common techniques for incorporating fixed boundary conditions in derivative discretization?

Some common techniques for incorporating fixed boundary conditions include the use of ghost points, which are artificial points added to the boundary to enforce the constraints, and the method of manufactured solutions, which involves choosing a solution that satisfies the boundary conditions and using it to generate a consistent discretization scheme.

How do fixed boundary conditions affect the accuracy and convergence of derivative discretization methods?

The accuracy and convergence of derivative discretization methods can be greatly affected by the choice and implementation of fixed boundary conditions. If the boundary conditions are not properly incorporated, the solutions may be inaccurate or may not converge to the correct solution. Therefore, careful consideration must be given to the choice and implementation of boundary conditions in order to ensure accurate and efficient solutions.

Similar threads

Replies
17
Views
2K
  • Calculus and Beyond Homework Help
Replies
5
Views
262
Replies
4
Views
1K
Replies
1
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
8
Views
3K
Replies
4
Views
748
  • Differential Equations
Replies
6
Views
2K
  • Introductory Physics Homework Help
Replies
8
Views
1K
  • Advanced Physics Homework Help
Replies
5
Views
1K
Back
Top