Skip to content

Conversation

@ZedThree
Copy link
Member

  • Adds a golden answer regression test with five different cases, plus a unit test which has some basic sense checking
  • Breaking change: make the "boundary_mode" input an enum, rather than an int. This means you can set e.g. density_boundary_mode = limit_free in the input file
  • Bug fix: one of the loops used the wrong cell face when calculating the cross-sectional area
  • Refactoring: pull out some helper functions, and use lambdas to de-duplicate the loops over the y boundaries

@ZedThree ZedThree requested review from bendudson and mikekryjak June 25, 2025 16:59
@ZedThree ZedThree added boundary conditions Changes related to boundary conditions tests Continuous integration refactor Improving code structure labels Jun 25, 2025
ZedThree added 2 commits July 18, 2025 14:58
Didn't flip noflow BCs at same time, so was not exactly symmetric
@ZedThree ZedThree force-pushed the sheath-boundary-testing branch from 45f3c45 to 083c0f0 Compare July 18, 2025 14:03
Comment on lines +190 to +198
flipped_upstream = base_downstream
flipped_upstream["Ve"] = -flipped_upstream["Ve"]
flipped_upstream["Vi"] = -flipped_upstream["Vi"]
flipped_upstream["Si_sheath"] = -flipped_upstream["Si_sheath"]

expected = {
"upstream": flipped_upstream,
"downstream": base_upstream,
}
Copy link
Member Author

Choose a reason for hiding this comment

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

I solved the issue with switching which end had the sheath BC not being symmetric -- I needed to also switch the noflow BC to the other end. Now that I fixed that, it is exactly symmetric.

I just want to double check that the particle source Si_sheath should also flip sign -- is it a flux in the y-direction, rather than a scalar quantity? And should we expect that the flux is in the opposite sense to the velocities? (Particles moving into the boundary require a flux in the opposite direction to remove them and avoid a build up of density?)

@dschwoerer
Copy link
Collaborator

Refactoring: pull out some helper functions, and use lambdas to de-duplicate the loops over the y boundaries

I just wanted to let you know that that is essentially what I did for sheath_parallel:
https://github.com/dschwoerer/hermes-3/blob/fci-auto-with-debug/src/sheath_boundary_parallel.cxx#L226
in a way that lets you do both FCI and non-FCI in one go.

I think the plan is to only keep the parallel version, so too much refactoring is probably not worth it :-/

@ZedThree
Copy link
Member Author

ZedThree commented Aug 5, 2025

I just wanted to let you know that that is essentially what I did for sheath_parallel: https://github.com/dschwoerer/hermes-3/blob/fci-auto-with-debug/src/sheath_boundary_parallel.cxx#L226 in a way that lets you do both FCI and non-FCI in one go.

Yes, this way is very similar, although it's a complete free function, so doesn't rely on changes in BOUT++. I think a sensible plan is to get this in, and then look at refactoring it into BOUT++, and probably using regions like your version. We should very much try to avoid globals though.

I think the plan is to only keep the parallel version, so too much refactoring is probably not worth it :-/

I'm currently merging the different sheath boundary implementations into one, so I will also pull out your parallel version and merge it all together. This PR is laying the groundwork for that.

* master: (54 commits)
  Silence some compiler warnings.
  Increase the test tolerance to work around compiler differences (seen with -O0 vs. -O2 and gcc@12+).
  fixed_velocity: Add description of mesh array to manual
  Typo in assert message.
  fixed_velocity: Read velocity from mesh
  Extend test input densities, temperatures outside clipped ranges.
  ADAS CX tests.
  Use common input ranges for all reaction regression tests.
  Rename test base class for ADAS izn/rec.
  Move AmjuelCXTest::generate_state() up to a parent class, so it can reused for ADAS.
  Rejig ReactionTest::sources_regression_test to check species data stored in (sub-)sections, including collision freqencies.
  evolve_pressure: Initialize flow_ylow if diagnose but no velocity
  Add H isotope CX tests.
  Move generate_data() for ADAS, Amjuel izn and rec tests into a separate class.
  Consistent naming of reaction regression data files.
  ADAS ionisation, recombination reaction regression tests.
  Correct a mistake in the docs Makefile that meant the doxygen target wasn't declared as .PHONY.
  Tidy up ReactionTest::generate_state().
  Revert "Rename doxygen Makefile target to avoid clash with docs subdirectory name."
  Add missing header.
  ...
@ZedThree
Copy link
Member Author

ZedThree commented Aug 8, 2025

I've added a similar test for the insulating BC, along with a bug fix

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

boundary conditions Changes related to boundary conditions refactor Improving code structure tests Continuous integration

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants