Dear Firedrakers,


For the model,

https://github.com/booker213/compressible_acoustic/blob/master/Firedrake/1D/compressible_acoustic.py

I'm interested in finding out how the energy in my system is distributed at the end of my model.

My naive approach, below, was to try and create a function, so I could visualise it.


localenergyfile = File('./Results/local_energy.pvd')
E_local = Function(R, name="Local Energy")
E_local = 0.5*(inner(u,u) + rho**2
localenergyfile.write(E_local , time =t)


But this does not work. How would I go about implementing this?

Regards,

Will