From 1a187345e4471a8844cb4d0f8679e4e53125cd5e Mon Sep 17 00:00:00 2001 From: Ayush Rathore Date: Thu, 14 Dec 2017 22:38:49 -0500 Subject: [PATCH] Part E --- README.md | 112 +++++++++++++++++++++++++++++++++++++++++++++++++++++- SE_diff.m | 66 ++++++++++++++++++++------------ 2 files changed, 152 insertions(+), 26 deletions(-) diff --git a/README.md b/README.md index 869ce3c..cd28060 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,23 @@ # ME 3255 Final Project ## Part A +#### Problem Statement +Create a central finite difference approximation of the gradient with 3-by-3 interior nodes of w +for the given membrane solution in terms of P and T. `[w]=membrane_solution3(T,P);` The +output `w` should be a vector, but the solution represents a 2D data set w(x,y). +#### Approach Central finite difference approximation for gradient of 3x3 interior nodes of w. ```matlab [w] = membrane_solution3(T,P); ``` ## Part B +#### Problem Statement +Solve for w given a pressure, P=0.001 MPa and tension, T=0.006 uN/um. Plot the result with +`surf(X,Y,W)` where X, Y, and W are the x-, y-, and z-coordinates of each point on the +membrane from 0-10um. +#### Approach + T = 0.006 uN/um P = 0.001 MPa ```matlab @@ -16,6 +27,13 @@ P = 0.001 MPa ## Part C +#### Problem Statement +Create a general central finite difference approximation of the gradient with +n-by-n interior nodes of w +for the given membrane solution in terms of P and T. `[w]=membrane_solution(T,P,n);` The +output `w` should be a vector, but the solution represents a 2D data set w(x,y). +#### Approach + General central finite difference approximation for gradient of nxn interior nodes of w. ```matlab @@ -23,6 +41,12 @@ of nxn interior nodes of w. ``` ## Part D +#### Problem Statement +Solve for w given a pressure, P=0.001 MPa and tension, T=0.006 uN/um with 10 interior +nodes. Plot the result with `surf(X,Y,W)` where X, Y, and W are the x-, y-, and +z-coordinates of each point on the membrane from 0-10um. +#### Approach + - T = 0.006 uN/um - P = 0.001 MPa - n = 10 nodes @@ -32,12 +56,76 @@ of nxn interior nodes of w. ![Fig. 2](./figures/PartD.png) ## Part E -Function that calculates the difference in the strain energy and the work done by pressure for n-by-n elements. +#### Problem Statement +Create a function `SE_diff` that calculates the difference in strain energy (right hand side Eq. +4) and work done by pressure (left hand side Eq. 4) for n-by-n elements. + +`[pw_se,w]=SE_diff(T,P,n)` + +Use the solution from part **c** to calculate w, then do a numerical integral over the +elements to calculate work done and strain energy. +#### Approach ```matlab -[pw_se,w] = SE_diff(T,P,n) +function [pw_se,w] = SE_diff(T,P,n) +% function that calculates the difference between +% strain energy and work done by pressure on the membrane. +% Input: +% T = tension per unit length (uN/um) +% P = pressure (MPa) +% n = # of interior nodes +% Output: +% pw_se = Absolute value of difference between strain energy and work done by pressure +% w = displacement vector for interior nodes + +E = 1e6; % 1 TPa ~= 10^6 MPa +t = 3*10^-4; % thickness [um] +h = 10/(n+1); % height [um] +v = 0.31; % Poisson's Ratio + +% Displacement vector w found using Part C +w = membrane_solution(T,P,n); +z = zeros(n + 2); +z(2:end-1,2:end-1) = reshape(w,[n n]); + +% Calculate average displacement, wavg, for each element by taking the displacement at each +% corner and then average the found values. +num = n + 1; +wavg = zeros(num); +for i = 1:num + for j = 1:num + wavg(i,j) = mean([z(i,j),z(i+1,j),z(i,j+1),z(i+1,j+1)]); + end +end + +% final work done by pressure +pw = sum(sum(wavg.*h^2.*P)) + +% to find= change in displacement, find the change in displacement on +% the x-axis, dwdx, and the change in displacement on the y-axis, dwdy, and +% average the found values. +dwdx = zeros(num); +dwdy = zeros(num); +for i = 1:num + for j = 1:num + dwdx(i,j) = mean([z(i+1,j)-z(i,j),z(i+1,j+1)-z(i,j+1)]); + dwdy(i,j) = mean([z(i,j+1)-z(i,j),z(i+1,j+1)-z(i+1,j)]); + end +end + +% Using dwdx and dwdy, calculate the strain energy, se. +se = (E*t*h^2)/(2*(1-v^2)) * sum(sum((1/4).*dwdx.^4+(1/4).*dwdy.^4+(1/4).*(dwdx.*dwdy).^2)); + +% Final value of difference between strain energy and work done by pressure, pw_se. +pw_se = pw - se; ``` ## Part F +#### Problem Statement +Use a root-finding method to calculate the tension in the membrane given a +pressure, P=0.001 MPa, and n=[20:5:40] interior nodes. + +Show that the error in tension is decreasing with a table: +#### Approach Root-finding Method used to find tension in the Membrane, given: - P = 0.001 MPa - n = [20:5:40] @@ -54,4 +142,24 @@ Error ``` ## Part G +#### Problem Statement +Plot the Pressure vs maximum deflection (P (y-axis) vs max(w) (x-axis)) for +P=linspace(0.001,0.01,10). Use a root-finding method to determine tension, T, at each +pressure. Use a cubic best-fit to find A, where, P(x)=A*dw^3. State how +many interior nodes were used for the graph. +#### Approach + Pressure v. Maximum deflection (MPa v. um) +## Part H +#### Problem Statement +Show that the constant A is converging as the number of nodes is +increased (Similar table to **f**). +#### Approach + + +## Part I +#### Problem Statement +If the square membrane sides are always equal, but have a tolerance of 0.1\%, what +should the depth of the sensor be if 2.5% of the sensors won't hit the bottom given a +maximum pressure of 0.01 MPa. +#### Approach diff --git a/SE_diff.m b/SE_diff.m index fd864cb..dcb9ae7 100644 --- a/SE_diff.m +++ b/SE_diff.m @@ -1,33 +1,51 @@ function [pw_se,w] = SE_diff(T,P,n) - E = 1; % 1 TPa ~= 10^6 MPa - v = 0.31; - t = 3*10^-4; - h = 10/(n+1); +% function that calculates the difference between +% strain energy and work done by pressure on the membrane. +% Input: +% T = tension per unit length (uN/um) +% P = pressure (MPa) +% n = # of interior nodes +% Output: +% pw_se = Absolute value of difference between strain energy and work done by pressure +% w = displacement vector for interior nodes - w = membrane_solution(T,P,n); +E = 1e6; % 1 TPa ~= 10^6 MPa +t = 3*10^-4; % thickness [um] +h = 10/(n+1); % height [um] +v = 0.31; % Poisson's Ratio - z = zeros(n + 2); - z(2:end-1,2:end-1) = reshape(w,[n n]); +% Displacement vector w found using Part C +w = membrane_solution(T,P,n); +z = zeros(n + 2); +z(2:end-1,2:end-1) = reshape(w,[n n]); - num = n + 1; - wavg = zeros(num); - for i = 1:num - for j = 1:num - wavg(i,j) = mean([z(i,j),z(i+1,j),z(i,j+1),z(i+1,j+1)]); - end +% Calculate average displacement, wavg, for each element by taking the displacement at each +% corner and then average the found values. +num = n + 1; +wavg = zeros(num); +for i = 1:num + for j = 1:num + wavg(i,j) = mean([z(i,j),z(i+1,j),z(i,j+1),z(i+1,j+1)]); end +end - pw = sum(sum(wavg.*h^2.)) - dwdx = zeros(num); - dwdy = zeros(num); +% final work done by pressure +pw = sum(sum(wavg.*h^2.*P)) - for i = 1:num - for j = 1:num - dwdx(i,j) = mean([z(i+1,j) - z(i,j), z(i+1,j+1) - z(i,j+1)]); - dwdy(i,j) = mean([z(i,j+1) - z(i,j), z(i+1,j+1) - z(i+1,j)]); - end - end +% to find= change in displacement, find the change in displacement on +% the x-axis, dwdx, and the change in displacement on the y-axis, dwdy, and +% average the found values. +dwdx = zeros(num); +dwdy = zeros(num); +for i = 1:num + for j = 1:num + dwdx(i,j) = mean([z(i+1,j)-z(i,j),z(i+1,j+1)-z(i,j+1)]); + dwdy(i,j) = mean([z(i,j+1)-z(i,j),z(i+1,j+1)-z(i+1,j)]); + end +end - se = (E*t*h^2)/(2*(1-v^2)) * sum(sum((1/4).*dwdx.^4+(1/4).*dwdy.^4+(1/4).*(dwdx.*dwdy).^2)); +% Using dwdx and dwdy, calculate the strain energy, se. +se = (E*t*h^2)/(2*(1-v^2)) * sum(sum((1/4).*dwdx.^4+(1/4).*dwdy.^4+(1/4).*(dwdx.*dwdy).^2)); - pw_se = pw - se; +% Final value of difference between strain energy and work done by pressure +pw_se = pw - se;