Contour not being rendered for non-finite data??

7 views (last 30 days)
I am getting the following warning and my contourf is returning blank
Warning: Contour not rendered for non-finite ZData
> In contourf (line 60)
In Project1 (line 23)
%crack length - for Kanalytical
a = 0.1;
K = sqrt(pi*a)*1000;
%grid for results to look like plate, adjusting for crack edge tip
[x,y] = meshgrid(-0.1:0.01:1-a, -0.5:0.01:0.5);
%polar coordinates
r = sqrt(x.^2+y.^2);
theta = atan(y./x);
%Airy stress ; for a = 10cm
sigmaxx = (K./sqrt(2*pi*r)).*cos(theta/2).*(1-(sin(theta/2).*sin(3*theta/2)));
sigmayy = (K./sqrt(2*pi*r)).*cos(theta/2).*(1+(sin(theta/2).*sin(3*theta/2)));
tauxy = (K./sqrt(2*pi*r)).*cos(theta/2).*(sin(theta/2).*cos(3*theta/2));
sigmavm = ((.5*(((sigmaxx-sigmayy)^2)+(sigmaxx^2)+(sigmayy^2)))+(3*(tauxy^2))^.5);
%surface of plate
surf(x,y,sigmavm);
xlabel('X'), ylabel('Y'), zlabel('von Mises Stress')
figure(1);
contourf(x,y,sigmavm)
xlabel('X'), ylabel('von Mises Stress')
%sigmayy along theta = 0
figure(2);
[i,j]=meshgrid(-0.1:0.01:1-a, -0.5:0.01:0.5);
rr = sqrt(x.^2+y.^2);
M=K./(sqrt(2*pi*rr));
figure(2)
plot(rr,M,'-',Color='b')
xlim([-0.1, 0.9])
xlabel('X'), ylabel('Sigmayy'), title('Sigmayy versus r at theta = 0');

Answers (1)

VBBV
VBBV on 5 Dec 2022
%crack length - for Kanalytical
a = 0.1;
K = sqrt(pi*a)*1000;
%grid for results to look like plate, adjusting for crack edge tip
[x,y] = meshgrid(-0.1:0.03:1-a, -0.5:0.03:0.5);
%polar coordinates
r = sqrt(x.^2+y.^2);
theta = atan(y./x);
%Airy stress ; for a = 10cm
sigmaxx = (K./sqrt(2*pi*r)).*cos(theta/2).*(1-(sin(theta/2).*sin(3*theta/2)));
sigmayy = (K./sqrt(2*pi*r)).*cos(theta/2).*(1+(sin(theta/2).*sin(3*theta/2)));
tauxy = (K./sqrt(2*pi*r)).*cos(theta/2).*(sin(theta/2).*cos(3*theta/2));
sigmavm = ((.5*(((sigmaxx-sigmayy)^2)+(sigmaxx^2)+(sigmayy^2)))+(3*(tauxy^2))^.5);
%surface of plate
surf(x,y,real(sigmavm));
xlabel('X'), ylabel('Y'), zlabel('von Mises Stress')
figure(1);
contourf(x,y,real(sigmavm))
xlabel('X'), ylabel('von Mises Stress')
%sigmayy along theta = 0
figure(2);
[i,j]=meshgrid(-0.1:0.03:1-a, -0.5:0.03:0.5);
rr = sqrt(x.^2+y.^2);
M=K./(sqrt(2*pi*rr));
figure(2)
plot(rr,M,'-',Color='b')
xlim([-0.1, 0.9])
xlabel('X'), ylabel('Sigmayy'), title('Sigmayy versus r at theta = 0');
  1 Comment
VBBV
VBBV on 5 Dec 2022
use a grid resolution to avoid singularity, i.e. zero
[x,y] = meshgrid(-0.1:0.03:1-a, -0.5:0.03:0.5); %
since these expressions have the reciprocals of x and y variables at which value becomes infinite
sigmaxx = (K./sqrt(2*pi*r)).*cos(theta/2).*(1-(sin(theta/2).*sin(3*theta/2)));
sigmayy = (K./sqrt(2*pi*r)).*cos(theta/2).*(1+(sin(theta/2).*sin(3*theta/2)));
tauxy = (K./sqrt(2*pi*r)).*cos(theta/2).*(sin(theta/2).*cos(3*theta/2));

Sign in to comment.

Categories

Find more on Stress and Strain in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!