3.3.3. printA Command
This command is used to print the matrix \(\mathbf{A}\) of the system of equations, \(\mathbf{A} \mathbf{x} = \mathbf{b}\), formed by the integrator, to the screen or a file, or to return it to the script. With a static integrator the matrix is the tangent stiffness matrix. With a transient integrator it is a combination of the mass, damping and stiffness matrices.
- printA <-file $fileName> <-ret> <-sparse $baseIndex> <-binary> <-precision $nSD>
ops.printA('-file', fileName, '-ret', '-sparse', baseIndex, '-binary', '-precision', nSD)
Argument |
Type |
Description |
|---|---|---|
$fileName |
string |
name of the file to which the matrix is written (optional: default = the screen) |
-ret |
string |
return the matrix to the script, as a list of values row by row, instead of printing it (optional) |
$baseIndex |
integer |
write the matrix in sparse (COO) format, i.e. as (row, column, value) triplets, numbering rows and columns from baseIndex, e.g. 0 or 1 (optional) |
-binary |
string |
write the sparse matrix to the file in binary; requires -file and -sparse, and cannot be used with -ret (optional) |
$nSD |
integer |
number of significant digits written (optional: default = 6) |
Note
The command must be used after the analysis has been defined and at least one step has been analyzed, or after analysis and an analyze command, so that the matrix has been formed.
The full matrix can only be printed or returned if the FullGeneral linear system is used (see the system command). With other systems, use -sparse, which works with the systems that support sparse output.
-sparse, -binary and -precision were added after version 3.8.0. Earlier versions ignore them.
To print a particular combination of the mass, damping and stiffness matrices, e.g. only the mass matrix, use the GimmeMCK integrator, which forms \(\mathbf{A} = m \mathbf{M} + c \mathbf{C} + k \mathbf{K}\) for the factors given.
Example:
The following example prints the matrix to the screen, and then returns it to the variable A.
system FullGeneral
...
analyze 1
printA
set A [printA -ret]
ops.system('FullGeneral')
...
ops.analyze(1)
ops.printA()
A = ops.printA('-ret')
3.3.3.1. OpenSeesRT
In OpenSeesRT, used from Tcl and Python through the xara package, printA also accepts factors that scale the inertial (mass), damping and static (stiffness) parts of the matrix:
- printA <-file $fileName> <-m $m> <-c $c> <-k $k>
For example, the following returns the matrix \(\mathbf{A} = \frac{1}{2}\mathbf{M} + \frac{1}{10}\mathbf{K}\):
printA -m 0.5 -k 0.1
A = model.getTangent(m=0.5, k=0.1)
These factors are not supported by OpenSees or OpenSeesPy, which ignore them (or, in versions after 3.8.0, report them as unknown).