Questions tagged [finite-difference]

Referring to the discretization of derivatives by Finite differences, and its applications to numerical solutions of partial differential equations.

Filter by
Sorted by
Tagged with
7
votes
1answer
729 views

Finite difference recursion and higher order

This may be a trivial question, but I've always wondered... For the classical, central finite difference schemes, if I'm interested in determining the second derivative, does applying the first ...
7
votes
2answers
7k views

2nd order centered finite-difference approximation of $u_{xy}$

The problem is to find a 2nd order finite difference approximation of the partial derivative uxy, where u is a function of x and y. Page 5 of this pdf I found does a centered difference approximation ...
7
votes
1answer
646 views

Conservative finite-difference expression for the advection equation

Following on from the earlier question I am trying to derive a finite-difference scheme for the advection equation which is conservative. It was suggested that for advection equation with variable ...
7
votes
1answer
450 views

CFL condition in polar coordinates

In this question, I suggested that the Couran-Friedrichs-Lewy (CFL) condition for the wave equation in polar coordinates reads $$C = 2c\frac{\Delta t}{\Delta r \Delta \phi} \leq C_\max \enspace ,$$ ...
7
votes
1answer
226 views

How do I analyze the error for the Crank-Nicolson method on a parabolic PDE?

I would like to do the analysis for the Crank-Nicolson method on a non-uniform grid for the parabolic equation with variable coefficients. I was able to prove everything for a uniform grid by energy ...
7
votes
1answer
150 views

Which finite difference better approximates $uu'$?

