Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [finite-difference]

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

5
votes
2answers
394 views

Time discretization: Runge-Kutta methods vs. standard backward difference

I've recently written a code that solves the incompressible/low-Mach number formulation of the Navier-Stokes equation with high-order methods for both time and space. My advisor insisted that I use ...
3
votes
1answer
2k views

Iteratively solving 3D Poisson equation in MATLAB

I have written a function that sets up a sparse matrix A and RHS b for the 3D Poisson equation in a relatively efficient way. The set-up is nothing fancy: I have extended the 2D 5-point stencil to an ...
4
votes
1answer
446 views

1-D incompressible unsteady Couette Flow Explicit finite differece CFD

I am currently following J.Anderson Jr.'s CFD with basic application and I came into some troubles while coding for my very first CFD problem. As the title suggests I am solving an incompressible ...
0
votes
0answers
121 views

how to do von neuman stability analysis for given equation

I have two coupled differential equations. Their implicit schemes were given below. is there anyone who will do "von neuman stability analysis". because i need to know in which conditions my solution ...
3
votes
1answer
202 views

Numerically find Greens function

I am trying to numerically evaluate a Greens function for this equation: $$ \left[\frac{\partial^2}{\partial x^2} + f(x) \right] G(x) = \delta (x-x_0) $$ With Neumann boundary conditions. Here, the ...
0
votes
1answer
221 views

Discretization of Laplacian with boundary conditions

