Skip to content
Discussion options

You must be logged in to vote

Yes, exactly, from the standard stencil you would expect for the diagonal term to be 2/Hx^2 * u_i, but due to multiplication on both sides with Hx you only have 2/Hx.

In the test_one_dim example the Dirichlet boundary condition on the left are set to zero. So in this case it doesn't really make a difference if we multiply with Hx or not. For the condition on the right we have the condition u(x=1) = 1. To ensure that this is the case we need to have a look at the matrix, which sets 2/Hx on the diagonal and then just uses "pass" on the boundary terms. So for the last index we are solving 2/Hx u(n-1) = 2/Hx, giving u(n-1) = 1 as we wanted. Recall that there was many ways of adjusting the bou…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by emboyer
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants