Podcast #128: We chat with Kent C Dodds about why he loves React and discuss what life was like in the dark days before Git. Listen now.

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
3
votes
0answers
330 views

Orthogonal vs general curvilinear coordinates

Solutions to PDEs over irregular domains can be computed using the finite difference method by the introduction of so called body fitted coordinate systems where the coordinate lines are aligned to ...
5
votes
1answer
3k views

Laplace's equation problem in Polar Coordinates (Edit)

Is there public code in Matlab for solving the Laplace equation in polar coordinates in a circular domain? I tried a lot but my level of Matlab and Mathematica is not good enough, but still not ...
2
votes
1answer
380 views

rate of convergence for the second order accurate method on two dimensional grid

I am solving $u_t=u_{xx}+u_{yy}$ with a solver which is locally $O(dx^2+dy^2+dt^2)$. I use the following norm for the error between the numerical vector solution and the analytical solution $$||e||_2=\...
2
votes
0answers
104 views

Resampling of values between body fitted and cartesian grids

Assuming there exist two 2D grids on the same domain, one of them is a cartesian one while the other is curvilinear (body fitted regular grid, with curved coordinate lines). I am looking for a way to ...
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 ...
3
votes
2answers
138 views

Effect of boundary condition on the local error

Any error analysis is based on the Taylor expansions. So, if I take a finite difference scheme, I can calculate the value of the function at any point using the known value at another node via Taylor. ...
13
votes
2answers
1k views

Alternatives to von neumann stability analysis for finite difference methods

I'm working on solving the coupled one-dimensional poroelasticity equations (biot's model), given as: $$-(\lambda+ 2\mu) \frac{\partial^2 u}{\partial x^2} + \frac{\partial p}{\partial x} = 0$$ $$\...
2
votes
2answers
316 views

Numerical solution of fractional integro-diffrential equ. using collocation method?

problem comes from "Numerical solution of fractional integro-differential , equations by collocation method , E.A. Rawashdeh, Department of Mathematics, Yarmouk University, Irbid 21110, Jordan" $D^...
7
votes
1answer
466 views

Linearized implicit time stepping

Consider the general FD implicit time stepping scheme $\frac{x_{t+1} - x_t}{\Delta t} = f(x_{t+1})$, where $x$ is the vector variable of interest and $f$ is some function, generally non-linear. ...
10
votes
2answers
710 views

Finite difference scheme for “wave equation”, method of characteristics

Consider the following problem $$ W_{uv} = F $$ where the forcing term can depend on $u,v$ (see Edit 1 below for the formulation), and $W$ and its first derivatives. This is a 1+1 dimensional wave ...
4
votes
2answers
2k views

Implementing a finite difference method in Mathematica

I am trying to iterate the following equation $$ x_{k}(n+1)=x_k (n)-\epsilon (x_{k+1}(n)-2x_k(n) +x_{k-1}(n))+\sqrt{\epsilon}\; \eta_{k}(n) $$ where $n$ denotes which time step I'm on and $k$ is the ...
14
votes
4answers
6k views

Boundary conditions for the advection equation discretized by a finite difference method

I am trying to find some resources to help explain how to choose boundary conditions when using finite difference methods to solve PDEs. The books and notes which I currently have access to all say ...
5
votes
2answers
549 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 ...
8
votes
1answer
2k views

Finite difference coordinate transformation for spherical polar coordinates

I have part of a problem that is described by the momentum conservation equation: $\frac{\partial \rho}{\partial t} + \frac{1}{\sin\theta} \frac{\partial}{\partial \theta}(\rho u \sin \theta) =0$ ...
1
vote
2answers
268 views

Smoothing the diffusion coefficient to improve convergence

I have been reading a book by Thomee and he considers the case of $u_t=(au_x)_x$, for the case of $a$ possibly being discontinuous. Then he says that the problems with convergence might occur, and ...
7
votes
3answers
788 views

analyze stability on a nonuniform grid

Assume you have a stability constraint between the space distance in time and space, for example, with an explicit Euler method for $u_t=u_{xx}$ we know $\tau\leq h^2/2$. That is, one can do stability ...
1
vote
1answer
2k views

