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 simple 1D reservoir model #204

Draft
wants to merge 14 commits into
base: master
Choose a base branch
from
Draft

Add simple 1D reservoir model #204

wants to merge 14 commits into from

Conversation

mikekryjak
Copy link
Collaborator

@mikekryjak mikekryjak commented Feb 1, 2024

A major limitation of 1D SOL models is the inability to consider cross-field transport. This is particularly impactful in deep detachment where the neutral pressure can be many times higher than in a comparable 2D model where neutrals can spread across field lines and get pumped out.

This PR adds a simple reservoir model based on the one in DIV1D but a step simpler. The user defines the reservoir location by passing an expression to reservoir_location and sets it to a constant density with reservoir_density. The exchange term for density will be proportional to the difference between the domain density and the reservoir density, and there will be proportional pressure and momentum sinks. In regions where the particle transfer goes in the other direction, new particles will appear with the same pressure and momentum as the local ones.

Still trying to work out exactly what DIV1D did but I think they evolve the reservoir density with a domain exchange term as described above plus a pump sink term. This is according to Gijs Derks' MSc thesis and may have changed since then.

The reservoir can be implemented for any species.

  • Implement component
  • Implement exchange channels
  • Think about whether we need to evolve density
  • Think about what pressure and momentum the returning particles should be
  • Fix description of energy source (currently pressure)
  • Test
  • Docs

If we have evolving reservoirs we need to evolve a scalar. Peter prepared an example: https://github.com/boutproject/BOUT-dev/blob/evolve-scalars/tests/integrated/test-solve-scalar/test_solve_scalar.cxx

@mikekryjak mikekryjak added the enhancement New feature or request label Feb 1, 2024
@mikekryjak
Copy link
Collaborator Author

Hi @tbody-cfs

src/reservoir.cxx Outdated Show resolved Hide resolved
src/reservoir.cxx Outdated Show resolved Hide resolved
bendudson and others added 3 commits February 8, 2024 22:20
Accidentally making a copy of the state, rather than getting a reference.
- Deleted commented-out code
- Replaced nested loop with BOUT_FOR
- Use GET_NOBOUNDARY so that more useful errors are printed
  if values are modified out of order
- Add comments to class, moving some from .cxx to header
- Delete unused variables
- Run clang-format
Rather than checking `reservoir_region` every time `transform` is
called, create a `Region` containing only the cell indices needed.
@mikekryjak mikekryjak marked this pull request as draft February 16, 2024 15:46
@mikekryjak
Copy link
Collaborator Author

There is an issue where the final domain cell is seeing an extremely high density source in the last domain cell. Here is a plot near the target which includes guard cells showing the model output and a post-processing calculation which is identical to what's in the code.

image

There is no large energy source there which is bizarre since it should be proportional. However, there is a large pressure source in the first guard cell for whatever reason.
image

The momentum source matches the calculation, unlike energy and density. Again, this is very strange since the momentum source is proportional to the density source:
image

No clue what's going on here. I think I will start by setting the guard cells to 0 in case they are having an impact, but I thought they wouldn't. @bendudson any ideas?

@mikekryjak mikekryjak mentioned this pull request May 1, 2024
9 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants