Ansys Learning Forum › Forums › Discuss Simulation › General Mechanical › How to Create a Stiffness Matrix in APDL › Reply To: How to Create a Stiffness Matrix in APDL
July 28, 2021 at 1:35 am
Awlad
Subscriber
Dear Mr. Erik
MANY, MANY thanks for sharing the link. It was really helpful. This is what I did to get the stiffness matrix.
First, I open ANSYS Product Launcher. I defined the "Directory (or Folder)" where all the files could be generated or saved. Then, I executed my APDL code line by line. However, I am getting an error message when I am executing the command "combine, full!! combines all file*.full into file.full".
Yes, there is NO "file0.full" file in the Directory (or Folder)". Is this error a concern not to provide the stiffness matrix properly? Could you please let me know?
However, my APDL code generates the MatK (name of the stiffness matrix) file properly. I am using Truss element (Link180). I am also using "1 element" model. So, I have only 2 nodes. Hence, the stiffness matrix will be a (2x2) matrix. After applying the Boundary Condition, the stiffness matrix from MATLAB is as follows:
I am using the *dmat command to create the dense stiffness matrix. Then, I am opening the MatKMMF.text file. This is what I am getting (as shown below). So, how to READ the file? Does it mean that K(1,1) = 1E6? Could you please correct me? Does APDL start the Row and Column numbers from ZERO? If so, then why I am NOT getting the K(0,0) = 1, K(0,1) = 0, and K(1,0) = -1E6? Could you please correct my understanding?
This is my APDL code. Is there anything wrong in this file?
!! Extracting Stiffness Matrix from ANSYS APDL
finish!! It will finish all previous work
/clear!! Clean woking window
/title, How to Get Stiffness Matrix?
/prep7!! Enter to pre-processor
!! Choose a proper element type
et,1,180!! et - element type
!! Define sectional properties
A=1!! Area, in^2
r,1,A!! r -- real consant number
!! Define material
mp,ex,1,10e6!! mp -- material properties
mp,prxy,1,0.3!! mp --
!! Make FE Model, make nodes and elements
L= 10!! L -- length, 10 inch
k,1!! n -- making nodes
k,2,L
L,1,2
!! Make elements
!! Before making elements, we must recall ID #
type,1!! type -- element type
real,1!! real -- real constant
mat,1!! mat --materials
esize,,1 !! ONE Element
Lmesh,all
elist
!! Apply BC- Boundary Conditions
d,1,all,0!! d -- dof at nodes
!! Apply force
f,2,fx,1000!! f -- force at nodes
alls!! all select
/solution!! enter solution
eqslv, sparse!! Equation solver
wrfull, 1!! Stops solution after assembling global matrix
solve!! solve
fini!! finish with solutions
save
/aux2!! Enters the binary file dumping processor
combine, full!! combines all file*.full into file.full
finish
! Gets Stiffness Matrix
*dMAT, MatK, D, import, full, file.full, stiff
*dMAT, Nod2Bcs, D, import, full, file.full,NOD2BCS
*print, MatK, matk.txt! Exports Stiffness to Text File
*export, MatK, mmf, matkMMF.txt
Any feedback will be highly appreciated. Thanks Awlad.
MANY, MANY thanks for sharing the link. It was really helpful. This is what I did to get the stiffness matrix.
First, I open ANSYS Product Launcher. I defined the "Directory (or Folder)" where all the files could be generated or saved. Then, I executed my APDL code line by line. However, I am getting an error message when I am executing the command "combine, full!! combines all file*.full into file.full".
Yes, there is NO "file0.full" file in the Directory (or Folder)". Is this error a concern not to provide the stiffness matrix properly? Could you please let me know?
However, my APDL code generates the MatK (name of the stiffness matrix) file properly. I am using Truss element (Link180). I am also using "1 element" model. So, I have only 2 nodes. Hence, the stiffness matrix will be a (2x2) matrix. After applying the Boundary Condition, the stiffness matrix from MATLAB is as follows:
I am using the *dmat command to create the dense stiffness matrix. Then, I am opening the MatKMMF.text file. This is what I am getting (as shown below). So, how to READ the file? Does it mean that K(1,1) = 1E6? Could you please correct me? Does APDL start the Row and Column numbers from ZERO? If so, then why I am NOT getting the K(0,0) = 1, K(0,1) = 0, and K(1,0) = -1E6? Could you please correct my understanding?
This is my APDL code. Is there anything wrong in this file?
!! Extracting Stiffness Matrix from ANSYS APDL
finish!! It will finish all previous work
/clear!! Clean woking window
/title, How to Get Stiffness Matrix?
/prep7!! Enter to pre-processor
!! Choose a proper element type
et,1,180!! et - element type
!! Define sectional properties
A=1!! Area, in^2
r,1,A!! r -- real consant number
!! Define material
mp,ex,1,10e6!! mp -- material properties
mp,prxy,1,0.3!! mp --
!! Make FE Model, make nodes and elements
L= 10!! L -- length, 10 inch
k,1!! n -- making nodes
k,2,L
L,1,2
!! Make elements
!! Before making elements, we must recall ID #
type,1!! type -- element type
real,1!! real -- real constant
mat,1!! mat --materials
esize,,1 !! ONE Element
Lmesh,all
elist
!! Apply BC- Boundary Conditions
d,1,all,0!! d -- dof at nodes
!! Apply force
f,2,fx,1000!! f -- force at nodes
alls!! all select
/solution!! enter solution
eqslv, sparse!! Equation solver
wrfull, 1!! Stops solution after assembling global matrix
solve!! solve
fini!! finish with solutions
save
/aux2!! Enters the binary file dumping processor
combine, full!! combines all file*.full into file.full
finish
! Gets Stiffness Matrix
*dMAT, MatK, D, import, full, file.full, stiff
*dMAT, Nod2Bcs, D, import, full, file.full,NOD2BCS
*print, MatK, matk.txt! Exports Stiffness to Text File
*export, MatK, mmf, matkMMF.txt
Any feedback will be highly appreciated. Thanks Awlad.