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
In the case when R < r the inner "imaginary" surfaces created an additional source of scattering close to the center of the torus. This error occurred due to the lack of a check in the solution of the torus equation. If we describe the equation in more detail, we obtain the following:
![image](https://private-user-images.githubusercontent.com/60288416/251144256-8d1263a9-2280-4188-9671-072fead4f726.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzk0MzY0MzcsIm5iZiI6MTczOTQzNjEzNywicGF0aCI6Ii82MDI4ODQxNi8yNTExNDQyNTYtOGQxMjYzYTktMjI4MC00MTg4LTk2NzEtMDcyZmVhZDRmNzI2LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAyMTMlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMjEzVDA4NDIxN1omWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTBiNTgwOGM4ZjEwMzhjYmFmNzY3NjJjM2RmMGY0MjE1NzJmY2Y5YmI5NzA3OGM2NGFmZDQ5MTZiZWZjMjg3YjAmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.HYBHsKtIuitlBfK_BQAZJuEufa4kZAK-v8D4sqi7RXU)
![bad_torus](https://private-user-images.githubusercontent.com/60288416/251168006-ab2a8605-4657-48f1-9d53-ec7a229885f9.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzk0MzY0MzcsIm5iZiI6MTczOTQzNjEzNywicGF0aCI6Ii82MDI4ODQxNi8yNTExNjgwMDYtYWIyYTg2MDUtNDY1Ny00OGYxLTlkNTMtZWM3YTIyOTg4NWY5LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAyMTMlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMjEzVDA4NDIxN1omWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPThiZTA2YjA3ODJiZGZmYWU1ZThkNDhiYjA3MGExOGYyN2FiMjcwM2E2NzcyNmJmZjY4NzgzODIxZThkZDc1MDAmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.VZOMYuapGdD60p-KxVdTTRE6OXmeorM0gj3DgfbYGx4)
We see that the left part should obviously be greater than or equal to zero.
As a result of OpenMC with these geometry parameters (torus_test_xml.tar.gz), there is an anomaly in the form of surfaces inside, which in fact should not be:
This check was missing in the code of surface.cpp file and was added in lines 974-978. After fixing this error, the torus image looks correct:
![torus_good](https://private-user-images.githubusercontent.com/60288416/251168334-16e7b720-e20b-4be5-bde2-d01351df4412.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzk0MzY0MzcsIm5iZiI6MTczOTQzNjEzNywicGF0aCI6Ii82MDI4ODQxNi8yNTExNjgzMzQtMTZlN2I3MjAtZTIwYi00YmU1LWJkZTItZDAxMzUxZGY0NDEyLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAyMTMlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMjEzVDA4NDIxN1omWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTRjYjQyNGRlODUxZjJjOTFiZThmOGU5YTA0MDE4MzkwNjMwZDJjNmE5ODkwYTcxMDU5MjRiOTU5MWMyNTQ2NzcmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.TeqLI_V4NvtOk56Ge8-3K-FAF2BLsnj7CxIzmtqMQXE)
This is probably not a common problem, but I encountered it when calculating heat in one of the projects, where there was an anomalous surface where it should not be.
Fixes # (issue)
Checklist