Skip to main content

All Questions

Filter by
Sorted by
Tagged with
2 votes
1 answer
232 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(...
econmajorr's user avatar
2 votes
1 answer
220 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)=...
k.dkhk's user avatar
  • 255
2 votes
1 answer
389 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 $...
mnuizhre's user avatar
  • 123
1 vote
0 answers
109 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}{...
JMenezes's user avatar
  • 119
4 votes
1 answer
139 views

Solving geodesics on triangular meshes gives negative distances

I have implemented the heat method for geodesics: https://www.cs.cmu.edu/~kmcrane/Projects/HeatMethod/paperCACM.pdf When I run it I am getting a solution that, visually, seems correct: In this image, ...
Makogan's user avatar
  • 379
1 vote
0 answers
150 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 ...
Abdelrahman Mabrouk's user avatar
5 votes
0 answers
450 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-...
Millemila's user avatar
  • 445
-3 votes
1 answer
173 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(\...
vincent's user avatar
1 vote
0 answers
60 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 ...
Abdelrahman Mabrouk's user avatar
0 votes
1 answer
225 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 ...
R Surya Narayan's user avatar
1 vote
0 answers
76 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)...
lrs417's user avatar
  • 11
0 votes
1 answer
118 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 ...
Pame's user avatar
  • 123
0 votes
1 answer
116 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)...
k.dkhk's user avatar
  • 255
0 votes
1 answer
1k 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 ...
Pame's user avatar
  • 123
2 votes
0 answers
167 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 ...
Rafael Riveros Ávila's user avatar
0 votes
1 answer
214 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 ...
justauser's user avatar
  • 145
1 vote
0 answers
60 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 ...
Hridey's user avatar
  • 41
2 votes
0 answers
89 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-\...
Hanno Jacobs's user avatar
2 votes
0 answers
81 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 ...
Mechasteel's user avatar
3 votes
1 answer
151 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 ...
xiaohuamao's user avatar
2 votes
2 answers
468 views

Two-dimensional heat equation with Neumann boundary conditions: any hope to find an analytical solution?

I am looking for references showing how to analytically solve the heat equation with Neumann boundary conditions in two dimensions. So far, I have found the problem solved analytically in one ...
Max_89's user avatar
  • 61
0 votes
1 answer
463 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 ...
user avatar
0 votes
1 answer
458 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 ...
Ivan's user avatar
  • 1
0 votes
0 answers
893 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 ...
Puneet Valecha's user avatar
0 votes
1 answer
2k 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, ...
Dddduuu's user avatar
0 votes
1 answer
219 views

Technique to find the CFL condition using the Galerkin method in space and finite-difference in time?

I am using the Galerkin method (Discontinuous to be precise) to discretize in space the scalar linear wave equation and the explicit second order centered finite difference scheme to discretize in ...
lucmobz's user avatar
  • 155
4 votes
1 answer
923 views

Backwards Difference Implicit Method for Nonlinear Parabolic PDE in Python

Original Stack Overflow Question: https://stackoverflow.com/questions/65683788/indexerror-index-31-is-out-of-bounds-for-axis-1-with-size-31?noredirect=1#comment116218335_65683788 PDE: u_t = u_xx + u(...
AlphaArgonian's user avatar
1 vote
0 answers
198 views

Integrating a wavelike equation with absorbing boundary conditions

I am trying to numerically solve the following equation: $\frac{\partial^{2} \phi}{\partial t^{2}}-\frac{\partial^{2} \phi}{\partial x^{2}}+V(x) \phi(x, t)=0$ On some domain, with: $\phi(x, 0) = I(x)$ ...
Joel's user avatar
  • 111
7 votes
1 answer
190 views

Which finite difference better approximates $uu'$?

I want to approximate $uu'$ with a finite difference. On the one hand, it seems to be $$(uu')_i=u_i\frac{u_{i+1}-u_{i-1}}{2\Delta t}=\frac{u_iu_{i+1}-u_iu_{i-1}}{2\Delta t}$$ On the other hand, $$(uu')...
Vladislav Gladkikh's user avatar
-1 votes
1 answer
244 views

Numerical solution of the advection equation with Crank–Nicolson finite difference method

I need to implement a numerical scheme for the solution of the one-dimensional advection equation $$\\\frac{\partial u}{\partial t} + C(x, t) \frac{\partial u}{\partial x} = 0 \\\\$$ $$ \\ C(x,t) = \...
Winabryr's user avatar
0 votes
0 answers
41 views

Devising Convergent Numerical Scheme for PDE

I'm currently looking at the PDE \begin{align*} u_t + \left[x(1-y) - (1-x)\right]u_x - (1-y) u_y + (z-xy) u_z = (z-xy) u_{xy} - (1-x)u& \\ \end{align*} with \begin{align*} u(x,y,z,0) = 1& \\ ...
Mike D's user avatar
  • 141
2 votes
1 answer
106 views

Fix for FD WENO method for multi-component compressible flows

I'm solving two-dimensional four-component compressible Navier-Stokes equations with finite-difference WENO approach. The equations are pretty standard: $$ \frac{\partial U}{\partial t} + \frac{\...
omican's user avatar
  • 347
0 votes
0 answers
277 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 (...
IPribec's user avatar
  • 645
1 vote
2 answers
501 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{...
omican's user avatar
  • 347
1 vote
1 answer
181 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. \\ \...
Mike D's user avatar
  • 141
2 votes
0 answers
60 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 ...
fibonatic's user avatar
  • 470
0 votes
0 answers
52 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 ...
N. Morgan's user avatar
1 vote
1 answer
66 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{\...
Almendrof66's user avatar
0 votes
0 answers
222 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 ...
lrs417's user avatar
  • 11
2 votes
2 answers
219 views

Heat equation in non-dimensional form behaving differently than in usual format

Starting from $$ c_p \frac{\partial u }{\partial t} = k \nabla^2 u $$ in a one dimensional domain [0,1] where $c_p$ and $k$ are modeling two different materials: $$ k = \begin{cases} 1 ~\text{if} ~x &...
balborian's user avatar
  • 601
1 vote
2 answers
353 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 ...
Ken Grimes's user avatar
2 votes
0 answers
79 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 ...
omican's user avatar
  • 347
5 votes
0 answers
192 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$ $$ \...
user8384493's user avatar
3 votes
1 answer
620 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) = ...
Dong Le's user avatar
  • 131
2 votes
2 answers
180 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 ...
omican's user avatar
  • 347
4 votes
1 answer
117 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{ ...
sound wave's user avatar
1 vote
1 answer
270 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-...
Almir Tricic's user avatar
1 vote
1 answer
81 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,
user37078's user avatar
5 votes
1 answer
3k 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_{...
Nankin's user avatar
  • 53
2 votes
1 answer
85 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 ...
Pedro Secchi's user avatar

1
3 4
5
6 7
19