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
0 votes
1 answer
48 views

numerical schemes for 1D PDE: for smaller grid size there is an increased roundoff error, larger size more truncation, so sweet spot in between?

I had a discussion with a colleague today. He claimed that usually for a general numerical scheme for solving a general 1D PDE, for smaller grid size there is an increased roundoff error because of ...
Millemila's user avatar
  • 435
2 votes
1 answer
106 views

How to quantify the numerical diffusion term in a second-order upwind advection scheme?

In the first-order upwind scheme, numerical diffusion can be quantified as: $$\frac{dT}{dt} = -w\left(\frac{dT}{dz}\right) + \left(\frac{wdz}{2}\right)\left(\frac{d^2T}{dz^2}\right)$$ For Lax-Wendroff,...
Yoni Verhaegen's user avatar
3 votes
1 answer
265 views

Why does the FDM give a correct solution to a PDE with a discontinuous initial condition?

I was solving the dimensionless wave equation: $$ u_{xx} = u_{tt} \tag 1$$ with the initial conditions: $$ u(x,0) = 0 \tag 2 $$ $$ u_t(x=0,0) = v_0 \tag 2 $$ $$ u_t(x>0,0) = 0 \tag 3 $$ and the ...
FriendlyNeighborhoodEngineer's user avatar
1 vote
1 answer
56 views

How to calculate the force of solid applied by fluid? Using finite difference method, DNS, staggered grid, SIMPLE algorithm, immersive boundary

Problem I am using finite difference method to solve classic problem of flow around cylinder, for validation of my group's immersive boundary method. The common way to validate numerical method is ...
CheapMeow's user avatar
2 votes
0 answers
89 views

Finite difference scheme to 1D wave equation with Dirac Delta forcing term

