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

Implement fast recycling #176

Merged
merged 20 commits into from
Oct 5, 2023
Merged

Implement fast recycling #176

merged 20 commits into from
Oct 5, 2023

Conversation

mikekryjak
Copy link
Collaborator

@mikekryjak mikekryjak commented Sep 3, 2023

Turns out fast recycling has a big impact. This PR does a simple implementation of this:

$$\Gamma_{E_{n}} = R \times (R_{f} \alpha_{E} \Gamma_{E_{i}}^{sheath} + (1 - R_{f}) T_{R} \Gamma_{N_{i}})) $$

Where $R$ is the recycle multiplier, $R_{f}$ is the fast reflection fraction, $\alpha_{E}$ is the energy reflection factor,
$\Gamma_{E_{i}}^{sheath}$ is the incident heat flux from the sheath boundary condition, $T_{R}$ is the recycle energy and $\Gamma_{N_{i}}$ is the incident ion particle flux.

This is implemented for the SOL and the PFR and is fully compatible with the neutral pump.

In addition, the example cases haven't been corrected to reflect the new recycling flags - this is now done in this PR for all examples.

Tasks:

  • Implement for ylow and yup targets
  • Test
  • Run case for complex test
  • Make compatible with neutral pump
  • Add documentation

- Very simple expression at the moment, need to check later whether there are any factors missing from a detailed derivation
- Unsure whether neutral energy source is energy or pressure. Previously neutral energy was T_FC * N and added to energy_source, which seems inconsistent.
@mikekryjak mikekryjak added enhancement New feature or request boundary conditions Changes related to boundary conditions labels Sep 3, 2023
@mikekryjak mikekryjak self-assigned this Sep 3, 2023
@mikekryjak mikekryjak marked this pull request as draft September 3, 2023 19:12
The fast recycling energy wasn't being added to the actual energy source, only to the diagnostic energy source
@mikekryjak
Copy link
Collaborator Author

There is an issue here. The formula for the energy of recycled neutrals is using a weighting of temperature, not heat flux. Yes, the returning thermal neutrals are all 3eV and their heat flux calculation is therefore very straightforward. However, the ions are a drifting maxwellian going through sheath_boundary.cxx. I have to use the ion heat flux as calculated there. I think the easiest way would be to store the sheath heat flux somehow and pick it up in fast recycling.

Probably the easiest way would be to add it to EnergyFlow_d+_ylow which already exists and is the total species heat flux by definition.

- This allows the heat flow through the sheath to be used by other parts of the code
Field energy_flow_ylow should be shifted to non-aligned
coordinates. In axisymmetric simulations this doesn't make a difference.
Thanks Ben!
Heat flow now correctly calculated from ion sheath heat flow
which is calculated in sheath_boundary_simple.
sheath_boundary not yet supported.
Improved variable names and comments for clarity
Further improvements to code clarity and readability
@mikekryjak
Copy link
Collaborator Author

Corrected the formulation to use the actual ion energy flows leaving the model, extended to SOL/PFR, fixed some bugs and improved code clarity. Documentation next

Copy link
Collaborator Author

@mikekryjak mikekryjak left a comment

Choose a reason for hiding this comment

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

Commit fe6161c causes a segmentation fault in the 1D-recycling integrated test.

@mikekryjak mikekryjak marked this pull request as ready for review October 5, 2023 17:16
@mikekryjak
Copy link
Collaborator Author

@bendudson ready for review. Unfortunately it seems to arbitrarily fail the documentation build test again. I have no idea why since all I've changed is some text... it would be good to finally get this merged and reduce the amount of live PRs. Do you think the issue is with the test or with the documentation itself?

This is the error:

Configuration error:
There is a programmable error in your configuration file:

Traceback (most recent call last):
File "/home/docs/checkouts/readthedocs.org/user_builds/hermes3/envs/176/lib/python3.11/site-packages/sphinx/config.py", line 358, in eval_config_file
exec(code, namespace) # NoQA: S102
^^^^^^^^^^^^^^^^^^^^^
File "/home/docs/checkouts/readthedocs.org/user_builds/hermes3/checkouts/176/docs/sphinx/conf.py", line 152, in
import sphinx_rtd_theme
ModuleNotFoundError: No module named 'sphinx_rtd_theme'

Copy link
Owner

@bendudson bendudson left a comment

Choose a reason for hiding this comment

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

Thanks @mikekryjak ! Readthedocs is acting up at the moment, will sort out at some point.

@bendudson bendudson merged commit 818976d into master Oct 5, 2023
2 checks passed
@bendudson bendudson deleted the fast-recycling branch October 5, 2023 20:22
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 enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants