Hot answers tagged

2

The short answer is, no; you can't use the DST approach for a case with general geometry or boundary conditions. The best way to understand this is to consider WHY the DST approach works for the "rectangular" case. For this case, we happen to know that the complete set of eigenvectors of the differential equation are products of sin functions. We can then ...


2

The formula you show is not a general formula for the Neumann Boundary Condition, it is already projected onto $\mathbf{n}$. To see this, note that the gradient in finite difference approximation (with central differences) is given by: $$\boldsymbol{\nabla}f=\left(\frac{\partial f}{\partial x}, \frac{\partial f}{\partial y}\right)\approx\left(\frac{f_{i+1,j}...


2

I know this question is old but I found an error that I wanted to clear up in @DrHansGruber 's answer. It took me a few hours to spot the issue and I wanted to post the solution to save anyone else from working through this. First, as has been stated by Hans and Peter, there are infinitely many solutions to the 1D Poisson equation with Neumann BCs at both ...


1

That type of behaviour usually happens when you matrix is poorly-conditioned. Reasons: your iterative solve works fine for different matrices (less-likely to have a bug/bad memory access, etc) the problem gets worse when you increase the matrix size (condition number would be proportional to the matrix size) Suggested actions: check condition number of ...


1

PETSc does not immediately create your sparse matrix representation. So, when you call MatSetValues(), you, usually, place the values in the intermediate cache which will occasionally get "dumped" into the real sparse matrix storage. So, the impact of the order in which you insert matrix elements is limited. The fact that the cache is used, allows multiple ...


Only top voted, non community-wiki answers of a minimum length are eligible