simon21 发表于 2005-8-23 08:51

[分享]ANSYS中整体、单元刚度和质量矩阵的提取

1、整体刚度和质量矩阵的提取。
该功能需要进行二次开发,由ansys形成
的二进制文件.full提取整体刚度和质量
矩阵。

基于ansys的一个用户开发程序例子编
了一个程序。

开发环境:compaq fortran 6.5
运行环境:win2000。
一个主文件:self.for,
另一个文件matrixout.f90用于矩阵输出
binlib.lib为ansys提供的库文件,将其
引入项目中(也可直接扔进debug目录)

.full文件由子空间迭代模态分析获得。
运行编译后的可执行文件.exe

2、单元刚度和质量矩阵的提取。
/DEBUG命令。详细说明可由以下转载文章
获得:
发信人: tomath1 (雨天), 信区: FEA
标 题: Re: ANSYS中命令/DEBUG那儿有
发信站: BBS 水木清华站 (Thu Jun 27 14:28:51 2002)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文件,可以看到按单元写出的质量、刚度等矩阵

[ 本帖最后由 xinyuxf 于 2007-5-4 10:23 编辑 ]

jl_zxw 发表于 2005-9-12 10:08

请教一下,这个提取刚度矩阵的程序怎样才能运行,必须装Fortran吗?

FSI 发表于 2005-9-12 10:27

another method:

HBMAT, Fname, Ext, --, Form, Matrx, Rhs
Writes an assembled global matrix in Harwell-Boeing format

jl_zxw 发表于 2005-9-12 16:19

请教

我一下载完上面的压缩程序,在Fortran下运行时出现:
<html>
<body>
<pre>
<h1>Build Log</h1>
<h3>
--------------------Configuration: matrixout - Win32 Debug--------------------
</h3>
<h3>Command Lines</h3>
Creating command line "link.exe kernel32.lib /nologo /subsystem:console /incremental:yes /pdb:"Debug/matrixout.pdb" /debug /machine:I386 /out:"Debug/matrixout.exe" /pdbtype:sept ".\Debug\matrixout.obj" ".\Debug\SELF.OBJ" "
<h3>Output Window</h3>
Linking...
SELF.OBJ : error LNK2001: unresolved external symbol _BINIQR@8
SELF.OBJ : error LNK2001: unresolved external symbol _BININI@4
SELF.OBJ : error LNK2001: unresolved external symbol _BINTFO@24
SELF.OBJ : error LNK2001: unresolved external symbol _BINSET@44
SELF.OBJ : error LNK2001: unresolved external symbol _BINRD@24
SELF.OBJ : error LNK2001: unresolved external symbol _BINCLO@16
Debug/matrixout.exe : fatal error LNK1120: 6 unresolved externals
Error executing link.exe.

<h3>Results</h3>
matrixout.exe - 7 error(s), 0 warning(s)
</pre>
</body>
</html>
什么问题,不懂Fortran


谢谢

FSI 发表于 2005-9-12 18:34

回复:(jl_zxw)请教

binlib.lib为ansys提供的库文件,将其
引入项目中(也可直接扔进debug目录)

realyyy 发表于 2006-5-9 11:45

回复:(van321)[分享]ANSYS中整体、单元刚度和质量矩...

我用HBMAT方法生成质量矩阵文件(文本文件格式)内容如下,看不懂啊

Mass matrix from ANSYS FULL file dumped into Harwell-Boeing format
49 9 16 16 8
RSA 8 8 16 0
(I14) (I14) (d25.15) (d25.15)
F 1 8
1
3
6
8
11
14
15
16
17
3
1
4
5
2
6
3
7
8
4
7
8
5
6
7
8
0.166666666666667D+00
0.333333333333333D+00
-0.690476190476191D-01
-0.404761904761905D-01
0.142857142857143D+00
0.166666666666667D+00
0.666666666666667D+00
-0.107142857142857D+01
0.690476190476191D-01
0.314285714285714D+01
-0.690476190476191D-01
-0.404761904761905D-01
0.285714285714286D+00
0.666666666666667D+00
0.314285714285714D+01
0.285714285714286D+00
0.000000000000000D+00
0.000000000000000D+00
0.000000000000000D+00
0.000000000000000D+00
0.000000000000000D+00
0.000000000000000D+00
0.000000000000000D+00
0.000000000000000D+00
谁能帮我解释一下这里面的数字对应质量矩阵中的哪行哪列啊?
感谢万分!!

qq6764770 发表于 2006-5-9 14:59

