-
Notifications
You must be signed in to change notification settings - Fork 504
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
First Collision Source Method (FCS) #3114
Open
tpaganin
wants to merge
27
commits into
openmc-dev:develop
Choose a base branch
from
tpaganin:first_collided_branch_v2
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
This PR introduces the First Collision Source method (FCS) as a preprocessing stage for the Random Ray solver (TRRM) that will allow full usage of the user-defined source capabilities for fixed-source calculations already existent in OpenMC. FCS works as a preconditioner of the source, distributing the source contribution throughout the domain. This PR implements feature request #3011 as part of the Random Ray FW-CADIS project. This method is not new (Alcouffe) and has already been widely implemented in several recent other codes (Ragusa, Falabino).
The FCS works by generating uncollided neutron angular fluxes at the user-defined source that travel through the domain interacting with the media, being naturally attenuated in the process. Neutrons that experience any collision are treated as first collided neutrons and will be used to estimate the volumetric neutron fixed source at that cell. Once the FCS preprocess stage is complete, the fixed volumetric source will be added to each iteration of the random ray solver. The remaining uncollided flux that has not interacted at any point of the preprocessing stage is added to the final solution at the end of the neutron transport code.
Complexities
This simulation step executes two ray tracing methods: one for uncollided and first-collided fluxes calculation and another for initial volume estimation. Both algorithms are added inside of the function:
first_collision_source_simulation();
.Uncollided and first collided fluxes
The ray tracing for flux calculation is executed differently than the current Random Ray solver as it doesn't have active and inactive lengths. The rays in FCS will travel through the system until they reach a vacuum BC or have their angular flux reduced below a certain negligible threshold value. The storing and calculation of first-collided rays into fixed-source is conducted similarly to regular angular flux in the original Random Ray solver.
The volumetric source obtained from these calculations is normalized by the number of rays used and scaled by its respective source strength.
Initial Volume Estimation
The volumetric source is required to be scaled by the cell volume. This requires an estimation of the volume of each cell with a source. Therefore, there is an initial ray tracing stage (same transport mode in Random Ray solver) to estimate the cell volume using tracklengths.
Prob_actual()
Unlike the Monte Carlo method, FCS and Random Ray solver are required to generate rays with multiple energy groups simultaneously. The generation of each ray will call the normalized user-provided distribution for the energy groups of the source as prob_actual_() from the external_sample_source().
The prob_actual_ variable had to be added so the user-provided energy distribution would be preserved and easily accessed before being altered by Vose's method. This has no impact on previous eigenvalue calculations but could cause errors in the previous fixed-source Random Ray solver and FCS.
Validation
The first test conducted was the simulation of the Kobayashi dog leg problem. The neutron flux was evaluated in each tally for the FCS-TRRM solution in comparison to OpenMC's Multi Group Monte Carlo (MGMC) solution. The domain is discretized in 1 [cm] side cubic cells. One can see in Figure 1 that there is general agreement between the two methods.
Figure 2 provides another look into the Kobayashi dog leg problem, focusing on the relative error and variance from different TRRM simulations in relationship to a TRRM reference solution for the neutron flux. The simulations were: TRRM and FCS-TRRM with flat and linear sources. For the case of FCS-TRRM, it was used 128,000 uncollided rays and 30,000 rays for initial volume estimation. These solutions used 1000 inactive batches, 200 active batches, 15000 rays/batch, 100 [cm] inactive ray length, and 400 [cm] active ray length. The domain is discretized in 1 [cm] side cubic cells. The reference solution was provided using the Monte Carlo existent in OpenMC. The average values for the relative error and variance are also provided at the bottom of Figure 2.
It is visible that FCS-TRRM provided overall smaller error and variance for both flat ($0.845%$ and $0.279 %$ ) and linear sources ($0.695%$ and $0.281 %$ ), compared to TRRM, which had flat ($1.022%$ and $0.757 %$ ) and linear source ($1.025%$ and $0.757 %$ ). The source type (flat and linear) had no impact on the variance, but the addition of the first collision source mode caused a 3x reduction factor.
It was evaluated how many rays the FCS-TRRM method would require in the Kobayashi Dog Leg problem (with 1 [cm] side cubic cells, 100 inactive and 100 active batches) to provide an accurate solution. Figure 3 presents the average relative error between the FCS-TRRM and the MGMC solution and the percentage of cells hit by the uncollided rays. As the amount of uncollided rays increases, the average error of the tallies reduces to a certain level slightly below the TRRM error. This region is reached as the percentage of cells hit approaches 100%.
An automatic method using the number of cells hit by uncollided rays was developed. Firstly the method generates some rays, checks for amount of cells hit, and accumulates the contributions on each cell's fluxes. If newer cells were discovered, the algorithm generates more rays until it reaches a maximum value or no newer cells were discovered.
Checklist