Questions tagged [finite-difference]
Referring to the discretization of derivatives by Finite differences, and its applications to numerical solutions of partial differential equations.
855
questions
3
votes
1
answer
180
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 ...
0
votes
0
answers
45
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 ...
3
votes
1
answer
175
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 ...
1
vote
1
answer
82
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 ...
1
vote
1
answer
72
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 ...
2
votes
1
answer
97
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 \...
0
votes
1
answer
139
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
...
0
votes
0
answers
35
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?
0
votes
1
answer
85
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) (...
0
votes
0
answers
37
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 ...
1
vote
2
answers
180
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 ...
0
votes
0
answers
86
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.
...
2
votes
2
answers
100
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 ...
2
votes
1
answer
137
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 ...
1
vote
0
answers
32
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 ...
3
votes
1
answer
191
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{...
1
vote
0
answers
96
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)...
0
votes
2
answers
121
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 $...
2
votes
0
answers
63
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 ...
3
votes
1
answer
304
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 ...
2
votes
0
answers
108
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,\...
3
votes
1
answer
196
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 ...
1
vote
0
answers
67
views
Can I apply the product rule for the following finite difference discretization
I would like to know if the following discretization is correct. Here D is the dispersion, C is the concentration. Both D and C are varying with space. Here n+1 represents the unknown time level. I ...
1
vote
1
answer
102
views
Isolating decaying solutions to nonlinear second-order ode
I need to solve a nonlinear ODE of the form
$$
\frac{d^2 y}{dx^2} + \frac{1}{x}\frac{dy}{dx}-\frac{1}{x^2}\sin(y)\cos(y)+\frac{2}{\alpha}\frac{\sin^2(y)}{x}-\sin(y)=0
$$
numerically, subject to the ...
0
votes
0
answers
28
views
Parallel Block-Structured class abstraction for FDM
I’m currently developing a FDM/FVM (using contravariant coordinates) code using Fortran and Co-Arrays (SIMD, in general), and so far I have all sparse matrix (BiCGStab, working on AMG) solvers and ...
0
votes
0
answers
28
views
How can i model upward natural convection in various angles (0 - 90)?
I am looking for a way to numerically solve the Naiver-Stokes equations for steady incompressible flow using FDM over a surface with various angles?
1
vote
1
answer
144
views
Crank Nicolson Method with closed boundary conditions
I want to simulate 1D diffusion with a constant diffusion coefficient using the Crank-Nicolson method.
$$\frac{\partial u (x,t)}{\partial t} = D \frac{\partial^2 u(x,t)}{\partial x^2}.$$
I take an ...
0
votes
1
answer
57
views
Oscillation in non-linear porous flow solved by finite difference
I am trying to solve numerically the flow of a gas through a porous, spherically symmetric body. The non-dimensional equations read:
$$
\frac{\partial\rho}{\partial t}+\tau\frac{1}{r^2}\frac{\partial}{...
6
votes
1
answer
129
views
Numerical artefacts in solution of spherical heat equation using FDM
I was attempting to solve the diffusion equation for a solid sphere using a naive FDM scheme. The governing PDE for the scalar concentration field $u(r,t)$ is
$$
u_t = r^{-2}(r^2 \alpha u_r)_r, \quad ...
0
votes
0
answers
39
views
fdtd ansys Lumerical vs fresnel solution
I am comparing reflectance intensity of silicon structure with a hole. I am getting oscillating solution for 0 roughness factor in equation based model. but spectrum shape of fdtd and equation based ...
11
votes
1
answer
1k
views
Is using iterative methods to solve a linear system always superior to inversing the matrix?
I have a silly question. Is it always more computationally efficient to use iterative methods to solve for some matrix $A$, $Ax=b$, where $x$ and $b$ change but $A$ stays constant, compared to ...
0
votes
1
answer
43
views
How to address the element face adjacent to boundaries when the finite difference method and marker-and-cell scheme are used to solve the Stokes flow?
The Stokes equations are
$$-\Delta \mathbf u + \nabla p = f \text{, in }\Omega,$$ and
$$ -\nabla \cdot \mathbf u = g, \text{ in } \Omega$$
where $\mathbf u = \left( u, v \right)$ is the flow ...
1
vote
1
answer
112
views
how to solve a coupled nonlinear partial differential equations(Boundary Value Problem)
So far, I have been looking into linear and nonlinear differential equations(Boundary value problem) that look like the following:
$\frac{d^2 \theta}{dz^2} + \sin(\theta) = 0$
I am now familiar with ...
3
votes
0
answers
150
views
Python code of explicit method of a nonlinear a BVP
I am trying to have a Python code for the following nonlinear BVP:
$$\frac{\partial N}{\partial t}=\frac{\partial^2 N}{\partial x^2}+N(1-N)-\sigma N$$ $$N(0,x)=\sin(2\pi x)$$
$$N(t,0)=0 \hspace{3mm}N(...
1
vote
1
answer
61
views
Once Lyapunov exponents have converged, can they diverge again?
I know the strength of attraction for a single attractor might vary from place to place. Say, if I calculated the Lyapunov exponents for a small portion of the attractor and they have already ...
2
votes
1
answer
112
views
How to numerically solve differential equations involving sines, cosines and inverses of the unknown function?
I'm very new to finite difference method and I am just introduced to methods of solving differential equation using finite difference method via sparse matrix method.
I find that the main idea is to ...
1
vote
3
answers
226
views
Partial derivatives for triangular meshes (in 3D)
A grid offers an obvious definition for the partial derivatives at a grid point, given
$x$ the value of a point $p$ in an $n$ dimensional grid, the forward partial derivative that point for coordinate ...
0
votes
0
answers
39
views
Refluxing step on Finite difference AMR
Hi I am a computer scientist working on MHD code for astrophysics simulation. We use a finite difference scheme where we first solve the spatial derivatives and with them solve the right hand side and ...
0
votes
0
answers
74
views
Encountering blow-up when solving the one-way heat equation using Lax-Wendroff
This is my first time attempting to implement a finite difference method for a PDE in Python, and I am having a bit of trouble. The PDE I am trying to solve is as follows:
$$
\begin{cases}
...
1
vote
0
answers
49
views
Need help implementing finite difference Beam Propagation Method to Solve 2-D Helmholtz equation
I am trying to implement beam propagtion method in a two-dimensional lattice to solve Helmholtz equation by following the scheme given this paper. I am using Matlab for implementation.
The expected ...
3
votes
1
answer
89
views
A question related with $p$-Laplacian and conjugate gradient method
I have the following energy functional of $p$-Laplacian equation:
$$
E(u) = \frac{1}{p} \int_{\Omega} |\nabla u|^p dx
$$
for $2.8 \leq p \leq 5$.
My goal is to minimize the energy functional by using ...
2
votes
0
answers
146
views
Poisson equation solution in a semiconductor structure
I am trying to solve the $\textbf{1-D}$ Poisson equation for a semiconductor structure at equilibrium (There is no external bias applied).
$\textbf{Background}$
\begin{equation}
\frac{d^2V}{dx^2} = -\...
0
votes
1
answer
73
views
On solving a first order nonlinear differential equation
It all starts with this Cauchy problem:
$$
\begin{cases}
\sin(2x(t)) -\cos(3x'(t)) = x(t) + x'(t) \\
x(0) = 1 \\
\end{cases}
\quad \quad \text{with} \; t \in [0,10]\,.
$$
Not knowing which way to turn,...
2
votes
2
answers
227
views
Solving 2D Poisson equation with nonhomogeneous boundary conditions (Dirichlet) and a source
I am a physicist who is fairly new to numerical analysis, currently, I am trying to simulate a non-linear paraxial equation, and part of my calculation involves solving a 2D Poisson equation with ...
0
votes
0
answers
55
views
Solving Laplace for Velocity Potential in Constricted Channel
I am trying to solve the 2D Laplace equation numerically to give the velocity potential of a fluid flowing in a channel with a constriction:
$u_{xx}+u_{yy}=0$
There is a constriction in the channel at ...
2
votes
0
answers
100
views
Scipy.root not converging even when provided with initial guesses very close to solution
I've made a previous question here and also in SO wondering why only the fsolve solver converges for the simple one dimensional unsteady conduction problem
$$ \frac{\partial T}{\partial t} = \alpha \...
0
votes
2
answers
305
views
Why is this scipy.root code not converging?
I'm running a test problem to set up larger problems. Solving the simple unsteady heat equation via finite differences:
$$ \frac{\partial T}{\partial t} = \alpha \frac{\partial^2T}{\partial x^2}$$
$\...
1
vote
0
answers
84
views
How to include zero flux boundary conditions?
I am trying to solve the following differential equation in the domain of $\theta \in [0, 2 \pi]$ using finite differences scheme:
For $0< \theta \leq \pi$
\begin{align}
\rho_i^{n+1}=\rho_i^{n}+D\...
1
vote
0
answers
101
views
A staggered grid for an eigenvalue problem (linear stability analysis)
I'm interested in extending the concept of a staggered grid (commonly used to solve the incompressible Navier-Stokes equations) to a linear stability analysis context. For example, we can consider ...
2
votes
1
answer
134
views
Computing numerical derivatives
I am trying to create a sweeping surface, for which I need the frenet frame of a curve. I am trying to compute this for arbitrary curves but for testing I am just using the parametric unit half circle....