-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
152 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |