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

Add PI_controller for temperature, update PI_controller for density, and add coll_krook heat flux closure #284

Open
wants to merge 41 commits into
base: master
Choose a base branch
from

Conversation

LucasMontoya4
Copy link
Collaborator

The PI controller for density has been updated, and one has been made for temperature, so now a simulation can be forced towards a desired temperature and density midpoint. Note that the PI controller for temperature is not quite perfect yet - it is a copy of the energy source, but the evolve_moments = false seems to not converge in the same way as evolve_moments = true for the moment_kinetic case.

There is also now a loop in euler_time_advance! that checks if we are using coll_krook_ions or not. This makes the code for a coll_krook simulation run around 75% faster (since the shape function is never used). However, there are still many pieces of code (such as the boundary condition checks) that will carry around the shape function anyway, and some of these are still necessary for the moment boundary conditions. Hence, instead of rewriting lots of functions to have extra loops checking for the ion physics, the easiest route is to just set the vpa n_grid and n_element both to 1. This makes the fluid run around 60 times faster than a kinetic run. The limit would be around 200 times faster (depending on what your vpa grid resolution was), so this seems adequate for now.

LucasMontoya4 and others added 30 commits September 18, 2024 10:11
…nskii ion physics. Gyrokinetic flag replacement of the gyrokinetic_ions case will happen in a later commit, so right now the gyrokinetic option for ion_physics does the same as drift_kinetic.
…gyrokinetic_ions = true being the test, we see whether ion_physics == gyrokinetic_ions
…nnormalised pdf (then subsequent heat flux updates will be with the braginskii closure)
….jl to use the reference collision frequency to calculate braginskii heat flux
…mean free path) and braginskii heat flux boundary condition at walls, following Stangeby (though I haven't checked the subtracted part for conductive heat flux yet).
…small correction to ion braginskii heat flux boundary condition
…ocstring for collisionality_plots function in makie_post_processing
…hat run (for when heat flux in the simulation is calculated using the shape function - having this option for braginskii_ions would just plot the same thing twice)
…nd power in upstream external source. Might add higher powers later.
… braginskii one (which just overplots the old one, apart from the boundaries)
…hich is much clearer than just writing braginskii everywhere. Note that I will soon change the naming system to collisional_krook
…ource with an input guess, which is the source_strength option in the input file. This means when you restart a run from another that had a constant external source, that choice of starting point for the PI_controller source should mean the PI_controller doesn't have to do too much work (as long as the target amplitude is not very far from the current midpoint amplitude).
…tances of the name braginskii for ion functions to coll_krook. The electron braginskii fluid naming is unchanged for now.
…rid and nelement can both be 1 (to speed up process easily). Also change gamma_i to 4.0 for stability of more dense cases in collisionality scans.
…ux of coll_krook calculation to reflect the 1D pressure rather than 3D isotropic pressure used. Also comment out line where boundary_conditions.jl is used in krook_collisions.jl since I need to use krook_collisions.jl in the velocity_moments.jl module. THIS IS NOT A WORKAROUND AND NEEDS TO BE FIXED AT SOME POINT.
… collisions module can be defined later in moment_kinetics.jl. This fixes the issue highlighted in the previous commit.
…amplitude of an energy source so that the temperature midpoint is kept at a desired level. A few notes on this for now: 1. The temperature of the source has to be higher than the desired temperature, otherwise it can never be made hot enough, no matter how high the input amplitude. 2. The temperature of the source actually needs to be at least DOUBLE the desired value, which I think is coming from a factor of 2 error somewhere - this should be fixed when I comb through all the stuff I've written to iron out these missing factors of 2 one day. 3. This currently only really works for the ion fluid case - something has gone wrong with the part that actually adds to the pdf. I'll try to fix this soon.
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

Successfully merging this pull request may close these issues.

2 participants