I am trying to solve the equation below numerically for various functions $I(x)$: $$ \frac{\partial^2}{\partial x^2} G(x) + I(x)G(x) = 0 $$ Subject to the boundary contitions: $$ \frac{\partial}{\...
4
votes
0answers
541 views

How to implement boundary conditions on Finite Difference WENO5 scheme for the Euler equations

I'm implementing a Finite Difference WENO5 with Lax-Friedrich flux splitting on a uniform, structured grid to solve the 2D Euler equations of fluid dynamics on a rectangular domain in cartesian ...
1
vote
0answers
44 views

A stable method for solving monontoe HJB equation

I am considering solving HJB equation of the form $$ v_t=g(a(x)v_x),\quad x\in \mathbb{R}, t>0, $$ with initial condition $v(0)=v_0$. Here $g:\mathbb{R}\to \mathbb{R}$ is Lipschitz and monotone ...
4
votes
1answer
117 views

Stable method for solving a HJB equation

I am considering finite difference methods and their error analysis for solving HJB equation of the following form: $$ v_t=|\sigma(x)v_x|,\quad x\in \mathbb{R}, $$ where $\sigma$ is a given function ...
3
votes
0answers
113 views

How one could choose the value of viscous coefficient for obtaining stable solution of Burgers' equation?

Burgers' equation is a fundamental PDE used in various fields such as number theory, gas dynamics, heat conduction, elasticity, etc. It is crucial especially for developing numerical models for ...
1
vote
1answer
723 views

Solving poisson equation on image with neumann boundary condition

I am trying to solve a standard Poisson equation on image with Neumann boundary condition. The Poisson equation has the form: $Δp=b$ where $b$ is the divergence of the input image,which is as shown: ...
1
vote
2answers
261 views

implementation of method of line and Runge-Kutta to the given equation

$$\frac{d^2 u}{dx^2} +A \frac{d^2}{dx^2}\left(\frac{du}{dt}\right)=B $$ I want to solve the equation given above. I need to first discretize it by the Method of Lines and then evolve the resulting ...
5
votes
2answers
266 views

Numerical differentiation of non-linear functions

In my efforts to write a code for a calculation I have encountered a problem of numerically differentiating a non-linear function at different points on a grid. I used the simple forward finite ...
0
votes
2answers
368 views

Finite Difference Grid Spacing and Scaling

I have been exploring finite differences and heat transfer using the 2D heat equation to further expand my knowledge. So far I think it is going well. I am running into some confusion around grid ...
1
vote
0answers
97 views

Solve Stokes equations (finite difference)

I have to solve the steady state Stokes equations with stream function and vorticity: I discretized: And my domain is, with boundary conditions: I want to solve the problem with a direct method (LU ...
1
vote
0answers
135 views

Numerical solution of non-linear heat-diffusion PDE using the Crank-Nicholson Method

I am trying to solve numerically the following 1D EBM: $C\frac{\partial T[x,t] }{\partial t} - \frac{\partial }{\partial x}\left ( D(1-x^2)\frac{\partial T[x,t] }{\partial x} \right ) + I[T] = S[x,t](...
1
vote
2answers
97 views

Finite difference equations representing semilinear elliptic PDE

I recently asked a question pertaining to the appliciation of Jacobi's method to a semilinear elliptic PDE (Poisson's equation) $$ \nabla^2u = -\rho~e^{-u} $$ A more efficient method like the Bi ...
1
vote
2answers
91 views

Explicitly including boundary points in a set of finite-difference equations

Consider the 1D poisson equation $$ \frac{d^2 u}{dx^2} = -\rho $$ with Dirichlet boundary conditions $u(0) = u(l) = g$. Using a finite difference scheme, with a 5-point grid $u_1,u_2,u_3,u_4,u_5$ (...
1
vote
0answers
46 views

Non-cubic blocks in Adaptive Mesh Refinement

Most Adaptive Mesh Refinement softwares/logic have cubic blocks. I have explored the BoxLib library and it ONLY supports cubic blocks. To be more precise it supports non-cubic blocks at the coarsest ...
6
votes
1answer
182 views

Convergence of Jacobi's method for a semilinear elliptic PDE

I have an iterative finite difference scheme for the Poisson equation $$ \nabla^2 u=-\rho $$ It's the Jacobi method, which has the form (for 1D systems) $$ u^{n+1}_{i} = \frac{1}{2}(u^n_{i+1} + u^n_{...
1
vote
0answers
148 views

Mass conservation in atmospheric continuity equation numerical solution

My phd project is heavily related to numerical modeling of planetary atmospheres. In particular now I am dealing with a particular expression of the continuity equation, involving a thermodynamic flux....
1
vote
1answer
330 views

Jacobi iteration for finite difference: when to stop?

I implemented a finite difference scheme to solve Poisson's equation in a 2D grid in C. I solve the system by using Jacobi iteration. Everything works fine until I use a while loop to check whether it ...
0
votes
1answer
200 views

Runge-Kutta Stability Regions

Based on this link, in particular Figure 1, what is the exact meaning of the plot? To my understanding, it implies that for a given differential equation: $$ \frac {dy}{dt} = \lambda y $$ that the ...
0
votes
1answer
459 views

Heat equation with Neumann and Dirichlet conditions on same boundary

I am looking at numerical solutions to the heat equation with Dirichlet and Neumann conditions on the same boundary. That is $u(x,t)$ satisfying $$ u_t = u_{xx}\,, \quad x \in[0,1]\,, \quad t>0\,,...
-4
votes
1answer
148 views

Use Finite Difference Discretization to find approximate solution to the Poisson's equation

I've just been introduced to the Poisson's equation. I've never had the need to dealt with PDE, so I'm a bit lost. Apparently we can compute an approximate solution of the Poisson's equation $$\frac{...
1
vote
0answers
73 views

Methods to approximate discretized derivatives in PDEs

When solving a general PDE such as $$ \frac {\partial ^2 E}{\partial t ^2} = \frac {\partial ^2 E}{\partial z ^2} - \frac {\partial E}{\partial z} $$ this equation can be solved by the method of ...
1
vote
0answers
74 views

Implementing initial conditions into the solution domain of a 1-D advection-diffusion equation

I have the following PDE. $\frac{\partial c}{\partial t} + v\frac{\partial c}{\partial x} - D\frac{\partial^2 c}{\partial x^2} = 0 \\$. I have discretized it such that i now have $\frac{dC}{dt} = ...
2
votes
1answer
140 views

What is the error associated with Fornberg's algorithm?

Bengt Fornberg derived a general way to compute the weights for arbitrary finite difference schemes in two papers: his 1988 paper and (better) his 1998 paper. What are the numerical errors ...
1
vote
2answers
76 views

Best numerical scheme for this problem

I have a set of data, $x, y$ and $ z$, each with length n: $x \rightarrow \{x_{1}...x_{n}\}$ $y \rightarrow \{y_{1}...y_{n}\}$ $z \rightarrow \{z_{1}...z_{n}\}$ $y$ and $z$ are parameterised by $x$...
1
vote
1answer
968 views

Solving the Poisson equation with Neumann Boundary Conditions - Finite Difference, BiCGSTAB

I am trying to solve the Poisson equation in a rectangular domain using a finite difference scheme with a rectangular mesh. I have happily generated the matrix system of equations Ax = b which is ...
1
vote
0answers
49 views

Equation of Motion Moving Cylinder, Displacement due to spring force

I have to simulate a cylinder moving in transverse direction due to an external force (no damping). The equation of motion is: $M\frac{d^2Y}{dt^2}+kY = F_Y$ My confusion is regarding $kY$, how to get ...
1
vote
1answer
163 views

Finite-difference form of the reaction-term in the solute transport equation

The partial differential equation is a combination of the diffusion plus convective trans­port equations and an adsorption sink. The equation for one-dimensional solute transport model is: $$\frac{\...
1
vote
0answers
135 views

Limit to precision of step-size

When solving an equation of the following form: $$ \begin{aligned} \frac {\partial A}{\partial t} &= EB - A \\ \frac {\partial B}{\partial t} &= EA - B \\ \frac {\partial E}{\partial t} &...
4
votes
3answers
369 views

Numerical approximation for a known exact solution of advection-dispersion equation

My goal is to create a numerical solution of 1D-solute transport (Convective-dispersion equation, CDE) to match it's analytical solution based on experimental data. The CDE can be written as (where, C=...
0
votes
1answer
68 views

2nd order accurate finite difference method variable material properties near boundary

I'm aware that a 2nd order accurate finite-difference method using variable properties for central differencing can be written in a finite-volume type way: $$ \nabla \bullet (k \nabla f) = \frac{\...
0
votes
0answers
117 views

Solving 1D wave equation with dissipation in anisotropic medium

I'm trying to solve a wave equation given here. This is a 1D wave equation in non-homogeneous medium that contains both thermal and viscous dissipation. I have solved it using Implicit-explicit ...
0
votes
1answer
233 views

The system matrix and the right hand side for diffusion equation with staggered grid

In the following staggered grid setting, I want to solve diffusion equation as a linear system. $$\frac{\partial u}{\partial t} = \frac{\partial^2 u}{\partial x^2} + \frac{\partial^2 u}{\partial y^2}$...
1
vote
2answers
234 views

Solving PDE in 1D with FD and MATLAB

I have to solve the following equation: $-u_{xx}=1$, with $x\in(0,1)$ and $u(0)=0,u(1)=0$. I have to solve it with the following numerical scheme: $\frac{1}{h_k^2}(-\frac{1}{2}u_{k-1}+u_k-\frac{1}{...
0
votes
1answer
391 views

Interpolation of velocities on staggered grid (in PIC)

Edit: (copying from my comment) Let's consider the inverse problem when I need to transfer velocities from particles to the grid (inverse bilinear interpolation). How'd I transfer a particle's x-...
4
votes
1answer
132 views

CG question: is symmetry always necessary?

Consider the 1D Poisson equation $$\nabla^2 u = f.$$ Using finite difference method on cell corner data and a uniform grid with ghost points, I think we can write the system of equations with Neumann ...
0
votes
1answer
198 views

Upwind difference for velocity in staggered grid

I am reading the paper, http://math.mit.edu/~gs/cse/codes/mit18086_navierstokes.pdf In the paper, the nonlinear term is treated as mix of central central difference and upwind difference using a ...
1
vote
2answers
190 views

derivative of an array

Hi I am trying to take a derivative of an array but am having trouble. The array is two dimensional, $x$ and $y$ directions. I would like to take a derivative along $x$ and along $y$ using central ...
1
vote
0answers
46 views

Decreasing - increasing - stabilising $l_{2}$ norm

Let $\bar{x}$ denote the analytical solution of a PDE. Let $x^{(k)}$ be the solution at the $k^{th}$ iteration. The initial guess for the solution is $x^{(0)} = 0$. Let $r_{0} = ||\bar{x}-x^{(0)}||_{2}...
1
vote
1answer
285 views

Solving first versus second order PDE

I am trying to numerically solve a PDE, and just had a question as to the validity of a certain approach. For example, given the PDE: $$ \frac {\partial ^2 E}{\partial t^2} = - k\frac {\partial E}{\...
2
votes
2answers
208 views

$O(h^2)$ convergence for Elliptic PDE

I am trying to solve an elliptic PDE in 2-D: $$-\nabla^{2} u = 20tanh(10x-5)(10-10tanh(10x-5)^2) = f$$ I know that the solution is $u = tanh(10x-5)$ but I am unable to get $O(h^2)$ solution with a ...
2
votes
2answers
110 views

How to support or contradict a hypothesis on unconditional stability using numerical optimization

The main motivation behind my next question is that I think I derived a higher order numerical scheme for linear advection equation that is unconditionally stable using Von Neumann stability analysis. ...
2
votes
1answer
2k views

Using backward vs central finite difference approximation

I am solving the simple 2nd-order wave equation: $$ \frac {\partial ^2 E}{\partial t^2} = c^2 \frac {\partial ^2 E}{\partial z^2} $$ Over a domain of (in SI units): $ z = [0,L=5]$m, $t = [0,t_{max} ...
2
votes
2answers
708 views

Data corruption when taking gradient of numerical data in python

Question Below is a plot of a graph $y$ and its derivative $dy/dx$ calculated using python's numpy.gradientwhich approximates the derivative with finite ...
2
votes
1answer
193 views

An interesting numerical pde problem

I'm somewhat struggling with how they are getting this scheme. This is a problem from Morton & Mayers book on numerical pde solutions. I think they are using a forward difference approximation for ...
0
votes
2answers
272 views

Stable implicit method to solve convection-heat diffusion in 3D

The last couple of hours I have been looking for an unconditionally stable method to solve the convection-diffusion equation within a 3D inhomogeneous material. Here's the well known diffusion-...