-
-
June 3, 2026 at 6:57 am
Audy Maulizar
SubscriberDear all. I am having a little bit of trouble with setting up a looping transient structural analysis code. For the sake of brevity, I have put only the relevant block of code below.
!---------------------------------Flutter Analysis Loop---------------------------------
U_fin = 19 !m/s
init_time = 5 !s
final_time = 20 !s
dt = 2.5E-02 !time step in seconds
total_steps = (final_time-init_time)/dt*DO,i,1, total_steps, 1
/PREP7
[Element Modification Code Here]
ALLSEL, ALL
/SOLU
time_val = init_time + i*dt
ANTYPE,,RESTART
AUTOTS, OFF
DELTIM, dt
TIMINT, ON
OUTRES,ALL,20
TIME, time_val
SOLVE
FINISH*ENDDO
The general idea behind this looping section is to have ANSYS modify the properties of a structural element in every load step (as shown with the /PREP7 section) then solve the resulting new structural setup (as shown in /SOLU section). The problem I faced was that the DELTIM and TIME commands seem to not receive the values from the parameters "dt" and "time_val" respectively, regardless of how those parameters have been defined beforehand. This resulted in ANSYS returning to the default values for the time step sizes and time at the end of a load step.
Anyone's help on this problem is very welcome.
-
June 3, 2026 at 4:35 pm
mrife
Ansys EmployeeHi Audy Maulizar
The restart database contains the parameters as they are at the first substep of the first load step. Use parsav and parres to save/resume the parameters within the loop.
Also, I am getting a 'code smell' from the posted script and the "element modification code". What exactly is going on here?
Mike
-
June 4, 2026 at 4:50 am
Audy Maulizar
SubscriberThank you for your answer Mike. The [Element Modification Code Here] is just a block of code I wrote to change the parameter values for the MATRIX27 elements. I omitted it from this post, because I figured it'd make the code too long for the troubleshooting purpose when it's the looping part that has problems. Here's a more complete version for your reference.
!---------------------------------Flutter Analysis Loop---------------------------------
U_fin = 19 !m/s
init_time = 5 !s
final_time = 20 !s
dt = 2.5E-02 !time step in seconds
total_steps = (final_time-init_time)/dt*DO,i,1, total_steps, 1
/PREP7
!Constant Coefficients
rho = 1.225 ! air density kg/m^3
B = 11.89 ! deck width
Le = 15.24! element length
Pi = 3.14159
Uh = U_fin*dt/(final_time-init_time)
init_freq = 0.19788713 ! Hz
osi_freq_0 = init_freq
! flutter variables
Ur = Uh/(osi_freq_0*B)
omega_h = 2*Pi*osi_freq_0 ! radial natural frequency
K_h = omega_h*B/Uh
a_h = 0.5*rho*Uh*Uh*K_h*K_h*Le
b_h = 0.5*rho*Uh*B*K_h*Le
! flutter derivatives
A1 = vala1(Ur)
A2 = vala2(Ur)
A3 = vala3(Ur)
A4 = vala4(Ur)
A5 = vala5(Ur)
A6 = vala6(Ur)
H1 = valh1(Ur)
H2 = valh2(Ur)
H3 = valh3(Ur)
H4 = valh4(Ur)
H5 = valh5(Ur)
H6 = valh6(Ur)
P1 = valp1(Ur)
P2 = valp2(Ur)
P3 = valp3(Ur)
P4 = valp4(Ur)
P5 = valp5(Ur)
P6 = valp6(Ur)
r,900
rmodif, 900, 14, -b_h*P5
rmodif, 900, 15, -b_h*P1
rmodif, 900, 16, -b_h*B*P2
rmodif, 900, 26, -b_h*H5
rmodif, 900, 27, -b_h*H1
rmodif, 900, 28, -b_h*B*H2
rmodif, 900, 38, -b_h*B*A5
rmodif, 900, 39, -b_h*B*A1
rmodif, 900, 40, -b_h*B*B*A2
rmodif, 900, 92, -b_h*P5
rmodif, 900, 93, -b_h*P1
rmodif, 900, 94, -b_h*B*P2
rmodif, 900, 104, -b_h*H5
rmodif, 900, 105, -b_h*H1
rmodif, 900, 106, -b_h*B*H2
rmodif, 900, 116, -b_h*B*A5
rmodif, 900, 117, -b_h*B*A1
rmodif, 900, 118, -b_h*B*B*A2
CMSEL, S, DampMatElement, ELEM
EMODIF, ALL, REAL, 900
r,901
rmodif, 901, 14, -a_h*P6
rmodif, 901, 15, -a_h*P4
rmodif, 901, 16, -a_h*B*P3
rmodif, 901, 26, -a_h*H6
rmodif, 901, 27, -a_h*H4
rmodif, 901, 28, -a_h*B*H3
rmodif, 901, 38, -a_h*B*A6
rmodif, 901, 39, -a_h*B*A4
rmodif, 901, 40, -a_h*B*B*A3
rmodif, 901, 92, -a_h*P6
rmodif, 901, 93, -a_h*P4
rmodif, 901, 94, -a_h*B*P3
rmodif, 901, 104, -a_h*H6
rmodif, 901, 105, -a_h*H4
rmodif, 901, 106, -a_h*B*H3
rmodif, 901, 116, -a_h*B*A6
rmodif, 901, 117, -a_h*B*A4
rmodif, 901, 118, -a_h*B*B*A3
CMSEL, S, StiffMatElement, ELEM
EMODIF, ALL, REAL, 901
ALLSEL, ALL
/SOLU
time_val = init_time + i*dt
ANTYPE,,RESTART
AUTOTS, OFF
DELTIM, dt
TIMINT, ON
OUTRES,ALL,20
TIME, time_val
SOLVE
FINISH*ENDDO
-
-
June 4, 2026 at 1:12 pm
dlooman
Ansys EmployeeIt's possible you could change the matrix27 values in solution simplifying the analysis. Worth a try anyway.
-
June 4, 2026 at 1:59 pm
mrife
Ansys EmployeeHi Audy Maulizar
Dave Looman is right, defining a real constant can be done in the solution processor (as well as in the preprocessor). And I don't see a reason in the script to have the emodif commands, so you don't need to exit out of the /solu processor.
-
June 5, 2026 at 9:39 am
Audy Maulizar
SubscriberBy not having emodif command, I assume the RMODIF commands are already enough?
-
-
June 5, 2026 at 1:29 pm
mrife
Ansys EmployeeHi Audy
By the script shown yes assuming that say the elements of component DampMatElement aleady were assigned the real constant (ID) 900.
-
- You must be logged in to reply to this topic.
-
6625
-
1906
-
1469
-
1311
-
1022
© 2026 Copyright ANSYS, Inc. All rights reserved.