-
Notifications
You must be signed in to change notification settings - Fork 0
/
AnalyzeResults.m
100 lines (91 loc) · 4.54 KB
/
AnalyzeResults.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
%% Analyze Results of StokesFlowInRigidTube
%% Check conservation of mass and forces
[inflow, outflow, inletForce, SumofForces, ...
SumofMoments, SumofNormofMoments] = ...
BalanceofMassForcesMoments(FieldPts, BasisFn, NormalV, Weights, ...
inletelem, outletelem, wallelem, ...
elemDofNum, ...
unodal, Telem, ...
numGaussPoints);
%%
MassBalance = (inflow-outflow)*RefVelocity*RefLength^2; % micron^3/s
MassBalanceError = ((inflow-outflow)/(inflow+outflow))*100;
ForceBalanceError = (norm(SumofForces)/norm(inletForce))*100;
MomentBalanceError = (norm(SumofMoments)/SumofNormofMoments)*100;
fprintf('\nMass balance; \ndifference of inlet and outlet flow: %8.6f micron^3/s \n', ...
MassBalance)
fprintf('Mass balance error in tube: %8.6f%%\n',MassBalanceError)
fprintf('Sum of forces error in tube: %8.6f%%\n',ForceBalanceError)
fprintf('Sum of moment error in tube: %8.6f%%\n',MomentBalanceError)
%% Plotting the velocity and traction profiles on the vessel boundary
%% Plot Settings
PlotSettings
%% A line along the tube length
numNodesOnCircumference = 2*16; % for 16 elements around the circimference
if strcmp(name,'ShortMicrocapillary_16El')
numNodesAlongTubeLength = 2*16+1; % for 16 element along the length
elseif strcmp(name,'RefinedConstrictedVessel_16El')
numNodesAlongTubeLength = 2*48+1; % for 48 element along the length
elseif strcmp(name,'LongConstrictedVessel_16El')
numNodesAlongTubeLength = 2*48+1; % for 48 element along the length
end
wallnodeArray = reshape(wallnode, numNodesOnCircumference, ...
numNodesAlongTubeLength);
wallnodeOnlyWallLine = wallnodeArray(9,[1 3:numNodesAlongTubeLength 2]);
% % Depict wallnodeOnlyWallLine on vessel
% figure('Color','white')
% hold on
% Patch_Mesh(coord, connect)
% plot3(coord(1,wallnodeOnlyWallLine), ...
% coord(2,wallnodeOnlyWallLine), ...
% coord(3,wallnodeOnlyWallLine), 'k.','MarkerSize',MarkerSizeind)
%% Inlet and Outlet velocity profile
Plot_VectorFields(coord, connect, ...
[coord(1,inletnode) coord(1,outletnode)], ...
[coord(2,inletnode) coord(2,outletnode)], ...
[coord(3,inletnode) coord(3,outletnode)], ...
[unodal(1,inletnode) unodal(1,outletnode)], ...
[unodal(2,inletnode) unodal(2,outletnode)], ...
[unodal(3,inletnode) unodal(3,outletnode)], ...
Scaleind, LineWidthind, MaxHeadSizeind)
view([0, 90])
fig = gcf;
fig.NumberTitle = 'off';
fig.Name = 'Inlet and Outlet velocity profile';
if verbose_PrintProfiles
print('InletOutletVelocityProfile','-dpng','-r0')
end
%% Arrangement of connectivity matrix
[connectArranged,connectArrangedInd] = unique(connect);
%% Set-up for patch plotting
[connectIndArrange, coordPatchx, coordPatchy, coordPatchz] = ...
SetUp_CoordPatch(coord, connect);
%% Computing the unit normal vectors at element nodes
[NormalVNodal, NormalVNodalPatch] = ...
UnitNormalVectorAtElementNodes(coord, connect, connectIndArrange, ...
numElem, numNodesPerElem, ...
numDofPerNode);
% % Depict NormalVNodalPatch
% Plot_VectorFields(coord, connect, ...
% coordPatchx, coordPatchy, coordPatchz, ...
% NormalVNodalPatch(:,:,1), ...
% NormalVNodalPatch(:,:,2), ...
% NormalVNodalPatch(:,:,3), ...
% Scaleind, LineWidthind, MaxHeadSizeind)
%% Nodal traction, pressure and shear fields
Plot_TractionPressureShearFieldsOnVessel...
(coord*RefLength, ... % micron
connect, wallnodeOnlyWallLine, ...
coordPatchx*RefLength, ... % micron
coordPatchy*RefLength, ... % micron
coordPatchz*RefLength, ...% micron
TubeRadius*RefLength, ...% micron
TubeLength*RefLength, ...% micron
Telem*RefPressure, ... % Pa
InletPressure*RefPressure, ... % Pa
NormalVNodal, NormalVNodalPatch, ...
connectIndArrange, connectArrangedInd, ...
numElem, numDofPerNode, numDofPerElem, numNodesPerElem, ...
Scaleind, MarkerSizeind, LineWidthind, ...
MaxHeadSizeind, TransparencyInd, ...
name, verbose_PrintProfiles, false)