Open
Description
The objective
Finite Element Analysis of a Sinusoidal Excitation,i want to use it to predict the result when Frequency changes .
Already tried tests
sanpshot has 3 diffrent frequency[2,5,10]node num is 306 time iteration 101 so the snapshot shape is 303306.
params shape is [3032]
value is
[[ 0. 2. ]
[ 0.01 2. ]
......
[ 1. 2. ]
[ 0. 5. ]
[ 0.01 5. ]
[ 0.02 5. ]
[ 0.03 5. ]
......
[ 1. 5. ]
[ 0. 10. ]
[ 0.01 10. ]
[ 0.02 10. ]
[ 0.03 10. ]
......
[ 1. 10. ]]
origin data when node id is 7 the picture is as follow
when i predit the frequece is 4 the picture is as follow
code as follow:
#np.save('paramsTest.npy', params_data)
#np.save('x_data.npy', x_data)
params_data = np.load(r'params_data')
x_data = np.load(r'x_data')
times_i = np.load(r'times_i.npy')
db = Database(params_data, x_data)
print("POD")
pod = POD("svd")
# rbf = RBF(kernel="linear")
rbf = RBF(kernel="inverse_multiquadric",epsilon=1)
# rbf = RBF()
rom = ROM(db, pod, rbf)
print("rom.fit()")
rom.fit()
print("predict")
predict_data = []
for i in range(101):
times_i[i]
predict_params=[]
predict_params.append(times_i[i])
predict_params.append(4)
# res = rom.predict(new_param).snapshots_matrix
res = rom.predict(predict_params).snapshots_matrix
predict_data.append(res[0,6])
import matplotlib.pyplot as plt
plt.figure(figsize=(12, 8))
# plt.plot(times_i,x_data[0:101,6], label='X Component')
plt.plot(times_i,predict_data, label='X Component')
plt.title(f' - X Component Acceleration')
plt.xlabel('Time')
plt.ylabel('Acceleration')
plt.legend()
plt.grid(True)
plt.show(block=True)