Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Energy conservation #1

Open
aratava opened this issue Jan 21, 2023 · 2 comments
Open

Energy conservation #1

aratava opened this issue Jan 21, 2023 · 2 comments

Comments

@aratava
Copy link

aratava commented Jan 21, 2023

Hi Calvin, thanks for the great code. I added a total energy calculation function (kinetic energy plus the electrostatic). I checked the conservation of energy in the example of two-stream instability and it was not very good for the default dt (dt=1.0/omega_theory*0.01). I reduced the dt to (dt=1.0/omega_theory*0.001) and it was much better. But this means dt=0.01 in terms of 1/omega_pe. It is strange if such a small dt is required to keep the energy conserved, so I thought maybe I am doing something wrong. The total energy is calculated as:

        es_energy=0.5*dx*sum((Fields_struct.ion_density.-Fields_struct.electron_density).*Fields_struct.phi)
        total_energy = electrons.total_kinetic_energy+ions.total_kinetic_energy+es_energy

Have you calculated this before? What can be the issue?

Thank you, Arash

@iamcalvinlau
Copy link
Owner

iamcalvinlau commented Jan 21, 2023 via email

@aratava
Copy link
Author

aratava commented Feb 1, 2023

I tried to turn off the self-consistent field calculation and the energy conservation was much better. However, because the field calculation is self-consistent, it does not necessarily mean that there is a problem in the field calculation (The reverse would have been more understandable if it had happened.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants