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
0answers
48 views

How to make a directed graph symmetric?

Say I have a directed graph given as an adjacency matrix $A$ in CSR format represented by the arrays ia (row indexes) and ja (...
1
vote
2answers
90 views

How to apply central difference to viscous fluxes in 2D Navier-Stokes equations?

I'm trying to solve 2D unsteady compressible Navier-Stokes equations with finite-difference or finite-volume method. Here is the system, it's pretty standard: $$ \frac{\partial U}{\partial t} + \frac{...
1
vote
1answer
57 views

Finite Difference for Advection Equation With Source

I'm trying to find a convergent finite difference scheme for the PDE \begin{equation} \begin{split} u_t + (x-1) u_x &= (x-1)u, \hspace{.5cm} x \in [0,1] \\ u(x,0) &= 1 \\ u(1,t) &= 1. \\ \...
0
votes
0answers
49 views

Solving 1D wave equation with finite difference method

I've written a code in Python to solve the 1D wave equation with the finite difference method (the explicit and the implicit methods). I'm trying to perform a mesh convergence study to estimate the ...
2
votes
0answers
37 views

In sights into why higher order finite differencing method leads faster to instability

I was playing around with numerically solving the 1D wave equation with density and stiffness varying with position using central differencing methods and noticed that for certain discretization steps ...
0
votes
0answers
48 views

Finding a CFD paper with extra degree of freedom variable in mass conservation

I am trying to find a paper that I saw about a year ago. I am not sure of the actual date of the paper. I believe it was a finite difference CFD paper. The interesting part of the paper was the ...
1
vote
1answer
45 views

How I can derive the Neuman boundary condition of this system of hyperbolic equations in 1D?

I would like to research the Neuman boundary that can verify the following problem $\begin{aligned} &\text { (} P \text { )}\left\{\begin{array}{l} \frac{\partial U}{\partial t}(x, t)+A \frac{\...
0
votes
0answers
32 views

discretizing advection equation with variable wave speed + stability

I currently have a code that solves $u_t+ cu_x=0$ with periodic boundary conditions, and constant $c$ (using an upwind method). I'm wondering how I would alter this code to solve something of the form ...
2
votes
1answer
105 views

(Lack of) Availability of Finite-Difference library for simple 2D PDEs

I would like to solve two types of simple 2D problems, namely the stationary heat equation on an L shaped geometry like this: And also compute the magnetostactic field in an air gap of the following ...
2
votes
0answers
45 views

Haw to apply central difference to viscous flux in energy equation?

In many modern papers Navier-Stokes equations are solved with finite-difference or finite-volume methods using WENO reconstruction for non-viscous fluxes and central differences for viscous ones. It ...
5
votes
0answers
56 views

2nd-order TVD criteria for flux-limiter

Consider a nonlinear hyperbolic conservation equation: $$ \partial_{t}u = -\partial_{x}f(u) $$ The spatial derivative of $f(u)$ may approximated after a spatial discretization by $x_{j}=j\Delta x$ $$ \...
3
votes
1answer
90 views

Dirichlet Boundary Condition finite difference method using sparse-matrix $Ax = b$ system

I am trying to solve the boundary value problem for heat equation: $$ u_{xx} + u_{yy} = f(x,y) $$ where the solution $u(x,y) \in [0,1] \times [0,1]$ and the Dirichlet boundary condition $u(x,y) = ...
2
votes
2answers
105 views

Simplest way to “upgrade” from Euler equations to Navier-Stokes equations in FV or FD framework

I have quite a lot of experience solving unsteady Euler equations, including multi-component ones, with in house-coded finite-difference and finite-volume methods, including MacCormack and MUSCLE ...
4
votes
1answer
84 views

Accuracy of Explicit Euler method (finite difference) decreases as Δx decreases, shouldn't it increase?

The price of a commodity can be described by the Schwartz mean reverting SDE $$dS = \alpha(\mu-\log S)Sdt + \sigma S dW, \qquad \begin{array}.W = \text{ Standard Brownian motion} \\ \alpha = \text{ ...
1
vote
1answer
68 views

How is the mixed 2nd partial derivative simplified to a more efficient form?

I'm implementing the Finite Different 2nd and 3rd derivatives in my research and naturally I'm looking for the most efficient approach. From https://en.wikipedia.org/wiki/Finite_difference#cite_ref-...
1
vote
1answer
72 views

If analytically, a function is not differentiable at a point, does it make sense to write a finite difference code for the function at that point?

What would happen if I wrote a finite-difference code evaluated at a point where the function isn't differentiable analytically? I'm trying to think analytically vs numerically. Thanks,
0
votes
0answers
99 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}\...
1
vote
1answer
74 views

3D laplacian operator

I have been unable to find the equivalent of the 5-point stencil finite differences for the Laplacian operator. In 2 dimensions for me it is clear that, using the finite difference method: $$ \nabla_{...
2
votes
1answer
61 views

Parity for artificial dissipation term in a finite-difference solution

I have a doubt regarding the signal of the dissipative term in a finite difference solution for an equation of the form $$ \frac{\partial u}{\partial x}+f(x)=0, u(0)=0 $$ In which $f$ is an odd ...
0
votes
0answers
44 views

numerical solution to pde on an ellipse

Looking for advice on discretization (preferably finite difference) schemes for pdes on curves in general, but in this case it is an ellipse (so given by $(a\cos(r), b\sin(r)$). The problem is the ...
0
votes
2answers
89 views

No flux Neumann boundary condition for non-stationary PDE equivalent to Dirichlet boundary?

When using no flux Neumann boundary conditions (i.e. zero derivative to the normal on the boundary) in a non-stationary PDE, I don't seem to recognize the difference to using Dirichlet boundary ...
2
votes
1answer
76 views

Method of Lines: How to simplify Jacobian with periodic BCs?

Consider the advection equation $$\frac{\partial u}{\partial t}+c(x)\frac{\partial u}{\partial x}=0.$$ With periodic boundary condtitions in $x$ with period $L$, i.e. $u(x,t)=u(x+L,t)$ and initial ...
7
votes
3answers
323 views

Finite-difference software for solving custom equations

Are there any good, easy to use, software for simulating the evolution of systems of generic differential equations? I know there are custom programs for various specific circumstances (such as ...
1
vote
1answer
75 views

Problems with manufactured solutions for 1D inviscid burgers' equation

I'm having an issue with the easiest example of a nonlinear 1D PDE, the (inviscid) burgers' equation: $u_t + uu_x = 0,~~(1)$ which can be rewritten as some convection equation $u_t + f(u)_x = 0$ with ...
1
vote
0answers
57 views

1-D Conduction Steady state heat transfer using FD

I have tried to solve 1-D Conduction Steady state heat transfer problems in Matlab (see below). Here is the 1-D model: T''[x] == 0, T[0] == 100, T'[100] == 0 ...
4
votes
1answer
106 views

Imposing no flux boundary conditions on variants of the Cahn-Hilliard equation using Finite Differences in Python

I have been looking into simulations of phase separation in variants of the Cahn-Hilliard system and have been running into issues with implementing no flux boundary conditions on certain variants. ...
0
votes
0answers
26 views

Choosing appropriate timestep for FDTD and PIC algorithms

I'm doing some particle-in-cell (PIC) simulations of propagation of short pulses in plasmas with a widely used code. This code uses Yee's field solver. So, the timestep must be lower than the Courant ...
1
vote
2answers
201 views

Solve wave equation with discontinuous coefficients numerically?

I would like to solve the following equation $$\frac{\partial^2 y}{\partial t^2} - c^2(x,t)\frac{\partial^2 y}{\partial x^2}=0,$$ for $y=y(x,t)$ numerically. The wave speed, $c(x,t)$, is of the form $$...
7
votes
1answer
372 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 ...
0
votes
0answers
56 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 ...
0
votes
1answer
48 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 ...
0
votes
1answer
87 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 ...
2
votes
1answer
64 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
2answers
156 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 ...
2
votes
2answers
128 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
44 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
56 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
125 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
35 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 ...
2
votes
1answer
107 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
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 ...
4
votes
2answers
181 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
99 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
195 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 ...
0
votes
1answer
72 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
22 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 ...
1
vote
1answer
32 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
6k 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
42 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
28 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
2 3 4 5
14