Skip to content

Conversation

@RemiLehe
Copy link
Member

@RemiLehe RemiLehe commented Jul 24, 2022

In RZ geometry, particles need to be temporarily rotated before/after the two-particle fusion event, in order to reflect the cylindrical symmetry of the distribution function for the plasma. (This is similar to what was implemented for the Coulomb collisions: #2510.)

In this PR we implement this rotation, but only for the incident particles (i.e. not yet for the products of the reaction, which will be done in a follow-up PR). As a result the reaction rates and number of particles created will be correct (because the incident have been properly rotated), but the exact momentum distribution of the product species will not. (At least, not before we implement the rotation of the product, in the follow-up PR.)

This PR also adds an RZ test, where particles are initialized with an azimuthal velocity. The test does not check for isotropy in the momentum distribution of the products, because of the above-mentioned limitation for the momentum distribution of the products.

@lgtm-com
Copy link
Contributor

lgtm-com bot commented Sep 7, 2022

This pull request introduces 1 alert when merging e85d2c5 into afda3a4 - view on LGTM.com

new alerts:

  • 1 for Unused local variable

@lgtm-com
Copy link
Contributor

lgtm-com bot commented Sep 16, 2022

This pull request introduces 1 alert when merging f1994ea into 47eef0b - view on LGTM.com

new alerts:

  • 1 for Unused local variable

@lgtm-com
Copy link
Contributor

lgtm-com bot commented Sep 17, 2022

This pull request introduces 1 alert when merging 422586b into 47eef0b - view on LGTM.com

new alerts:

  • 1 for Unused local variable

@RemiLehe RemiLehe marked this pull request as ready for review September 19, 2022 14:22
@RemiLehe RemiLehe changed the title [WIP] Test fusion module in RZ geometry Test fusion module in RZ geometry Sep 19, 2022
@RemiLehe RemiLehe changed the title Test fusion module in RZ geometry Correct and test fusion module in RZ geometry Sep 19, 2022
@lgtm-com
Copy link
Contributor

lgtm-com bot commented Sep 19, 2022

This pull request introduces 1 alert when merging 337b2ed into 3bf1a33 - view on LGTM.com

new alerts:

  • 1 for Unused local variable

@RemiLehe RemiLehe requested a review from NeilZaim September 19, 2022 17:04
@RemiLehe RemiLehe added the component: collisions Anything related to particle collisions label Sep 19, 2022
check_isotropy(data, relative_tolerance = 3.e-2)
def specific_check1(data, dt):
if not is_RZ:
check_isotropy(data, relative_tolerance = 3.e-2)
Copy link
Member Author

Choose a reason for hiding this comment

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

We don't check for isotropy in the RZ case, since the distribution of momentum for the products is not yet correct.

@RemiLehe RemiLehe requested a review from EZoni September 19, 2022 17:07
@lgtm-com
Copy link
Contributor

lgtm-com bot commented Sep 19, 2022

This pull request introduces 1 alert when merging 70a864e into 6e75516 - view on LGTM.com

new alerts:

  • 1 for Unused local variable

Copy link
Member

@EZoni EZoni left a comment

Choose a reason for hiding this comment

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

Thank you for this PR, Remi! Looks good to me, I just left a couple of minor comments.

Comment on lines 69 to 71
## Checks whether this is the 2D or the 3D test
is_RZ = "RZ" in sys.argv[1]

Copy link
Member

Choose a reason for hiding this comment

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

One other way to do this (which I personally find a little more robust, because it does not rely on the test's name) is to parse the output file warpx_used_inputs and determine the geometry from there:

warpx_used_inputs = open('./warpx_used_inputs', 'r').read()
if re.search('geometry.dims = 2', warpx_used_inputs):
    is_RZ = False
elif re.search('geometry.dims = RZ', warpx_used_inputs):
    is_RZ = True

useMPI = 1
numprocs = 2
useOMP = 1
numthreads = 2
Copy link
Member

Choose a reason for hiding this comment

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

I think this needs to be maximum 1 if numprocs = 2:

Suggested change
numthreads = 2
numthreads = 1

@lgtm-com
Copy link
Contributor

lgtm-com bot commented Sep 20, 2022

This pull request introduces 1 alert when merging 65b43eb into 5e17906 - view on LGTM.com

new alerts:

  • 1 for Unused local variable

@lgtm-com
Copy link
Contributor

lgtm-com bot commented Sep 20, 2022

This pull request introduces 1 alert when merging d399ac2 into 5e17906 - view on LGTM.com

new alerts:

  • 1 for Unused local variable

@RemiLehe RemiLehe enabled auto-merge (squash) September 20, 2022 15:54
@RemiLehe RemiLehe merged commit 2fed282 into BLAST-WarpX:development Sep 20, 2022
dpgrote pushed a commit to dpgrote/WarpX that referenced this pull request Nov 22, 2022
* Add particle rotation in NuclearFusionFunc.H

* Minor

* indent

* initial work

* fixed bugs and added species

* update documentation

* delete unused file

* Add properties for neutron, hydrogen isotopes, helium isotopes

* Update code to be more consistent

* Correct typo

* Parse deuterium-tritium fusion

* Start putting in place the files for deuterium-tritium

* Update documentation

* Prepare structures for deuterium tritium

* Fix typo

* Fix compilation

* Add neutron

* Add correct formula for the cross-section

* Correct compilation error

* Fix nuclear fusion

* Reset benchmarks

* Prepare creation functor for 2-product fusion

* First implementation of momentum initialization

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Use utility function for fusion

* Minor modification of variable names

* Fix GPU compilation

* Fix single precision compilation

* Update types

* Use util function in P-B fusion

* Correct compilation errors

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Correct errors

* Update values of mass and charge

* Correct compilation error

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Correct compilation error

* Correct compilation error

* Correct compilation error

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Reset benchmark

* Use helium particle in proton-boron, to avoid resetting benchmark

* Fixed proton-boron test

* Revert "Fixed proton-boron test"

This reverts commit 73c8d9d.

* Incorporate Neil's recommendations

* Reset benchmarks

* Correct compilation errors

* Add new deuterium tritium automated test

* Correct formula of cross-section

* Correct cross-section

* Improve analysis script

* Add test of energy conservation

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Add test of conservation of momentum

* Progress in analysis script

* Fix error in the initial energy of the deuterium particles

* Add check of isotropy

* Clean up the test script

* Rewrite p_sq formula in a way to avoids machine-precision negative numbers

* Add checksum

* Clean up code

* Add test for fusion in RZ geometry

* Update code to take into account actual timestep

* Update RZ test

* Update RZ test

* Increase number of particles

* Impart radial memory on DT particles

* Correct RZ momenta

* Remove unused file

* Update test

* Fix definition of theta

* Add new test

* Add checksum

* Update test

* Update tests

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Fix Python analysis script

* Remove CPU and ID from new benchmark

Co-authored-by: Yinjian Zhao <[email protected]>
Co-authored-by: Luca Fedeli <[email protected]>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

component: collisions Anything related to particle collisions

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants