|
501 | 501 |
|
502 | 502 | N = 100 |
503 | 503 | dx = 0.25 |
| 504 | + dx_vec = 0.25:0.25:(N+2)*0.25 |
504 | 505 | dy = cumsum(rand(N+2)) |
505 | 506 | M = zeros(N+2,N+2) |
506 | 507 |
|
@@ -542,12 +543,30 @@ end |
542 | 543 | mul!(M_temp, A, M) |
543 | 544 | @test M_temp ≈ ((Lx2*M)[1:N,2:N+1]+(Lx3*M)[1:N,2:N+1]+(Lx4*M)[1:N,2:N+1]+(Ly2*M)[2:N+1,1:N]+(Ly3*M)[2:N+1,1:N]+(Ly4*M)[2:N+1,1:N]) |
544 | 545 |
|
| 546 | + # Last case where we now have some `irregular-grid` operators operating on the |
| 547 | + # regular-spaced axis x |
| 548 | + |
| 549 | + # These operators are operating on the regular grid x, but are constructed as though |
| 550 | + # they were irregular grid operators. Hence we test if we can seperate irregular and |
| 551 | + # regular gird operators on the same axis |
| 552 | + # Lx2 has 0 boundary points |
| 553 | + _Lx2 = 4.532*CenteredDifference{1}(2,2,dx_vec,N) |
| 554 | + # Lx3 has 1 boundary point |
| 555 | + _Lx3 = 0.235*CenteredDifference{1}(3,3,dx_vec,N) |
| 556 | + # Lx4 has 2 boundary points |
| 557 | + _Lx4 = CenteredDifference{1}(4,4,dx_vec,N) |
| 558 | + |
| 559 | + A += _Lx2 + _Lx3 + _Lx4 |
| 560 | + mul!(M_temp, A, M) |
| 561 | + @test M_temp ≈ ((_Lx2*M)[1:N,2:N+1]+(_Lx3*M)[1:N,2:N+1]+(_Lx4*M)[1:N,2:N+1]+(Lx2*M)[1:N,2:N+1]+(Lx3*M)[1:N,2:N+1]+(Lx4*M)[1:N,2:N+1]+(Ly2*M)[2:N+1,1:N]+(Ly3*M)[2:N+1,1:N]+(Ly4*M)[2:N+1,1:N]) |
| 562 | + |
545 | 563 | end |
546 | 564 |
|
547 | 565 | @testset "irregular x grid and regular y grid (dy = 0.25)" begin |
548 | 566 |
|
549 | 567 | N = 100 |
550 | 568 | dy = 0.25 |
| 569 | + dy_vec = 0.25:0.25:(N+2)*0.25 |
551 | 570 | dx = cumsum(rand(N+2)) |
552 | 571 | M = zeros(N+2,N+2) |
553 | 572 |
|
|
589 | 608 | mul!(M_temp, A, M) |
590 | 609 | @test M_temp ≈ ((Lx2*M)[1:N,2:N+1]+(Lx3*M)[1:N,2:N+1]+(Lx4*M)[1:N,2:N+1]+(Ly2*M)[2:N+1,1:N]+(Ly3*M)[2:N+1,1:N]+(Ly4*M)[2:N+1,1:N]) |
591 | 610 |
|
| 611 | + # Last case where we now have some `irregular-grid` operators operating on the |
| 612 | + # regular-spaced axis y |
| 613 | + |
| 614 | + # These operators are operating on the regular grid y, but are constructed as though |
| 615 | + # they were irregular grid operators. Hence we test if we can seperate irregular and |
| 616 | + # regular gird operators on the same axis |
| 617 | + # Ly2 has 0 boundary points |
| 618 | + _Ly2 = CenteredDifference{2}(2,2,dy_vec,N) |
| 619 | + # Ly3 has 1 boundary point |
| 620 | + _Ly3 = CenteredDifference{2}(3,3,dy_vec,N) |
| 621 | + # Ly4 has 2 boundary points |
| 622 | + _Ly4 = 12.1*CenteredDifference{2}(4,4,dy_vec,N) |
| 623 | + |
| 624 | + A += _Ly2 + _Ly3 + _Ly4 |
| 625 | + mul!(M_temp, A, M) |
| 626 | + @test M_temp ≈ ((Lx2*M)[1:N,2:N+1]+(Lx3*M)[1:N,2:N+1]+(Lx4*M)[1:N,2:N+1]+(Ly2*M)[2:N+1,1:N]+(Ly3*M)[2:N+1,1:N]+(Ly4*M)[2:N+1,1:N]+(_Ly2*M)[2:N+1,1:N]+(_Ly3*M)[2:N+1,1:N]+(_Ly4*M)[2:N+1,1:N]) |
| 627 | + |
592 | 628 | end |
0 commit comments