ansys提取刚度阵质量阵的快速方法.docx_第1页
ansys提取刚度阵质量阵的快速方法.docx_第2页
ansys提取刚度阵质量阵的快速方法.docx_第3页
ansys提取刚度阵质量阵的快速方法.docx_第4页
ansys提取刚度阵质量阵的快速方法.docx_第5页
免费预览已结束,剩余9页可下载查看

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

HBMAT命令:命令:HBMAT,fname,ext,-,form,matrx,rhs其中: Fname-输出矩阵的路径和文件名,缺省为当前工作路径和当前工作文件名。 ext-输出矩阵文件的扩展名,缺省为.matrix。 form-定义输出矩阵文件的格式,其值可取: =ASCII:ASCII码格式; =BIN:二进制格式。 matrix-定义输出矩阵的类型,其值可取: =STIFF:输出刚度矩阵。可用于写入了.FULL文件的任何类型的分析。 =MASS:输出质量矩阵。可用于特征值屈曲、子结构分析、模态分析。 =DAMP:输出阻尼矩阵。仅用于有阻尼的模态分析。 rhs-右边项输出控制(右边项指用矩阵所表示方程的等号右端矢量,这里可为节点荷载向量),如rhs=YES则输出,如rhs=NO则不输出。 模态分析时,因仅LANB和QR法可生成完整的质量矩阵,因此也仅采用这两种方法时才可使用HBMAT命令得到质量矩阵文件。Harwell-Boeing文件格式: 用HBMAT命令可输出结构刚度矩阵、质量矩阵和阻尼矩阵,其文件记录格式为大型稀疏矩阵的标准交换格式,采用索引存储方法仅记录矩阵的非零元素。文件基本格式是前面有4或5行描述数据,其后为单列矩阵元素值,说明如下: 第1行:格式(A72),为文件头的字符型解释,如刚度矩阵或质量矩阵等标题。 第2行:格式(5I14),分别表示该文件的总行数(不包括文件头)、矩阵列指针的总行数、矩阵行索引的总行数、矩阵元素数值的总行数、右边项总行数。 第3行:格式(A3,11X,4I14),分别为矩阵类型、矩阵行数、矩阵列数、矩阵行索引数(对组装后的矩阵,该值等于矩阵行索引数)、单元元素数(对组装后的矩阵此值为0)。 第4行:格式(2A16,2A20),分别表示列指针格式、行索引格式、系数矩阵数值格式、右边项数值格式。 第5行:格式(A3,11X,2I14),A3各列分别表示右边项格式、应用高斯起始矢量、应用eXact求解矢量;两个整数分别表示右边项列数、行索引数。三个字符中的第1个字符可取:F-全部存贮(如节点荷载向量的全部元素)、M-与系数矩阵相同方法。 第6行后:矩阵元素值(单列)。 矩阵类型用3个字符表示,第1个字符可取:R-实数矩阵、C-复数矩阵、P-仅矩阵结构(无元素数值);第2个字符可取:S-对称矩阵、U-不对称矩阵、H-Hermitian矩阵、Z-病态对称矩阵;R-带状矩阵;第3个字符可取:A-组装的矩阵、E-单元矩阵(未组装)。对称矩阵只存储下三角元素,如结构刚度矩阵为对称矩阵,Harwell-Boeing格式则仅记录下三角元素。 根据Harwell-Boeing文件格式,可读取矩阵的任意行列元素的数值,也可编程还原为满矩阵存储,以便它用,很显然这种提取方式比较方便。如当生成.FULL文件后,可采用命令:/AUX2FILE,mywork,fullHBMAT,mystiff,txt,ASCII,STIFF,YESFINISH将二进制mywork.full文件输出为ASCII码文件mystiff.txt,并输出右边项。Menu PathsMain MenuGeneral PostprocData & File Opts Main MenuTimeHist PostproSettingsFile Utility MenuFileListBinary Files Utility MenuListFilesBinary Files 这一步一定要先读取数据,Main MenuGeneral PostprocData & File Opts 不然导不出来。然后在计算的工作目录下找到mystiff.txt,OK了,只不过这是Harwell-Boeing文件格式的,还要利用程序把它转换了满矩阵存储,希望用过的高手把程序贴出来,让大家共同进步。急求把Harwell-Boeing转化为满矩阵存储的命令或程序,请大家帮帮忙。一个存储例子:Stiffness matrix from ANSYS FULL file dumped into Harwell-Boeing format 43 7 15 15 6RSA 6 6 15 0(I14) (I14) (d25.15) (d25.15) F 1 6 1 4 8 11 13 15 16 1 3 4 2 3 5 6 3 5 6 4 6 5 6 6 0.512000000000000D+03 0.240000000000000D+02 -0.500000000000000D+03 0.512000000000000D+03 0.240000000000000D+02 -0.120000000000000D+02 0.240000000000000D+02 0.128000000000000D+03 -0.240000000000000D+02 0.320000000000000D+02 0.512000000000000D+03 0.240000000000000D+02 0.512000000000000D+03 -0.240000000000000D+02 0.128000000000000D+03 0.110000000000000D+02 -0.500000000000000D+01 -0.100000000000000D+01 0.000000000000000D+00 -0.500000000000000D+010.500000000000000D+01命令流例子:下面是书中的一个例子,但要/input读入,不能在命令行直接执行,因存在format格式。!= !EX6.10 提取结构刚度矩阵及处理FINISH$/CLEAR$/FILNAME,HBFILE$/PREP7 !定义工作文件名HBFILE.TXTET,1,BEAM3$MP,EX,1,2E5$R,1,1E-2,32E-5,0.5 !定义单元类型、材料、实常数N,1$N,2,0,4$N,3,4,4$N,4,4,0$EN,1,2,3$EN,2,1,2$EN,3,4,3 !按图6-9所示创建有限元模型F,2,FX,5$SFBEAM,1,1,PRES,10,2,-1$SFBEAM,2,1,PRES,3 !施加节点荷载和单元荷载D,1,ALL$D,4,ALL !施加约束/SOLU$SOLVE$FINISH$/AUX2 !进入求解层求解后再进入AUX2处理器FILE,HBFILE,FULL !指定文件HBFILE.FULLHBMAT,HBFILE,TXT,ASCII,STIFF,YES !转换刚度矩阵和右边项为HBFILE.TXT文件FINISH!以下从HBFILE.TXT读入数据,并还原为满矩阵存储*DIM,CONTLINE,5 !定义一维数组*VREAD,CONTLINE(1),HBFILE,TXT,5,1 !跳过第1行后读入5个数据(5F14.0)PTRCRD=CONTLINE(2) !保存列指针总行数INDCRD=CONTLINE(3) !保存行索引总行数VALCRD=CONTLINE(4) !保存矩阵元素总行数RHSCRD=CONTLINE(5) !保存右边项总行数*VREAD,CONTLINE(1),HBFILE,TXT,4,2 !跳过第2行后读入4个数据(A3,11X,4F14.0)NROW=CONTLINE(2)$NCOL=CONTLINE(3) !保存刚度矩阵的行列数STRLINE=$CONTLINE= !删除数组*IF,RHSCRD,EQ,0,THEN !如果无右边项取LS0=4行,否则取LS0=5LS0=4$*ELSE$LS0=5$*ENDIF*DIM,POINTR,PTRCRD !定义列指针数组*DIM,ROWIND,INDCRD !定义行索引数组*DIM,VALUES,VALCRD !定义矩阵元素值数组*DIM,RHSVAL,RHSCRD !定义右边项元素值数组*VREAD,POINTR(1),HBFILE,TXT,PTRCRD,LS0(F14.0) !读入列指针数据*VREAD,ROWIND(1),HBFILE,TXT,INDCRD,LS0+PTRCRD(F14.0) !读入行索引数据*VREAD,VALUES(1),HBFILE,TXT,VALCRD,LS0+PTRCRD+INDCRD(D25.15) !读入矩阵元素数据*VREAD,RHSVAL(1),HBFILE,TXT,RHSCRD,LS0+PTRCRD+INDCRD+VALCRD(D25.15) !读入右边项元素数据*DIM,SMATR,NROW,NCOL !定义矩阵行列数,满矩阵存储的矩阵*DO,ICOL,1,NCOL !以列数循环STACOL=POINTR(ICOL) !得到当前列指针(元素的列号)ENDCOL=POINTR(ICOL+1) !得到下一列指针*DO,IROW,STACOL,ENDCOL-1 !以当前列中的非零元素个数循环TRUEROW=ROWIND(IROW) !得到当前元素的行号SMATR(TRUEROW,ICOL)=VALUES(IROW) !按行列号将元素值保存到矩阵中*ENDDO$*ENDDO !结束两个循环*DO,IROW,1,NROW !形成上三角元素,进而得到满矩阵*DO,ICOL,1,NCOL SMATR(IROW,ICOL)=SMATR(ICOL,IROW)*ENDDO$*ENDDO!以下为删除临时变量和数组变量POINTR=$ROWIND=$VALUES=$RHSVAL=$ICOL=$IROW=$LS0=$STACOL=ENDCOL=$TRUEROW=$TOTCRD=$PTRCRD=$INDCRD=$VALCRD=$RHSCRD=Matlab读取Harwell-Boeing format文件数据:采用matlab的Harwell-Boeing format文件数据提取程序,将数据文件提取为相应矩阵形式即可。HB_TO_MM is a MATLAB program which accepts the name of a file containing a sparse matrix in the Harwell Boeing Sparse Matrix File Format, and which reads that data and writes a corresponding Matrix Market sparse matrix file. File:mmread.m Requires:strtok.m from Matlab Version 4.2.If using a previous version of Matlab, substitute gettok.m Function:A, rows, cols, entries = mmread(filename); Description:Reads the contents of the Matrix Market file filename into the matrix A. A will be either sparse or full (in the Matlab sense) depending on the Matrix Market format, indicated by coordinate (coordinate sparse storage or array (dense array storage). The data will be duplicated as appropriate if symmetry is indicated in the header.Optionally, size information about the matrix can be obtained by using the return values rows, cols, and entries, where entries is the number of nonzero entries in the final matrix. Licensing: The computer code and data files described and made available on this web page are distributed under the GNU LGPL license. Related Data and Programs: HB is a dataset directory which contains a collection of sparse matrices in the HB format. HB_IO is a MATLAB library which reads and writes Harwell-Boeing files, used by HB_TO_MSM. HB_TO_MM is a MATLAB program which converts a sparse matrix from Harwell-Boeing to Matrix Market format. HB_TO_MSM is a MATLAB program which converts a sparse matrix stored in a Harwell Boeing file to MATLAB sparse matrix format; HB_TO_ST is a MATLAB program which converts a sparse matrix from Harwell-Boeing to sparse triplet format. HBSMC, a dataset directory which contains the Harwell Boeing Sparse Matrix Collection; MM is a data directory which contains a description and examples of the Matrix Market format for storing matrices. MM_IO is a MATLAB library which reads and writes sparse linear systems stored in the Matrix Market format. MM_TO_HB is a MATLAB program which reads the sparse matrix information from an MM Matrix Market file and writes a corresponding HB Harwell Boeing file. SPARSE is a MATLAB builtin function which creates and manipulates sparse matrices. ch_cap.m, returns the uppercase version of a character. ch_eqi.m, determines whether two characters are the same, ignoring case. ch_is_digit.m, determines whether a character is a digit. ch_is_format_code.m, determines whether a character is a one letter FORTRAN format code. ch_to_digit.m, converts a character to the digit it represents. hb_exact_read.m, reads the exact solution vectors of an HB file. hb_file_read.m, reads an HB file. hb_guess_read.m, reads the starting guess vectors of an HB file. hb_header_read.m, reads the header of an HB file. hb_rhs_read.m, reads the right hand sides of an HB file. hb_structure_read.m, reads the structure of an HB file. hb_to_msm.m, reads an HB file and creates a MATLAB Sparse Matrix. hb_values_read.m, reads the values of an HB file. s_len_trim.m, determines the length of a string to the last nonblank. s_to_format.m, extracts information from a string representing a FORTRAN format. s_to_i4.m, converts a string to an I4. s_to_r8.m, converts a string to an R8. timestamp.m, prints the current YMDHMS date as a timestampANSYS单元和整体刚度矩阵的提取 一、单元刚度矩阵的提取/DEBUG命令详细说明:finish /clear PI=3.1415926 w1=3 w2=10 w3=6 w4=1.2 r=.8 t=0.08 /PREP7 !* ET,1,SHELL63 R,1,t ET,2,MASS21 R,2,500,500,500,2000,2000,2000, !* UIMP,1,EX, , ,2e11 UIMP,1,NUXY, , ,0.3, UIMP,1,DAMP, , ,0.2, UIMP,1,DENS, , ,7800, BLC4,0,0,w2,w1 ESIZE,1.5,0, AMESH,all NSEL,S,LOC,X,0.0 D,all, , , , , ,ALL, , , , , allsel,all SFA,all,1,PRES,12 FINISH /OUTPUT,cp,out, ! 将输出信息送到cp.out文件 /debug,-1,1 ! 指定输出单元矩阵 /SOLU SOLVE finish /OUTPUT, TERM ! 将输出信息送到output windows中 这时用编辑器打开cp.out文件,可以看到按单元写出的质量、刚度等矩阵二、整体刚度矩阵的提取(有三种方法:用户程序法、超单元法、HBMAT命令法)1、用户程序法:需要二次开发(略)2、超单元法/solu antype,7 !substructuring分析类型 seopt,matname,1 !设置文件名称和刚度矩阵类型(刚度,质量,阻尼等) nsel,all !选择所有节点 m,all,all !定义所有节点自由度为主自由度 solve !求解 selist,matname,3 !列出整体刚度矩阵 3、HBMAT命令法提取整体矩阵命令:HBMAT,fname,ext,-,form,matrx,rhs其中: Fname-输出矩阵的路径和文件名,缺省为当前工作路径和当前工作文件名。 ext-输出矩阵文件的扩展名,缺省为.matrix。 form-定义输出矩阵文件的格式,其值可取: =ASCII:ASCII码格式; =BIN:二进制格式。 matrix-定义输出矩阵的类型,其值可取: =STIFF:输出刚度矩阵。可用于写入了.FULL文件的任何类型的分析。 =MASS:输出质量矩阵。可用于特征值屈曲、子结构分析、模态分析。 =DAMP:输出阻尼矩阵。仅用于有阻尼的模态分析。 rhs-右边项输出控制(右边项指用矩阵所表示方程的等号右端矢量,这里可为节点荷载向量),如rhs=YES则输出,如rhs=NO则不输出。 模态分析时,因仅LANB和QR法可生成完整的质量矩阵,因此也仅采用这两种方法时才可使用HBMAT命令得到质量矩阵文件。 Harwell-Boeing文件格式 用HBMAT命令可输出结构刚度矩阵、质量矩阵和阻尼矩阵,其文件记录格式为大型稀疏矩阵的标准交换格式,采用索引存储方法仅记录矩阵的非零元素。文件基本格式是前面有4或5行描述数据,其后为单列矩阵元素值,说明如下: 第1行:格式(A72),为文件头的字符型解释,如刚度矩阵或质量矩阵等标题。 第2行:格式(5I14),分别表示该文件的总行数(不包括文件头)、矩阵列指针的总行数、矩阵行索引的总行数、矩阵元素数值的总行数、右边项总行数。 第3行:格式(A3,11X,4I14),分别为矩阵类型、矩阵行数、矩阵列数、矩阵行索引数(对组装后的矩阵,该值等于矩阵行索引数)、单元元素数(对组装后的矩阵此值为0)。 第4行:格式(2A16,2A20),分别表示列指针格式、行索引格式、系数矩阵数值格式、右边项数值格式。 第5行:格式(A3,11X,2I14),A3各列分别表示右边项格式、应用高斯起始矢量、应用eXact求解矢量;两个整数分别表示右边项列数、行索引数。三个字符中的第1个字符可取:F-全部存贮(如节点荷载向量的全部元素)、M-与系数矩阵相同方法。 第6行后:矩阵元素值(单列)。 矩阵类型用3个字符表示,第1个字符可取:R-实数矩阵、C-复数矩阵、P-仅矩阵结构(无元素数值);第2个字符可取:S-对称矩阵、U-不对称矩阵、H-Hermitian矩阵、Z-病态对称矩阵;R-带状矩阵;第3个字符可取:A-组装的矩阵、E-单元矩阵(未组装)。对称矩阵只存储下三角元素,如结构刚度矩阵为对称矩阵,Harwell-Boeing格式则仅记录下三角元素。 根据Harwell-Boeing文件格式,可读取矩阵的任意行列元素的数值,也可编程还原为满矩阵存储,以便它用,很显然这种提取方式比较方便。如当生成.FULL文件后,可采用命令/AUX2$FILE,mywork,full$HBMAT,mystiff,txt,ASCII,STIFF,YES$FINISH将二进制mywork.full文件输出为ASCII码文件mystiff.txt,并输出右边项。 命令流: /aux2file,hbfile,fullhbmat,hbfile,txt,ascii,stiff,yesfinish!从hbfile.txt读入数据,并还原为满矩阵存储*dim,contline,5*vread,contline(1),hbfile,txt,5,1(5f14.0)totcrd=contline(1)ptrcrd=contline(2)indcrd=contline(3)valcrd=contline(4)rhscrd=contline(5)*vread,contline(1),hbfile,txt,4,2(a3,11x,4f14.0)nrow=contline(2)ncol=contline(3)strline=contline=*if,rhscrd,eq,0,thenls0=4*elsels0=5*endif*dim,pointr,ptrcrd*dim,rowind,indcrd*dim,values,valcrd*dim,rhsval,rhscrd*vread,pointr(1),hbfile,txt,ptrcrd,ls0(f14.0)*vread,rowind(1),hbfile,txt,indcrd,ls0+ptrcrd(f14.0)*vread,values(1),hbfile,txt,valcrd,ls0+ptrcrd+indcrd(d25.15)*vread,rhsval(1),hbfile,txt,rhscrd,ls0+ptrcrd+indcrd+valcrd(d25.15)*dim,smatr,nrow,ncol*do,icol,1,ncolstacol=pointr(icol)endcol=pointr(icol+1)*do,irow,stacol,endcol-1truerow=rowind(irow)smatr(truerow,icol)=values(irow)*enddo*enddo*do,irow,1,nrow*do,icol,1,ncolsmatr(irow,icol)=smatr(icol,irow)*enddo*enddopointr=rowind=values=rhsval=icol=irow=ls0=stacol=endcol=truerow=totcrd=ptrcrd=indcrd=valcrd=rhscrd=以上这些是我总结的,结果不同就错了。HB File Characteristics: ASCII; Each data item in the file must occur in particular columns. Oriented to FORTRAN, in the explicit use of FORTRAN FORMAT codes; HB files begin with a header of 4, or sometimes 5, lines: Line 1: TITLE, (72 characters) KEY, (8 characters) Line 2: TOTCRD, integer, total number of data lines, (14 characters) PTRCRD, integer, number of data lines for pointers, (14 characters) INDCRD, integer, number of data lines for row or variable indices, (14 characters) VALCRD, integer, number of data lines for numerical values of matrix entries, (14 characters) RHSCRD, integer, number of data lines for right hand side vectors, starting guesses, and solutions, (14 characters) Line 3: MXTYPE, matrix type (see table), (3 characters) blank space, (11 characters) NROW, integer, number of rows or variables, (14 characters) NCOL, integer, number of columns or elements, (14 characters) NNZERO, integer, number of row or variable indices. For assembled matrices, this is just the number of nonzero entries. (14 characters) NELTVL, integer, number of elemental matrix entries. For assembled matrices, this is 0. (14 characters) Line 4: PTRFMT, FORTRAN I/O format for pointers, (16 characters) INDFMT, FORTRAN I/O format for row or variable indices, (16 characters) VALFMT, FORTRAN I/O format for matrix entries, (20 characters) RHSFMT, FORTRAN I/O format for right hand sides, initial guesses, and solutions, (20 characters) Line 5: (only present if 0 RHSCRD!) RHSTYP, describes the right hand side information, (3 characters) blank space, (11 characters) NRHS, integer, the number of right hand sides, (14 characters) NRHSIX, integer, number of row indices, (14 characters) Each character of the MXTYPE variable specifies a separate fact about the matrix: 1. R, C or P indicates that the matrix values are real, complex, or that only the pattern of nonzeroes is going to be supplied. Note that if complex arithmetic is specified, then any data vectors included in the file will also be assumed to be complex. FORTRAN I/O treats a complex number as a simple pair of real numbers. Thus, a line that records the single complex number 12+17i would look like 2. 12.0 17.0 3. U, S, H, Z or R indicates that the matrix is symmetric, unsymmetric, Hermitian, skew symmetric, or rectangular. Each of these facts implies something about how the nonzero elements of the matrix are stored in the file. o U: if the matrix is unsymmetric (and square), then every nonzero element of the matrix corresponds to an entry in the file. o S: if the matrix is symmetric (which implies that it is square), (and which typically only occurs for real arithmetic), then half of the nonzero off-diagonal elements dont need to be stored in the file. A user need only specify the diagonal elements, and perhaps just those beneath the diagonal. A program reading the file must, correspondingly, assume that a value associated with one off-diagonal element should also be assigned to its corresponding transposed location. o H: if the matrix is Hermitian, (which implies that it is square) (and which typically only occurs for complex arithmetic), then half of the nonzero off-diagonal elements dont need to be stored in the file. A user need only specify the diagonal elements, and perhaps just those beneath the diagonal. A program reading the file must, correspondingly, assume that a value associated with one off-diagonal element should also be used to assign a value to its corresponding transposed location.

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论