Skip to content

Commit

Permalink
Part E
Browse files Browse the repository at this point in the history
  • Loading branch information
ayr13001 committed Dec 15, 2017
1 parent 3f8523c commit 1a18734
Show file tree
Hide file tree
Showing 2 changed files with 152 additions and 26 deletions.
112 changes: 110 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -16,13 +27,26 @@ 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
[w] = membrane_solution(T,P,n)
```

## 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
Expand All @@ -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]
Expand All @@ -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
66 changes: 42 additions & 24 deletions SE_diff.m
Original file line number Diff line number Diff line change
@@ -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;

0 comments on commit 1a18734

Please sign in to comment.