The Harwell-Boeing format is the most popular mechanism for text-file exchange of sparse matrix data. The following information, taken from [ftp://ftp.cerfacs.fr/pub/harwell_boeing/userguide.ps.Z User's Guide for the Harwell-Boeing Sparse Matrix Collection] provides a specification for this format. Matrix data is held in an 80-column, fixed-length format for portability. Each matrix begins with a multiple line header block, which is followed by two, three, or four data blocks. The header block contains summary information on the storage formats and space requirements. From the header block alone, the user can determine how much space will be required to store the matrix. Information on the size of the representation in lines is given for ease in skipping past unwanted data.

If there are no right-hand-side vectors, the matrix has a four-line header block followed by two or three data blocks containing, in order, the column (or element) start pointers, the row (or variable) indices, and the numerical values. If right-hand sides are present, there is a fifth line in the header block and a fourth data block containing the right-hand side(s). The blocks containing the numerical values and right-hand side(s) are optional. The right-hand side(s) can be present only when the numerical values are present. If right-hand sides are present, then vectors for starting guesses and the solution can also be present; if so, they appear as separate full arrays in the right-hand side block following the right-hand side vector(s).

The first line contains the 72-character title and the 8-character identifier by which the matrix is referenced in our documentation. The second line contains the number of lines for each of the following data blocks as well as the total number of lines, excluding the header block. The third line contains a three character string denoting the matrix type as well as the number of rows, columns (or elements), entries, and, in the case of unassembled matrices, the total number of entries in elemental matrices. The fourth line contains the variable Fortran formats for the following data blocks. The fifth line is present only if there are right-hand sides. It contains a one character string denoting the storage format for the right-hand sides as well as the number of right-hand sides, and the number of row index entries (for the assembled case). The exact format is given by the following, where the names of the Fortran variables in the subsequent programs are given in parenthesis:



Line1 (A72,A8)

Col. 1 - 72 Title (TITLE)

Col. 73 - 80 Key (KEY)


Line 2 (5I14)

Col. 1 - 14 Total number of lines excluding header (TOTCRD)

Col. 15 - 28 Number of lines for pointers (PTRCRD)

Col. 29 - 42 Number of lines for row (or variable) indices (INDCRD)

Col. 43 - 56 Number of lines for numerical values (VALCRD)

Col. 57 - 70 Number of lines for right-hand sides (RHSCRD) (including starting guesses and solution vectors if present) (zero indicates no right-hand side data is present)

Line 3 (A3, 11X, 4I14)

Col. 1 - 3 Matrix type (see below) (MXTYPE)

Col. 15 - 28 Number of rows (or variables) (NROW)

Col. 29 - 42 Number of columns (or elements) (NCOL)

Col. 43 - 56 Number of row (or variable) indices (NNZERO) (equal to number of entries for assembled matrices)

Col. 57 - 70 Number of elemental matrix entries (NELTVL) (zero in the case of assembled matrices)

Line 4 (2A16, 2A20)

Col. 1 - 16 Format for pointers (PTRFMT)

Col. 17 - 32 Format for row (or variable) indices (INDFMT)

Col. 33 - 52 Format for numerical values of coefficient matrix (VALFMT)

Col. 53 - 72 Format for numerical values of right-hand sides (RHSFMT)

Line 5 (A3, 11X, 2I14) Only present if there are right-hand sides present

Col. 1 Right-hand side type: F for full storage or M for same format as matrix

Col. 2 G if a starting vector(s) (Guess) is supplied. (RHSTYP)

Col. 3 X if an exact solution vector(s) is supplied.

Col. 15 - 28 Number of right-hand sides (NRHS)

Col. 29 - 42 Number of row indices (NRHSIX) (ignored in case of unassembled matrices)
Note: For matrices in elemental form, the leading two dimensions in the header give the number of variables in the finite element application and the number of elements. It is common that not all of the variables in the application appear in the linear algebra subproblem; hence the matrix represented can be of lower order than the first parameter, described as the "number of variables (NROW)". The finite element variables are numbered from 1 to NROW, but only the subset of variables that actually appear in the list of variables for the elements define the rows and columns of the matrix. The actual order of the square matrix cannot be determined until all of the indices are read.


The three character type field on line 3 describes the matrix type. The following table lists the permitted values for each of the three characters. As an example of the type field, RSA denotes that the matrix is real, symmetric, and assembled.



First Character:

R Real matrix

C Complex matrix

P Pattern only (no numerical values supplied)

Second Character:

S Symmetric

U Unsymmetric

H Hermitian

Z Skew symmetric

R Rectangular

Third Character:

A Assembled

E Elemental matrices (unassembled)
把这个文献看懂,就能搞定什么意思了

cathy100 发表于 2006-5-9 17:52

这都能办到啊!

我真是没想到还能把这个也导出.
楼主英明啊!

realyyy 发表于 2006-5-11 14:13

感谢qq6764770!
研究研究先。

zgl11 发表于 2009-2-12 11:16

得到matrixout.exe文件后,运行该文件出错

提取整体刚度矩阵中,成功build 程序self.for和matrixout.f90后得到matrixout.exe,但是运行matrixout.exe出现错误:程序未能找到binlib.dll,因此未能成功启动。
请问这是什么原因呢?急啊!

zgl11 发表于 2009-2-12 14:26

得到matrixout.exe文件后,运行该文件无错误但不见了

提取整体刚度矩阵中,成功build 程序self.for和matrixout.f90后得到matrixout.exe,运行matrixout.exe,之后就不见了。结果在哪里啊?

noiss 发表于 2009-5-27 16:09

附件没有了?:@(

wangdongw 发表于 2016-9-18 15:02

请问楼主还有附件吗?真是不懂呀
页: [1]
查看完整版本: [分享]ANSYS中整体、单元刚度和质量矩阵的提取