I want to approximate $uu'$ with a finite difference. On the one hand, it seems to be $$(uu')_i=u_i\frac{u_{i+1}-u_{i-1}}{2\Delta t}=\frac{u_iu_{i+1}-u_iu_{i-1}}{2\Delta t}$$ On the other hand, $$(uu')...
7
votes
1answer
269 views

Implementation of convection scheme given by normalized variable diagram

In finite difference and finite volume methods, convection schemes (upwind, central, quick, ...) are usually shown in a normalized variable diagram. The diagram gives the normalized face variable as a ...
7
votes
1answer
1k views

FDTD Poynting Vector

I'm attempting to validate my FDTD code against Meep by calculating the Poynting vector field across a simulation consisting of a monochromatic point source within a box (no boundary conditions (...
7
votes
1answer
214 views

Compressible flow through a porous medium with a variable inlet concentration

I'm trying to solve the transient behaviour of a compressible flow through a porous medium (porosity is $\epsilon$) where the fraction of B in A ($ \phi$) changes with time. The equations that I found ...
6
votes
3answers
807 views

Why is my second order accurate method only converging at first order when the coefficients are rough?

I have a method that is supposed to be second order accurate based on asymptotic analysis/Taylor series expansion which assumes that the solution is smooth. I am solving a PDE which has very rough ...
6
votes
2answers
501 views

What heuristics can be used to minimize the asymptotic matrix bandwidth of a 5-point Laplacian discretization?

I can see that there are multiple heuristics to achieve a matrix with minimum bandwidth. As heuristics, they can't guarantee an optimal solution in polynomial time (after all, the problem is NP-...
6
votes
3answers
369 views

ODE $x''(t)+\eta x'(t)+x(t)=0$ with the $\eta$ extremely small

I want to numerically solve the damped oscillator equation $$\frac{d^2x}{dt^2}+\eta\frac{dx}{dt}+x=0 .$$ Usually it's very easy to solve this kind of ODE analytically and numerically. But now the ...
6
votes
2answers
421 views

How can I reduce the communication bottleneck of a parallel explicit finite difference scheme?

Suppose i was trying to solve a parabolic PDE (heat equation) on a rectangular domain using an explicit finite difference scheme. I am storing my solution vector in a matrix form (because it closely ...
6
votes
4answers
2k views

how to test convergence of the solution vector

I am using some finite difference algorithm to solve the problem of a parabolic equation. Reading the Leveque's book on finite differences he suggests to test convergence of the method by considering ...
6
votes
1answer
888 views

Stability analysis of Heun's method

I am using Heun's method with a third order upwind spatial scheme, which is suggested by Shao (2008) to be used for solving the horizontal advection part of the advection-diffusion equation. This is ...
6
votes
3answers
3k views

Open boundary conditions with the advection-diffusion equation

Following on from my previous equation I'm would like to apply open boundary condition to the advection-diffusion equation (with reaction term), $$ \frac{\partial \phi}{\partial t} = \frac{\partial}{\...
6
votes
4answers
575 views

Why do I still obtain a unique solution with one-sided formula when b.c. isn't enough?

Let me illustrate the issue with an simplified example. Suppose we want to solve the following problem with finite difference method (FDM): $$\frac{\partial u(t,x)}{\partial t}=\frac{\partial^2 u(t,x)...
6
votes
2answers
5k views

How can I prove numerical diffusion in upwind scheme for transport equation

I was just implementing the upwind scheme for a linear transport equation $u_t + cu_x = 0$ where $c=0.5$ and I saw that the solution was indeed advected but over time it starts to diffuse. Can anyone ...
6
votes
2answers
220 views

Why naively chopped finite difference matrix works for different ODE boundary conditions

We know finite difference method (FDM) can replace $y''(x)$ as $\frac{1}{h^2}[y(x+h)+y(x-h)-2y(x)]$ or so. One naive way to write down the matrix of the differential operator is like the following, ...
6
votes
1answer
366 views

Gaussian Numerical Differentiation

Gaussian quadrature improves on Newton-Cotes formulas by allowing the abscissas to vary along with the weights in order to integrate higher order polynomials. Can this idea be extended to numerical ...
6
votes
1answer
200 views

Fourier characteristics of repeated numerical derivative

Background I am trying to analyse fourier characteristics of a derivative. For example if I have a first order derivative approximated as following: $$\frac{\partial \Psi(x)}{\partial x} = \frac{\...
6
votes
1answer
377 views

Error implementing Robin boundary conditions in toy ODE problem

I am attempting to solve the following ODE problem: $$-u''+ u = x$$ $$u(0) = 0$$ $$u'(1) = -u(1)$$ The exact solution is: $u(x) = e^{-x-1} - e^{x-1} + x$ I have a Dirichlet at $x = 0$ and a Robin ...
6
votes
1answer
4k views

Poisson equation with Neumann boundary conditions

I'm trying to solve the Poisson equation with pure Neumann boundary conditions, $$ \nabla^2\phi = \rho \quad in \quad \Omega\\ \mathbf{\nabla}\phi \cdot \mathbf{n} = 0 \quad on \quad \partial \Omega $$...
6
votes
1answer
2k views

Trouble implementing Neumann boundary conditions because the ghost points cannot be eliminated

Neumann boundary conditions are implemented by introducing ghost points outside the domain and then using the boundary conditions to eliminate the ghost points. For example, see this question. I ...
6
votes
1answer
207 views

Does mean removal increase accuracy of numerical differentiation?

I wish to compute the derivative of a vector through numerical differentiation. Let's say, we use a standard 2nd order central difference scheme, to arrive at a differentiation matrix, and apply it on ...
6
votes
3answers
7k views

Poisson equation finite-difference with pure Neumann boundary conditions

I'm trying to solve a 1D Poisson equation with pure Neumann boundary conditions. I've found many discussions of this problem, e.g. 1) Poisson equation with Neumann boundary conditions 2) Writing the ...
6
votes
1answer
1k views

method of frozen coefficients and its relation to von Neumann stability analysis

I am considering two equations $$u_t=a(x)u_{xx}$$ and $$v_t=b(x)v_x$$ as classical representatives of the parabolic and hyperbolic family of equations. If $a(x)=a$ and $b(x)=b$ were constants, to show ...
6
votes
1answer
293 views

Adaptive h for gradient estimation

Can anyone point me to methods for varying $h$ in gradient estimation for noisy numerical optimization? Some programs have the user give a fixed $h$, which is used for forward-difference or central-...
6
votes
1answer
551 views

eigenvalue analysis vs fourier analysis for stability and their equivalence

I have a question regarding stability analysis for constant coefficient pde. Suppose I am looking at the pde $$u_t= au_{xx}$$ So the first approach is to compute the amplification factor, and this is ...
6
votes
2answers
2k views

Numerical Solution to Schrödinger Equation--Multiple Wells

I am trying to solve for the allowed wavefunctions and energies for a 1D quartic potential well. To do this I am using the patching method (https://engineering.dartmouth.edu/microeng/otherweb/...
6
votes
2answers
3k views

9-point stencil finite difference Laplacian with variable diffusion coefficients

So I'm trying to implement a 9-point stencil discretization to the 2D difussion equation. The stencil is here. However, most of the literature deals with a Laplacian that has a constant diffusion ...
5
votes
2answers
3k views

Crank-Nicolson method for solving nonlinear parabolic PDEs

Is the Crank-Nicolson method appropriate for solving a system of nonlinear parabolic PDEs like $\partial u/\partial t - a\Delta u + u^4 = 0$ ? I tried to apply this method for solving such system but ...
5
votes
1answer
294 views

How to design good finite difference schemes? [closed]

In principle, I know finite differences. In university, we discussed it and derived consistency and boundary conditions. But I am still left with a big question. How to design a good finite ...
5
votes
3answers
3k views

Discrete Poisson Equation with Pure Neumann Boundary Conditions

I'm trying to implement the Helmholtz-Hodge Decomposition in 2D, which states that a vector field is composed by a rotational free component, a divergence free component and a harmonic component. ...
5
votes
2answers
629 views

Interpolation schemes to move data between cells and nodes

I work on non-graded quadtree grids where the entire grid is a hierarchy of cells specified using a quadtree data structure, where, in general, there is no constraint regarding the relative size of ...
5
votes
3answers
186 views

What are the negatives of using higher order finite diference schemes?

I was looking at this wikipedia page: http://en.wikipedia.org/wiki/Finite_difference_coefficient It is a lists of higher order finite difference approximations, is there any negatives in using these ...
5
votes
2answers
515 views

PetSc vs Sundials for serial numerical computations?

I am currently working on a physics problem that turns into a non-linear boundary value problem. I need an efficient numerical solver that I could run on my laptop with i5 dual core CPU. I am ...
5
votes
1answer
198 views

Accuracy of finite differences

I'm currently reading this paper, and I'm a bit confused about how they compute the accuracy of their algorithm. In the aforementioned paper, they investigate the regularized long-wave equation: $$ ...
5
votes
2answers
1k views

How to impose boundary conditions on eigenfunction problems?

I am trying to solve for the eigenfunctions of a (1D) differential operator using finite differences: $$A \, f(x) = \lambda f(x)$$ Here is an example in Python where $A = \partial_x^4$: ...
5
votes
2answers
923 views

Advice on numerical solution for 2D hyperbolic PDE with zero flux boundary conditions

I would like to numerically solve a hyperbolic PDE of the form $\frac{\partial\theta_t}{\partial t}(x,y)+\frac{\partial\left[\theta_t \gamma_t^x\right]}{\partial x}(x,y)+\frac{\partial\left[\theta_t \...
5
votes
1answer
271 views

Is is possible to mix finite-volume and finite-difference discretisations when solving a coupled non-linear system?

In my last question I noticed a peculiar error when solving the Poisson equation using finite volume method (FVM), Peculiar error when solving the Poisson equation on a non-uniform mesh (1D only) ...
5
votes
1answer
566 views

Riemann Solver in WENO methods

I'm reading now Shu, C.-W. (1999). High Order ENO and WENO Schemes for Computational Fluid >Dynamics. (T. J. Barth & H. Deconinck, Eds.)Lecture Notes in Computational >Science and Engineering, ...
5
votes
2answers
256 views

Regularization of a discontinuous source term in an elliptic pde

Suppose I'm solving $$\frac{d}{dx}\left(K(x)\frac{du}{dx}\right)=f \text{ in }\Omega,$$ $$u=g \text{ on } \partial\Omega$$where $K(x)$ is smooth and $$ f(x) = \left\{ \begin{array}{ll} ...
5
votes
1answer
3k views

Stability of numerical method for 1D Burger's equation

I am trying to solve 1D viscous Burger's equation numerically and I cannot apply von Neumann analysis because the equation is non-linear. How do I predict the stability criteria for my system? I also ...
5
votes
2answers
282 views

I'm having trouble debugging multigrid. What to do?

I've spent far too much time coding and debugging multigrid. While I clearly can't post all of my code as it would be silly to ask someone to go through all that code, is there anything I should pay ...
5
votes
1answer
845 views

Finite-difference discretization for a convective term

How does one discretize the classical convective term in a transport equation using finite differences? I know the finite volume schemes out ther i.e. upwind, central differencing etc. Are there ...
5
votes
1answer
163 views

Need a good reference for numerical transport phenomena

I'm a chemical engineering undergraduate and I'm currently starting to work in a theoretical transport phenomena/colloid science group. While my group has a nice code base for larger scale ...
5
votes
1answer
781 views

Best practice for dealing with Dirichlet boundary conditions in finite-difference schemes: add artificial unknowns?

I know of at least two ways of dealing with Dirichlet boundary conditions in finite-difference schemes (and, to a lesser extent, finite-element schemes). Here I'm thinking of solving Poisson's ...
5
votes
1answer
2k views

FEM: which is the correct way to impose Dirichlet B.C

I know the Neumann B.C. is implicit in FEM language. However, I have seen at least two ways to impose Dirichlet B.C. e.g. for the following problem 1D, $$\nabla^2 u + \nabla u= 0, u_{left}= 1, u_{...
5
votes
1answer
7k views

Implementing Explicit formulation of 1D wave equation in Matlab

So the theory is straightforward. We have: $$\frac{\partial^2U}{\partial t^2}=c^2 \frac{\partial^2U}{\partial x^2}$$ discretizing it gives: $$\frac{U(i+1,j)- 2U(i,j) + U(i-1,j)}{(\Delta t)^2} = c^2 \...

1
2
3 4 5
15