19 July 2015 09:24:37 AM FEM1D_BVP_LINEAR_PRB C++ version Test the FEM1D_BVP_LINEAR library. TEST00 Solve -( A(x) U'(x) )' + C(x) U(x) = F(x) for 0 < x < 1, with U(0) = U(1) = 0. A(X) = 1.0 C(X) = 1.0 F(X) = X U(X) = X - SINH(X) / SINH(1) Number of nodes = 11 I X U Uexact Error 0 0 0 0 0 1 0.1 0.0147773 0.0147663 1.10125e-05 2 0.2 0.028701 0.0286795 2.1423e-05 3 0.3 0.0409088 0.0408782 3.0616e-05 4 0.4 0.0505213 0.0504834 3.79499e-05 5 0.5 0.0566333 0.0565906 4.27426e-05 6 0.6 0.0583042 0.0582599 4.42572e-05 7 0.7 0.0545491 0.0545074 4.1687e-05 8 0.8 0.0443287 0.0442945 3.41391e-05 9 0.9 0.0265389 0.0265183 2.06168e-05 10 1 0 0 0 l1 norm of error = 2.58586e-05 L2 norm of error = 0.000426196 Seminorm of error = 0.0156388 Max norm of error = 0.0011594 TEST01 Solve -( A(x) U'(x) )' + C(x) U(x) = F(x) for 0 < x < 1, with U(0) = U(1) = 0. A1(X) = 1.0 C1(X) = 0.0 F1(X) = X * ( X + 3 ) * exp ( X ) U1(X) = X * ( 1 - X ) * exp ( X ) Number of nodes = 11 I X U Uexact Error 0 0 0 0 0 1 0.1 0.0994655 0.0994654 1.33423e-07 2 0.2 0.195425 0.195424 2.47563e-07 3 0.3 0.283471 0.28347 3.39433e-07 4 0.4 0.358038 0.358038 4.05613e-07 5 0.5 0.412181 0.41218 4.42187e-07 6 0.6 0.437309 0.437309 4.44681e-07 7 0.7 0.422888 0.422888 4.07976e-07 8 0.8 0.356087 0.356087 3.26231e-07 9 0.9 0.221364 0.221364 1.92775e-07 10 1 0 0 0 l1 norm of error = 2.67262e-07 L2 norm of error = 0.00400665 Seminorm of error = 0.138667 Max norm of error = 0.012139 TEST02 Solve -( A(x) U'(x) )' + C(x) U(x) = F(x) for 0 < x < 1, with U(0) = U(1) = 0. A2(X) = 1.0 C2(X) = 2.0 F2(X) = X * ( 5 - X ) * exp ( X ) U2(X) = X * ( 1 - X ) * exp ( X ) Number of nodes = 11 I X U Uexact Error 0 0 0 0 0 1 0.1 0.0995976 0.0994654 0.000132179 2 0.2 0.195686 0.195424 0.000261061 3 0.3 0.283852 0.28347 0.000381845 4 0.4 0.358526 0.358038 0.000487632 5 0.5 0.412749 0.41218 0.000568904 6 0.6 0.437921 0.437309 0.000612904 7 0.7 0.423491 0.422888 0.00060287 8 0.8 0.356604 0.356087 0.000517106 9 0.9 0.221692 0.221364 0.000327866 10 1 0 0 0 l1 norm of error = 0.000353851 L2 norm of error = 0.00369835 Seminorm of error = 0.138675 Max norm of error = 0.0119751 TEST03 Solve -( A(x) U'(x) )' + C(x) U(x) = F(x) for 0 < x < 1, with U(0) = U(1) = 0. A3(X) = 1.0 C3(X) = 2.0 * X F3(X) = - X * ( 2 * X * X - 3 * X - 3 ) * exp ( X ) U3(X) = X * ( 1 - X ) * exp ( X ) Number of nodes = 11 I X U Uexact Error 0 0 0 0 0 1 0.1 0.0995489 0.0994654 8.35035e-05 2 0.2 0.195591 0.195424 0.000166483 3 0.3 0.283718 0.28347 0.000247341 4 0.4 0.358361 0.358038 0.000322738 5 0.5 0.412567 0.41218 0.000386818 6 0.6 0.437739 0.437309 0.000430206 7 0.7 0.423327 0.422888 0.000438689 8 0.8 0.356478 0.356087 0.000391498 9 0.9 0.221623 0.221364 0.000259052 10 1 0 0 0 l1 norm of error = 0.000247848 L2 norm of error = 0.00377892 Seminorm of error = 0.138671 Max norm of error = 0.0120095 TEST04 Solve -( A(x) U'(x) )' + C(x) U(x) = F(x) for 0 < x < 1, with U(0) = U(1) = 0. A4(X) = 1.0 + X * X C4(X) = 0.0 F4(X) = ( X + 3 X^2 + 5 X^3 + X^4 ) * exp ( X ) U4(X) = X * ( 1 - X ) * exp ( X ) Number of nodes = 11 I X U Uexact Error 0 0 0 0 0 1 0.1 0.0998202 0.0994654 0.000354837 2 0.2 0.196115 0.195424 0.0006904 3 0.3 0.284455 0.28347 0.000985074 4 0.4 0.359254 0.358038 0.00121595 5 0.5 0.41354 0.41218 0.00135997 6 0.6 0.438703 0.437309 0.00139455 7 0.7 0.424186 0.422888 0.00129771 8 0.8 0.357134 0.356087 0.00104777 9 0.9 0.221987 0.221364 0.000622818 10 1 0 0 0 l1 norm of error = 0.000815371 L2 norm of error = 0.00338872 Seminorm of error = 0.138705 Max norm of error = 0.0118277 TEST05 Solve -( A(x) U'(x) )' + C(x) U(x) = F(x) for 0 < x < 1, with U(0) = U(1) = 0. A5(X) = 1.0 + X * X for X <= 1/3 = 7/9 + X for 1/3 < X C5(X) = 0.0 F5(X) = ( X + 3 X^2 + 5 X^3 + X^4 ) * exp ( X ) for X <= 1/3 = ( - 1 + 10/3 X + 43/9 X^2 + X^3 ) .* exp ( X ) for 1/3 <= X U5(X) = X * ( 1 - X ) * exp ( X ) Number of nodes = 11 I X U Uexact Error 0 0 0 0 0 1 0.1 0.0999805 0.0994654 0.000515151 2 0.2 0.196432 0.195424 0.00100789 3 0.3 0.284924 0.28347 0.00145384 4 0.4 0.359566 0.358038 0.00152843 5 0.5 0.413603 0.41218 0.00142291 6 0.6 0.438574 0.437309 0.00126559 7 0.7 0.423939 0.422888 0.00105136 8 0.8 0.356861 0.356087 0.000774081 9 0.9 0.221791 0.221364 0.000426454 10 1 0 0 0 l1 norm of error = 0.000858701 L2 norm of error = 0.00349352 Seminorm of error = 0.138709 Max norm of error = 0.0119258 TEST06 Solve -( A(x) U'(x) )' + C(x) U(x) = F(x) for 0 < x < 1, with U(0) = U(1) = 0. A6(X) = 1.0 C6(X) = 0.0 F6(X) = pi*pi*sin(pi*X) U6(X) = sin(pi*x) Compute L2 norm and seminorm of error for various N. N l1 error L2 error Seminorm error Maxnorm error 11 3.90303e-06 0.00579769 0.201186 0.0121534 21 2.56142e-07 0.0014528 0.100697 0.00307274 41 1.64086e-08 0.000363412 0.0503613 0.000770343 81 1.03833e-09 9.08662e-05 0.0251823 0.000192721 161 6.52875e-11 2.27174e-05 0.0125913 4.81886e-05 TEST07 Solve -( A(x) U'(x) )' + C(x) U(x) = F(x) for 0 < x < 1, with U(0) = U(1) = 0. Becker/Carey/Oden example Compute L2 norm and seminorm of error for various N. N l1 error L2 error Seminorm error Maxnorm error 11 0.0105234 0.0548944 2.11962 0.272576 21 0.00468867 0.0151701 1.06991 0.0664751 41 0.00120958 0.0049502 0.685573 0.0254211 81 0.000302655 0.00126683 0.350963 0.00709015 161 7.51137e-05 0.000317375 0.176055 0.00180081 TEST08 Solve -( A(x) U'(x) )' + C(x) U(x) = F(x) for 0 < x < 1, with U(0) = U(1) = 0. A8(X) = 1.0 C8(X) = 0.0 F8(X) = X * ( X + 3 ) * exp ( X ), X <= 2/3 = 2 * exp ( 2/3), 2/3 < X U8(X) = X * ( 1 - X ) * exp ( X ), X <= 2/3 = X * ( 1 - X ) * exp ( 2/3 ), 2/3 < X Number of nodes = 11 I X U Uexact Error 0 0 0 0 0 1 0.1 0.0845329 0.0994654 0.0149325 2 0.2 0.165559 0.195424 0.029865 3 0.3 0.238673 0.28347 0.0447975 4 0.4 0.298308 0.358038 0.05973 5 0.5 0.337518 0.41218 0.0746626 6 0.6 0.347713 0.437309 0.0895952 7 0.7 0.319447 0.409024 0.089577 8 0.8 0.251919 0.311637 0.059718 9 0.9 0.145437 0.175296 0.029859 10 1 0 0 0 l1 norm of error = 0.0447942 L2 norm of error = 0.0595979 Seminorm of error = 0.240692 Max norm of error = 0.103643 TEST09 Solve -( A(x) U'(x) )' + C(x) U(x) = F(x) for 0 < x < 1, with U(0) = U(1) = 0. A9(X) = 1.0 C9(X) = 0.0 F9(X) = X * ( X + 3 ) * exp ( X ), X <= 2/3 = 2 * exp ( 2/3), 2/3 < X U9(X) = X * ( 1 - X ) * exp ( X ), X <= 2/3 = X * ( 1 - X ) * exp ( 2/3 ), 2/3 < X Number of nodes = 11 I X U Uexact Error 0 0 0 0 0 1 0.1 0.0729598 0.0994654 0.0265056 2 0.2 0.142413 0.195424 0.0530111 3 0.3 0.203954 0.28347 0.0795167 4 0.4 0.252016 0.358038 0.106022 5 0.5 0.279652 0.41218 0.132528 6 0.6 0.278275 0.437309 0.159034 7 0.7 0.240438 0.21 0.0304383 8 0.8 0.180292 0.16 0.0202922 9 0.9 0.100146 0.09 0.0101461 10 1 0 0 0 l1 norm of error = 0.0561358 L2 norm of error = 0.0822364 Seminorm of error = 0.233968 Max norm of error = 0.179063 TEST10 Solve -( A(x) U'(x) )' + C(x) U(x) = F(x) for 0 < x < 1, with U(0) = U(1) = 0. A(X) = 1.0 C(X) = 1.0 F(X) = X U(X) = X - SINH(X) / SINH(1) log(E) E L2error H1error Maxerror 0 1 0.0387837 0.129787 0.0578696 1 2 0.0104315 0.0750012 0.0214296 2 4 0.0026516 0.0387482 0.00647518 3 8 0.000665607 0.0195299 0.00177789 4 16 0.000166571 0.0097844 0.00046583 5 32 4.16532e-05 0.00489464 0.000119228 6 64 1.0414e-05 0.00244762 3.016e-05 log(E1) E1 / E2 L2rate H1rate Maxrate 0 1 / 2 1.89451 0.791158 1.4332 1 2 / 4 1.97601 0.952785 1.72662 2 4 / 8 1.99412 0.988446 1.86475 3 8 / 16 1.99854 0.997126 1.93229 4 16 / 32 1.99963 0.999282 1.96608 5 32 / 64 1.99991 0.999821 1.98302 Created graphics data file "data.txt". Created graphics command file "commands_l2.txt". Created graphics command file "commands_h1.txt". Created graphics command file "commands_mx.txt". FEM1D_BVP_LINEAR_PRB Normal end of execution. 19 July 2015 09:24:37 AM