Skip to content

Commit

Permalink
Part A update
Browse files Browse the repository at this point in the history
  • Loading branch information
ayr13001 committed Dec 15, 2017
1 parent 1a18734 commit ed83626
Show file tree
Hide file tree
Showing 3 changed files with 81 additions and 54 deletions.
121 changes: 73 additions & 48 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,38 @@
## 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).
for the given membrane solution in terms of P and T. `[w]=membrane_solution3(T,P);`

#### Approach
Central finite difference approximation for gradient of 3x3 interior nodes of w.
```matlab
[w] = membrane_solution3(T,P);
function [w] = membrane_solution3(T,P)
% Central finite difference approximation of gradient
% with 3x3 (um^2) interior nodes in terms of P & T.
% Input:
% T = tension per unit length (uN/um)
% P = pressure (MPa)
% Output:
% w = displacement vector for interior nodes
od = ones(8,1);
od(3:3:end) = 0;
k = -4 * diag(ones((3^2),1)) + diag(ones((3^2)-3,1),3) + diag(ones((3^2)-3,1),-3) + diag(od,1) + diag(od,-1);
y = -(10/4)^2*(P/T)*ones(9,1);
w = k\y;
% Find displacement vector w
% which represents 2D data set w(x,y)
[x,y] = meshgrid(0:10/4:10,0:10/4:10);
z = zeros(size(x));
z(2:end-1,2:end-1) = reshape(w,[3 3]);
% Plot gradient of membrane displacement
surf(x,y,z)
title('Gradient of Membrane Displacement')
zlabel('Displacement [um] (micrometers)')
end
```

## Part B
Expand Down Expand Up @@ -67,50 +93,50 @@ elements to calculate work done and strain energy.
#### Approach
```matlab
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
% 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 node rows/columns
% 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
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)]);
wavg(i,j) = mean([z(i,j),z(i+1,j),z(i,j+1),z(i+1,j+1)]);
end
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));
Expand All @@ -121,8 +147,7 @@ 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.
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
Expand Down
2 changes: 1 addition & 1 deletion SE_diff.m
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
% Input:
% T = tension per unit length (uN/um)
% P = pressure (MPa)
% n = # of interior nodes
% n = # of interior node rows/columns
% Output:
% pw_se = Absolute value of difference between strain energy and work done by pressure
% w = displacement vector for interior nodes
Expand Down
12 changes: 7 additions & 5 deletions membrane_solution3.m
Original file line number Diff line number Diff line change
@@ -1,25 +1,27 @@
function [w] = membrane_solution3(T,P)
% Central finite difference approximation of gradient
% with 3x3 (um^2) interior nodes in terms of P & T.
% Input:
% T = tension per unit length (uN/um)
% P = pressure (MPa)
% Output:
% w = displacement vector for interior nodes

od = ones(8,1);
od(3:3:end) = 0;
k = -4 * diag(ones((3^2),1)) + diag(ones((3^2)-3,1),3) + diag(ones((3^2)-3,1),-3) + diag(od,1) + diag(od,-1);

%
y = -(10/4)^2*(P/T)*ones(9,1);
%
w = k\y;

%
% Find displacement vector w
% which represents 2D data set w(x,y)
[x,y] = meshgrid(0:10/4:10,0:10/4:10);
z = zeros(size(x));
%
z(2:end-1,2:end-1) = reshape(w,[3 3]);
surf(x,y,z)

% Plot gradient of membrane displacement
surf(x,y,z)
title('Gradient of Membrane Displacement')
zlabel('Displacement [um] (micrometers)')
end

0 comments on commit ed83626

Please sign in to comment.