Commit 7f43417d authored by Mark van Turnhout's avatar Mark van Turnhout
Browse files

deleted old plotting scripts from basillab

parent b3d83bf0
clear all; close all;
odbase = 'basil140611';
% read mesh, may take a while
fprintf('reading mesh\n')
mesh = aba_read_mesh(strcat(odbase,'.inp'));
fprintf('done reading mesh\n')
if ~exist(strcat(odbase,'.U'),'file')
system(sprintf('abaqus python extract_U.py -odb %s',odbase));
end
if ~exist(strcat(odbase,'.xyz'),'file')
system(sprintf('abaqus python extract_COORD.py -odb %s',odbase));
end
coord = load(strcat(odbase,'.xyz'));
coordi = coord(coord(:,1) == 0,:);
U = load(strcat(odbase,'.U'));
delidx = find(U(:,end-2) == 0 & U(:,end-1) == 0 & U(:,end) == 0)
coordi(delidx,:) = [];
U(delidx,:) = [];
coorde = coordi;
coorde(:,end-2:end) = coordi(:,end-2:end)+U(:,end-2:end);
if ~exist(strcat(odbase,'.evol'),'file')
system(sprintf('abaqus python extract_EVOL.py -odb %s',odbase));
end
evol = load(strcat(odbase,'.evol'));
nelm = evol(evol(:,1) == 0,2); % element numbers
ivol = evol(evol(:,1) == 0,3); % initial volume
fvol = evol(evol(:,1) == max(evol(:,1)),3); % final volume
% % find cast element set
% for s = 1:size(mesh,2)
% if strcmp(mesh(s).elsetname,'cast')
% castset = s;
% end
% end
% % elements belonging to cast
% castel = mesh(castset).elset;
% % delete cast elements from output
% ivol(ismember(castset,nelm(:,1)),:) = [];
% fvol(ismember(castset,nelm(:,1)),:) = [];
% nelm(ismember(castset,nelm(:,1)),:) = [];
J = [nelm, fvol./ivol];
minJ = J(J(:,2) == min(J(:,2)),:)
minJnodes = mesh(1).elem(minJ(1),2:end)
maxJ = J(J(:,2) == max(J(:,2)),:)
maxJnodes = mesh(1).elem(maxJ(1,1),2:end)
figure
hold on
plot3(coordi(:,3), coordi(:,4), coordi(:,5),'b.')
plot3(coorde(:,3), coorde(:,4), coorde(:,5),'k.')
for n = 1:size(minJnodes,2)-1
for m = n+1:size(minJnodes,2)
plot3(coordi(minJnodes([n m]),3), coordi(minJnodes([n m]),4), coordi(minJnodes([n m]),5),'b')
plot3(coorde(minJnodes([n m]),3), coorde(minJnodes([n m]),4), coorde(minJnodes([n m]),5),'r')
plot3(coordi(maxJnodes([n m]),3), coordi(maxJnodes([n m]),4), coordi(maxJnodes([n m]),5),'b')
plot3(coorde(maxJnodes([n m]),3), coorde(maxJnodes([n m]),4), coorde(maxJnodes([n m]),5),'g')
end
end
xlabel('x')
ylabel('y')
zlabel('z')
axis equal
X = coordi(:,3); Y = coordi(:,4); Z = coordi(:,end);
v = U(U(:,1) > 0,end-1);
for z = -9:9
[Xq,Yq,Zq] = meshgrid(linspace(min(X),max(X),100),linspace(min(Y),max(Y),100),z);
vq = griddata(X,Y,Z,v,Xq,Yq,Zq);
figure
contourf(Xq,Yq,vq,25)
colorbar
xlabel('x')
ylabel('y')
title(sprintf('displacements at z = %i',z))
end
\ No newline at end of file
clear all; close all;
odbase = 'basil140611';
% read mesh topology
if ~exist(strcat(odbase,'.top'),'file')
fprintf('extracting mesh topology from %s.odb\n',odbase);
system(sprintf('abaqus python extract_topology.py -odb %s',odbase));
end
top = load(strcat(odbase,'.top'));
if ~exist(strcat(odbase,'.xyz'),'file')
fprintf('extracting node coordinates from %s.odb\n',odbase);
system(sprintf('abaqus python extract_COORD.py -odb %s',odbase));
end
coord = load(strcat(odbase,'.xyz'));
coordi = coord(coord(:,1) == 0,:);
coorde = coord(coord(:,1) >0,:);
if ~exist(strcat(odbase,'.sed'),'file')
fprintf('extracting strain energy density from %s.odb\n',odbase);
system(sprintf('abaqus python extract_ESEDEN.py -odb %s',odbase));
end
sed = load(strcat(odbase,'.sed'));
data = zeros(size(sed,1),4);
% get element centroids
for el = 1:size(sed,1)
% sed(el,2)
% top(top(:,1) == sed(el,2),2:end)
% intersect(coordi(:,2), top(top(:,1) == sed(el,2),2:end))
coords = coordi(ismember(coordi(:,2), top(top(:,1) == sed(el,2),2:end)),3:end);
data(el,:) = [mean(coords,1), sed(el,end)];
end
[Xq, Yq, Zq] = meshgrid(linspace(min(data(:,1)),max(data(:,1)),100),linspace(min(data(:,2)),max(data(:,2)),100),0);
for z = -9:9
Zq = z*ones(size(Zq));
vq = griddata(data(:,1),data(:,2),data(:,3),data(:,4),Xq,Yq,Zq);
figure
contourf(Xq,Yq,vq)
caxis([0 max(data(:,end))])
colorbar
xlabel('x')
ylabel('y')
title(sprintf('SED at z = %i',z))
end
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment