📄 abaqusto.m
字号:
function []= ABAQUStoMatlab(infil);%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% Copyright (c) 1993-1994 Annette D. Karstensen %% / University of Glasgow, SCOTLAND %% %% This post proccesing reads the fil-files from an ABAQUS-run, %% and returns numbers readable for matlab and %% can be used for further post processing. % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% CHANGES :% 12/2 95 <ADK> Reading in displacement from nodes% 29/3 95 <ADK> Changes for the newest version of ABAQUS 5.4-1% as the new version writes node set and element set% numbers to the fil file as a model% 8/6-95 <ADK> Jem Taylor kindly helped with some changes for the newest% version of ABAQUS (5.4-1) (Thank you)% 5/1-96 <ADK> Some comments about requirements for the input file is added.%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % The program should work with any input file from ABAQUS, however there% is a few caviats I would like to add. Useing the program we often found% that when writing the input file is was important to keep the same% frequency for all the variables, because if foreksample J is written% to the fil-file in a different frequency than s11, then it could be% difficult to use the vectors and matrises for calculation. Also% in the postprocessing program constraint, to use that it is requiret% that some of the names of the node set is defined correct. This will% be explaned later in the program.%%%% INPUT :% infil = the fil-file eq 'ccp0113.fil'% This is a centre cracked panel, a/W =0.1% and hardening rate 13, the file_reader routine% will automatic recognise that.%% OUTPUT :% for variables output : in matlab do > help variables%**************************************************************************% 1 stress11 : First stress component% 2 stress22 : Second stress component% 3 stress33 : Third stress component% 4 stress12 : Shear stress component% 5 miss : Mises stress% 6 tres : Tresca stress% 7 hydr : Hydrostatic pressure% 8 princ1 : First principal stress% 9 princ2 : Second principal stress% 10 princ3 : Third Principal stress% 11 inv3 : Third invariant% 12 strain11 : First total strain component% 13 strain22 : Second total strain component% 14 strain33 : Third total strain component% 15 strain12 : Fourth total strain component% 16 pstrain11 : First plastic strain component% 17 pstrain22 : Second plastic strain component% 18 pstrain33 : Third plastic strain component% 19 pstrain12 : Fourth plastic strain component% 20 pequst : Equvalent plastic strain% 21 reac_set1 : First component of reaction force% 22 reac_set2 : Second component fo reaction force% 23 Tese : Total elastic strain energy% 24 Tew : Total external work% 25 Tpd : Total plastic dissipation% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Opens the fil-file into matlab system% fid=fopen(infil);%% Read the first record so as to establish 'label' and 'items'% [items,label,status]=read_header(fid);%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Read of identification for the file% [cp_num,hard,a,cp]=file_reader(infil); %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%status=0;node_cnt=0;%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% This subfunction has been changed to fit the new version v.5.4% because then all the node sest and element set numbers are written% to the fil file as a part of the model, in 1931/32 and 1933/34 records.%% label 1931 is the node set numbers and label 1933 is the element set% numbers written, those is only written once in the program%% 1931/2/3/4 records will be before the 2000 record which introduces the% data read in the next phases further below ....%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% while (label~=2000) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % read has the value 0 or -1 % 0 : skip to end of record and read new label % -1 : new label allready read %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% read=0; if (label==1921)%% get the version information from the 1921 VERSION record% version,date,date/cont,time,elements,nodes,etc...% [vers,status]=read_text(fid); [date_1,status]=read_text(fid); [date_2,status]=read_text(fid); dato=date_1; dato(9)=date_2(1); elseif (label==1901) node_cnt=node_cnt+1; [node_no_tmp,status]=read_integer(fid); if status==0 MODEL(node_cnt)=node_no_tmp; [coord_tmp,status]=read_float(fid); end if status==0 coord(1,node_no_tmp)=coord_tmp(1); coord(2,node_no_tmp)=coord_tmp(2); end elseif (label==1931) % % read the 1931 and any 1932 continuation records ... % node_numbers=0; [nodeset_name,status]=read_text(fid); items=items-3; for item=1:items, node_numbers(item)=read_integer(fid); end items_so_far=items; [status]=skip_to_end(fid); [items,label,status]=read_header(fid); % % read has the value 0 or -1 % 0 : skip to end of record and read new label % -1 : new label allready read % if (label~=1932) read=-1; end while (label==1932) % % 1932 continuation records if present ... % items=items-2; for item=1:items node_numbers(items_so_far+item)=read_integer(fid); end items_so_far=items_so_far+items; [status]=skip_to_end(fid); [items,label,status]=read_header(fid); read=-1; end %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % save the nodes under nodeset_name ... %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% eval([ nodeset_name '= node_numbers;']) elseif (label==1933) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % read the 1933 and any 1934 continuation records ... %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% element_numbers=0; [elementset_name,status]=read_text(fid) items=items-3; for item=1:items, element_numbers(item)=read_integer(fid); end items_so_far=items; [status]=skip_to_end(fid); [items,label,status]=read_header(fid); if (label~=1934) read=-1; end while (label==1934) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % 1934 continuation records if present ... %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% items=items-2; for item=1:items element_numbers(items_so_far+item)=read_integer(fid); end items_so_far=items_so_far+items; [status]=skip_to_end(fid); [items,label,status]=read_header(fid); read=-1 end %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % save the elements under elementset_name ... %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% eval([ elementset_name '= element_numbers;']); %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% end if read==0 [status]=skip_to_end(fid); [items,label,status]=read_header(fid); end end%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Skip other unwanted info until we reach the 2000 INCREMENT START% which preceeds the increment data we actually want to read.%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% cur_inc=0; out_label=0;%% Read increment data% while status~=-1%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 1 is the key number for node/element header record this record% alway come before a% stress% record to identified which node number the stress correspond to,% this record is only written to once as it is repeated for each increment%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % if ((label==1911) & (cur_inc==1)) & vers~='5.4-1 '% if (exist('tmp_node')==1) & status==0% if (exist(string)==0)% eval([ string '= tmp_node;']);% tmp_node=0;% end% end%% [flag,status]=read_integer(fid);% [string,status]=read_text(fid); % % tmp_nn=0;% tmp_node=0; % if (label==1) & (cur_inc==1) node_number=read_integer(fid);%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % 11 is the key number for stresses%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% elseif (label==11) if out_label~=label tmp_nn=0; end out_label=label; ns_node=ns_node+1; tmp_nn=tmp_nn+1; if (cur_inc==1) tmp_node(tmp_nn)=node_number; stress_node(ns_node)=node_number; end [vector,status]=read_float(fid);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -