-
Notifications
You must be signed in to change notification settings - Fork 1
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
Implement CompressibleEulerPlasma equations #53
base: main
Are you sure you want to change the base?
Implement CompressibleEulerPlasma equations #53
Conversation
Review checklistThis checklist is meant to assist creators of PRs (to let them know what reviewers will typically look for) and reviewers (to guide them in a structured review process). Items do not need to be checked explicitly for a PR to be eligible for merging. Purpose and scope
Code quality
Documentation
Testing
Performance
Verification
Created with ❤️ by the Trixi.jl community. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good first effort!
Seeing this, I would in general opt for implementing the Multi-Ion Euler equations, similar to the Multi-Ion MHD equations. Then, we can derive the Electron-Ion as a special case for this.
Thank you for your detailed feedback! I have implemented the multi-ion system for compressible Euler equations. Is this now more in line with what you had in mind? Running
P.S. The example also works with lax-friedrichs flux. |
Yeah, looking good! Now we need to find a way to make this system really coupled. Staying for the moment with the ion-only case, you could take a look at the work by Andres and implement the ion-ion collision source terms. I am not sure if the testcase itself makes sense, or if you need for this the electron temperature/pressure business. |
I can also implement the electrons' contribution. Based on this reference, it seems to not be much of a hassle since we only need additional input functions for electron pressure, temperature, and some constants to enable the ion-electron source term. However, I’d like to ask if we can simply adapt the existing source terms (with minor adjustments) from the multi-ion GLM-MHD equations for this purpose. Is what we are implementing the same with 13a), 13b), 13c) from this paper? |
Taking a look at the PR by Andres, it seems the collision terms are purely hydrodynamic, so you should be able to directly re-use them for the Ion-Electron case. What I am not sure about (maybe you need to read up on this) is the treatment of the electrons. As far as I understand, the electron pressure and temperature are simplifications that are based on neglecting the momentum equation for the electrons due to the significantly lower mass (and thus momentum) of the electrons compared to ions. I really do not know if the testcase in the linked PR is still applicable for the full order model, for this I would need to consider those references. So I (have to) leave this assessment for the moment to you. |
I see. I will look it up and see what I can do. My last question at the moment is: what do you expect to see out of the result of running a successful simulation? Do you expect to see a temperature plot that is close to Figure 5d Ghosh et al. (the same one the PR you linked reproduced)? |
Yes, so looking at that test you see that the magnetic fields are initialized with zero, and that they also do not appear in the source terms. So yes, I would hope that the temperature looks somewhat similar (depending on how much the explicit treatments of electrons change this). |
The test case works for this implementation as well. This is the plot by our equations: Looks the same as what the reference pull request (and the literature) produced. Like the reference PR, ignoring electron-ion collision terms also yields the same result of the temperature plot. Let me know if you want me to test out sth else! If everything looks OK then I'll proceed to clean up the code and extend the equations to higher dimensions (if it is necessary) |
Awesome! Really good job! |
Got it!
|
As of now, I will be working on the code under the assumption of a single ion species, since (as far as I understand) the current electron flux relies on a constant based on the ratio of m_e/ m_i. This term will become ambiguous for electron flux if we introduce multiple ion species. However, I will structure the code in a way that transitioning to a multi-species system will not be difficult in the future. If I can find literature that reformulated the conservation laws so, that the ion flux is dependent on m_i / m_e (or if this is done by ourselves), I will change the flux function accordingly. Let me know if I misunderstood anything! |
Yes exactly, only a single ion species, absolutely correct 👍 |
Here is the result of test case 1 that was run in the example Compared to Fig 1. and Fig 2. in An asymptotic preserving scheme for the two-fluid Euler–Poisson model in the quasineutral limit, the sin waves that I obtained from my code have different amplitudes (in v1_ion) and there is a bit phase discrepancy (rho_electron, v1_electron). Maybe I did implement the initial and/or the boundary conditions incorrectly. In addition: I, however, got an error message:
But the example runs just fine. Do you know why this is the case? I tried to apply homogeneous Dirichlet boundary conditions to the Poisson equation and the periodic boundary conditions. |
@muladd begin | ||
#! format: noindent | ||
|
||
struct ParametersEulerPlasma{RealT <: Real, TimestepPlasma} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just to have this posted somewhere: We should add at some point docstrings to these structs where we explicitly mention the paper we take the test cases from to familiarize people with the equations we use.
resid_tol = 1.0e-4, | ||
n_iterations_max = 10^4, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These parameters essentially govern how accurately the poisson equation is solved. You could experiment e.g. with stricter tolerance if this improves the result.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see! I tried to adjust these a bit, including trying both lax friedrichs and hll flux. The result is still the same. Maybe I did sth wrong with the initial condition but I somehow cannot identify it.
…ed to recheck again if there is a compact way to do this in the paper
I fixed some rather important bugs and read some more about the simulation. We do need a really small time step (delta_t < 10^-6) and really fine grid delta_x < 1e-4 (per instruction from the paper and also if these are two bigs the residual blows up to 2000-3000). After fixing and trying this small grid size and time step, I found out that the simulation takes a very long time to run. Also, a more pressing matter is that the electric potential solver does not converge properly, leaving around 1e-3 to 1e-1 residual even with this set of parameters and increased maximum iterations. My sincere apologies for the lousy report from before! Let me know if I did something wrong or if you want me to try something! In the meantime, I'll look around to find if i can fix this issue or persist, run this on the cluster and send you the result despite the problem with the convergence of the electric potential solver. |
I see, thanks for the detailed report! The observations you report sound reasonable to me, so I think it is worth running these. If it is not feasible at the moment don't worry - I might get to it later. Also sorry for not reporting quickly to you - I am at the conference right now, i.e., long busy days + 7 hour timeshift. Anyways, great work as usual! |
…draft is overall not making any substance
…tep size less than 1e-6
I wish you the very best of luck! Another observation I want to write out and report is that I found that for electric potential solvers, we might not need the CFL number to be as small as the one we need for the time step of the Euler's equations (lower than 1e-6). This makes the simulation go faster. However, for certain time steps, I run into large residues, or it just takes much, much longer for the electric potential to converge. It might be worth it to experiment with these numbers before investing time in running the full simulation. |
The system consists of two conservation laws, one for ions and the other for electrons. An example of these equations is also added.
The examples from the literature: An asymptotic preserving scheme for the two-fluid Euler–Poisson model in the quasineutral limit will be implemented.