how to measure the error of a finite difference method

Suppose I am solving a pde with a solution known with a finite-difference method. I can represent it as $A_hu_h=f$ for some approximating matrix $A_h$. And I define the discrete norm in which I will ...
6
votes
1answer
466 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 ...
5
votes
0answers
113 views

How to choose a stable PML for pseudo-spectral method with strongly varying velocity

My friend was working on this, and he asked me about the stability of PML while applying on pseudo-spectral method, I believe his concern was how to choose the difference(if the difference should be ...
4
votes
1answer
63 views

regularity of a solution and its affect on the global error

I am solving the following equation $u_t=x^2u_{xx}+\frac{x-y}{T-t}u_y$ with an initial data $u_0=max(y-C,0)$ for some $C$ in the domain of the numerical method. In time I am solving that on $[0,T]$. ...
4
votes
2answers
1k views

choice of the norm for the error of the numerical method

When I read books on finite differences they often end up using discrete $L^2$ norm for estimating the error as it naturally arises from weak formulation. I was wondering if people do that in Sobolev ...
0
votes
2answers
100 views

Impact of irregularity at the boundary on the error analysis

I am looking at the pde of the type $u_t=\mathcal{L}u$ for some elliptic operator $\mathcal{L}$ and on some domain $D$. Assume I am solving that with a finite difference method and want to estimate ...
7
votes
1answer
203 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 ...
6
votes
3answers
733 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 ...
4
votes
1answer
252 views

Defining electric current source excitations for surface integral equation formulations

In a finite difference (FD) based electromagnetic formulation based on a Yee cell grid, one can define electric current source excitations ($J$) on the $E$ field grid points. At a distance, the fields ...
2
votes
2answers
341 views

I don't understand how to correctly calculate truncation error

I am looking at the finite difference methods to solve simple $u_t=a(x,t)u_{xx}$. There are explicit, implicit, Crank Nicolson. The latter is said to be more accurate since the local truncation ...
9
votes
5answers
646 views

How can I derive a bound on the spurious oscillations in the numerical solution of the 1D advection equation?

Suppose I had the following periodic 1D advection problem: $\frac{\partial u}{\partial t} + c\frac{\partial u}{\partial x} = 0$ in $\Omega=[0,1]$ $u(0,t)=u(1,t)$ $u(x,0)=g(x)$ where $g(x)$ has a ...
11
votes
2answers
862 views

How do you improve the accuracy of a finite difference method for finding the eigensystem of a singular linear ODE

I am attempting to solve an equation of the type: $ \left( -\tfrac{\partial^2}{\partial x^2} - f\left(x\right) \right) \psi(x) = \lambda \psi(x) $ Where $f(x)$ has a simple pole at $0$, for the ...
8
votes
1answer
525 views

Finite difference scheme for compressible nonisothermal flow in porous media

My challenge is to solve the following system of equations, which describe gas combustion in porous media: 1) Continuity $\varepsilon \frac{\partial \rho_g}{\partial t} +\frac{\partial}{\partial x} \...
14
votes
4answers
1k views

Illustrative examples of mimetic finite difference methods

As much as I try to find a concise explanation on the internet, I can't seem to grasp the concept of a mimetic finite difference, or how it even relates to standard finite differences. It would be ...
20
votes
3answers
12k views

Recommendation for Finite Difference Method in Scientific Python

For a project I am working on (in hyperbolic PDEs) I would like to get some rough handle on the behavior by looking at some numerics. I am, however, not a very good programmer. Can you recommend ...
4
votes
2answers
1k views

How should I build a 2D 5-point stencil Laplacian matrix in parallel?

I'm making a simple eigenvalue solver with SLEPc, using a 5-point stencil and the finite difference method. I want to be able to assemble the matrix in parallel. My first thought was just to use <...
11
votes
1answer
1k views

Optimal transport warping implementation in Matlab

I am implementing the paper "Optimal Mass Transport for Registration and Warping", my goal being to put it online as I just cannot find any eulerian mass transportation code online and this would be ...
15
votes
2answers
6k views

