Scalling RHS #89
|
In the RHS function of the test_one_dim file when the Dirichlet boundary value of 1 is applied instead due to scalling 2/Hx is supplied, my understanding of the situation is that we multiply both sides by the volume of each element so in the 1D case by Hx, which appears to be the case in the diag, mult and sparse functions and in the general case of the RHS function. Why is this value different? |
Replies: 1 comment
|
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 boundary values in FD schemes, this is just one of them. Does that make sense? |
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…