1 / 28

Variational Formulation

Variational Formulation. PDE With BC. Weak Form. Linear System. Discrete Form. Variational Formulation. PDE With BC. Weak Form. where. Variational Formulation. BVP. Weak Formulation ( variational formulation).

Télécharger la présentation

Variational Formulation

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Variational Formulation PDE With BC Weak Form Linear System Discrete Form

  2. Variational Formulation PDE With BC Weak Form where

  3. Variational Formulation BVP Weak Formulation ( variational formulation) Multiply equation (1) by and then integrate over the domain Green’s theorem gives where

  4. Triangulation We have We have

  5. Weak Formulation ( variational formulation) Infinite dimensional space Finite dim subspace Space of all cont. pcw-linear

  6. Discrete Form  Linear System approximate u In expanded form In Matrix form This is a linear system of 5 equations in 5 unknowns

  7. The approximate Solution Once this linear system is solved we obtain an approximation to the solution In Matrix form Remark: Remark: We are going to focus our attention in the efficient construction of this stiffness matrix

  8. Sparsity In Matrix form Remark: This matrix is sparse (many zeros) few non-zero entries another example

  9. Sparsity Sparsity of the matrix # of nonzero =1153 312 triangles and 177nodes Use spy(A) to see sparsity

  10. Local basis function and global basis function 5 12 13 Global basis function If we restrict the function to the triangle K12 it becomes one of the local basis functions for K12 K12 has 3 local basis functions Matrix t

  11. Remark: This matrix is sparse (many zeros) few non-zero entries Assembly of the Stiffness Matrix Remark: These few nonzero entries are computed by looping over all triangles In Matrix form Remark: nonzero entry is a sum of integrals of local basis functions over a triangle

  12. Assembly of the Stiffness Matrix Step1 primary stiffnes matrix Loop over all triangles 1 -16. in each triangle, we calculate 3x3 matrix which involves calculating 9 integrals of all possible combination of local basis functions. Step2 impose boundary condition After we assemble the primary stiffness matrix in step1, we enforce the boundary condition by forcing the corresponding coefficient to be zero.

  13. Step1 primary stiffnes matrix For k = 1 : 16 Step1a: find all gradients Step1b: Find 9 integrals Step1c: Add these contributions to the primary stiffness matrix End the loop

  14. Find the gradients with cyclic permutation of the index i,j k over 1,2,3

  15. Find the gradients with cyclic permutation of the index i,j k over 1,2,3 function [area,b,c] = Gradients(x,y) area=polyarea(x,y); b=[y(2)-y(3); y(3)-y(1); y(1)-y(2)]/2/area; c=[x(3)-x(2); x(1)-x(3); x(2)-x(1)]/2/area;

  16. Step1 primary stiffnes matrix Loop over all triangles 1 -16 for example K9 10 5 13

  17. Step1 primary stiffnes matrix We want to compute: local basis functions Find gradient for each Find 3x3 matrix Loop over all triangles 1 -16. for example K9 10 5 13

  18. Step1 primary stiffnes matrix We want to compute: local basis functions Find gradient for each Find 3x3 matrix Loop over all triangles 1 -16. for example K9 10 5 13

  19. Step1 primary stiffnes matrix We want to compute: local basis functions Find gradient for each Find 3x3 matrix Loop over all triangles 1 -16. for example K9 10 5 13

  20. Step1 primary stiffnes matrix We want to compute: local basis functions Find gradient for each 10 5 13 Find 3x3 matrix Local to global

  21. Step1 primary stiffnes matrix We want to compute: local basis functions Find gradient for each 10 5 13 Find 3x3 matrix Local to global

  22. Step1 primary stiffnes matrix Triangle K10 1 2 3 1 1 -1/2 -1/2 2 -1/2 1/2 0 3 -1/2 0 1/2 Local to global 5 10 11 5 1 -1/2 -1/2 10 -1/2 1/2 0 11 -1/2 0 1/2

  23. K =1 1/2 0 -1/2 0 1/2 -1/2 -1/2 -1/2 1 K =2 1/2 0 -1/2 0 1/2 -1/2 -1/2 -1/2 1 K = 3 1/2 0 -1/2 0 1/2 -1/2 -1/2 -1/2 1 K =4 1/2 0 -1/2 0 1/2 -1/2 -1/2 -1/2 1 K =13 1/2 0 -1/2 0 1/2 -1/2 -1/2 -1/2 1 K =14 1/2 0 -1/2 0 1/2 -1/2 -1/2 -1/2 1 K =15 1/2 0 -1/2 0 1/2 -1/2 -1/2 -1/2 1 K =16 1/2 0 -1/2 0 1/2 -1/2 -1/2 -1/2 1

  24. Step1 primary stiffnes matrix 1 0 0 0 0 0 0 1 0 0 0 0 0 0 1 0 0 0 0 0 0 1 0 0 0 0 0 0 4 0 0 0 0 0 0 2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -1 0 0 0 -1 -1 0 -1 0 0 -1 -1 0 0 -1 0 -1 0 0 0 0 -1 -1 0 0 0 0 -1 0 0 0 0 0 0 0 -1 0 0 0 0 0 0 0 -1 0 0 0 0 0 0 0 -1 0 0 0 -1 -1 -1 -1 0 0 0 -1 -1 0 0 2 0 0 0 -1 -1 0 0 2 0 0 0 -1 -1 0 0 2 -1 0 0 -1 0 0 -1 4 0 0 0 -1 0 0 0 4 0 0 -1 -1 0 0 0 4 0 0 -1 -1 0 0 0 4 function A = StiffMat2D(p,t) np = size(p,2); nt = size(t,2); A = sparse(np,np); for K = 1:nt loc2glb = t(1:3,K); % local-to-global map x = p(1,loc2glb); % node x-coordinates y = p(2,loc2glb); % node y- [area,b,c] = Gradients(x,y); AK = (b*b'+c*c')*area; % element stiff mat A(loc2glb,loc2glb) = A(loc2glb,loc2glb)+ AK; % add element stiffnesses to A end

  25. Assemble the Load vector L In Matrix form

  26. Assembly of the Load Vector Step1 primary Load vector Loop over all triangles 1 -16. in each triangle, we calculate 3x1 matrix which involves calculating 3 integrals Step2 impose boundary condition After we assemble the primary load vector and stiffness matrix in step1, we enforce the boundary condition by forcing the corresponding coefficient to be zero.

  27. The load vector b is assembled using the same technique as the primary stiffness matrix A, that is, by summing element load vectors BKover the mesh. On each element K we get a local 3×1 element load vector BKwith entries BKi = ∫Kf φi dx; i = 1;2;3 Using node quadrature, we compute these integrals we end up with BKi≈ 1/3f (Ni)|K|; i = 1;2;3 We summarize the computation of the load vector with the following Matlab code.

  28. function b = LoadVec2D(p,t,f) np = size(p,2); nt = size(t,2); b = zeros(n,1); for K = 1:nt loc2glb = t(1:3,K); x = p(1,loc2glb); y = p(2,loc2glb); area = polyarea(x,y); bK = [f(x(1),y(1)); f(x(2),y(2)); f(x(3),y(3))]/3*area; % element load vector b(loc2glb) = b(loc2glb) ... + bK; % add element loads to b end

More Related