Open
Conversation
…of a eirene.c to gyrokinetic/apps/eirene.c . It's a bit difficult to figure out how to initialize the bgk sources through eirene.c
…up the diagnostics for the external bgk source type.
…t and M0dot come out correct
…verything looks good now including M2. Test is done with 1 cpu/block. Not tested on gpu yet
… the density or temperature negative during a coupling time. If the sink is too strong in a particular location, the sink rate will be set to something that won't reduce n or T bellow eps*n or eps*T during the coupling time. eps is an input parameter (damping factor) which I set to 0.01 in my tests. This required a new array operation in core gkyl_array_ceil_range.
…ta onto the gkeyll grid
…dd integrated diagnostics of the whole term. Not yet tested.
…ose to expected energy injection rates for all species. There could be a correction step later on, but I haven't figured that out yet. There is a lot of debugging code in this commit and leftover old functions. I will remove them soon. Need to commit this version because it is working well
…king well and producing expected results. Modified input structs to allow options per species. One debugging block is still in place, going to run a couple more tests and remove that block if we are fine
This reverts commit f9fb517.
…accidentally added the lbo energy conservation fix
…d and works, I can run simulations using the SOLPS build and coupling repo produced by these mkdeps with build-solps=yes and build-eirene-coupling=yes.
…into eirene_coupling
| #include <assert.h> | ||
| #include <time.h> | ||
|
|
||
| static bool gyrokinetic_str_ends_in_b67(char *name){ |
Collaborator
There was a problem hiding this comment.
Maybe I'm ignorant, but I don't know what this b67 (or b1011) means. So if I'm a gkeyll person who doesn't know EIRENE, can we have a more descriptive names for what makes these two files different? We can put a comment that this means the files end in b67, but the function name should make the purpose and operation clear.
| for (int i=0; i<eirene->info.num_coupling_species; ++i) { | ||
| struct gk_species *gks = eirene->coupling_species[i]; | ||
| struct gk_source_bgk *bgk_src = &eirene->bgk_src[i]; | ||
| cstr fileNm = cstr_from_fmt("%s%s-%s_M0source.txt", eirene->info.input_data_path, app->name, gks->info.name); |
Collaborator
There was a problem hiding this comment.
The convention us usually _source_M0.gkyl, so maybe we should keep that for these formats
|
|
||
| eirene->info = gk->eirene; | ||
|
|
||
| for (int i=0; i<eirene->info.num_coupling_species; ++i) |
Collaborator
There was a problem hiding this comment.
Please put braces around single line if statements and for loops
| gyrokinetic_app_geometry_copy_and_write(app, app->gk_geom->geo_corn.mc2nu_pos_deflated, arr_hocdim, "mc2nu_pos_deflated", mt); | ||
| } | ||
|
|
||
| gyrokinetic_app_geometry_copy_and_write(app, app->gk_geom->geo_int.mc2p , arr_ho3, "mapc2pint", mt); |
Collaborator
There was a problem hiding this comment.
changing this to mapc2p_int might be clearrer and more organized
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Overview
In this PR we enable the coupling of Gkeyll to Eirene for neutral evolution. The model for including plasma sources in Gkeyll based on eirene output is described in DR #923 . Gkeyll evolves the plasma and Eirene evolves the neutrals (recycling, reactions, etc.). They exchange data through I/O every time Gkeyll outputs data.
This PR contains several parts. The first is the automatic installation of eirene and grid generation parts of SOLPS-ITER as part of the gkeyll mkdeps process. (This only occurs if one uses --build-solps=yes). The second part is the installation of a python library written by @jRoeltgen and me which does post-processing and interpolation routines to pass plasma information from gkeyll to eirene and plasma sources from eirene to gkeyll. The third is the code within Gkeyll itself that applies the sources.
Automatic installation of Eirene + SOLPS-ITER Grid generation
Without modifying the eirene codebase itself, one has to use an existing interface for grid generation and coupling. We are using the SOLPS-ITER (https://github.com/iterorganization/SOLPS-ITER ) interface. The scrip
install-deps/build-solps.shautomatically installs the necessary parts SOLPS_ITER intogkylsoft/. This is only tested on perlmutter, as the SOLPS-ITER installation process can be difficult.Automatic Installation of GK-Neutral_coupling
To actually pass information between Gkeyll and Eirene, post-processing and interpolation routines are required. This is taken care of by the GK-Neutral_coupling repo (https://github.com/jRoeltgen/GK-Neutral_coupling/tree/main) which contains examples and instructions for how to run coupled simulations.
Code Within Gkeyll
With guidance from @manauref, the additions to the code have been written in such a way that they interfere minimally with the rest of the gyrokinetic app. Most of the new code is in
gyrokinetic/apps/eirene.candgyrokinetic/apps/gk_species_source_bgk.c. The second file,gyrokinetic/apps/gk_species_source_bgk.c, has now replaced gk_species_heating.c and retains the old functionality while also adding the ability to apply sources from an external model (EIRENE). I also had to modifyarray_ops.cwith a new functiongkyl_array_ceil_rangeto apply limits on the temperature of the sources come from eirene to improve the stability of simulations.Input Files
The input file interface is quite simple. You provide