Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Finite Difference Question

  1. Aug 25, 2015 #1


    User Avatar
    Gold Member

    Hi PF!

    I was wondering if anyone could help me with a finite difference question? The problem I am doing is a 1-D space and time problem, so ##z## (space variable, from left to right) and ##t## (time) are my independent variables and my dependent variable is ##h##, the height, governed by a PDE I don't think we need to get into. There is a moving boundary at both ends of ##z##, however.

    My question is, in writing a code I am doing a central finite difference scheme for all interior nodes and then for the node on the far left I am taking a forward difference and for the node are the far right I am taking a backward difference in order to evaluate these endpoints.

    Is this a legitimate approach or is there something I am missing?

    Thanks so much for your input!

  2. jcsd
  3. Aug 26, 2015 #2
    What is your boundary condition? You could extend your grid by adding an aditional fictitious point at each end and by imposing the boundary condition in terms of central finite differences you get the condition for the actual end points.
  4. Aug 26, 2015 #3


    User Avatar
    Gold Member

    The boundary conditions are the right tip is zero and the left is 1. I believe I understand what you're proposing; not a bad idea.

    Is there anything wrong with the technique I have used though? For some reason my code isn't working and I'm troubleshooting it. I can give this technique a try, though, but is there something wrong that you can see from what I've explained?
  5. Aug 26, 2015 #4
    The method you described should work, I have no experience with moving boundary conditions. To maintain the accuracy probably one uses a different stencil at the boundary. This modifies the symmetry of the matrix and in case of a dedicated matrix solver you can get into trouble. You can reduce the accurary at the boundary by using a first order stencil which preserve the symmetry of the matrix.

    Can you write here the equation which you try to solve?
  6. Aug 26, 2015 #5
    The "zero boundary condition" means ##f(z_b)=0## or ##f(z_b)\rightarrow 0## at boundary ##z_b##?
    Last edited: Aug 26, 2015
  7. Aug 26, 2015 #6


    User Avatar
    Gold Member

    The equation is $$h_t = h_{zz} \cdot h + 2 (h_z)^2$$. There is an integral constraint that dictates the position of the left tip, and a linear solution in time and space solves this PDE, which implies the right tip is linear; thus I linearly extrapolate to find it.
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Similar Threads - Finite Difference Question Date
A Runge Kutta finite difference of differential equations Monday at 6:31 PM
A Convergence order of central finite difference scheme Nov 8, 2017
A Finite Difference Oct 30, 2017
A Better way to find Finite Difference Oct 16, 2017