I am trying to simulate the following 1-dimensional wave equation with trivial initial conditions and a inhomogeneous Dirac delta function: $u_{tt} - c^2 u_{xx} = \delta(x - x')\delta(t - t'), \ u(0, ...
Rishi's user avatar
  • 121
3 votes
0 answers
83 views

finite difference method not working when going to two dimensions

I have two coupled ordinary differential equations in the steady state: The following code solves, using the Jacobi finite difference method, in 1d using Dirichlet boundary conditions for function $...
BeauGeste's user avatar
  • 131
1 vote
0 answers
91 views

How to implement boundary conditions for the Thomas algorithm

For my variable $U(t,x)$, I have implemented the thomas algorithm with $U_j^i$: $$ a(x)U_{j-1}^{i+1}+ b(x)U_j^{i+1} + c(x)U_{j+1}^{i+1} = d(x)U_j^{i} $$ Then $\textbf{A}$ is a tridiagonal vector with ...
THAT'S MY QUANT MY QUANTITATIV's user avatar
0 votes
0 answers
52 views

Prof A. Stanoyevitch's finite difference based PDE matlab code

Where can one find Prof A. Stanoyevitch's finite difference based PDE matlab code? They have a book on such a topic but can't find the accompanying code. Is it well received? It's not commonly talked ...
feynman's user avatar
  • 287
2 votes
0 answers
46 views

Upwind scheme flux conservation not satisfied in 2D

I have read that the upwind scheme is flux conservative. Then by my understanding, in the absence of sinks/sources and with absorbing boundaries, the amount of the quantity leaving through the ...
ThreeOrangeOneRed's user avatar
3 votes
1 answer
273 views

How to evaluate the points near/at the boundary when using Richardson extrapolation for improved accuracy of a derivative

If we want to improve the accuracy of our numerical estimation of a derivative, we can use Richardson extrapolation. The method is very beneficial when using a centered difference scheme and the ...
FriendlyNeighborhoodEngineer's user avatar
2 votes
1 answer
126 views

Can the Runge-Kuta algorithm help in reducing numerical dispersion and anisotropy when using the FDM to solve the 2D wave equation? [closed]

I am currently studying the effects of group velocity on the finite difference solution of the wave equation. Most of what I learned is from this source. I understand that high frequency components in ...
Amilox Lex's user avatar
1 vote
1 answer
91 views

Reference request: graph Laplacian approximation for domains/manifolds

Is there any reference on solving the heat equation on irregular geometries via creating a mesh and using the graph Laplacian instead of FEM techniques? (Convergence to real solution). That is to say, ...
Aner's user avatar
  • 151
1 vote
0 answers
101 views

Can I reduce my simulation error with a staggered grid, postprocessing and compatibility equation feedback?

What I did Using the finite difference method, I solved with a certain amount of error the following system of hyperbolic partial differential equations in cylindrical coordinates (the problem is ...
FriendlyNeighborhoodEngineer's user avatar
0 votes
0 answers
43 views

2nd-order backward difference approximation for temporal terms of Euler–Bernoulli beam

I am trying to solve the Euler–Bernoulli beam numerically in structural dynamics analysis: $$\frac{\partial^2w(x,t)}{\partial t^2}= \frac {q(x,t)}{\mu(x)}-\frac {1}{\mu(x)}\frac {\partial^2}{\partial ...
Chaozhi Qiu's user avatar
1 vote
1 answer
115 views

Best finite difference scheme in 2D for the mixed derivative

The are good methods to deduce finite difference schemes for derivatives of functions of one variable. But how to get a good one for the mixed derivative of a function of two variables $u=u(x,y)$, ...
Bogdan's user avatar
  • 113
1 vote
0 answers
124 views

How to vectorise numerical differentiation

I have a 2-D matrix with 2 spatial coordinates and I want to be able to vectorise the process of numerically differentiating with respect to its 2 coordinates, rather than just looping along the rows ...
THAT'S MY QUANT MY QUANTITATIV's user avatar
0 votes
2 answers
2k views

When can I use finite differences for differentiation?

Finite differences are usually used to integrate ODE's and PDE's. However, sometimes they can be used for differentiation which I illustrated simply by using the Matlab code below to differentiate the ...
FriendlyNeighborhoodEngineer's user avatar
3 votes
0 answers
148 views

Population of the coefficient matrix of a linear system Ax=b stemming from the finite differences of an arbitrary geometry

I've been looking into solving a linear system $$Ax=b$$ where $A\in\mathbb{R}$ is the sparse coefficient matrix of size $K\times K$, $b\in\mathbb{R}$ is the right-hand side (i.e., the source term) of ...
Akhaim's user avatar
  • 83
2 votes
1 answer
91 views

Creating nonuniform grids for FDM with multiple points of concentration

If I am creating a grid in the $S_i$ direction with $N_S+1$ grid points. If I want more steps around some $K$, I can use: $$ S_i=K+c \sinh \left(\xi_i\right), \quad i=0,1, \ldots, N_S $$ where $c=\...
THAT'S MY QUANT MY QUANTITATIV's user avatar
0 votes
0 answers
37 views

Convergence of Modified Crank-Nicolson Scheme

I'm dealing with a particular reaction-diffusion equation having the form $$ c_t = \alpha \nabla^2 c + F(c,x,t). \tag{1}$$ where $F$ is nonlinear. I would like to solve (1) with a finite-difference ...
zaccandels's user avatar
2 votes
0 answers
90 views

Numerical solution for inviscid Burgers' equation seems to have no breaking time?

So I'm trying to use the Lax-Friedrichs method to solve the inviscid burgers' equation with initial condition $$u(x,0) = \sin(x)$$, using $$u_m^{n+1} = \frac{1}{2}(u_{m+1}^n + u_{m-1}^n) - \frac{\...
Applesauce44's user avatar
0 votes
1 answer
82 views

My toy Laplace equation solver using finite-difference is unstable and I'm not sure why

I am trying to solve the variable-coefficient Laplace equation $$\partial(\epsilon\partial u) = (\partial\epsilon)(\partial u) + \epsilon\partial^2 u = 0$$using a finite difference scheme: $$\left(\...
DJames's user avatar
  • 417
0 votes
0 answers
97 views

Solving a steady-state PDE

I'm working on trying to solve a steady state PDE in python and I am quite new to python and I am slightly confused on the implementation details. I have an example implementation of solving a non-...
blov's user avatar
  • 43
4 votes
1 answer
137 views

Burger's equation (PDE) does not work with downwind difference?

I'm working on implementing the discretised Burger's equation. I am quite confused as to why it does not work when using a step-function and downwind difference formula. When using a step-function and ...
blov's user avatar
  • 43
1 vote
1 answer
120 views

Finite Difference method, ADI Scheme of Douglas and Rachford

I am trying to implement the ADI scheme of Douglas and Rachford. For $p(X,Z,t)$, there is: $$ \begin{gathered} A=p^{n-1}+\Delta t_n\left[F_0\left(p^{n-1}, t_{n-1}\right)+F_1\left(p^{n-1}, t_{n-1}\...
Xerium's user avatar
  • 11
2 votes
1 answer
283 views

Where am I making a mistake in solving the heat equation using the spectral method (Chebyshev's differentiation matrix)?

I would like to numerically solve the following heat equation problem: $$ u_t = \Bigg(2{a \over l}\Bigg)^2 u_{xx} \tag 1$$ $$ x \in [ -1, 1 ] \tag 2$$ $$ u(x, 0) = 0 \tag 3$$ $$ u(1, t) = A \sin \Bigg(...
FriendlyNeighborhoodEngineer's user avatar
0 votes
0 answers
55 views

ENO-Runge-Kutta discretization

One beginner's question about discretization of a Hamilton-Jacobi equation(non-linear) $$ u_t = H(u_x) $$ $u_x$ is discreated with 2nd order ENO-FD 1st order: $D_1^{\pm}u = \pm [u_{x\pm1} - u_x ] / \...
solanin's user avatar
0 votes
0 answers
44 views

Which numerical method can I use to solve this system of hyperbolic PDEs?

Backround The mathematical model I am trying to numerically solve models wave propagation inside a cylinder with specific material properties suited for dynamic loading. The cylinder's upper base is ...
FriendlyNeighborhoodEngineer's user avatar
3 votes
1 answer
273 views

Finite difference problem

I have a problem to resolve with the Finite Difference method in $[a,b]$: $$-\frac{d}{dx}(\alpha(x)\frac{du}{dx})= g(x),$$ with $\alpha(x) \in L^{\infty}$ continuous in $]a,c[$ and $]c,b[$ and ...
Kaneki Ken's user avatar
0 votes
0 answers
48 views

Is a sort of "z-drift" the result of numerical precision errors in FDM?

Upon solving the 2D wave equation with Neumann boundary conditions $u_x = u_y = 0$ on a rectangular $10 \times 10 \times 10$ grid, I noticed something odd - $u$ seemed to shift upwards with time. This ...
JS4137's user avatar
  • 133
3 votes
1 answer
184 views

Stability of Euler forward method

I am trying to solve a linear system of ODEs of the form: $$ \frac{du}{dt} = A u, \quad u(0)=k$$ where $A$ is a 2x2 matrix and $u(t)$ is a 2x1 column vector. I want to solve this numerically, using ...
rainbow's user avatar
  • 31
1 vote
1 answer
85 views

derivative matrix and the Dirac delta distribution

For a project I'm working on, I was working with the following equation $$ w(x) = \int k(x,y)v(y)dy $$ I noticed that if I choose $$ k(x,y) = -\delta'(x-y) $$ Then we probably get (I haven't touched ...
NNN's user avatar
  • 758
1 vote
1 answer
77 views

Does anyone know how to add a forcing term at the center of a cicular membrane?

I am here once again searching for wisdom, as some of you might notice I asked a related question a few days ago. And now I am struggling to add a forcing term at the center of the membrane, in order ...
Manuel Borra's user avatar
2 votes
1 answer
142 views

Can this finite difference dispersion be eliminated somehow?

I am trying to solve the wave equation $$ {\partial ^2u(t,x) \over \partial x^2} = {\partial ^2u(t,x) \over \partial t^2} \tag1 $$ with the following boundary and initial conditions: $$ {\partial u \...
FriendlyNeighborhoodEngineer's user avatar
0 votes
1 answer
174 views

Solving the wave equation for a circular membrane in polar cordinates

As you see this mode is not right, unless for what i understand And the initial conditions were ...
Manuel Borra's user avatar
0 votes
0 answers
40 views

First-order modified Patankar–Euler scheme (MPE)

Is the first-order Modified Patankar–Euler scheme (MPE) an implicit or explicit method? Is there an open-source code implementing the MPE scheme for a system of ODEs?
Mahmoud Saleh's user avatar
0 votes
1 answer
108 views

Discretization of generalized kinetic term in 2D Poisson partial differential equation

A typical 2D Poisson PDE is given as $$\nabla^2\varphi(x, y)=f(x, y)$$ where the Laplacian term, $\nabla^2\varphi$, can to some degree be interpreted as the kinetic energy (given proper scaling) (...
Akhaim's user avatar
  • 83
0 votes
0 answers
39 views

Perfect Conducting (PC) and Perfect Insulating (PI) boundary conditions for magnetic induction in MHD problems in cylindrical coordinates

I understand the computational implementation of the PC and PI bcs in cartesian case. In terms of the magnetic field components for PI, we have $B_x = B_y = B_z = 0$, and for PC, we have $\partial_x ...
myresh's user avatar
  • 1
1 vote
2 answers
183 views

Modeling contamination diffusion in a draining container, part 2

Part 1, but I'll repeat here. This time we'll move the top boundary. I have a container of water with initial volume $V_0$ and height $L$, open at the top which receives a constant mass flux $\phi$. A ...
HiddenBabel's user avatar
1 vote
0 answers
92 views

Closed formula to diagonalize discretized (perhaps randomized) Laplacians

I was wondering whether there is a closed formula for the eigenvalues and eigenvectors of the discretized Laplacian in (edit) $[0,1]^n$ with a uniform grid, using what I imagine is a $2n+1$ stencil. ...
Aner's user avatar
  • 151
2 votes
2 answers
110 views

Automatic Differentiation In the Presence of Jump Points

I have a complex monte-carlo cashflow model that traditionally uses the finite difference (FD) method to calculate its derivative at any given point. To improve model performance, I coded forward-mode ...
Mild_Thornberry's user avatar
2 votes
1 answer
140 views

Modeling contamination diffusion in a draining container

I asked this on the Physics site, but it fits much better here, and I now can ask a more specific question. For the scope of the problem, I have a 250-mL bottle filled with pure water and a sampling ...
HiddenBabel's user avatar
1 vote
0 answers
34 views

Can any discretization scheme reproduce the kane quasi-linear dispersion relation?

It is straightforward to solve the eigenproblem $$\hat{k}^2 \psi = E\psi$$using a finite-difference method. But what about$$\hat{k}^2 \psi = E(1+\alpha E)\psi$$I know it is possible to first solve the ...
DJames's user avatar
  • 417
3 votes
1 answer
206 views

First derivative central differences with reflecting boundary conditions

I have the following problem in 1-D: \begin{equation} \partial_t u(t,x) = v(x)\partial_x u(t,x) + \kappa(x) \partial_{xx} u(t,x),\,x\in\Omega;\quad \partial_{\nu}u(t,x) = 0, \,x\in\partial\Omega. \end{...
lightxbulb's user avatar
  • 2,122
1 vote
0 answers
113 views

Stability for the 2d diffusion equation

I'm reading this set of notes on numerical stability of the diffusion equation. I can't seem to derive equation (7.17) from the previous equation. I've tried using $\sin^2(\theta)=\frac{1-\cos(2\theta)...
NNN's user avatar
  • 758
0 votes
2 answers
196 views

How and when to impose inhomogeneous Dirichlet boundary conditions in Newton method solver for a PDE?

I am applying a central Finite Difference scheme in space and an implicit Euler scheme in time on a variant of the 2d Burgers equation, of the form:$$u_t + uu_x + uu_y = \nu(u_{xx} + u_{yy})$$ where $...
Robby Ram's user avatar
2 votes
0 answers
68 views

Literature request for pinning the corner singularities in finite differences

Corner singularities cause instability of finite difference solutions. They occur at the intersection of boundary conditions. I was recently going through an online video course that was explaining ...
FriendlyNeighborhoodEngineer's user avatar
3 votes
1 answer
568 views

Solving Poisson's Equation with Periodic Boundary Conditions

So, I've been attempting to design a simple solver for a problem of finding the gravitational potential of a system using Poisson's equation (let's call the potential phi, $\phi$). The goal is that I ...
TheAkashain's user avatar
2 votes
0 answers
110 views

Efficient heat diffusion implementation with varying coefficients

I have the following heat diffusion equation: \begin{alignat}{3} \partial_t u(t, \vec{x}) &= g(\vec{x})\Delta u(t,\vec{x}), &\quad& \vec{x} \in\Omega, \, t\in(0,\infty],\\ \partial_n u(t,\...
lightxbulb's user avatar
  • 2,122
3 votes
1 answer
258 views

Generalized eigenvalue problem for large, potentially ill-conditioned systems

Say that I have a generalized eigenvalue problem of the form $$Ax=\lambda Bx.$$ Using MATLAB, some naive ways that one may solve this is by either directly inverting $B$ then applying the ...
user45844's user avatar

1
2 3 4 5
18