Skip to content

Refactor phi wall boundary conditions into species table - #1101

Merged
Maxwell-Rosen merged 3 commits into
gk-lc-mask-yushmanovfrom
refactor-field-func
Aug 31, 2026
Merged

Refactor phi wall boundary conditions into species table#1101
Maxwell-Rosen merged 3 commits into
gk-lc-mask-yushmanovfrom
refactor-field-func

Conversation

@Maxwell-Rosen

Copy link
Copy Markdown
Collaborator

This is from sol 5.6 high. The parameter for the shetath potential function should be a property of the species, not the field, says Mana. This is because the sheath BC is a species BC, not a field BC.

This is behind my PR #997

Sol's notes

  • Sheath BCs now provide wall potential through .aux_profile and .aux_ctx.
  • Sheath and fdot loss-cone paths consume species-owned projected profiles.
  • Grounded walls default to zero; time-dependent profiles update each stage.
  • Removed obsolete field-owned wall machinery and cleaned multiblock input handling.
  • Added focused coverage in gyrokinetic/unit/ctest_gk_species_wall_potential.c.

@Maxwell-Rosen
Maxwell-Rosen requested a review from manauref August 31, 2026 15:03

@manauref manauref left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This approach is not quite as modular as I expected. Specifically, rather than a gk_species_wall_potential.c file that calculated phi_wall lower AND upper, there should just be two calls to a gk_species_phi_wall_advance method in gk_species_apply_bc, right before the gk_species_sheath_advance, one for each of lower/upper.

The call to calculate phi_wall in the calc_field will also go away, since phi_wall is a BC property.

Additionally:

  • I don't see why lines 356-364 in gyrokinetic_multib.c should be deleted.
  • L913 in gyrokinetic_multib.c will disappear after changes requested above.
  • The introduction of struct gk_species_wall_potential seems unnecessary at first, but let's wait (until after changes requested above) and see. It might be a good idea.

…ctions and update boundary condition applications
@Maxwell-Rosen

Copy link
Copy Markdown
Collaborator Author

This has been refactored to be contained inside a gk_species_phi_wall_advance method. The methods from gk_field_biased_wall have been moved into this new gk_species_phi_wall updater, as the biases are now a property of the species. Full functionality is retained.

Redundant code was removed from gyrokinetic_multib.c, but the lines in question were restored.

@manauref manauref left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

see 2 more requested edits below before you merge.

Comment thread gyrokinetic/apps/gk_species_phi_wall.c Outdated
gk_species_phi_wall_advance(gkyl_gyrokinetic_app *app,
const struct gk_species_wall_potential *wall, double tm)
{
if (wall->projector) {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

as with other modules, since this _advance method is called in the time loop, remove this if-statement by creating a function pointer in the struct gk_species_wall_potential that gets allocated to an empty function if aux_profile is not given.

Comment thread gyrokinetic/apps/gk_species.c Outdated
Comment on lines +1506 to +1507
gk_species_phi_wall_init(app, &gks->lower_bc[wall_dir], &gks->phi_wall_lo);
gk_species_phi_wall_init(app, &gks->upper_bc[wall_dir], &gks->phi_wall_up);

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think these should go around lines 880 and 940 I think

@Maxwell-Rosen
Maxwell-Rosen merged commit 5017c40 into gk-lc-mask-yushmanov Aug 31, 2026
@Antoinehoff

Copy link
Copy Markdown
Collaborator

Wait why was this merged with only one approval??

@Maxwell-Rosen

Copy link
Copy Markdown
Collaborator Author

It was merged with only 1 approval because it was merged into a branch, not into main

@Antoinehoff

Antoinehoff commented Sep 1, 2026

Copy link
Copy Markdown
Collaborator

oh my bad hahaha thanks!

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.

3 participants