Code covered by the BSD License  

Highlights from
Stress2Strain

image thumbnail

Stress2Strain

by

 

13 Jul 2009 (Updated )

The interface allows computing strain courses from stress courses.

matproperty
function mate = matproperty

%Function MATE = MATPROPERTY creates the graphical user interface
%to create the structure MATE that includes all required material
%properties for the Mroz-Garud kinematic hardeing model of material
%
%Author: Aleksander Karolczuk, 14 August 2009

fh = figure('Name','Material properties. Copyright: a.karolczuk@po.opole.pl',...
    'Position',[100,150,640,500],...
    'Resize', 'off',...
    'Toolbar','none',...
    'Menubar','none','Color',[0.941176 0.941176 0.941176]);

panel1 = uipanel('Parent',fh,'Title','Coefficients',...
    'Position',[.01 .66 .98 .32]);

Dtextedit=0.18;
y1=0.55; %first row
y2=0.08; %second row

%--Young modulus----------------------------------%
edithE = uicontrol(panel1,'Style','edit',...
    'Units','normalized',...
    'String','210000',...
    'BackgroundColor','white',...
    'Fontsize',9,...
    'Position',[0.02 y1 0.2 Dtextedit]);

texthE = uicontrol(panel1,'Style','text',...
    'Units','normalized',...
    'String','Young modulus, MPa',...
    'Position',[0.02 0.76 0.2 0.14]);

%--Poisson ratio----------------------------------%
edithni = uicontrol(panel1,'Style','edit',...
    'Units','normalized',...
    'String','0.30',...
    'BackgroundColor','white',...
    'Fontsize',9,...
    'Position',[0.02 y2 0.2 Dtextedit]);

texthni = uicontrol(panel1,'Style','text',...
    'Units','normalized',...
    'String','Poisson ratio, -',...
    'Position',[0.02 0.27 0.2 0.14]);

%--Coefficient of cyclic hardening, K'-----------------%
edithK = uicontrol(panel1,'Style','edit',...
    'Units','normalized',...
    'String','1320',...
    'BackgroundColor','white',...
    'Fontsize',9,...
    'Position',[0.27 y1 0.2 Dtextedit]);

texthK = uicontrol(panel1,'Style','text',...
    'Units','normalized',...
    'String','Coefficient of cyclic hardening, K'', MPa',...
    'Position',[0.27 0.76 0.2 0.23]);

%--Yield stress----------------------------------%
edithSigy = uicontrol(panel1,'Style','edit',...
    'Units','normalized',...
    'String','220',...
    'BackgroundColor','white',...
    'Fontsize',9,...
    'Position',[0.27 y2 0.2 Dtextedit]);

texthSigy = uicontrol(panel1,'Style','text',...
    'Units','normalized',...
    'String','Yield stress, MPa',...
    'Position',[0.27 0.27 0.2 0.14]);

%--Exponent of cyclic hardening, n'-----------------%
edithn = uicontrol(panel1,'Style','edit',...
    'Units','normalized',...
    'String','0.2074',...
    'BackgroundColor','white',...
    'Fontsize',9,...
    'Position',[0.52 y1 0.2 Dtextedit]);

texthn = uicontrol(panel1,'Style','text',...
    'Units','normalized',...
    'String','Exponent of cyclic hardening, n'', -',...
    'Position',[0.52 0.76 0.2 0.23]);

%--Radius increment of yield surfaces----------------------------%
edithDSig = uicontrol(panel1,'Style','edit',...
    'Units','normalized',...
    'String','50',...
    'BackgroundColor','white',...
    'Fontsize',9,...
    'Position',[0.52 y2 0.2 Dtextedit]);

texthDSig = uicontrol(panel1,'Style','text',...
    'Units','normalized',...
    'String','Radius increment of yield surfaces, MPa',...
    'Position',[0.52 0.27 0.2 0.23]);


%--Maximum stress, MPa-----------------%
edithSigmax = uicontrol(panel1,'Style','edit',...
    'Units','normalized',...
    'String','500',...
    'BackgroundColor','white',...
    'TooltipString','Maximum stress must be higher than Yield stress !',...
    'Fontsize',9,...
    'Position',[0.77 y1 0.2 Dtextedit]);

texthSigmax = uicontrol(panel1,'Style','text',...
    'Units','normalized',...
    'String','Maximum stress, MPa',...
    'TooltipString','Maximum stress must be higher than Yield stress !',...
    'Position',[0.77 0.76 0.2 0.23]);

axesh = axes('Parent',fh,'units','normalized',...
    'Box','on',...
    'Fontsize',8,...
    'Position',[0.1 0.11 0.86 0.51]);
set(get(axesh,'xlabel'),'string','\epsilon_a, -','fontsize',8)
set(get(axesh,'ylabel'),'string','\sigma_a, MPa','fontsize',8)


%---buttons----------------------------------------%
bhApply = uicontrol(fh,'Units','normalized',...
    'Position',[0.81 0.23 0.13 0.08],...
    'String','Apply',...
    'Callback',@buttonApply);

bhOk = uicontrol(fh,'Units','normalized',...
    'Position',[0.81 0.13 0.13 0.08],...
    'String','OK',...
    'Callback',@buttonOK);

uiwait(fh);


%------------------------------------------------%

    function buttonApply(hObject,eventdata)
        
        mate.E=str2double(get(edithE,'String'));
        mate.K=str2double(get(edithK,'String'));
        mate.n=str2double(get(edithn,'String'));
        mate.ni=str2double(get(edithni,'String'));
        mate.Sig_y=str2double(get(edithSigy,'String'));
        mate.DSig=str2double(get(edithDSig,'String'));
        mate.Sigmax=str2double(get(edithSigmax,'String'));
        
        if mate.Sigmax<mate.Sig_y,
            f = warndlg('Maximum stress must be higher than the yield stress.', 'Warning');
            mate.Sigmax=mate.Sig_y+mate.DSig;
            set(edithSigmax,'string',num2str(mate.Sigmax))
            uiwait(f)
        end
        
        Sig_ai=[0:5:mate.Sigmax];
        Eps_ai=Sig_ai/mate.E+(Sig_ai/mate.K).^(1/mate.n);
        
        Sig_a=[0 mate.Sig_y:mate.DSig:mate.Sigmax];
        Eps_a=Sig_a/mate.E+(Sig_a/mate.K).^(1/mate.n);
        %axes(axesh)
        plot(Eps_ai,Sig_ai,'-k',Eps_a,Sig_a,'+-b')
        xlabel('\epsilon_a, -')
        ylabel('\sigma_a, MPa')
        
        H=zeros(length(Sig_a)-2,1);
        for i=2:length(Sig_a)-1,
            H(i-1,1)=((3/2)*(((Eps_a(i+1)-Eps_a(i))/(Sig_a(i+1)-Sig_a(i)))-1/mate.E))^-1;
        end
        R=Sig_a(2:end)';
        
        mate.R=R;
        mate.H=H;
        
    end

%------------------------------------------------%

    function buttonOK(hObject,eventdata)
        close(fh)
    end
end

Contact us