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
3 votes
1 answer
46 views

ON the Kronecker product form of the laplacian matrix

It's well known that if we use 2nd order, centered, finite differences for the Laplace operator, we have that the matrix can be written as $$K=I \otimes A + A \otimes I $$ where $I$ is the identity ...
0 votes
1 answer
70 views

Convergence stall when solving 2D Poisson PDE with pure Neumann boundaries (finite differences)

I recently started coding a small library of 2D PDE solvers (time dependent and time independent), and my first attempt was a 2D Poisson equation of the form: $$\nabla(\epsilon\nabla\varphi)=\nabla\...
0 votes
1 answer
228 views

Implementing Dirichlet BC for the Advection-Diffusion equation using a second-order Upwind Scheme finite difference discretization

i am implementing a Matlab code to solve the following equation numerically : $$ (\frac{\partial c}{\partial t} =-D_{e} \frac{\partial^2 c}{\partial z^2} +U_{z}\frac{\partial c}{\partial z}) $$ with ...
0 votes
1 answer
111 views

What's Kane S. Yee who invented FDTD in Chinese?

I'm not sure if the question suits this section of StackExchange, but I think the chance to get the answer is highest here (compared with other forums). So I hope more tolerance could be shown towrad ...
2 votes
1 answer
95 views

Stepping over a rapid oscillation in advection

As a model of a more complex problem, I am studying a linear advection equation with a rapidly oscillating velocity $$ \partial_t u + a \cos(\omega t) \partial_x u = 0 $$ with initial condition $u(x,0)...
0 votes
0 answers
57 views

Solving a system of PDEs with an ODE

