You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I want to generate data from the Burger's equation in 2D. I want to build a list u_n_all that contains all u_n from t=0 to t=N, with timestep = dt. Here is my initial code :
for k, nu in tqdm(zip(ks, nus)):
i += 1
nu = Constant(nu)
u_ic = project(k, V) #
u_n.assign(u_ic)
u_n1.assign(u_ic)
u_n_all = []
F = ( inner((u_n1 - u_n)/dt, v) + inner(dot(u_n1, nabla_grad(u_n1)),v) + nu*inner(grad(u_n1),grad(v)) )*dx
t = float(0)
end = float(0.1)
u_n_all.append(u_n)
while (t <= end):
solve(F == 0, u_n1, solver_parameters={'ksp_type': 'preonly', 'pc_type': 'lu'})
u_n.assign(u_n1)
t += float(dt)
u_n_all.append(u_n)
us.append(u_n_all)
But when I looked at the u_n_all list, it is all the same element that is repeated. I tried to use .copy(deepcopy == True) when I .appen to the list, but it is also not working.
What am I doing wrong ?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hello everyone,
I want to generate data from the Burger's equation in 2D. I want to build a list u_n_all that contains all u_n from t=0 to t=N, with timestep = dt. Here is my initial code :
But when I looked at the u_n_all list, it is all the same element that is repeated. I tried to use .copy(deepcopy == True) when I .appen to the list, but it is also not working.
What am I doing wrong ?
Beta Was this translation helpful? Give feedback.
All reactions