Ansys Learning Forum Forums Discuss Simulation General Mechanical Stiffness matrix commands for student version Reply To: Stiffness matrix commands for student version

blmcdona
Subscriber

Thank you for your response.  Regarding commands, I actually used different commands to write the following code for stiffness and mass matrix:

 

 
 
*CFOPEN, stiffness_matrix.txt, TXT  ! Open a file for writing the stiffness matrix
 
/SOLU                     ! Switch to the solution environment
MAT, K, 1, STIFF  ! This will extract the global stiffness matrix
 
*DO, I, 1, 1000   ! Loop over matrix rows (adjust the number based on your model size)
    *DO, J, 1, 1000  ! Loop over matrix columns (adjust based on your model)
        *GET, Kij, MATRIX, I, J, STIFF  ! Get the stiffness matrix component K_ij
        *VWRITE, I, J, Kij
        (F10.5, F10.5, F10.5)  ! Format for writing the data
    *ENDDO
*ENDDO
 
*CFCLOS   ! Close the output file after writing the matrix
 
 
!Mass matrix
 
*CFOPEN, global_mass_matrix.txt, TXT  ! Open a text file for writing the mass matrix
 
/SOLU                     ! Switch to the solution environment
MAT, M, 1, MASS  ! Extract the global mass matrix
 
*DO, I, 1, 1000   ! Loop over matrix rows (adjust the number based on your model size)
    *DO, J, 1, 1000  ! Loop over matrix columns (adjust based on your model)
        *GET, Mij, MATRIX, I, J, MASS  ! Get the mass matrix component M_ij
        *VWRITE, I, J, Mij
        (F10.5, F10.5, F10.5)  ! Format for writing the data (adjust as needed)
    *ENDDO
*ENDDO
 
*CFCLOS  ! Close the output file after writing the matrix
 
However, the matrices are not square.  Instead, the only have three columns.  How do I make the matrices square?
 
Best,
Brandon