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
votes
2answers
46 views

CVODE Warning: Internal t = *** and h = 2.09813e-13 are such that t + h = t on the next step. The solver will continue anyway

I have a system to simulate the bubble evolution at different temperature conditions. I used CVODE_DENSE algorithm to solve the ODEs and get the bubble size and ...
1
vote
0answers
67 views

Finite Difference Approximation for the Laplacian in 2D that produces a nonsymmetric matrix

Consider the following PDE \begin{align} -\Delta u &= f \ \ \text{en} \ \ (0,1)\times (0,1) \label{P1} \\ u &= 0 \ \ \text{en} \ \partial ((0,1)\times (0,1)) \label{P2} \end{align} if we ...
0
votes
1answer
61 views

Finite Difference Method on a function with multiple elements of the same array

First time posting here, so I apologize for any missing info upfront. I am working on a program in VBA that calculates a function (which itself calls another function), then calculates the derivative ...
2
votes
1answer
130 views

Why can bad jacobians sometimes works better for implicit ODE method?

I'm solving a system of stiff ODEs describing atmospheric chemistry and transport. I am using CVODE BDF from Sundials Computing. I have two ways to approximate the jacobian: Allow CVODE to ...
3
votes
0answers
63 views

TVD Lax-Wendroff with non-constant velocity

