04 March 2022 01:48:37 PM MULTIGRID_POISSON_1D: C++ version Test the MULTIGRID_POISSON_1D library. TEST01_MONO MONOGRID_POISSON_1D solves a 1D Poisson BVP using the Gauss-Seidel method. -u''(x) = 1, for 0 < x < 1 u(0) = u(1) = 0. Solution is u(x) = ( -x^2 + x ) / 2 Mesh index K = 5 Number of intervals N=2^K = 32 Number of nodes = 2^K+1 = 33 I X(I) U(I) U Exact(X(I)) 0 0 0 0 1 0.03125 0.0150838 0.0151367 2 0.0625 0.029192 0.0292969 3 0.09375 0.0423251 0.0424805 4 0.125 0.0544837 0.0546875 5 0.15625 0.0656682 0.065918 6 0.1875 0.0758789 0.0761719 7 0.21875 0.0851163 0.0854492 8 0.25 0.0933807 0.09375 9 0.28125 0.100672 0.101074 10 0.3125 0.106992 0.107422 11 0.34375 0.112339 0.112793 12 0.375 0.116714 0.117188 13 0.40625 0.120118 0.120605 14 0.4375 0.122549 0.123047 15 0.46875 0.124009 0.124512 16 0.5 0.124497 0.125 17 0.53125 0.124014 0.124512 18 0.5625 0.122559 0.123047 19 0.59375 0.120131 0.120605 20 0.625 0.116732 0.117188 21 0.65625 0.11236 0.112793 22 0.6875 0.107016 0.107422 23 0.71875 0.100699 0.101074 24 0.75 0.0934081 0.09375 25 0.78125 0.085144 0.0854492 26 0.8125 0.0759058 0.0761719 27 0.84375 0.0656933 0.065918 28 0.875 0.054506 0.0546875 29 0.90625 0.0423435 0.0424805 30 0.9375 0.0292052 0.0292969 31 0.96875 0.0150909 0.0151367 32 1 0 0 Maximum error = 0.000502527 Number of iterations = 575 TEST01_MULTI MULTIGRID_POISSON_1D solves a 1D Poisson BVP using the multigrid method. -u''(x) = 1, for 0 < x < 1 u(0) = u(1) = 0. Solution is u(x) = ( -x^2 + x ) / 2 Mesh index K = 5 Number of intervals N=2^K = 32 Number of nodes = 2^K+1 = 33 I X(I) U(I) U Exact(X(I)) 0 0 0 0 1 0.03125 0.0151174 0.0151367 2 0.0625 0.0292622 0.0292969 3 0.09375 0.0424323 0.0424805 4 0.125 0.0546305 0.0546875 5 0.15625 0.0658541 0.065918 6 0.1875 0.0761055 0.0761719 7 0.21875 0.0853817 0.0854492 8 0.25 0.093685 0.09375 9 0.28125 0.101013 0.101074 10 0.3125 0.107367 0.107422 11 0.34375 0.112744 0.112793 12 0.375 0.117148 0.117188 13 0.40625 0.120575 0.120605 14 0.4375 0.123028 0.123047 15 0.46875 0.124503 0.124512 16 0.5 0.125003 0.125 17 0.53125 0.124526 0.124512 18 0.5625 0.123072 0.123047 19 0.59375 0.120639 0.120605 20 0.625 0.11723 0.117188 21 0.65625 0.112841 0.112793 22 0.6875 0.107474 0.107422 23 0.71875 0.10113 0.101074 24 0.75 0.0938081 0.09375 25 0.78125 0.0855096 0.0854492 26 0.8125 0.0762335 0.0761719 27 0.84375 0.065978 0.065918 28 0.875 0.0547417 0.0546875 29 0.90625 0.0425244 0.0424805 30 0.9375 0.0293273 0.0292969 31 0.96875 0.0151519 0.0151367 32 1 0 0 Maximum error = 6.75166e-05 Number of iterations = 43 TEST02_MONO MONOGRID_POISSON_1D solves a 1D Poisson BVP using the Gauss-Seidel method. -u''(x) = - x * (x+3) * exp(x), for 0 < x < 1 u(0) = u(1) = 0. Solution is u(x) = x * (x-1) * exp(x) Mesh index K = 5 Number of intervals N=2^K = 32 Number of nodes = 2^K+1 = 33 I X(I) U(I) U Exact(X(I)) 0 0 0 -0 1 0.03125 -0.0311615 -0.0312344 2 0.0625 -0.0622285 -0.0623727 3 0.09375 -0.0930982 -0.0933113 4 0.125 -0.123659 -0.123938 5 0.15625 -0.153789 -0.154132 6 0.1875 -0.18336 -0.183762 7 0.21875 -0.21223 -0.212687 8 0.25 -0.240247 -0.240755 9 0.28125 -0.26725 -0.267803 10 0.3125 -0.293063 -0.293657 11 0.34375 -0.317498 -0.318127 12 0.375 -0.340356 -0.341014 13 0.40625 -0.36142 -0.362101 14 0.4375 -0.38046 -0.381157 15 0.46875 -0.39723 -0.397938 16 0.5 -0.411467 -0.41218 17 0.53125 -0.422892 -0.423603 18 0.5625 -0.431206 -0.431908 19 0.59375 -0.436089 -0.436777 20 0.625 -0.437204 -0.43787 21 0.65625 -0.434189 -0.434828 22 0.6875 -0.426662 -0.427268 23 0.71875 -0.414214 -0.414782 24 0.75 -0.396415 -0.396938 25 0.78125 -0.372803 -0.373277 26 0.8125 -0.342894 -0.343312 27 0.84375 -0.306169 -0.306528 28 0.875 -0.262082 -0.262377 29 0.90625 -0.210054 -0.21028 30 0.9375 -0.14947 -0.149624 31 0.96875 -0.079681 -0.0797599 32 1 0 0 Maximum error = 0.000712828 Number of iterations = 702 TEST02_MULTI MULTIGRID_POISSON_1D solves a 1D Poisson BVP using the multigrid method. -u''(x) = - x * (x+3) * exp(x), for 0 < x < 1 u(0) = u(1) = 0. Solution is u(x) = x * (x-1) * exp(x) Mesh index K = 5 Number of intervals N=2^K = 32 Number of nodes = 2^K+1 = 33 I X(I) U(I) U Exact(X(I)) 0 0 0 -0 1 0.03125 -0.0312133 -0.0312344 2 0.0625 -0.062331 -0.0623727 3 0.09375 -0.0932499 -0.0933113 4 0.125 -0.123857 -0.123938 5 0.15625 -0.154033 -0.154132 6 0.1875 -0.183644 -0.183762 7 0.21875 -0.212552 -0.212687 8 0.25 -0.240603 -0.240755 9 0.28125 -0.267636 -0.267803 10 0.3125 -0.293473 -0.293657 11 0.34375 -0.317929 -0.318127 12 0.375 -0.340801 -0.341014 13 0.40625 -0.361875 -0.362101 14 0.4375 -0.38092 -0.381157 15 0.46875 -0.39769 -0.397938 16 0.5 -0.411922 -0.41218 17 0.53125 -0.423336 -0.423603 18 0.5625 -0.431634 -0.431908 19 0.59375 -0.436497 -0.436777 20 0.625 -0.437589 -0.43787 21 0.65625 -0.434551 -0.434828 22 0.6875 -0.427004 -0.427268 23 0.71875 -0.414543 -0.414782 24 0.75 -0.396734 -0.396938 25 0.78125 -0.373114 -0.373277 26 0.8125 -0.34319 -0.343312 27 0.84375 -0.306441 -0.306528 28 0.875 -0.262317 -0.262377 29 0.90625 -0.210239 -0.21028 30 0.9375 -0.149596 -0.149624 31 0.96875 -0.0797441 -0.0797599 32 1 0 0 Maximum error = 0.000281309 Number of iterations = 73 MULTIGRID_POISSON_1D: Normal end of execution. 04 March 2022 01:48:37 PM