Implicit finite difference schemes for advection equation

There are numerous FD schemes for the advection equation $\frac{\partial T}{\partial t}+u\frac{\partial T}{\partial x}=0$ discuss in the web. For instance here: http://farside.ph.utexas.edu/teaching/...
22
votes
2answers
4k views

A good finite difference for the continuity equation

What would be a good finite difference discretization for the following equation: $\frac{\partial \rho}{\partial t} + \nabla \cdot \left(\rho u\right)=0$? We can take the 1D case: $\frac{\partial \...
5
votes
1answer
748 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 ...
6
votes
1answer
256 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-...
7
votes
2answers
225 views

How can I obtain a one dimensional finite difference formula for $U_{xx}$ with unevenly spaced nodes?

I know that if I had evenly spaced points, I can use $U_{xx}\approx \frac{U_{i-1}-2U_{i}+U_{i+1}}{dx^2}$. But if my gridpoints are unevenly spaced, I assume that I can obtain the finite difference ...
7
votes
3answers
734 views

Largest eigenvalue of FD discrete Laplacian

Is there good approximation for largest (in magnitude) eigenvalue for discrete Laplacian ($\nabla^2$) obtained from nonuniform structured grid (like that)? Of course, one can always use general ...
14
votes
3answers
6k views

How to impose boundary conditions in finite difference methods

I have a problem when I want to use the high order center difference approximation: $$\left(\frac{-u_{i+2,j}+16u_{i+1,j}-30u_{i,j}+16u_{i-1,j}-u_{i-2,j}}{12}\right)$$ for the Poisson equation $$(...
4
votes
3answers
426 views

How to obtain finite difference, which is continuous

I want to calculate a finite difference (something like this SO Post). My data is as follows: I have x-values that are powers of two (4, 8, 16, 32 and 64). Corresponding to them are y-values, such ...
2
votes
2answers
246 views

Algorithm to compute the intersection of meshlines with a boundary

I need a program or an algorithm that computes the intersection of a mesh and a boundary. The mesh is structured orthogonal in nature and the boundary is a circle (for example). This will be used ...
5
votes
1answer
438 views

Does ADI/Split-operator change the stability properties of the Crank-Nicholson method?

I'm using the Crank-Nicholson method to solve the time-dependent Schrödinger equation with the split-operator method. I'm getting some weird results that are probably the result of a bug somewhere in ...
2
votes
2answers
5k views

Can't understand a simple wave equation matlab code

I'm trying to figure out how to draw a wave equation progress in a 2D graph with Matlab. I found this piece of code which effectively draw a 2D wave placing a droplet in the middle of the graph (I ...
-5
votes
1answer
851 views

Successive over-relaxation formation of heat equation?

What is the form of SOR iterative equation for the heat equation $u_{xx}=u_{t}-1$ using centered differences both in time and spatial derivatives and using Crank-Nicolson method? $$(u(x,0)=u(L,t)=u(0,...
8
votes
3answers
1k views

Laplacian eigenmodes on a semi-circular region with finite-difference method

The computation of eigenmodes of a semi-circular membrane reduces to the following eigenvalue problem $$\nabla^2u=k^2u\;,$$ where the region of interest is a semi-circle defined by $r\in[0,1]$ and $\...
5
votes
2answers
465 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-...
15
votes
4answers
1k views

How to reorder variables to produce a banded matrix of minimum bandwidth?

I'm trying to solve a 2D Poisson equation by finite differences. In the process, I obtain a sparse matrix with only $5$ variables in each equation. For example, if the variables were $U$, then the ...
3
votes
1answer
1k views

How to obtain an implicit finite difference scheme for the wave equation?

Suppose I had the following problem: $U_{tt}=U_{xx}+U_{yy}$ in $\Omega=[0,1]\times[0,1]$ $U(x,y,0)=f(x,y)$ $U_{t}(x,y,0)=g(x,y)$ $U=0$ on $\partial \Omega$ I know that there is an explicit ...
6
votes
2answers
406 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 ...