Skip to main content

All Questions

Filter by
Sorted by
Tagged with
1 vote
1 answer
522 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 ...
Jbag1212's user avatar
  • 111
2 votes
1 answer
120 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 ...
Hari Sam's user avatar
3 votes
0 answers
267 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 ...
velenos14's user avatar
  • 141
3 votes
0 answers
107 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 ...
nicholaswogan's user avatar
0 votes
0 answers
276 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
0 votes
1 answer
312 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 ...
kotozna's user avatar
  • 111
2 votes
0 answers
136 views

How to determine the finite difference coefficient matrix in 2D with periodic BC?

I'm solving a PDE in matlab using ode15s, and since the spatial dimension is 2, and number of variables grow large very quickly, I need to supply the structure of ...
Physicist's user avatar
  • 217
4 votes
2 answers
1k views

Solving Ax = b with sparse A and sparse b

Let's suppose I'm numerically solving the Poisson equation for a delta function source: $$ \nabla^2 f(x) = \delta(x-x') $$ I can represent the Laplacian $\nabla^2$ using the finite difference method ...
alexvas's user avatar
  • 213
4 votes
1 answer
4k views

Iteratively solving 3D Poisson equation in MATLAB

I have written a function that sets up a sparse matrix A and RHS b for the 3D Poisson equation in a relatively efficient way. The set-up is nothing fancy: I have extended the 2D 5-point stencil to an ...
slvrbld's user avatar
  • 143
0 votes
2 answers
312 views

CHOLMOD implementation

I am working on a domain decomposition code in C that uses CHOLMOD to approximate grid values for a PDE in each sub-domain. The issue I have is that the methods use Matrix Market format, which is not ...
user20973's user avatar
1 vote
1 answer
724 views

How efficient (compared to "normal" methods) is using a sparse finite difference matrix to solve differential equations?

Any differential operator can be written as a finite difference matrix acting on a vector of values. I recently used it to solve $\Delta A = j$ by writing the Laplacian as a finite difference ...
rubenvb's user avatar
  • 111
3 votes
0 answers
354 views

Efficient assembly of finite element matrix(coupled equations case)

I noticed this post, where spalloc and sparse are recommended for efficient assembly in Matlab. I personally use sparse ...
lorniper's user avatar
  • 593
2 votes
0 answers
1k views

How to solve singular non symmetric poisson equation with Neumann boundary condtions?

I am trying to solve 2D Poisson equations with Neumann boundary conditions. When the mesh is uniform, Poisson equation is singular and symmetric, so the method listed in Null Space Projection for ...
Simon's user avatar
  • 21
2 votes
1 answer
664 views

Assembling sparse matrix in PETSC for Poisson equation

I am a novice at PETSC, and I have been trying to write an FVM code for steady heat conduction in 2D using PETSC (square, regular grid, Dirichlet boundaries) Since the large matrix , say A, will be ...
me10240's user avatar
  • 445
18 votes
6 answers
2k views

How to reorder variables to produce a banded matrix of minimum bandwidth?

I'm trying to solve a 2D Poisson equation by finite differences. In the process, I obtain a sparse matrix with only $5$ variables in each equation. For example, if the variables were $U$, then the ...
Paul's user avatar
  • 12.2k