03 March 2020 09:32:47 AM FEM1D_NONLINEAR C++ version 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 interval [XL,XR] is broken into N = 10 subintervals Number of basis functions per element is NL = 2 The equation is to be solved for X greater than XL = 0 and less than XR = 1 The boundary conditions are: At X = XL, U = 0 At X = XR, U' = 1 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 10 Node Location 0 0 1 0.1 2 0.2 3 0.3 4 0.4 5 0.5 6 0.6 7 0.7 8 0.8 9 0.9 10 1 Subint Length 1 0.1 2 0.1 3 0.1 4 0.1 5 0.1 6 0.1 7 0.1 8 0.1 9 0.1 10 0.1 Subint Quadrature point 1 0.05 2 0.15 3 0.25 4 0.35 5 0.45 6 0.55 7 0.65 8 0.75 9 0.85 10 0.95 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 Number of unknowns NU = 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 0 20 -10 -0.154454 2 -10 20 -10 -0.147799 3 -10 20 -10 -0.136149 4 -10 20 -10 -0.119284 5 -10 20 -10 -0.0972917 6 -10 20 -10 -0.0706 7 -10 20 -10 -0.0399792 8 -10 20 -10 -0.00651058 9 -10 20 -10 0.0284722 10 -10 10 0 1.02308 Computed solution: Node X(I) U(X(I)) 0 0 0 1 0.1 0.0279485 2 0.2 0.0713424 3 0.3 0.129516 4 0.4 0.201305 5 0.5 0.285022 6 0.6 0.378468 7 0.7 0.478975 8 0.8 0.583479 9 0.9 0.688634 10 1 0.790942 Computed solution: Node X(I) U(X(I)) 0 0 0 1 0.1 0.00148389 2 0.2 0.0184564 3 0.3 0.0504114 4 0.4 0.0965231 5 0.5 0.155664 6 0.6 0.226426 7 0.7 0.307153 8 0.8 0.395967 9 0.9 0.490808 10 1 0.589466 Computed solution: Node X(I) U(X(I)) 0 0 0 1 0.1 0.0097823 2 0.2 0.035023 3 0.3 0.0751252 4 0.4 0.12911 5 0.5 0.19564 6 0.6 0.273059 7 0.7 0.35943 8 0.8 0.452588 9 0.9 0.550198 10 1 0.649816 Computed solution: Node X(I) U(X(I)) 0 0 0 1 0.1 0.00777244 2 0.2 0.031014 3 0.3 0.0691526 4 0.4 0.121249 5 0.5 0.186017 6 0.6 0.26186 7 0.7 0.346904 8 0.8 0.43905 9 0.9 0.536021 10 1 0.635418 Computed solution: Node X(I) U(X(I)) 0 0 0 1 0.1 0.00776462 2 0.2 0.0309987 3 0.3 0.0691306 4 0.4 0.121221 5 0.5 0.185985 6 0.6 0.261824 7 0.7 0.346867 8 0.8 0.439012 9 0.9 0.535982 10 1 0.63538 Computed solution: Node X(I) U(X(I)) 0 0 0 1 0.1 0.00776462 2 0.2 0.0309987 3 0.3 0.0691306 4 0.4 0.121221 5 0.5 0.185985 6 0.6 0.261824 7 0.7 0.346867 8 0.8 0.439012 9 0.9 0.535982 10 1 0.63538 Computed solution: Node X(I) U(X(I)) 0 0 0 1 0.1 0.00776462 2 0.2 0.0309987 3 0.3 0.0691306 4 0.4 0.121221 5 0.5 0.185985 6 0.6 0.261824 7 0.7 0.346867 8 0.8 0.439012 9 0.9 0.535982 10 1 0.63538 Computed solution: Node X(I) U(X(I)) 0 0 0 1 0.1 0.00776462 2 0.2 0.0309987 3 0.3 0.0691306 4 0.4 0.121221 5 0.5 0.185985 6 0.6 0.261824 7 0.7 0.346867 8 0.8 0.439012 9 0.9 0.535982 10 1 0.63538 Computed solution: Node X(I) U(X(I)) 0 0 0 1 0.1 0.00776462 2 0.2 0.0309987 3 0.3 0.0691306 4 0.4 0.121221 5 0.5 0.185985 6 0.6 0.261824 7 0.7 0.346867 8 0.8 0.439012 9 0.9 0.535982 10 1 0.63538 Computed solution: Node X(I) U(X(I)) 0 0 0 1 0.1 0.00776462 2 0.2 0.0309987 3 0.3 0.0691306 4 0.4 0.121221 5 0.5 0.185985 6 0.6 0.261824 7 0.7 0.346867 8 0.8 0.439012 9 0.9 0.535982 10 1 0.63538 Compare computed and exact solutions: X Computed U Exact U 0 0 0 0.125 0.0135731 0.0122325 0.25 0.0500647 0.0484598 0.375 0.108198 0.10729 0.5 0.185985 0.186462 0.625 0.283085 0.282933 0.75 0.39294 0.392996 0.875 0.51174 0.512421 1 0.63538 0.63662 FEM1D_NONLINEAR: Normal end of execution. 03 March 2020 09:32:47 AM