How to perform numerical analysisis using the Finite Difference Method on a square plate with a corner removed.
5 views (last 30 days)
Show older comments
Hi, I'm curious to know if it is possible to adapt an existing code, which is used to analyse a square plate with dimensions 'hx+1 X hy+1', so that I can use FDM on a the same plate but with the corner removed.
The idea would be that the boundary conditions could be applied to the point (1,hy).
Below is included the current script that I would like to adapt. The dimensions of the plate are defined from line 20, and the boundary conditions are defined at line 72.
Any help would be greatly appreciated.
1>>
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2>> %%%%%%% An Introduction to Scientific Computing %%%%%%%
3>> %%%%%%% I. Danaila, P. Joly, S. M. Kaber & M. Postel %%%%%%%
4>> %%%%%%% Springer, 2005 %%%%%%%
5>> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6>> %%
7>> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8>> %%
9>> %% Matlab Solution of exercise 2 - project 7
10>> %% ELAS: elastic deformation of a membrane
11>> %% Solution of the microphone problem (non-linear equation)
12>> %%
13>> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
14>> %%
15>> clear all; close all;
16>> %
17>> % 1) Construction of the linear system
18>> %
19>> % number of points
20>> nx=18;ny=18;
21>> % step mesh size
22>> % dimensions of the plate 1 mm x 1 mm (unit m)
23>> long=1.e-03;large=1.e-03;
24>> hx=long/(nx+1);hy=large/(ny+1);
25>> h2x=hx*hx;h2y=hy*hy;
26>> h4x=h2x*h2x;h4y=h2y*h2y;h4xy=h2x*h2y;
27>> % points coordinates
28>> x=[0.:hx:long];y=[0.:hy:large];
29>> n=nx*ny;
30>> fprintf('\n ');
31>> fprintf('\n Points in x direction %d',nx);
32>> fprintf('\n Points in y direction %d',ny);
33>> fprintf('\n Total number of points %d',n);
34>> fprintf('\n ');
35>> % computing time measure
36>> t=cputime;
37>> % matrix of realistic problem
38>> % plate mechanical strain
39>> T=100.; % in Newton/m
40>> % plate Young modulus (silicium)
41>> E=1.3e+11; % in Newton/m2
42>> % plate thickness
43>> e=1.e-06; % 1 up to 10 microns
44>> % Poisson coefficient
45>> nu=0.25; % no dimension
46>> c1=T;c2=(E*e*e*e)/(12.*(1.0-nu*nu));
47>> % Laplacian operator matrix
48>> Ah5=ELAS_lap_matrix(hx,hy,nx,ny);
49>> % Bi-Laplacian operator matrix
50>> Ah13=ELAS_bilap_matrix(hx,hy,nx,ny);
51>> % Test problem matrix
52>> Ah=c2*Ah13+c1*Ah5;
53>> % Cholesky factorization - Matlab
54>> Lh=chol(Ah');
55>> % Display of matrix structure
56>> fs=18;
57>> figure(10);colormap('gray');
58>> spy(Ah);title('Matrix Ah ','FontSize',fs);
59>> figure(11);colormap('gray');
60>> spy(Lh');title('Matrix Lh ','FontSize',fs);
61>> % sampling of the right-hand side
62>> rhs0=zeros(nx*ny,1);
63>> for ix=1:nx
64>> for iy=1:ny
65>> xx=x(ix+1);
66>> yy=y(iy+1);
67>> uu=0.;
68>> rhs0((iy-1)*nx+ix)=ELAS_pressure(xx,yy,uu);
69>> end
70>> end
71>> % boundary conditions
72>> uh=zeros(nx+2,ny+2);
73>> % uh is null on the boundary ==> no correction of rhs (cf ELAS_plate_ex.m)
74>> %
75>> % 2) Solution of the linear problem
76>> %
77>> vh=Lh'\rhs0;
78>> wh=Lh\vh;
79>> for ix=1:nx
80>> for iy=1:ny
81>> uh(ix+1,iy+1)=wh((iy-1)*nx+ix);
82>> end
83>> end
84>> %
85>> % 3) Display of results
86>> %
87>> % capacitor thickness
88>> h=5.e-06; % 5 microns
89>> figure(11);
90>> colormap('gray');surf(x,y,h-uh');
91>> fs=18;
92>> title('Solution for the plate problem','FontSize',fs);
93>> %
94>> % 4) Solution of the nonlinear problem
95>> %
96>> eps0=1.0e-03;
97>> var=1.0;
98>> % initialisation
99>> uuh=uh; % uh = solution of linear problem
100>> rhs=zeros(nx*ny,1);
101>> k=0;
102>> while ( var > eps0 )
103>> k=k+1;
104>> uuha=uuh;
105>> for ix=1:nx
106>> for iy=1:ny
107>> xx=x(ix+1);
108>> yy=y(iy+1);
109>> uu=uuh(ix+1,iy+1);
110>> rhs((iy-1)*nx+ix)=ELAS_pressure(xx,yy,uu);
111>> end
112>> end
113>> vh=Lh'\rhs;
114>> wh=Lh\vh;
115>> for ix=1:nx
116>> for iy=1:ny
117>> uuh(ix+1,iy+1)=wh((iy-1)*nx+ix);
118>> end
119>> end
120>> % variation
121>> e1=norm(uuh,2);
122>> e2=norm(uuh-uuha,2);
123>> var=e2/e1;
124>> fprintf('\n Iteration %d',k);
125>> fprintf('\n Variation %12.8f',var);
126>> end
127>> % computing time measure
128>> time=cputime-t;
129>> fprintf('\n Computing time %20.15f',time);
130>> %
131>> % 5) Display of results
132>> %
133>> figure(12);
134>> colormap('gray');surf(x,y,h-uuh');
135>> fs=18;
title('Solution for the microphone problem','FontSize',fs);
0 Comments
Answers (0)
See Also
Categories
Find more on Calculus in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!