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
1
vote
2answers
79 views

FVM vs FDM vs Conservative form vs Non conservative form

My question is regarding solving the conservative form and the non-conservative form of the governing-equations (GE), like continuity or the navier stokes equation, using finite difference method (FDM)...
2
votes
1answer
102 views

Modified Equation and Stability for Centred Finite Differences for Wave Equation

I am trying to use the modified equation to derive the stability condition for the finite difference approximation $$ \frac{u(x,t+\Delta t) - 2 u(x, t) + u(x, t -\Delta t)}{\Delta t^2} = c^2 \frac{...
1
vote
0answers
26 views

What kind of problem or matrices are suitable for multigrid method?

For Poisson or Convection-diffusion equation as follows: $$ -\Delta u=f,\qquad u|_\Omega = g. $$ or $$ -\Delta u +\vec{w}.\nabla u=f,\qquad u|_\Omega = g. $$ using FDM or FEM discretization, we can ...
-4
votes
0answers
27 views

Derive the Finite Difference equation corresponding to the steady state PDE. Explain how to implement Dirichlet and Neumann boundary conditions

A rod of length L = 1m, is made of copper, with thermal conductivity κ = 380W/m/K. A uniform heat supply h = 10kW/m3 is applied to the rod. The left boundary of the rod is kept at constant temperature ...
1
vote
1answer
69 views

Crank-Nicholson for diffusion-advection vs diffusion equation

Let's consider the following 1D diffusion equation: $\frac{\partial u}{\partial t} = xk \frac{\partial}{\partial x}(\frac{1}{x}\frac{\partial u}{\partial x})$ where we assume that the diffusion ...
2
votes
1answer
84 views

What is eighth order central difference?

The origin of the question can be found here. I know the details about forward, backward and central differences. If $u$ is the variable, does eight order means it approximates the $u_{xx}$ using $u$...
2
votes
1answer
39 views

Upwind finite difference: Matrix Implementation

I want to implement the upwind finite difference scheme for the 1D linear advection equation using a finite difference matrix in python: $$ A =\begin{pmatrix} 1-a\cfrac{\Delta t}{\Delta x} & 0 &...
5
votes
0answers
82 views

Evolutionary dynamics in vascularised tumors, PDE-ODE coupled system

I have to solve the following PDE-ODE system $$ \displaystyle{\partial_{t} n = \bigl[a(s) - b(s)(y - h(s))^{2} - d\int_{\mathbb{R}} n \, dy \; + \; \beta \, \partial^2_{yy} n \;} \\\\ \...
2
votes
1answer
111 views

Why $\alpha I +A$ can improve the condition nubmer of a SPD matrix $A$?

For Poisson equation with Dirichlet boundary conditions in 2 dimension: $$ -\Delta u=f, $$ using FDM (centered difference) or FEM discretization, we can obtain a SPD system of linear equations as ...
0
votes
1answer
80 views

How suitable is multigrid method for time-dependent PDEs?

For elliptic PDEs (Poisson-type), the multigrid method is very sufficient, but how about time-dependent problems (i.e parabolic or hyperbolic PDEs)? Is it efficient to solve such problems using a ...
1
vote
0answers
56 views

Can the standard multigrid performance be used for time-dependent PDEs?

Consider a time dependent pde(i.e u(x,t)).I know when only space-coarsening is used the standard multigrid performance can be applied but what if instead we use only time-coarsening?Can we apply the ...
1
vote
1answer
89 views

Simulating advection - diffusion problem in a network of 1D pipe

I'm interested in solving the following advection-diffusion system in a 1D network of pipes. $$\frac{\partial C}{\partial t} = D\frac{\partial ^2 C}{\partial x^2} - v\frac{\partial C}{\partial x}$$ ...
1
vote
0answers
26 views

Solving a system of PDEs with no-flux boundary conditions (finite difference discretization)

I am interested in solving a system of linear PDEs with the finite difference method and I'm having trouble to solve the no-flux boundary condition correctly. \begin{align} \frac{\partial n}{\partial ...
0
votes
0answers
40 views

Imposing decaying boundary conditions on a non linear ode

I am trying to solve $a^{2}y''=y+y^3$ numerically. This equation models a potential and goes to $\infty $ for $x\to0$ hence I get the singularity to be of order $\frac{1}{x}$ by keeping only the y^{3} ...
1
vote
0answers
59 views

Solving diffusion equation using finite difference method

I am solving an 1-dimensional diffusion equation with Neumann boundary condition at outlet and constant concentration, C, at the inlet. In the end, I want to observe how the concentration diffuses ...
1
vote
2answers
161 views

Lattice Boltzmann methods vs Navier stokes/ other eulerian methods for *water* simulation

Note, there is already a question here, however the answers don't answer the original question, let alone specific considerations when dealing with nearly in-compressible fluids (water). Another ...
2
votes
1answer
40 views

Stability of a finite-difference scheme for the reaction-diffusion equation

I currently need to solve numerically the following reaction-diffusion equation: $$\partial_tu=\partial^2_xu+u-u^2$$ For this purpose, I use the following numerical scheme (Crank-Nicolson??): $$ \...
1
vote
1answer
52 views

Should the derivative of an array be calculated array by array or element by element in CFD codes?

I am making my own finite difference computational magnetohydrodynamic code in Fortran 90. Looking at other codes they appear to calculate for example their $x$-derivatives, bb of their variables, e.g....
2
votes
1answer
73 views

1-D boundary value problem: How implement mixed boundary conditions using a FD method?

I have been given a convection-diffusion ODE modeling the steady state temperature of a pipe (through which flows a fluid) as $$-\frac{d}{dz}\left(\kappa \frac{dT}{dz} \right)+v\rho C\frac{dT}{dz}=Q(...
2
votes
1answer
48 views

Confusion about Zabusky and Kruskal's stepper for the KdV equation

In Zabusky and Kruskal's paper about solitons, they derive the following update for the Korteweg de Vries equation (their footnote 6): \begin{align*} u_{i}^{j+1} = u_{i}^{j-1} - \frac{1}{3} \frac{k}{...
1
vote
0answers
25 views

Finite difference/element method : time step and spatial resolution close to a finite singularity

I'm using the finite element method (FEM), but my question is quite a global question. It's related to this question but it is not the same. Let's assume we have this equation : $$\partial_t c - u\...
3
votes
0answers
82 views

numerical instabilities in Fluid Dynamics, Finite Element Method

I'm looking for references to understand where the numerical instabilities come from in hydrodynamics in general, and notably when the Péclet number: $Pe>1$. I'm using the finite element method. ...
1
vote
0answers
39 views

Predictor-Corrector vs. Deferred Difference Corrections

I want to use the Numerov method but keep higher-order terms from the Taylor expansions. In the literature, I found the term "Deferred Difference Corrections" for the procedure of first solving the ...
3
votes
1answer
132 views

Why do many people use FDM method to solve Stokes equations, i.e., saddle point matrix?

For numerical methods of the Stokes equations, with appropriate boundary: $$-\nabla^{2} \vec{u}+\nabla p=\overrightarrow{0}$$ $$\nabla \cdot \vec{u}=0$$ one may use FDM (finite difference method) ...
0
votes
1answer
85 views

Implementing structured grid boundary conditions using NumPy arrays?

I am making a toy code in Python to solve the advection equation $$u_t + cu_x = 0$$ with, for example, periodic boundary conditions. Background information The numerical grid is specified like this: ...
2
votes
0answers
85 views

Implementation of boundary conditions for 1D Euler equations

I'm trying to solve 1D Euler equations with gravity in spherical coordinates using a finite-difference TVD MacCormack method on a non-uniform grid of $N$ components, following the method provided in ...
2
votes
0answers
42 views

Verification on pressure predictor method for CFD code

I have developed a python code for a lid-drive cavity model. However, my results are not converging. The algorithm of my code looks like this: Euler Momentum Equation looks like this: $$\frac{u^{n+1}...
1
vote
0answers
65 views

FDM discretization of equation on the boundary

In order to simulate the following equation using FDM $$u_t(t,x)-u_{xx}(t,x)=0, \quad (t,x) \in (0,1)\times (0,1)$$ $$(u_t(t,x)-u_{x}(t,x))\rvert_{x=0}=0, \quad t \in (0,1)$$ $$(u_t(t,x)+u_{x}(t,x))\...
1
vote
0answers
47 views

WENO scheme on curvilinear coordinates

I've been developing a curvilinear FVM code. So far I've implemented the PPM scheme and am looking into adding WENO schemes. So far I've been discretizing the grid metrics using a second-order central....
0
votes
1answer
108 views

Need an example Legendre-Gauss-Radau pseudospectral differentiation matrix or Matlab code

I'm trying to implement various kinds of pseudospectral methods for direct optimization in Matlab using IPOPT. I've got some working Legendre-Gauss-Lobatto code, but would like to use the flipped ...
1
vote
1answer
117 views

Solving nonlinear PDE with finite difference based on Newton-Krylov

I am now working on solving MHD equations with finite difference method, which include nonlinear equations: $$ \frac{\partial\rho}{\partial t}+\nabla\cdot\left[\left(\rho_0+\rho\right){v}\right]-\...
2
votes
1answer
90 views

What method of Finite difference is this?

I am reviewing Numerical Recipes method on solving ODEs via relaxation (Chapter 18.3 in the 3rd edition) and they chose a finite difference method I am unfamiliar with (Equation 18.3.2): \begin{...
1
vote
1answer
48 views

Interpolating the gradient of a cylindrically symmetric potential field that's 'supposed to' obey the Laplace equation?

The script below tries to implement a Jacobi iterative relaxation of a potential field for an electrostatic lens. It's hot-off-the-press and I've just started to debug and look for things to test it ...
1
vote
0answers
31 views

Dealing with spurious oscillations in particle tracking methods

I work on modelling high intensity discharge xenon-filled lamps. The model governing the discharge is quite complex and sadly includes fluid dynamics. After some time, I managed to implement a finite-...
1
vote
1answer
82 views

Finite difference methods

I am currently applying the finite difference method to the solution of the diffusion equation. I think that a problem has occurred, and is as follows, my explicit method is the most accurate when ...
0
votes
0answers
39 views

Neumann boundary conditions on arbitrary surface for finite difference diffusion

I am facing the following problem, formulated in practical terms: I have a region $\Omega$ in two or three dimensions, represented as a binary mask, and an initial density $u_0$ within that region ...
0
votes
0answers
93 views

Second derivative using Fornberg finite difference method

I have some discrete data, non-equispaced in x, y=f(x). I want to use a numerical finite difference method to calculate the second derivatives of y, at some point. I am using the Fornberg method, ...
2
votes
0answers
42 views

How to determine the order of convergence of the Euler-Maruyama method?

This question is originally posted in Quant.StackExchange but has been unanswered for some time so I ask in here. To make this simple let us consider the Geometric Brownian Motions (GBM). My ...
3
votes
2answers
107 views

Finite difference for a highly nonlinear equation - The wind within the forest

Based on the Navier-Stokes equations and a few parameterizations, the horizontal steady-state wind $u(z)$ within a forest of height H satisfies: $$ a\left(\frac{du}{dz}\right)^2 + b\frac{du}{dz} \...
0
votes
1answer
90 views

Dirichlet boundary conditions in the 1D Heat Equation

Please consider the assignment I have uploaded on the picture. I am confused about the functions $g_L(t)$, $g_R(t)$ and $\eta(x)$. What are they and how do I find them... My question: Is it possbile ...
3
votes
2answers
102 views

Damped Harmonic Oscillation. Efficient algorithm to find the parameters resulting in threshold oscillation amplitude

Let's assume, that we have damped harmonic oscillation of a body in the form of a cone, immersed in a liquid. Equilibrium condition of the body is: $$m\overrightarrow{a} = \overrightarrow{F_\text{...
0
votes
1answer
130 views

Numerically solving a non-linear PDE

I have this non-linear partial differential equation. $$ \frac{\partial C}{\partial t}=\left(\frac{\partial C}{\partial x}\right)^2+C\frac{\partial^2 C}{\partial x^2} $$ I want to use the finite ...
0
votes
0answers
84 views

Double mach reflection at a inclined wedge

I am running into a strange problem when solving the 2D compressible Euler equations on a inclined wedge. To elaborate, my top boundary condition seems to emitting some type of instability. I have ...
0
votes
1answer
66 views

Numerical Stability of a Generalized Spatial Discretization Scheme

After reading the matrix stability chapter (10) of Hirsch [1], I decided to dive in the reference list of the chapter. One of the papers [2], which is cited as reference shows an very interesting ...
0
votes
0answers
51 views

Computationally obtaining the convergence rate of upwind scheme for Advection equation

The Advection equation (with velocity = 1) is $${\partial u \over \partial x} + {\partial u \over \partial t} = 0$$ I am trying to solve the equation with periodic BC. One of the ways to numerically ...
2
votes
2answers
76 views

Stability of Crank-Nicolson for $u_t = iu_{xx}+2iu$

I want to use the Crank-Nicolson scheme to solve the equation $$u_t = iu_{xx}+2iu$$ Here's the analysis: Suppose we make a grid, with $k = dt$ and $h = dx$, the usual notation, and also $u_j^n = u(...
1
vote
0answers
33 views

Boundary conditions for a Non-linear Schrödinger equation using an extended crank nicolson scheme

I try to solve numerically the following PDE for $E(r, z)$ with a cylindrical symmetrie (i. e. $E(r, z) = E(-r, z)$). $\frac{\partial E}{\partial z} = \frac{i}{2k} \Delta E + \mathcal{N}(E)$ Where $...
5
votes
0answers
82 views

Numerical methods for the continuity equation with Sobolev vector field

Consider the continuity equation $$ \partial_t \rho(x,t) + \operatorname{div} (b(x,t) \rho(x,t)) = 0, \qquad t \in [0,T], \quad x \in \mathbb R^N, $$ with $b \in L^1((0,T), W^{1,p}(\mathbb R^N))$. ...
1
vote
1answer
104 views

How to obtain linear tridiagonal system from PDE

I'm trying to re-solve the governing equations in hydraulic fracturing modeling as instructed step by step in a paper. After (A-9), the author stated that by substituting A-6, A-8 and A-9 into ...
1
vote
2answers
87 views

CFL equation for non-linear equation

I am trying to solve numerically (obviously) inviscid Burgers' equation with the finite difference method. The equation is the following: $$ \displaystyle \partial_t u + u \, \partial_x u = 0 $$ ...