I want to solve the following system of equations which consists two PDEs and one ODE: \begin{align} \rho_t+v\rho_x &= 0; \newline Y_t+vY_x &= 0 ;\newline v_t &= -\frac{1}{(\...
3 votes
1 answer
125 views

Does DCT diagonalize the FD discretisation of the Laplacian with Neumann boundary conditions?

If one has the Poisson problem (assume $\int_{\Omega} f = 0$ and $\int_{\Omega} u = 0$): \begin{alignat}{3} \Delta u(x) &= f(x), &\quad&x\in\Omega \\ \partial_nu(x) &= 0, &\quad&...
0 votes
1 answer
49 views

How to solve advective equation with source term depending on variable

I have the following equation $$ \dfrac{\partial s}{\partial t} + \nabla \cdot \left( \vec{v} s\right) = f(s) $$ Where $f(s)$ is an explicit source term that depends on $s$, e.g., ($\sin(s)\;cos(s)$). ...
10 votes
2 answers
8k views

Use of machine learning in computational fluid dynamics

Background: I have only built one working numeric solution to 2d Navier-Stokes, for a course. It was a solution for lid-driven cavity flow. The course, however, discussed a number of schemas for ...
-1 votes
0 answers
47 views

Initial value problems for PDE using finite difference method

I am new to numerical calculations. Recently I learned something about the finite difference method(FDM) and its applications in solving PDEs. For PDEs with initial and boundary conditions, I can ...
3 votes
0 answers
65 views

Solving simplified 1D plasma fluid equations with finite difference

The following two equations represent a simple model of a plasma where ions are immobile. $$n\frac{\partial u}{\partial t}+nu\frac{\partial u}{\partial x}=n\frac{d\phi}{dx}-\theta\frac{\partial n}{\...
2 votes
1 answer
493 views

How do you handle the singularity in polar or cylindrical coordinates?

Governing equations in polar or cylindrical coordinates often have terms with $\frac{1}{r}$ involved. At $r = 0$, such terms blow up to become a "singularity." The Cartesian version of such ...
1 vote
1 answer
75 views

finding discretization error in Burger equation

I was reading the paper given in the link http://www.unige.ch/~hairer/preprints/parareal.pdf and I have a problem in understanding in page 10 for the Burger equation on implementing Parareal method ...
4 votes
1 answer
110 views

How can I check mass conservation when solving the advection equation using an upwind scheme?

My question is how to keep track of the "mass" being advected out of a model domain, for the 1-D advection equation, and an upwind differencing scheme. Following is the background Consider ...
4 votes
0 answers
53 views

Dense factorization specialized for RBF-FD method

In RBF-FD methods (see Fornberg & Flyer. A Primer on Radial Basis Functions with Application to the Geosciences. SIAM, 2015. Chapter 5.), the finite-difference stencil coefficients for a set of ...
0 votes
0 answers
28 views

How to define a stretched coordinate perfectly matched layer (PML) parameters for maximum absorbtion?

I have written a MATLAB code for solving Maxwell's equations (electromagnetic wave propagation) in 3D with perfectly matched layer (PML) boundaries. I am using a stretched coordinate PML, but I see ...
1 vote
0 answers
32 views

Calculating the species mass consumption from implicit reaction-term in diffusion-reaction equation

The 1D diffusion equation with a chemical source term has the following form: $$\frac{\partial Y}{\partial t} = D \frac{\partial^2 Y}{\partial x^2} - k Y,$$ where $Y$ is the molar concentration of the ...
2 votes
1 answer
304 views

Is there a simple way to avoid carbuncles for FD WENO methods?

I have implemented finite-difference WENO scheme for Euler equations (with some variants - WENO-JS, WENO-Z, WENO-M, different flux splitting). It works well, but have problem with so-called carbuncles ...
1 vote
0 answers
30 views

How does Tannehill impose boundary conditions when coding the Parabolized Navier Stokes on an Implicit Finite Differences Scheme?

I'm trying to implement the scheme he describes on his book "Computational Fluid Mechanics and Heat Transfer" on Chap.9 and I'm having trouble imposing BC. I don’t get how he imposes them. I ...
2 votes
1 answer
2k views

CFL condition and Lax-Friedrich numerical flux

I got confused when trying to implement a scheme using Lax-Friedrichs numerical flux for a system of equations in 1D. According to my notes Lax-Friedrichs numerical flux is $$f_{LF}(u_l,u_r) = \frac{...
2 votes
1 answer
110 views

"A posteriori" estimates for finite difference methods

Suppose I have a PDE in a rectangular domain that I am solving numerically via a finite difference method. How do I answer the question, "How fine do I need to make the grid to so that my ...
1 vote
1 answer
141 views

A question on the Poisson equation with Neumann and periodic boundary conditions on a rectangular region

I am trying to solve the following PDE by using finite difference \begin{eqnarray*} \Delta u&=& f ~~on~~(0,1)\times(0,1)\\ \frac{\partial u}{\partial y}(x,0)&=&0=\frac{\partial u}{\...
1 vote
1 answer
139 views

Numerical solution of 2D wave equation using Fourier transform and finite differences

This is the $2$-dimensional wave equation $$ u_{tt} = u_{xx} + u_{yy} $$ with initial condition $u(x,y,0)=f(x,y)$ and $u_{t}(x,y,0) = 0$. The inverse Fourier transform used is $$ u(x,y,t) = \iint \hat{...
1 vote
0 answers
105 views

Closed (Robin) boundaries in advection-diffusion equation with FDM

I am solving the equation $$ \frac{\partial \phi}{\partial t} = \frac{\partial}{\partial x} \left( D \frac{\partial \phi}{\partial x} + v\phi \right) $$ using finite differences. I want to include ...
2 votes
0 answers
73 views

How to accelerate the computing of implicit finite difference method for heat conduction between two solids

Edit on May 3rd: I have found the problem. Because the difference of between $k_1$ and $k_2$ is huge, a very small time step need to be chosen so that the right green part can "feel" the ...
1 vote
1 answer
95 views

constructing a symmetric matrix for finite difference

I come across the following operator in a paper $\mathcal{I}\psi = \psi_{xxxx} + (r~\psi_x)_x$, where $\psi=\psi(x)$ and $r=r(x)$. Periodic boundary condition is employed. It claims that the operator $...
-1 votes
1 answer
75 views

The local and average Nusselt number in a square cavity

I am in the process of programming the local & average Nusselt number in a left vertical wall but my Matlab script gives me inappropriate values and it doesn't change with changing of Rayleigh ...
2 votes
0 answers
65 views

Numerical scheme for the heat equation on the icosahedral hexagonal grid

I have a predefined grid(like this) that is spawned from a regular icosahedradron. It consists of many hexagons and 12 pentagons (corresponding to icosahedradron vertexes). I can tweak the granularity ...
1 vote
0 answers
87 views

Open boundary condition for 1d wave equation with variable wave speed using finite differences

I have implemented a finite difference solver for the 1d wave equation with variable wave speed: $$ u_{tt} = c(x)u_{xx}, \hspace{10mm}c(x) = \dfrac{6 -x^2}{2} \hspace{5mm} $$ on $-2 \leq x \leq 2, t &...
0 votes
2 answers
106 views

Eigenvectors of Laplacian

I am studying introduction to Multigrid methods. In all tutorials, authors write that eigenvectors of Laplacian (1D, finite difference) are given as $w_k(x_i) = \sin(k \pi x_i),$ where $x_i$ is a ...
0 votes
1 answer
55 views

How can I correctly determine velocity of a point inside a grid after using mixed finite element method to solve Poisson equation?

I am using the mixed finite element method (MFEM) to solve the Poisson equation: $$\Delta h = 0,$$where $h$ denotes hydraulic pressure. The MFEM could determine the normal flux rate, $q_n$, through ...
3 votes
1 answer
123 views

Mineral dissolution and solute transport around a solid

I am trying to simulate solute transport of acid (HCl) and consequent mineral dissolution around a grain (calcite). The governing equation for transport is the advection-diffusion equation, given as: ...
2 votes
1 answer
76 views

Shock Capturing Methods for Shallow Water Equations

I am looking for some help finding a numerical solution to the shallow water equations: $\partial_tu+\partial_x(u^2/2+g\eta)=0$ $\partial_t \eta+\partial_x(u\eta)=0$. where $u$ is the depth averaged ...
0 votes
0 answers
52 views

Oscillating eigenvectors for 2d-laplace operator

I am trying to calculate the eigenvectors of a Laplace-operator in 2d, with boundary conditions equal to $u=0$ if $x, y$ are outside of a rectangle defined as $(0.5, 0.5), (1.5, 1.5)$. For that I used ...
2 votes
0 answers
106 views

solve Ax=b for outrigger A matrix python

I implement Crank-Nicolson 2D finite-difference method. I get a matrix A which is banded with 1 band above and below the main diagonal, but also contains 2 additional bands , further apart from the ...
3 votes
1 answer
63 views

Requesting for Finite Difference Methods reference in Portuguese or English

Crossposted on Mathematics SE I have been assigned a group project for an introductory Linear Algebra subject on Finite Difference Methods and sparse matrices. Our professor advised we use Gilbert ...
0 votes
0 answers
20 views

Transparent Boundary Conditions relationship with intermediate BCs in ADI-PR method

I have read some materials about ADI - PR method with the aim to understand how to put boundary conditions in my 2D scheme which solves the Time-Dependent Schrodinger Equation. All the theory I read ...
0 votes
0 answers
60 views

Transparent Boundary Conditions for Finite Difference ADI PR 2D TDSE solution

I want to put (non-dirichlet) boundary conditions inside the code I wrote to solve the 2dim TDSE using the alternating direction implicit Peaceman - Rachford method. $$ (1 + iB\Delta t/2 ) \psi^{n+1/2}...
0 votes
0 answers
103 views

Finite difference solver for the 2D Poisson's equation with an integral boundary condition

I wanted to attempt an implementation of a finite-difference-based solver for the 2D elctrostatic Poisson equation when metallic objects are present. Also, I hope to take as input, the location of ...
2 votes
1 answer
135 views

Index reduction of a DAE from a PDE system

I have a system of 2 non-linear, coupled PDEs that I would like to transform to a stiff ODE system to solve them using the method of lines. The 2 equations: $$\begin{align} \frac{\partial \phi}{\...
4 votes
0 answers
1k views

What is the difference between SSPRK3 and RK3 time discretization methods?

Here, SSPRK3 refers to third order strong stability preserving Runge-Kutta and RK3 refres to regular third order Runge-Kutta method. The meaning of the method is obvious from the name. However there ...
3 votes
1 answer
135 views

Comparison on adaptive mesh refinement on finite elements and finite differences

My current work requires using (Adaptive Mesh Refinement) AMR to resolve multi scale physics. I have a general question whether finite element is better than finite difference in this aspect or not. I ...
9 votes
4 answers
516 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 ...
0 votes
0 answers
88 views

Weighted Jacobi Not Working on 1D Poisson (Issue with Optimal $\omega$)

I've been trying to learn some numerical linear algebra, and I decided to try to implement the weighted Jacobi method to the 1D Poisson problem $$-u''(x)=f(x),\qquad u(0)=a,\ u(1)=b,$$ where we ...
3 votes
3 answers
2k 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 ...
0 votes
0 answers
26 views

Need help in attempting to solve an MHD eigenvalue problem

Background I am attempting to numerically solve the ideal MHD equations in normal mode form for a Harris current sheet. The linearized perturbed MHD equations can be written in a normal mode form: $$ -...
0 votes
1 answer
51 views

What does it mean for a finite difference method to be conditionally stable? Specifically when solving the diffusion equation

The diffusion equation is ∂u/∂t =∂^2u/∂x^2. Consider using an explicit finite difference method to solve it. What does it mean for that explicit finite difference method to be conditionally stable?
0 votes
0 answers
47 views

How do I identify negative group speeds?

This question is a continuation of one of my other questions. I've been trying to show that collocated (non-staggered) grids can suffer from negative group speeds in the linearized shallow water ...
4 votes
1 answer
115 views

Method to linearize highly nonlinear partial differential equation

I have a set of coupled pdes which I want to solve using finite-difference, of which one is nonlinear. The three linear pdes for quantities $T_f$, $T_s$ and $c$ are convection-diffusion-reaction-like ...
2 votes
1 answer
154 views

Interpolating the gradient of a cylindrically symmetric potential field expected obey the Laplace equation, especially near/across r=0

The script below tries to implement a Jacobi iterative relaxation of a potential field for an electrostatic lens. In order to plot electric field lines and calculate trajectories for charged particles,...

1
2 3 4 5
16