Hi,
I ran into a strange issue when I tried to store my solutions for a Helmholtz Equation inside an array like this:
for nf in range(0,len(f_axis)):
freq = f_axis[nf]
# Compute solution
omega.value =f_axis[nf]*2*np.pi
k0.value = 2*np.pi*f_axis[nf]/c0
problem.solve()
with XDMFFile(msh.comm, "solution" + str(f_axis[nf]) + ".xdmf", "w") as xdmf:
xdmf.write_mesh(msh)
xdmf.write_function(uh)
#I want to safe the solution for every single frequency here:
all_values.append(uh.x.array.real)
If I check the XDMF files in paraview or print the result with print(uh.x.array.real) during the loop, everything works fine but the all_values array only contains the solution of the last frequency over and over again.
What am I missing here? Is there any other way to do this?
Thanks for any advice!
Best,
Patrick