General fixes, improvements, and cleanup#7
Conversation
…magnitude only calculation)
…n spectrum if (alpha,n) is the only contribution, otherwise the total neutron spectrum is normalized twice
…tion to the total neutron spectrum, otherwise remains equal to 0 in this specific case, causing incorrect output
…dd the possibility that the contribution is from spontaneous fission only or from delayed neutrons only
…ission) is updated also when nt=0 (there are no targets for (alpha,n))
…ased for sources that do not undergo spontaneous fission
…s) is updated also when nt=0 (there are no targets for (alpha,n))
… calculation of the spontaneous fission source and delayed neutrons source
…sion of the code
…ontribution (no (alpha, n), no delayed neutrons)
…if (alpha,n) is the only contribution without skipping the section output of grand total (alpha,n) + s.f. + d.n. neutron spectrum
There was a problem hiding this comment.
I would suggest to change this into "if(l_sdata .and. sensitivity) then" for consistency.
There was a problem hiding this comment.
I would suggest to open files 13 and 14 only "if (sensitivity) ".
This should allow you to change also lines 441-452 into :
if(sensitivity)then
close(unit=13)
close(unit=14)
endif
There was a problem hiding this comment.
Ok. Changed also other instances of close(unit=13), close(unit=14).
There was a problem hiding this comment.
I think this should be "if(l_sdata.and.sensitivity)then"
There was a problem hiding this comment.
I would wrap these two lines initializing dq3c and dq3s into a "if(sensitivity)" statement.
| c----------------------------- | ||
| c calculate number of spontaneous fission | ||
| c and delayed neutrons sources if nt=0 | ||
| c----------------------------- |
There was a problem hiding this comment.
Comment: Perhaps a better solution would have been to set ISFNFQ and IDNNFQ independently of the value on NT before line 1221: "do 1120 i=1,nt".
There was a problem hiding this comment.
Changing these 2 line into:
2'atoms dk constant sf decay nu neutrons',/,8x,'nuclide',
3' per cm3 (/second) branching bar sec/cm3',****
should help solving the 4 spaces disalignment in tape 6 output.
|
|
||
| source source atoms dk constant sf decay nu neutrons | ||
| nuclide per cm**3 (/second) branching bar sec/cm**3 | ||
| nuclide per cm**3 (/second) branching bar sec/cm**3 |
There was a problem hiding this comment.
A correction is proposed in the source code.
This PR closes #1, #2, #4, #5, #6, #8.
Inconsistent normalization of total neutron spectrum in tape7, tape8, outp, outp2 #1: Correction of the incorrect normalization of the total neutron spectrum in tape7, tape8, outp and outp2 observed in the alpha beam configuration and in the homogeneous configuration when only (alpha, n) reactions contribute to the neutron emission.
Description: Output
tape7, which should contain the absolute spectra, shows the normalized total neutron spectrum. Furthermore, the normalized total neutron spectrum is calculated incorrectly by dividing the spectrum by the total neutron emission twice instead of once. This also leads to an incorrect output intape8, which contains the normalized neutron spectra. The contributions per single target-source combination, however, are correct on both tapes. The same issue can be observed in the absolute and normalized total neutron spectrum inoutp2and in the spectrum reported inoutp.Solution: The total neutron spectrum is printed in the section
output grand total (alpha,n) + s.f. + d.n. neutron spectrum. Here, the absolute total neutron spectrum is written totape7. Then, it is normalized and written totape8.In cases where the neutron emission consists of a single contribution from (alpha, n) reactions, an additional section is triggered, in which the total neutron spectrum is already normalized before entering the aforementioned output section.
As a result, the total neutron spectrum printed in
tape7is already normalized, and it undergoes a second normalization before being written intape8. This problem was solved by removing the additional normalization step triggered in cases with a single contribution from (alpha, n) reactions.Tests: This changes are reflected in the output of
test3,test6,test7in thesamplesfolder. For this test cases,tape7andtape8now show the correct values for the total neutron spectrum. Furthermore, the absolute and normalized total neutron spectrum inoutp2and the normalized spectrum inoutpare now correct.Incorrect total neutron spectrum in outp2 #2: In case of a single contribution to the neutron emission from spontaneous fission, the values of the absolute total neutron spectrum were written, in outp2, instead of the normalized total neutron spectrum, while the absolute neutron spectrum appeared to be zero.
Description: In case of nt=0 (no targets for (alpha, n) reactions) the variable
isfnq, storing the number of spontaneous fissioning nuclides, is not updated and remains initialized to zero, even in presence of spontaneous fissioning nuclides.The same happens for
iddnq, storing the number of nuclides that emit delayed neutrons.Solution: This problem was solved by ensuring that the variable
isfnqand the variableiddnqare correctly updated, adding a new sectioncalculate number of spontaneus fission and delayed neutrons sources if nt=0.Tests: An additional test case (
test9) was added in order to show this behaviour. The input oftest9consists of the same input of test1, modified to have 0 targets for (alpha, n).Increase in execution time with sensitivity calculation #4: The sensitivity calculation requires a significant computational time.
Description: The sensitivity calculation introduced in SOURCES 4D is computationally intensive, particularly when there are a large number of source nuclides or bins in the neutron spectrum. SOURCES always performs the sensitivity calculation, even when this is not required (the user may only be interested in the best-estimate values), which considerably increases the computational cost of each execution.
Solution: Since the sensitivity calculation is not required in all use cases, it is made optional. A new input parameter is introduced, allowing the user to enable or disable the sensitivity calculation. This parameter must be added in
card 2, after theidd,id,ergparameters. It accepts two values:0to disable the sensitivity calculation and1to enable it. To ensure compatibility with older inputs, this parameter is optional and, if omitted, it defaults to0. The sensitivity calculation is only available for the homogeneous configuration and for the alpha beam configuration, therefore this parameter has no influence in calculations with other configurations.Tests: The additional parameter introduced is set to the value
1in all the example inputs in thesamplesdirectory, in order to enable the sensitivity calculation. To provide an example of the impact of the sensitivity calculation,test1required ~2 min with the sensitivity calculation, while without it only requires ~0.1 s.Incorrect results for three-region interface configuration #5: The three-region interface configuration provides incorrect results.
Description: Depending on the options provided to the compiler, inputs using the three-region interface configuration result in an error or provide incorrect results. In particular, the outputs show values for the total neutron production and for the neutron emission spectrum that are either 0 or
NaN.Solution: This issue was caused by some variables not being properly passed between subroutines. This has been fixed by ensuring that all the required variables are correctly passed to the necessary subroutines.
Tests: An additional test (
test10) has been added in order to test the three-region configuration, since none of the present cases in thesamplesdirectory covered this configuration.Clean-up repository #6: The repository should not contain the compiled executable.
Description: To ensure code reproducibility, the executable should be removed from the repository. The
binfolder should be removed and added to the.gitignorefile. AMakefileshould also be added, and theREADMEupdated.Solution: The
binfolder has been removed and added to the.gitignorefile. Furthermore, aMakefilehas been added, that creates thebinfolder before creating the executable. TheREADMEhas been updated accordingly with installation instructions.Inconsistent results across runs due to uninitialized variables #8: Correction of inconsistent results across different runs.
Description: While running SOURCES4D on different machines, inconsistent results were observed across multiple runs. This behaviour is unexpected, as the code is deterministic.
Solution: The issue was traced back to the presence of uninitialized variables, which can lead to different results depending on the execution environment and compiler. A more thorough check was performed using stricter compilation flags, revealing additional uninitialized variables. These variables have been correctly initialized.
Minor related issues were also identified and fixed, including:
spectra for outp2 in ascending or descending orderis skipped ifid=1(magnitude only), for thehomogsubroutine;id>1(spectra are calculated), for thehomogsubroutine;neutronsubroutine, some checks have been added to avoid division by zero.Note: in the evaluation of the derivatives of source rate density w.r.t. (alpha,n) cross sections and stopping power data, the variable
fal(l)remained uninitialized in case ofidd=3. It has been set to 1 to avoid runtime issues. This variable does not affect the output inpdata.Tests:
test10is the only test modified by the changes. In particular, the value of theTotal (all targets)neutron production intape6is now correct. This leads to different values of the normalized spectra intape8, that is now normalized using the new correct value of the total neutron production.