# Questions tagged [finite-difference]

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

667 questions
Filter by
Sorted by
Tagged with
84 views

### Solution of Cahn-Hilliard equation

I need to solve the Cahn-Hilliard equation $$\frac{\partial u}{\partial t} = \Delta(f(u) - \epsilon^2\Delta u), \hspace{.5cm}(x, t)\in \Omega\times(0, T],$$ using mixed formulation \begin{equation}\...
54 views

357 views

### When and when not to use automatic differentiation

I am just learning (more) about automatic differentiation (AD) and at this stage it kind of seems like black magic to me. The second paragraph of its Wikipedia article makes it sound too good to be ...
54 views

### Preconditioning the $[1 \quad-2 \quad 1]$ Finite Difference matrix

Let $A$ be the well known tridiagonal matrix coming from the 1D Finite difference discretization of the Laplacian, with stencil $\frac{[1 \quad-2 \quad 1]}{h^2}$. The system $Ax = b$ is very large, so ...
38 views

### How to calculate error in successive over relaxation for PDE?

I am trying to solve the Poisson equation numerically using the FDM method in C++. But I have a little confusion with the iterative process. I understand that the number of iterations should go until ...
83 views

### Which scheme for inhomogeneous convection-diffusion equation with highly variable coefficients?

I have a 1D convection-diffusion equation $\sigma_t = a(x,t) \sigma_{xx}+b(x,t)\sigma_x+f(x,t)$ defined on the unit interval, with nonzero Neumann boundary conditions at both ends. It should be noted ...
61 views

### Effect on methods like Crank-Nicolson of adding a potential term, changing heat equation to Schrodinger equation

I'm studying up on methods for numerically solving the Schrodinger equation. The Schrodinger equation with a zero potential is formally identical to the heat equation in the sense that we just make ...
149 views

### $P0$ elements for $H1$

Are there $P0$ (zero degree/constant element) nonconforming methods for approximating solutions in $H1$? More specifically, I have the equation: $$u-f - T\Delta u = 0$$ Which can be interpreted as ...
105 views

### Finite difference method having a discontinuity

I am trying to understand the FDM which is a widely used method solving differential equations by using approximation below. $$\dfrac{\partial u}{\partial x}=\dfrac{u(i+1)-u(i-1)}{2\Delta x}$$ How can ...
39 views

### Numerical calculation of the Berry connection

I'm doing some numerical calculations involving Hermitian matrices, and derivatives of the eigenvectors. Essentially, I have an n x n, Hermitian matrix H(x), which is dependent on some continuous ...
49 views

### 2D heat equation in both steady state and Transient state using iterative solvers

While solving a 2D heat equation in both steady-state and Transient state using iterative solvers like Jacobi, Gauss seidel, SOR. Should the answers, I mean the converged results of Temperature ...
89 views

### Finite difference methods in cylindrical and spherical co-ordinate systems

I am quite familiar with finite difference schemes in cartesian coordinates. The key point here is that every point in the cartesian grid is treated equally as the spacing between consecutive points ...
30 views

### How to fill matrix entries for two-dimensional implicit finite-difference for the general case

If I have derived a finite-difference formula for a 2D problem, for example something like: $af_{i,j}+bf_{i-1,j}+cf_{i,j-1}+df_{i-1,j-1}=g_{i,j}$ where f is the unknown function on a grid and ...
94 views

### Numerical methods that can be written in flux conservative form

I have a system of non-linear PDEs that I expect to have shocks as well as the appearance of Gibbs phenomena (spurious oscillations that form near the shock) for 2nd-order methods or higher. I have ...
45 views

### When to discretize nonlinear Poisson Equation

I am trying to solve a nonlinear poisson equation of the form: $u_{xx} + f(u_y)u_{yy} = 0$. In trying to get a handle on this problem, it seems like there are two approaches. I could either ...
113 views

### Kronecker product representation of the finite difference laplacian

The laplacian equation when discretized gives a system of linear equations that can then be solved. See the answer to this question: https://math.stackexchange.com/questions/3120948/discretization-...
76 views

### Finite Difference libray C++

What is the best FD library (or collection of libraries) for C++ codes? I am looking for some data structure implementation that offers the possibility to do parallel computations on adaptively ...
167 views

### Order of accuracy for finite-difference on nonuniform grid

If we evaluate the first derivative of a function F(x) on a 1D grid {$x_i$} by central difference at $x=x_i$ as $$\frac{dF}{dx} \approx \frac{F_{i+1} - F_{i-1}}{x_{i+1} -x_{i-1}}$$ then it is known ...
65 views

### FDM on nonlinear PDEs

I'm working with a 2D Navier Stokes PDE in the unstabilized version - the equation is a linear equation of the type $\frac{∂u}{∂t} = F(u,t)$. In order to perform time discretization with FDM (finite ...
21 views

### Convection equation expanded in Legendre polynomials

In some areas of physics, for example radiation transport in plasmas, it is beneficial to re-express the convection equation in terms of a Legendre polynomial expansion. This results in a set of ...
30 views

### Norm of operator in finite element discretization of Heat equation

I am solving the heat equation discretized spatially via FEM and temporally via backward Euler. I get the system $$M \dot{u} = K u +f$$ where $u$ is a vector representing the solution at spatial ...
5k views

### What programming language should I choose and why?

I am a mechanical engineer, intermediated/advanced level in MATLAB and MATHEMATICA, and beginner in Python. I intend to get a PhD in aeroelasticity (FEM + CFD) and coding my own program. I intend to ...
40 views

### How does the “Stable Fluids” algorithm by Jos Stam relate to the SIMPLE and PISO algorithms?

The "Stable Fluids" paper (*) by Jos Stam starts by acknowledging that "Our method cannot be found in the computational fluids literature, since it is custom made for computer graphics applications. ...
26 views

119 views

### Time complexity of numerical finite differences

I have a function $f:\mathbb R^N\to \mathbb R$ and I would like to compute all the partial derivatives of $f$ w.r.t. the $N$ input. What is the computational complexity using the (ones-sided) finite ...
52 views

### What space-time points should a known coefficient function be evaluated at when using the Lax-Friedrichs scheme to solve the transport equation?

For a scalar quantity $u = u(x, t)$, I'm considering the transport equation \begin{align} u_t + au_x &= 0, \qquad{x\in[0, L], \ t\in[0, T]} \\ u(0, t) &= u_{\text{in}}, \\ u(x, 0) &= f(x). ...
45 views

### Spectral solver on em-pic

I'm recently studying for the spectral solver to implement EM-PIC code. I read an article and have some questions. Many PIC codes uses spectral solver to overcome numerical artifacts on FDTD. In the ...
80 views

126 views

59 views

### Solve convection-diffusion equation with a non-linear source term

I would like to solve this equation (which is adapted in my case, a plug flow reactor when a reaction occurs): $\frac{df}{dt} = D \frac{d²f}{dz²} - u \frac{df}{dz} + r(z,t)$ with \$r(z,t)= - k f^{n}...