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.

1
vote
1answer
85 views

interpolation 2D irregular nodes

Given a 2D irregular spaced data like shown in the figure, I would like to know how to find derivatives at '*' by interpolating the values at 'o'. Does lagrange 2D interpolation work at irregular ...
3
votes
4answers
890 views

Advection equation with finite difference: importance of forward, backward or centered difference formula for the first derivative

I am a newbie in finite difference methods, so I apologize in advance if the question is trivial. I am trying to solve the advenction equation, i.e. $\frac{\partial \phi(x,t)}{\partial t} + v \frac{\...
1
vote
1answer
255 views

(FD WENO) Correct characteristic decomposition of 2D Euler equations [closed]

After successful implementation of characteristic-wise finite-difference WENO method to 1D Euler equations, I'm moving to 2D equations on cartesian grid: $$ \frac{\partial U}{\partial t} + \frac{\...
0
votes
1answer
383 views

Finite Difference Method Limitations/Stability Criteria

Is it possible to solve an equation with only a single derivative such as: $$\frac{\partial U(x,t)}{\partial t} = A - BU(x,t)$$ with finite difference methods? I ask as I am trying to solve the ...
1
vote
2answers
112 views

How to compute WENO-reconstructed flux in local characteristic field?

I'm trying to apply finite-difference characteristic-wise WENO method to 1D Euler equations: $$ U_t + F(U)_x = 0, \; \;\text{where} \;\; U = (\rho, \rho u, e) \;\; \text{and} \;\;F(U) = (\rho u, \rho ...
1
vote
1answer
169 views

Does 1D component-wise Euler WENO work with shocks at all?

I'm trying to implement finite-difference WENO method to progressively complex equations and systems. At the moment I'm successful with singular scalar equations (constant advection and Burgers), and ...
1
vote
0answers
74 views

Computing the change of function at two close points without cancellation

I want to compute the difference $\Delta f(x_1,x_2) = f(x_1)-f(x_2)$ of a smooth function $f(x)$ at two points $x_1$ and $x_2$ which are close to each other. The magnitude of the expected result, $|\...
1
vote
0answers
90 views

Implementing Neumann boundary condition in nonlinear integro-differential equation

Problem I would like to solve a nonlinear integro-differential equations on a 2D square domain $\Omega$ subject to Neumann boundary conditions using finite differences: $$\frac{\partial u}{\partial t}...
1
vote
0answers
46 views

Extrapolating to non-fluid cells (for Shallow Water Equations), for a shore/beach?

The water height $h$ and 2d velocity field $(u,w)$ are "extrapolated to non-fluid-cells, i.e., setting $h$ equal to the value in the nearest fluid cell." [Bridson] I'm using finite differences. ...
1
vote
0answers
41 views

Discrepancy in estimating boundary stencil for finite difference method

I am trying to estimate the FD stencil for boundary as mentioned in this paper (section 4.1) using MATLAB. The stencil order (6th) is higher than the one mentioned in paper (4th). $$ f_1' +\alpha f_2'...
1
vote
1answer
240 views

How to implement finite difference method for one dimensional Navier-Stokes PDEs

I am trying to use backwards finite difference method to numerically solve a pair of partial differential equations: $\frac{\partial \left(pv\right)}{\partial x}+\frac{\partial p}{\partial t}=0$ $\...
2
votes
0answers
146 views

Understanding Davis artificial viscosity

I'm solving 2D Euler's equations in Cartesian coordinates: $$ \frac{\partial U}{\partial t} + \frac{\partial F}{\partial x} + \frac{\partial G}{\partial y} = 0, \qquad U = \left( \begin{array}{c} \...
1
vote
0answers
147 views

CFL condition of source term

Consider one dimensional hyperbolic pde $$u_t+f'(u)u_x=0$$ For the above problem ,CFL condition is $\Delta t\leq \dfrac{\Delta x}{|f'(u)|}.$ But if we include the source term $,S(u,t),$ which ...
1
vote
0answers
176 views

Crank-Nicolson scheme in space for advection equation

Consider the equation $$\frac{\partial}{\partial t}v(t,x)=\frac{\partial}{\partial x}v(t,x)$$, for $t,x\in\mathbb{R}$. I'd like to solve this equation forward in space and backward in time, ...
1
vote
3answers
434 views

Finite difference for mixed derivatives on nonuniform grid

I need to have a finite difference stencil for the mixed derivative $$f_{xy}$$ on nonuniform grids such as this one: Since I could not find a stencil in the literature, I tried to derive it by my ...
1
vote
0answers
76 views

How would you specify mixed boundary conditions for a 2D PDE in the matrix used for finite differences

I have the following PDE in 2D: $U_{x} + U_{xx} + U_y + U_{yy} + U_{xy} = f$ where $f$ is a constant. And I'm trying to create a matrix $A$ to solve the PDE through finite differences: $AU = f$. I ...
1
vote
2answers
93 views

First-order ODE scheme implementation giving less than first-order convergence?

I am solving the initial value problem $$ \frac{d}{dt} (E C_g) = -\delta, \quad E(0) = E_0, $$ for $E$, where $E$ and $C_g$ are functions of $t$, $C_g$ is completely known, and $\delta$ is a function ...
1
vote
0answers
56 views

Find B-spline coefficients from values on collocation points

The context of my question is how to compute high order derivates on direct numerical simulation of turbulent channel flow. It is of particular interest for fluid dynamics and turbulence research. I ...
3
votes
2answers
112 views

Why does multiplying two first derivative finite difference matrices not give the matrix for the second derivative?

The finite difference matrix for the first derivative is $\begin{bmatrix} -1 & 1 & 0 \\ 0 & -1 & 1 \\ 0 & 0 & -1 \end{bmatrix}$. The finite difference matrix for the second ...
1
vote
0answers
119 views

Time-dependent Schrodinger equation(time-dependent Hamiltonian)

This question was already asked here and this is a suitable form of the equation for numerically solving. \begin{align*} i\frac{\partial}{\partial t}u_{\ell}(r,t) = \Bigg(-\frac{1}{2} \frac{\partial ^...
0
votes
2answers
190 views

Finite difference methods for multidimensional coupled equations

My knowledge of finite difference is very basic so this could be very trivial. I've seen how multidimensional finite difference works for say fluid equations, but they are also dealing with a single ...
1
vote
0answers
69 views

Numerically solving generalized eigenproblem with Neumann conditions

I am interested in finding the eigenvalues/eigenfunctions of problems such as $$ \partial_{xx} u = \lambda \partial_{yy} u, $$ which can be solved as the generalised eigenvalue problem $$ \mathbf{A}...
1
vote
1answer
352 views

Crank-Nicolson method for inhomogeneous advection equation

Suppose we have the inhomogeneous advection equation $$\left(\frac{\partial}{\partial x}+\frac{1}{c}\frac{\partial}{\partial t}\right)u(t,x)=v(t,x)$$ for $u,v:\mathbb{R}\times\mathbb{R}\to\mathbb{R}$ (...
6
votes
1answer
249 views

Correct eigenfunctions of Laplace operator by Finite Differences

I am trying to compute the eigenfunctions of the Laplace operator, i.e. finding $u$ in $$ -\nabla^2 u = \lambda u .$$ For now I am trying to do this in 1D, so $$ \nabla^2 = \partial_{xx} .$$ I am ...
1
vote
0answers
128 views

Accuracy of finite difference method for heat equation on a disk

To study an approximation for the heat equation $$\frac{\partial^2 u}{\partial r^2}+\frac{1}{r}\frac{\partial u}{\partial r}+\frac{1}{r^2}\frac{\partial^2 u}{\partial\theta^2}=f(r,\theta)$$ on the ...
1
vote
1answer
110 views

Can this nonlinear advection-diffusion equation be discretized as to only have to solve SPD systems?

Consider a nonlinear advection-diffusion equation of the form $$ \frac{\partial u}{\partial t} = \nabla \cdot (a(u) \nabla b(u) - \vec{c}(u)u) \tag{1} $$ on a rectangular domain with Dirichlet ...
1
vote
1answer
129 views

Fully discrete finite element method for 1D dynamic euler-bernoulli beam problem

I am trying to solve a 1D initial boundary value problem in MATLAB using Finite Elements with time stepping, for the purpose of learning scientific computing and to build up to more difficult problems....
1
vote
1answer
207 views

Linearization in Finite Difference Method: Why?

I have a very basic question, and I hope some of you might be able to help me: In Fluid Dynamics, a common equation turning up time and time again is the so-called continuity equation: $$\frac{\...
1
vote
0answers
25 views

Simulation of a lens, insufficient points

I am simulating the propagation of a light pulse using the equation $$\frac{\partial}{\partial z}A=\frac{1}{2\cdot k_0}\nabla^2_rA$$ with $$k_0=\frac{2\pi}{\lambda_0}$$ The propagation with a step ...
5
votes
1answer
504 views

Von Neumann stability analysis with a constant term

I have a question concerning the von Neumann stability analysis of finite difference approximations of PDEs. There seem to be a wealth of online source explaining the application of this stability ...
0
votes
2answers
83 views

Parabolic differential equations with time delay

Let $d_1=1,d_2=2,a_{11}=\frac{5}{13},a_{12}=\frac{22}3,a_{21}=-2,a_{22}=\frac{6}7,\tau=\frac{5}7$, $\psi(t,x)=\cos^42x,\phi(t,x)=\frac{3}{13}x^4\sin^2 3x$, $\Omega=[0,200]$ How to solve: $$\left\{ \...
0
votes
1answer
318 views

Solving an equation in space and time using the Crank-Nicolson approach

Assume I have the following equation (light propagating in $z$-direction through the matter): $$id_zu+d^2_ru=0$$ with $u(z, r)$ being a complex wave. The time scale in this equation is $$t\equiv t_\...
0
votes
0answers
498 views

Periodic Boundary conditions for 2D Euler equations

I am currently writing a 2D hydrodynamics code that simulates the 2D Euler equations using the AUSM method (Meng Sing Lou). I have tested the code on various 2D Riemann problems with Neumann ...
2
votes
1answer
774 views

Solving an iterative, implicit Euler method in MATLAB

I'm trying to solve an iterative problem that includes an implicit (backwards) Euler method to find successive time values for a given function. The numerical problem is shown here: $$ \begin{...
1
vote
0answers
81 views

boundary condition in 2-D planar finite difference problem

I'm working on a 2-D planar finite difference code. My differencing scheme at the boundary nodes involves introducing ghost nodes in the computation. My code also involves a multi-dimensional ...
4
votes
2answers
403 views

Solving Ax = b with sparse A and sparse b

Let's suppose I'm numerically solving the Poisson equation for a delta function source: $$ \nabla^2 f(x) = \delta(x-x') $$ I can represent the Laplacian $\nabla^2$ using the finite difference method ...
0
votes
1answer
158 views

Numerical solution of nonlinear thermoconductivity equation

I have to find and plot a numerical solution for the following equation (I have to write a solver): $$u_{t} = (u^2 u_x)_x$$ with the following conditions $u(0,t) =0, u(1,t) = \sqrt{\frac{2c-2}{t}}, u(...
7
votes
1answer
219 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 ...
0
votes
2answers
99 views

Trying to compute the error from comparing two arrays

Some context: I am working with the Black-Scholes model.. I have an explicit (Black-Scholes) formula which is the exact solution to my problem. I have written code which implements a finite-difference ...
1
vote
2answers
417 views

MATLAB FFT Differentiation

I am trying to implement the Laplacian operator using Fourier Transform differentiation (https://en.wikibooks.org/wiki/Parallel_Spectral_Numerical_Methods/...
1
vote
0answers
62 views

Discretization of a multi-function term

I'm trying to do discretization to the following system: $\frac{{\partial \rho }}{{\partial t}} = - \frac{{\partial \rho }}{{\partial x}}u - \rho \frac{{\partial u}}{{\partial x}}$ $\frac{{\partial ...
1
vote
2answers
191 views

V-cycle Multigrid for 2D transient heat transfer on a square plate using finite difference

I'm currently developing a program to solve 2D transient state heat conduction on a square plate using the V-cycle multigrid. Althought my program is able to reach the steady state solution, it's ...
1
vote
0answers
125 views

Breather solutions of Sine-Gordon Using Finite Differences

I'm attempting to simulate a standing breather of the form $$ u(x,t)=4\tan^{-1}\left(\sqrt{3}\cos\left(\frac{t}{2}\right)sech\left(\frac{\sqrt{3}x}{2}\right)\right)$$ for the Sine-Gordon equation $$u_{...
1
vote
0answers
97 views

Smoothness indicator calculation for WENO methods

I am trying to calculate the smoothness indicators for the WENO methods using the method given by Jiang and Shu. $\beta_k = \sum_{l=1}^k \Delta x^{2l-1} \int_{x_{i-1/2}}^{x_{i+1/2}} \Big(\frac{\...
7
votes
1answer
196 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 ...
3
votes
2answers
283 views

Precision loss in Matrix-Vector product when applying Finite-Difference scheme

I am applying a 6th order Finite-Difference differentiation scheme as seen in http://www.scholarpedia.org/article/Method_of_lines/example_implementation/dss006 There seems to be severe numerical/...
8
votes
1answer
314 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
3answers
348 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 ...
4
votes
2answers
116 views

In numerical methods, eg, finite differencing approaches, does there exist convergent schemes that are not both consistent and stable?

In a book that our course is following this semester, the theorem given is only in one direction: if the scheme is both consistent and stable, then the scheme is convergent. However, since this ...
0
votes
1answer
113 views

Initial Condition in a Numerical Problem

In a initial value problem does the initial condition has to satisfy the boundary condition and the governing equation? For example: If a non-homogeneous Neumann boundary condition for the pressure ...