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
2
votes
1answer
56 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 ...
1
vote
1answer
83 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 ...
-1
votes
0answers
28 views

How to derive the corrector step for the eq $\frac{\partial u}{\partial t}+\frac{\partial f}{\partial x}=0$

Let define a predictor step for the equation $\frac{\partial u}{\partial t}+\frac{\partial f}{\partial x}=0$, by: $$U_{i+\beta}^{n+\alpha} \equiv \bar{U}_{i}=U_{i}^{n}+\beta\left(U_{i+1}^{n}-U_{i}^{n}\...
2
votes
2answers
89 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 ...
3
votes
0answers
34 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 ...
1
vote
1answer
44 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 ...
3
votes
1answer
78 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 ...
0
votes
1answer
29 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 ...
1
vote
1answer
89 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 ...
1
vote
0answers
43 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 ...
4
votes
2answers
104 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-...
1
vote
1answer
62 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 ...
1
vote
1answer
89 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 ...
0
votes
1answer
60 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 ...
1
vote
0answers
20 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 ...
0
votes
0answers
67 views

Solving a non-linear BVP using Finite Differences method

Edit: I have updated my question using the feedback in the comments. I have a boundary value problem that I need to solve using finite difference. My task is specifically to solve it using finite ...
0
votes
1answer
28 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 ...
11
votes
8answers
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 ...
2
votes
0answers
36 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. ...
1
vote
0answers
24 views

von Neumann analysis: computation of maximum value of amplification factor

In this question I adress the stability property of a numerical scheme (a FDM described below) to the problem $$ \begin{align} u_{t} &= \alpha u_{xx}+\beta u_{xxxx}, & &x\in\mathbb{R},\;t&...
1
vote
1answer
82 views

Efficient Arbitrary Order Finite Differences in 1D

I am implementing on Matlab a high-order finite differences scheme to approximate the first derivative of $f(x_i)$ given $x = [x(1), x(2),..., x(i),..., x(n)]$ and $f = [f(x(1)),..,f(x(n))]$ with $x$ ...
1
vote
3answers
149 views

How is central difference scheme second-order accurate?

In an arbitrarily unstructured mesh, shown in the figure below, in the context of finite volume method, I want to obtain an approximation of $\phi_f$, where $N$ and $P$ are cell centers of adjacent ...
2
votes
0answers
42 views

How to determine the finite difference coefficient matrix in 2D with periodic BC?

I'm solving a PDE in matlab using ode15s, and since the spatial dimension is 2, and number of variables grow large very quickly, I need to supply the structure of ...
2
votes
1answer
74 views

Crank-Nicholson scheme for transport equation

This is my attempt to find the approximate solution of the folowing transport equation $$\left\{\begin{array}{ll} \partial_{t} u+\partial_{x} u= (x^2-x)t+x^3/3-x^2/2, & t \in(0,0.4), x \in(0,1) \\ ...
0
votes
1answer
102 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 ...
1
vote
2answers
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). ...
3
votes
0answers
44 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 ...
1
vote
1answer
78 views

What is the maximum attainable accuracy with a given set of $\alpha,\beta$?

I am using LeVeque's book: https://faculty.washington.edu/rjl/fdmbook/ Suppose I want to compute $u''$ using FDM with $\alpha=\beta=2$ (centered) so the FDM is $$ u''=\sum_{m = - \alpha}^\beta a_mu(...
2
votes
0answers
30 views

Convergent Finite Difference Scheme for Parabolic Equation

Consider the PDE $$u_t = b_{11}u_{xx} + 2b_{12}u_{xy} + b_{22}u_{yy},$$ where $b_{11}, b_{22} > 0$, and $b_{12}^2 < b_1b_2$. In Strikwerda's book, the ADI scehme \begin{align*} \left( 1 - \frac{...
1
vote
1answer
54 views

Solving the pulse propagation using four different FDTD methods gives four different results - Which to trust?

I'd like to simulate the propagation of a pulse, and have different options for solving that. On the one hand, I can use the non-linear schrödinger equation $$\partial_zE=\frac{i}{2k_0}\nabla^2_\perp ...
0
votes
1answer
88 views

Simple Harmonic Motion using the leapfrog method

I have to use the leapfrog method to solve the simple harmonic oscillator and I having trouble writing it in code. This is what we were given in class $$ \frac{v_{n+1/2}-v_{n-1/2}}{\Delta t}=-\omega_0^...
2
votes
0answers
52 views

Numerical errors due to terms of the form $\frac{1}{r}$ (r goes to 0 at the boundary) while using finite difference method

I am trying to solve a system of differential equations using finite difference method. There are few terms of the form $\frac{A(r)}{r}$, both $A(r)$ and r go to zero at the boundary. Analytically ...
1
vote
0answers
63 views

Are linear, CTCS codes always stable?

I would like to solve some equations which basically look like this $$\frac{\partial u}{\partial x}=F\left(v,\frac{\partial v}{\partial y},\frac{\partial^2 v}{\partial y^2}\right),$$ $$\frac{\partial ...
0
votes
1answer
58 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}...
2
votes
1answer
189 views

Order of Accuracy Measurements on 1D Advection Methods

I am trying to learn about basics of computational fluid dynamics, at the moment on the simple example of linear advection in 1D. I am am currently testing the theoretical predictions of the order of ...
0
votes
1answer
30 views

Truncation error plot with weird issue

I have a function f(x) = sin(x)/x^3 whose first derivative I am trying to estimate using 1st, 2nd and 4th order Finite Difference schemes. I tried to plot the ...
1
vote
0answers
53 views

Incorporating radiation boundary condition at the edge in finite difference

I am trying to solve the 2-d heat equation on a rectangle using finite difference method. I am confused as to how to incorporate non linear radiation boundary condition at the edge. $-k\frac{\partial ...
1
vote
0answers
44 views

Unsteady diffusion equation with spatial finite elements and Forward Euler in time

I have solved the unsteady diffusion equation using piece-wise linear Finite elements(triangles) for spatial discretisation and Forward Euler for temporal discretisation. I have the following mesh ...
0
votes
1answer
96 views

Question on comparing the accuracy of numerical schemes

This is a follow up to my previous post here I'm solving the following 1D transport equation . $$\frac{\partial C}{\partial t} = D\frac{\partial ^2 C}{\partial x^2}-v\frac{\partial C}{\partial x}$$...
3
votes
2answers
165 views

Why FVM can handle unstructured meshes while FDM cannot?

How come Finite Volume Method(FVM) handle the unstructured meshes and Finite difference Method cannot, whereas in FVM to approximate the fluxes at the boundary we use the central differencing? My ...
1
vote
1answer
55 views

Stability condition for explicit time FEM for parabolic pdes

If we discretize a parabolic pde to obtain the system of ODE's $\frac{\boldsymbol{B}}{\Delta t} \boldsymbol{u}_k = (\boldsymbol{K} + \frac{\boldsymbol{B}}{\Delta t}) \boldsymbol{u}_{k-1} + \boldsymbol{...
0
votes
0answers
39 views

Pressure boundary conditions in Stokes Equation in 2D (Finite Volumes)

I am solving the steady-state incompressible Stokes equations in 2D: \begin{equation} \frac{\partial u_x}{\partial x} + \frac{\partial u_y}{\partial y} = 0, \end{equation} \begin{equation} \mu\left[\...
-1
votes
1answer
88 views

Finding derivative of Matrix at different grid points using Finite difference methods/ Cholesky Factorization

I want to code this problem in MATLAB. It would be a huge help if someone can suggest to me how I can approach it. I need to solve the below-highlighted equation, I need ...
1
vote
1answer
76 views

How to choose between compact finite differences and spectral methods

For a project in my advanced numerical method class I have to solve the 1D Kuramoto-Sivashinsky equation. $$ u_t + u u_x + \lambda u_{xx} + \eta u_{xxxx} = 0. $$ As explained here I will solve it ...
2
votes
1answer
97 views

Is this a valid way to implement Neumann BCs in finite differences?

I'm trying to solve the 1D heat equation with Neumann boundry conditions numerically using finite differences: $$u_t = \alpha u_{xx}$$ $$u_{x}(0, t) = u_{x}(L, t) = k$$ $$u(x, 0) = u_0(x)$$ The main ...
3
votes
0answers
59 views

What is the reason for this finite-difference high errors on non-uniform grid?

tl;dr Using a Taylor-matched method to find coefficients for the discretized equation $ \mathbf{A} \vec{f}'' = \mathbf{B} \vec{f} $, a Fortran code has been implemented to find the second derivative ...
0
votes
0answers
279 views

Numerically solving a partial differential equation in python with Runge Kutta 4

I'm supposed to solve the following partial differential equation in python using Runge-Kutta 4 method in time. $$ \frac{\partial}{\partial t}v(y,t)=Lv(t,y) $$ where $L$ is the following linear ...
2
votes
1answer
107 views

Testing a block tridiagonal system of equations

In 1D problems, tridiagonal systems of equations are obtained when we use finite-difference or finite-volumes in a structured mesh. A wide solver is the TDMA algorithm here. In two-dimensional ...
4
votes
1answer
279 views

Computation of diffusion time

While simulating the diffusion of a substance in 1D, $$ \frac{\partial C}{\partial t} = \nabla \cdot (D \nabla C). $$ I'd like to compute the diffusion time In this link, the diffusion time is given ...
3
votes
1answer
111 views

Numerical solution of zero-potential time-dependent Schrödinger equation in 1D

I want to solve numerically the one-dimensional time-dependent Schrödinger equation $$i \psi_t(x,t)=-\frac{\hbar}{2m} \psi''(x,t)$$ My issue is that I don't have the physical background to understand ...

1
2 3 4 5
14