07-Jan-2022 19:59:40 fem1d_nonlinear_test(): MATLAB/Octave version 9.8.0.1380330 (R2020a) Update 2 Test fem1d_nonlinear(). FEM1D_NONLINEAR MATLAB/Octave version 9.8.0.1380330 (R2020a) Update 2 Solve a nonlinear boundary value problem: -d/dx (p(x) du/dx) + q(x)*u + u*u' = f(x) on an interval [xl,xr], with the values of u or u' specified at xl and xr. The equation is to be solved for X greater than XL = and less than XR = The boundary conditions are: At X = XL, U = 0.000000 At X = XR, U' = 1.000000 This is test problem #1: P(X) = 1, Q(X) = 0, F(X) = X. Boundary conditions: U(0) = 0, U'(1) = 1. The exact solution is U(X) = X Number of quadrature points per element is 1 Number of iterations is 20 Node Location 0 0.000000 1 0.100000 2 0.200000 3 0.300000 4 0.400000 5 0.500000 6 0.600000 7 0.700000 8 0.800000 9 0.900000 10 1.000000 Subint Length 1 0.100000 2 0.100000 3 0.100000 4 0.100000 5 0.100000 6 0.100000 7 0.100000 8 0.100000 9 0.100000 10 0.100000 Subint Quadrature point 1 0.050000 2 0.150000 3 0.250000 4 0.350000 5 0.450000 6 0.550000 7 0.650000 8 0.750000 9 0.850000 10 0.950000 Subint Left Node Right Node 1 0 1 2 1 2 3 2 3 4 3 4 5 4 5 6 5 6 7 6 7 8 7 8 9 8 9 10 9 10 Node Unknown 0 -1 1 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 Printout of tridiagonal linear system: Equation ALEFT ADIAG ARITE RHS 1 20.000000 -10.000000 0.010000 2 -10.000000 20.000000 -10.000000 0.020000 3 -10.000000 20.000000 -10.000000 0.030000 4 -10.000000 20.000000 -10.000000 0.040000 5 -10.000000 20.000000 -10.000000 0.050000 6 -10.000000 20.000000 -10.000000 0.060000 7 -10.000000 20.000000 -10.000000 0.070000 8 -10.000000 20.000000 -10.000000 0.080000 9 -10.000000 20.000000 -10.000000 0.090000 10 -10.000000 10.000000 1.047500 Computed solution: Node X(I) U(X(I)) 0 0.000000 0.000000 1 0.100000 0.149750 2 0.200000 0.298500 3 0.300000 0.445250 4 0.400000 0.589000 5 0.500000 0.728750 6 0.600000 0.863500 7 0.700000 0.992250 8 0.800000 1.114000 9 0.900000 1.227750 10 1.000000 1.332500 Computed solution: Node X(I) U(X(I)) 0 0.000000 0.000000 1 0.100000 0.084945 2 0.200000 0.170164 3 0.300000 0.255932 4 0.400000 0.342534 5 0.500000 0.430266 6 0.600000 0.519437 7 0.700000 0.610377 8 0.800000 0.703436 9 0.900000 0.798989 10 1.000000 0.897438 Computed solution: Node X(I) U(X(I)) 0 0.000000 0.000000 1 0.100000 0.105202 2 0.200000 0.210298 3 0.300000 0.315181 4 0.400000 0.419746 5 0.500000 0.523887 6 0.600000 0.627501 7 0.700000 0.730483 8 0.800000 0.832732 9 0.900000 0.934149 10 1.000000 1.034638 Computed solution: Node X(I) U(X(I)) 0 0.000000 0.000000 1 0.100000 0.098293 2 0.200000 0.196620 3 0.300000 0.295016 4 0.400000 0.393514 5 0.500000 0.492148 6 0.600000 0.590953 7 0.700000 0.689964 8 0.800000 0.789215 9 0.900000 0.888741 10 1.000000 0.988577 Computed solution: Node X(I) U(X(I)) 0 0.000000 0.000000 1 0.100000 0.100569 2 0.200000 0.201126 3 0.300000 0.301661 4 0.400000 0.402161 5 0.500000 0.502615 6 0.600000 0.603012 7 0.700000 0.703341 8 0.800000 0.803589 9 0.900000 0.903746 10 1.000000 1.003800 Printout of tridiagonal linear system: Equation ALEFT ADIAG ARITE RHS 1 20.000000 -9.899437 0.020113 2 -10.050284 20.000000 -9.849169 0.040221 3 -10.100563 20.000000 -9.798919 0.060320 4 -10.150831 20.000000 -9.748692 0.080406 5 -10.201081 20.000000 -9.698494 0.100473 6 -10.251308 20.000000 -9.648330 0.120516 7 -10.301506 20.000000 -9.598205 0.140533 8 -10.351670 20.000000 -9.548127 0.160517 9 -10.401795 20.000000 -9.498100 0.180465 10 -10.451873 10.501900 1.095214 Computed solution: Node X(I) U(X(I)) 0 0.000000 0.000000 1 0.100000 0.100000 2 0.200000 0.200001 3 0.300000 0.300001 4 0.400000 0.400002 5 0.500000 0.500002 6 0.600000 0.600002 7 0.700000 0.700002 8 0.800000 0.800002 9 0.900000 0.900002 10 1.000000 1.000002 Computed solution: Node X(I) U(X(I)) 0 0.000000 0.000000 1 0.100000 0.100000 2 0.200000 0.200000 3 0.300000 0.300000 4 0.400000 0.400000 5 0.500000 0.500000 6 0.600000 0.600000 7 0.700000 0.700000 8 0.800000 0.800000 9 0.900000 0.900000 10 1.000000 1.000000 Computed solution: Node X(I) U(X(I)) 0 0.000000 0.000000 1 0.100000 0.100000 2 0.200000 0.200000 3 0.300000 0.300000 4 0.400000 0.400000 5 0.500000 0.500000 6 0.600000 0.600000 7 0.700000 0.700000 8 0.800000 0.800000 9 0.900000 0.900000 10 1.000000 1.000000 Computed solution: Node X(I) U(X(I)) 0 0.000000 0.000000 1 0.100000 0.100000 2 0.200000 0.200000 3 0.300000 0.300000 4 0.400000 0.400000 5 0.500000 0.500000 6 0.600000 0.600000 7 0.700000 0.700000 8 0.800000 0.800000 9 0.900000 0.900000 10 1.000000 1.000000 Computed solution: Node X(I) U(X(I)) 0 0.000000 0.000000 1 0.100000 0.100000 2 0.200000 0.200000 3 0.300000 0.300000 4 0.400000 0.400000 5 0.500000 0.500000 6 0.600000 0.600000 7 0.700000 0.700000 8 0.800000 0.800000 9 0.900000 0.900000 10 1.000000 1.000000 Computed solution: Node X(I) U(X(I)) 0 0.000000 0.000000 1 0.100000 0.100000 2 0.200000 0.200000 3 0.300000 0.300000 4 0.400000 0.400000 5 0.500000 0.500000 6 0.600000 0.600000 7 0.700000 0.700000 8 0.800000 0.800000 9 0.900000 0.900000 10 1.000000 1.000000 Computed solution: Node X(I) U(X(I)) 0 0.000000 0.000000 1 0.100000 0.100000 2 0.200000 0.200000 3 0.300000 0.300000 4 0.400000 0.400000 5 0.500000 0.500000 6 0.600000 0.600000 7 0.700000 0.700000 8 0.800000 0.800000 9 0.900000 0.900000 10 1.000000 1.000000 Computed solution: Node X(I) U(X(I)) 0 0.000000 0.000000 1 0.100000 0.100000 2 0.200000 0.200000 3 0.300000 0.300000 4 0.400000 0.400000 5 0.500000 0.500000 6 0.600000 0.600000 7 0.700000 0.700000 8 0.800000 0.800000 9 0.900000 0.900000 10 1.000000 1.000000 Computed solution: Node X(I) U(X(I)) 0 0.000000 0.000000 1 0.100000 0.100000 2 0.200000 0.200000 3 0.300000 0.300000 4 0.400000 0.400000 5 0.500000 0.500000 6 0.600000 0.600000 7 0.700000 0.700000 8 0.800000 0.800000 9 0.900000 0.900000 10 1.000000 1.000000 Computed solution: Node X(I) U(X(I)) 0 0.000000 0.000000 1 0.100000 0.100000 2 0.200000 0.200000 3 0.300000 0.300000 4 0.400000 0.400000 5 0.500000 0.500000 6 0.600000 0.600000 7 0.700000 0.700000 8 0.800000 0.800000 9 0.900000 0.900000 10 1.000000 1.000000 Computed solution: Node X(I) U(X(I)) 0 0.000000 0.000000 1 0.100000 0.100000 2 0.200000 0.200000 3 0.300000 0.300000 4 0.400000 0.400000 5 0.500000 0.500000 6 0.600000 0.600000 7 0.700000 0.700000 8 0.800000 0.800000 9 0.900000 0.900000 10 1.000000 1.000000 Computed solution: Node X(I) U(X(I)) 0 0.000000 0.000000 1 0.100000 0.100000 2 0.200000 0.200000 3 0.300000 0.300000 4 0.400000 0.400000 5 0.500000 0.500000 6 0.600000 0.600000 7 0.700000 0.700000 8 0.800000 0.800000 9 0.900000 0.900000 10 1.000000 1.000000 Computed solution: Node X(I) U(X(I)) 0 0.000000 0.000000 1 0.100000 0.100000 2 0.200000 0.200000 3 0.300000 0.300000 4 0.400000 0.400000 5 0.500000 0.500000 6 0.600000 0.600000 7 0.700000 0.700000 8 0.800000 0.800000 9 0.900000 0.900000 10 1.000000 1.000000 Computed solution: Node X(I) U(X(I)) 0 0.000000 0.000000 1 0.100000 0.100000 2 0.200000 0.200000 3 0.300000 0.300000 4 0.400000 0.400000 5 0.500000 0.500000 6 0.600000 0.600000 7 0.700000 0.700000 8 0.800000 0.800000 9 0.900000 0.900000 10 1.000000 1.000000 Computed solution: Node X(I) U(X(I)) 0 0.000000 0.000000 1 0.100000 0.100000 2 0.200000 0.200000 3 0.300000 0.300000 4 0.400000 0.400000 5 0.500000 0.500000 6 0.600000 0.600000 7 0.700000 0.700000 8 0.800000 0.800000 9 0.900000 0.900000 10 1.000000 1.000000 COMPARE: Compare computed and exact solutions: X U(X) U(exact) 0.000000 0.000000 0.000000 0.125000 0.125000 0.125000 0.250000 0.250000 0.250000 0.375000 0.375000 0.375000 0.500000 0.500000 0.500000 0.625000 0.625000 0.625000 0.750000 0.750000 0.750000 0.875000 0.875000 0.875000 1.000000 1.000000 1.000000 FEM1D_NONLINEAR: Normal end of execution. FEM1D_NONLINEAR MATLAB/Octave version 9.8.0.1380330 (R2020a) Update 2 Solve a nonlinear boundary value problem: -d/dx (p(x) du/dx) + q(x)*u + u*u' = f(x) on an interval [xl,xr], with the values of u or u' specified at xl and xr. The equation is to be solved for X greater than XL = and less than XR = The boundary conditions are: At X = XL, U = 0.000000 At X = XR, U' = 1.000000 This is test problem #2: P(X) = 1, Q(X) = 0, F(X) = -0.5*pi*cos(0.5*pi*X) + 2*sin(0.5*pi*X)*(1-cos(0.5*pi*X)/pi. Boundary conditions: U(0) = 0, U'(1) = 1. The exact solution is U(X) = 2*(1-cos(pi*x/2))/pi Number of quadrature points per element is 1 Number of iterations is 20 Node Location 0 0.000000 1 0.100000 2 0.200000 3 0.300000 4 0.400000 5 0.500000 6 0.600000 7 0.700000 8 0.800000 9 0.900000 10 1.000000 Subint Length 1 0.100000 2 0.100000 3 0.100000 4 0.100000 5 0.100000 6 0.100000 7 0.100000 8 0.100000 9 0.100000 10 0.100000 Subint Quadrature point 1 0.050000 2 0.150000 3 0.250000 4 0.350000 5 0.450000 6 0.550000 7 0.650000 8 0.750000 9 0.850000 10 0.950000 Subint Left Node Right Node 1 0 1 2 1 2 3 2 3 4 3 4 5 4 5 6 5 6 7 6 7 8 7 8 9 8 9 10 9 10 Node Unknown 0 -1 1 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 Printout of tridiagonal linear system: Equation ALEFT ADIAG ARITE RHS 1 20.000000 -10.000000 -0.154454 2 -10.000000 20.000000 -10.000000 -0.147799 3 -10.000000 20.000000 -10.000000 -0.136149 4 -10.000000 20.000000 -10.000000 -0.119284 5 -10.000000 20.000000 -10.000000 -0.097292 6 -10.000000 20.000000 -10.000000 -0.070600 7 -10.000000 20.000000 -10.000000 -0.039979 8 -10.000000 20.000000 -10.000000 -0.006511 9 -10.000000 20.000000 -10.000000 0.028472 10 -10.000000 10.000000 1.023081 Computed solution: Node X(I) U(X(I)) 0 0.000000 0.000000 1 0.100000 0.027948 2 0.200000 0.071342 3 0.300000 0.129516 4 0.400000 0.201305 5 0.500000 0.285022 6 0.600000 0.378468 7 0.700000 0.478975 8 0.800000 0.583479 9 0.900000 0.688634 10 1.000000 0.790942 Computed solution: Node X(I) U(X(I)) 0 0.000000 0.000000 1 0.100000 0.001484 2 0.200000 0.018456 3 0.300000 0.050411 4 0.400000 0.096523 5 0.500000 0.155664 6 0.600000 0.226426 7 0.700000 0.307153 8 0.800000 0.395967 9 0.900000 0.490808 10 1.000000 0.589466 Computed solution: Node X(I) U(X(I)) 0 0.000000 0.000000 1 0.100000 0.009782 2 0.200000 0.035023 3 0.300000 0.075125 4 0.400000 0.129110 5 0.500000 0.195640 6 0.600000 0.273059 7 0.700000 0.359430 8 0.800000 0.452588 9 0.900000 0.550198 10 1.000000 0.649816 Computed solution: Node X(I) U(X(I)) 0 0.000000 0.000000 1 0.100000 0.007139 2 0.200000 0.029750 3 0.300000 0.067270 4 0.400000 0.118771 5 0.500000 0.182984 6 0.600000 0.258332 7 0.700000 0.342960 8 0.800000 0.434788 9 0.900000 0.531558 10 1.000000 0.630886 Computed solution: Node X(I) U(X(I)) 0 0.000000 0.000000 1 0.100000 0.007961 2 0.200000 0.031389 3 0.300000 0.069713 4 0.400000 0.121987 5 0.500000 0.186923 6 0.600000 0.262916 7 0.700000 0.348089 8 0.800000 0.440332 9 0.900000 0.537365 10 1.000000 0.636784 Printout of tridiagonal linear system: Equation ALEFT ADIAG ARITE RHS 1 20.000000 -9.984305 -0.154208 2 -10.003980 20.000000 -9.965144 -0.146599 3 -10.015695 20.000000 -9.939006 -0.132676 4 -10.034856 20.000000 -9.906538 -0.111764 5 -10.060994 20.000000 -9.868542 -0.083731 6 -10.093462 20.000000 -9.825956 -0.049044 7 -10.131458 20.000000 -9.779834 -0.008787 8 -10.174044 20.000000 -9.731317 0.035388 9 -10.220166 20.000000 -9.681608 0.081373 10 -10.268683 10.318392 1.052264 Computed solution: Node X(I) U(X(I)) 0 0.000000 0.000000 1 0.100000 0.007765 2 0.200000 0.030999 3 0.300000 0.069131 4 0.400000 0.121221 5 0.500000 0.185985 6 0.600000 0.261825 7 0.700000 0.346867 8 0.800000 0.439012 9 0.900000 0.535983 10 1.000000 0.635380 Computed solution: Node X(I) U(X(I)) 0 0.000000 0.000000 1 0.100000 0.007765 2 0.200000 0.030999 3 0.300000 0.069131 4 0.400000 0.121221 5 0.500000 0.185985 6 0.600000 0.261824 7 0.700000 0.346867 8 0.800000 0.439012 9 0.900000 0.535982 10 1.000000 0.635380 Computed solution: Node X(I) U(X(I)) 0 0.000000 0.000000 1 0.100000 0.007765 2 0.200000 0.030999 3 0.300000 0.069131 4 0.400000 0.121221 5 0.500000 0.185985 6 0.600000 0.261824 7 0.700000 0.346867 8 0.800000 0.439012 9 0.900000 0.535982 10 1.000000 0.635380 Computed solution: Node X(I) U(X(I)) 0 0.000000 0.000000 1 0.100000 0.007765 2 0.200000 0.030999 3 0.300000 0.069131 4 0.400000 0.121221 5 0.500000 0.185985 6 0.600000 0.261824 7 0.700000 0.346867 8 0.800000 0.439012 9 0.900000 0.535982 10 1.000000 0.635380 Computed solution: Node X(I) U(X(I)) 0 0.000000 0.000000 1 0.100000 0.007765 2 0.200000 0.030999 3 0.300000 0.069131 4 0.400000 0.121221 5 0.500000 0.185985 6 0.600000 0.261824 7 0.700000 0.346867 8 0.800000 0.439012 9 0.900000 0.535982 10 1.000000 0.635380 Computed solution: Node X(I) U(X(I)) 0 0.000000 0.000000 1 0.100000 0.007765 2 0.200000 0.030999 3 0.300000 0.069131 4 0.400000 0.121221 5 0.500000 0.185985 6 0.600000 0.261824 7 0.700000 0.346867 8 0.800000 0.439012 9 0.900000 0.535982 10 1.000000 0.635380 Computed solution: Node X(I) U(X(I)) 0 0.000000 0.000000 1 0.100000 0.007765 2 0.200000 0.030999 3 0.300000 0.069131 4 0.400000 0.121221 5 0.500000 0.185985 6 0.600000 0.261824 7 0.700000 0.346867 8 0.800000 0.439012 9 0.900000 0.535982 10 1.000000 0.635380 Computed solution: Node X(I) U(X(I)) 0 0.000000 0.000000 1 0.100000 0.007765 2 0.200000 0.030999 3 0.300000 0.069131 4 0.400000 0.121221 5 0.500000 0.185985 6 0.600000 0.261824 7 0.700000 0.346867 8 0.800000 0.439012 9 0.900000 0.535982 10 1.000000 0.635380 Computed solution: Node X(I) U(X(I)) 0 0.000000 0.000000 1 0.100000 0.007765 2 0.200000 0.030999 3 0.300000 0.069131 4 0.400000 0.121221 5 0.500000 0.185985 6 0.600000 0.261824 7 0.700000 0.346867 8 0.800000 0.439012 9 0.900000 0.535982 10 1.000000 0.635380 Computed solution: Node X(I) U(X(I)) 0 0.000000 0.000000 1 0.100000 0.007765 2 0.200000 0.030999 3 0.300000 0.069131 4 0.400000 0.121221 5 0.500000 0.185985 6 0.600000 0.261824 7 0.700000 0.346867 8 0.800000 0.439012 9 0.900000 0.535982 10 1.000000 0.635380 Computed solution: Node X(I) U(X(I)) 0 0.000000 0.000000 1 0.100000 0.007765 2 0.200000 0.030999 3 0.300000 0.069131 4 0.400000 0.121221 5 0.500000 0.185985 6 0.600000 0.261824 7 0.700000 0.346867 8 0.800000 0.439012 9 0.900000 0.535982 10 1.000000 0.635380 Computed solution: Node X(I) U(X(I)) 0 0.000000 0.000000 1 0.100000 0.007765 2 0.200000 0.030999 3 0.300000 0.069131 4 0.400000 0.121221 5 0.500000 0.185985 6 0.600000 0.261824 7 0.700000 0.346867 8 0.800000 0.439012 9 0.900000 0.535982 10 1.000000 0.635380 Computed solution: Node X(I) U(X(I)) 0 0.000000 0.000000 1 0.100000 0.007765 2 0.200000 0.030999 3 0.300000 0.069131 4 0.400000 0.121221 5 0.500000 0.185985 6 0.600000 0.261824 7 0.700000 0.346867 8 0.800000 0.439012 9 0.900000 0.535982 10 1.000000 0.635380 Computed solution: Node X(I) U(X(I)) 0 0.000000 0.000000 1 0.100000 0.007765 2 0.200000 0.030999 3 0.300000 0.069131 4 0.400000 0.121221 5 0.500000 0.185985 6 0.600000 0.261824 7 0.700000 0.346867 8 0.800000 0.439012 9 0.900000 0.535982 10 1.000000 0.635380 Computed solution: Node X(I) U(X(I)) 0 0.000000 0.000000 1 0.100000 0.007765 2 0.200000 0.030999 3 0.300000 0.069131 4 0.400000 0.121221 5 0.500000 0.185985 6 0.600000 0.261824 7 0.700000 0.346867 8 0.800000 0.439012 9 0.900000 0.535982 10 1.000000 0.635380 COMPARE: Compare computed and exact solutions: X U(X) U(exact) 0.000000 0.000000 0.000000 0.125000 0.013573 0.012232 0.250000 0.050065 0.048460 0.375000 0.108198 0.107290 0.500000 0.185985 0.186462 0.625000 0.283085 0.282933 0.750000 0.392940 0.392996 0.875000 0.511740 0.512421 1.000000 0.635380 0.636620 FEM1D_NONLINEAR: Normal end of execution. fem1d_nonlinear_test(): Normal end of execution. 07-Jan-2022 19:59:41