I am dealing with a linear advection equation with a non-constant velocity, where I would like to apply a TVD Lax-Wendroff scheme in 1D. The equation is the following: \begin{equation} \frac{\...
1
vote
1answer
67 views

Numerical solution to the infinite well problem

I've used the following code to implement it ...
0
votes
1answer
21 views

How to decrease error in (FTCS) forward time centered space method?

I am using the FTCS method for solving differential equations. I know that the condition for stable output is $$ \frac{\alpha \Delta t}{\Delta x ^2} < \frac{1}{2} $$ But when I use the distance ...
0
votes
0answers
34 views

introduction to non-overlapping domain decomposition in 1D

I am new to domain decomposition and have been searching in google for an introduction in 1D which goes over the complete procedure from the continuous to the discrete problem as well as the algorithm ...
1
vote
1answer
102 views

Tensor product representation for the 9-point finite difference approximations for the Poisson equation

If we use 5-point finite difference approximations in a uniform rectangular grid to solve the Poisson PDE \begin{align} -\Delta u &= f \ \ \text{en} \ \ (0,1)\times (0,1) \label{P1} \\ u &= ...
0
votes
1answer
56 views

Compute numerical derivative for first and last points

Considering a centered finite difference approximation for the derivative, what is a reasonable approximation for the first and last points?
1
vote
2answers
172 views

Continuation of solution to $-\nabla\cdot (k(x,y)\nabla u)=f$

I'm trying to solve the following problem, I had previously opened another discussion for the implementation and well, it seems that it has turned out well, it can be found here. I need to calculate ...
3
votes
1answer
101 views

How to find the optimum finite difference method for derivatives?

Related to: What are the negatives of using higher order finite diference schemes? Problem: I have some discrete data of a trajectory $x_t$ with errors $\delta x_t$ of a physical system sampled at ...
3
votes
0answers
60 views

Solving PDEs: What is the best way to deal with non-banded/dense jacobians?

I have a system of PDEs describing atmospheric chemistry and transport. I use finite-differences to make my system of PDEs into a system of ~10,000 ODEs. I then integrate the ODEs forward in time with ...
3
votes
1answer
90 views

Calculating the Jacobian for a function containing a derivative

I have the equation $F(t) = \phi u + \frac{1}{2}\frac{d^2u}{dt^2} + u^3$ and broadly speaking, my task is to calculate the $\phi$ and $u(t)$ such that $F(t) = 0$. I am testing out a new algorithm to ...
0
votes
0answers
34 views

Expression for numerical amplification factor for Euler time integration and CD2 scheme for one degree hyperbolic function

This is the expression to be derived but I am not getting the exact expression as given in the image. Is the given expression given for the implicit Euler method? Here $N_c = c (\delta t)/h$ and $\tan(...
0
votes
2answers
332 views

Implementing routine for $-\nabla\cdot (k(x,y) \nabla u)=f$ in Matlab

I am solving the Poisson Equation for 2D given by the following expression: $$-\nabla\cdot (k(x,y) \nabla u)=f$$ in a rectangle with Dirichlet conditions on the boundary using Matlab. In principle I ...
0
votes
0answers
21 views

Why does this Non-Standard FDTD implementation lead to infinite increase in the magnitude of an EM pulse?

I have been working on a Particle-In-Cell Framework in Python and have noticed an issue where the magnitude of a EM pulse increasing infinitely as the simulation updates. Currently, I am using the Non-...
1
vote
2answers
172 views

why is complex step differentation better than central differences

I came across this post at Cleve's Corner, where he shows that complex step differentiation is more accurate than central differences. The error in both methods is $O(h^2)$. So why exactly does ...
1
vote
2answers
89 views

Stability condition FCTS method

The FTCS method comes from the discretization of a diffusion PDE like this: $$ a^{2} \frac{u_{i+1}^{k}-2 u_{i}^{k}+u_{i-1}^{k}}{\Delta x^{2}}=\frac{u_{i}^{k+1}-u_{i}^{k}}{\Delta t} $$ If I have the ...
-1
votes
1answer
59 views

Howo to implement complex step derivative for complex functions?

I have a complex analytic function of which I want to take the numerical derivative. \begin{align} f(z) &\equiv f(x,y) = u(x,y) + i v(x,y) \\ \frac{d f(z)}{d z} & = \lim_{h \to 0} \frac{f(z + ...
0
votes
2answers
83 views

Stability of the Forward-Time Central Space method, section 9.3 in LeVeque

I am reading section 9.3 in Leveque about stability. The explanations are very short and brief so I am asking for some help to understand and elaborations. The result of the section is that for FTCS ...
2
votes
1answer
130 views

How to discretize a non-linear PDE with boundary conditions and intial value

Consider this non linear PDE: $$u_t + c(u^2)_x =\alpha u_{xx} \text{ , } -1<x<1 , t>0 $$ with $$u(-1,t) = g_L(t) \text{ , } u(1,t) = g_R(t) \text{ and } u(x,0)=f(x) $$ where the 3 functions(...
0
votes
0answers
23 views

Reynolds boundary conditions

I came across this paper comparing various boundary conditions. I am particularly interested to understand how to obtain the Reynolds boundary conditions (refer to equation 28). $$\left( \frac{1}{c} \...
2
votes
1answer
45 views

How to demonstrate the order of convergence of FTBS method for solving a hyperbolic PDE

consider the Purely hyperbolic model problem $$u_t+au_x=0$$ $$u(-1,t)=u(1,t) \text{ (periodic boundary)}$$ $$u(x,0)=f(x)$$ with $f(y)=\sin(2\pi y)$. Furthermore the exact solution is given by $u(x,t)=...
2
votes
1answer
65 views

Solving the 2D Rectangular Waveguide PDE with a Neumann boundary condition for TE modes

I am trying to find the possible modes of a 2d rectangular waveguide by solving the equation, $$\Big(\frac{\partial^2}{\partial x^2} + \frac{\partial^2}{\partial y^2} + \gamma^2 \Big)\psi = 0$$ where $...
1
vote
0answers
47 views

Why is this Advection-convection model with insulating boundary losing mass?

I am trying to model a 1-d advection-convection numerically, using an upwind scheme. I'm using the following equation to calculate the value of internal cells: $$C_x^{t+1} = C_x^{t} + D\frac{\Delta t}{...
1
vote
0answers
47 views

Comparison between stability and accuracy of various Finite Difference schemes

I`m Analyzing the 1D convection equation (PDE) for stability, consistency, and accuracy. I know Both upwind schemes (explicit and implicit) show better stability with a higher number of waves for ...
4
votes
0answers
77 views

Stability of Crank-Nicholson for advection diffusion equation for spatial discretization other than finite differences second-order centered

Crank Nicholson is a time discretization method (see 4th equation here). From what I see around, you can use different space discretization, such as Finite elements. But for the linear advection-...
-3
votes
1answer
78 views

How to avoid negative concentration from numerical solution using FDM scheme?

$\frac{\partial C}{\partial t} + u \frac{\partial C}{\partial x} + w \frac{\partial C}{\partial x} = D \left(\frac{\partial^2C}{\partial x^2}+\frac{\partial^2C}{\partial y^2}\right)-C \cdot \left(\...
1
vote
0answers
51 views

Stability plot of upward difference implicit time

I am analyzing the stability of 1D convection (advection) equation as shown in the picture. When I derive the equations as shown I want to get rid of the complex number. I`m asking if those stability ...
0
votes
1answer
106 views

Discretization of a non-linear ODE using FDM isn't grid indepenent

I am trying to solve the ODE : $\frac{d^2T}{dx^2} = \omega_1 T+\omega_2 T^2$ + using different numerical methods. I have tried the following discretizations so far and none of them seem to be grid ...
1
vote
0answers
39 views

discretization of advection diffusion with variable coefficients

I am looking for help to find a somewhat stable FD numerical scheme for the advection diffusion equation posed on a curve $(x(r),y(r))$. The equation becomes $$u_t=\alpha(r) u_r +\beta(r) u_{rr}+f(r,t)...
0
votes
1answer
69 views

High Running Time and Suboptimal Accuracy of 2D Wave Equation Solver with Finite Differences

Im trying to solve the following 2D wave equation: $$u_{tt} = u_{xx} + u_{yy}, \hspace{3mm} u(x,y,0) = \cos(4 \pi x) \sin(4 \pi y), \hspace{3mm} u_t(x,y,0) = 0$$ with the periodic boundary condition ...
0
votes
0answers
24 views

(FD WENO) Correct symmetry boundary condition for Euler equations

I'm trying to solve 2D Euler equations in axisymmetric formulation with finite-difference WENO scheme. I found some info on high-order boundary conditions for plane formulation (in this thesis, for ...
0
votes
1answer
64 views

2 point BVP solver: how to compute errors

Background I am working with chapter 2 in LeVeque's book: https://faculty.washington.edu/rjl/fdmbook/ I have build my own solver in Python to solve the 2 point BVP: $$ \epsilon u''+u(u'-1) =0 , \\ u(0)...
0
votes
1answer
109 views

Trouble Implementing 1d Wave Equation Finite Difference Solver

Im trying to solve the 1d Wave Equation on $x \in \mathbb{R}, t > 0$: $$u_{tt} = c^2u_{xx}, \hspace{5mm} u(x,0) = \cos(4 \pi x), \hspace{5mm} u_t(x,0) = 0$$ with $c = 1$ and a periodic boundary ...
2
votes
0answers
63 views

Divergence on wave equation simulation

I'm currenly working on my own PDE solver for non-linear simulations in python. I've done succesfully simulations for KdV and Fisher's equation, but now I'm playing with second order derivatives in ...
0
votes
1answer
79 views

Incorporating heat flux into Laplace Equation

I need to find the temperature distribution of a square plate using the Laplace equation by using FDM: $$ \frac{d^2T}{dx^2} + \frac{d^2T}{dy^2} = 0$$ But there is a heat flux entering from the top ...
1
vote
0answers
40 views

Results blow up when number of intervals is increases (Yee algorithm FDTD, dielectric sphere)

I have been trying to write a program that analyses EM wave scattering by a dielectric sphere for a project. The reference is Sadiku's book Numerical Methods in electromagnetics Edition 3. Now the ...
2
votes
0answers
70 views

Linearising Nonlinear Coupled Partial Differential Equations - Alfvénic Diffusion

I am trying to solve the following coupled partial differential equations with a finite difference scheme: $$\partial_tf+v\partial_zf+\partial_z\frac{1}{W}\partial_zf=0$$ $$\partial_tW+v\partial_zW-\...
2
votes
0answers
42 views

How to solve this boundary value problem which has more unknown than equation on MATLAB

I need your helps about solving the problem below with MATLAB. I am trying to solve 2D Stress Wave Propagation problem by using FDTD(Finite difference time domain) method on the cylindrical coord. I ...
0
votes
0answers
30 views

velocity in CFL condition

I am studying the evolution of the density and velocity field of a core in a molecular cloud in 1 D. I defined the radial grid (let us say x between 100 and 101) and the time grid. I am using the ...
0
votes
0answers
55 views

Numerical dispersion in FDTD

I was reading the book "Computational Electrodynamics: The FDTD method" by Taflove and Hagness, probably the most cited book when it comes to the FDTD method in Electromagnetics. In the ...
3
votes
1answer
74 views

Maintain unitary time evolution for a nonlinear ODE

I want to solve a nonlinear ODE of matrix $A(t)$ $$\mathrm{i}\dot A = A(t)M(t),\:\mathrm{with}\: M(t)=A^\dagger(t)H(t)A(t)$$ where $H(t)$ and hence $M(t)$ are Hermitian. Therefore, I presume the time ...
0
votes
0answers
95 views

Why does FDTD and FIT disregard Gauss's law?

This is a reformulation of a question I asked a couple of days ago. I'm posting it again because I believe the previous post was very unclear, I will probably delete the previous question. My question ...
0
votes
1answer
113 views

Verification of order of convergence of Implicit Euler Method to numerically solve Black-Scholes PDE

I'm trying to verify the order of convergence for implicit Euler method to numerically solve Black-Scholes PDE. Theory says that it should be $O(\Delta t + \Delta S^2).$ My code is working absolutely ...
0
votes
0answers
44 views

When to stop iterations in SOR solver for 3D Poisson equation

I'm writing a solver (in C) for 3D incompressible fluids, using the finite-differences method, and I'm finding a somewhat surprising behaviour: the solver provides "good-looking" solutions, ...
0
votes
1answer
92 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
0answers
144 views

“This DAE appears to be of index greater than 1” daeic12 (line76) error code

Hi I am trying to solve a set of pde converted into ODE and DAE using central finite difference method. I have used the MATLAB 'solve' command to determine the coefficients of fictitious nodes for ...
0
votes
1answer
95 views

Compute 1st derivative with backward difference approximation in python

I am trying to write a function to compute 1st derivative with backward difference approximation. $ u'(x_i) = \frac{u(x_i) - u(x_i - \Delta_x)}{\Delta x} \equiv D_- u(x_i).$ And for the first point, ...

1
2 3 4 5
15