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

✨ Split of Neutroics pre cell csg and openmc running #3243

Merged
merged 10 commits into from
May 9, 2024

Conversation

je-cook
Copy link
Contributor

@je-cook je-cook commented May 2, 2024

Description

This separates the creation of csg pre cells and openmc cell generation.

TODO

  • Deal with materials better

Interface Changes

Checklist

I confirm that I have completed the following checks:

  • Tests run locally and pass pytest tests --reactor
  • Code quality checks run locally and pass pre-commit run --from-ref develop --to-ref HEAD
  • Documentation built locally and checked sphinx-build -W documentation/source documentation/build

Copy link

codecov bot commented May 2, 2024

Codecov Report

Attention: Patch coverage is 0% with 398 lines in your changes are missing coverage. Please review.

Project coverage is 74.48%. Comparing base (2630d0d) to head (9e1cbd6).

Files Patch % Lines
bluemira/neutronics/blanket_data.py 0.00% 99 Missing ⚠️
bluemira/neutronics/openmc/make_csg.py 0.00% 92 Missing ⚠️
bluemira/neutronics/neutronics_axisymmetric.py 0.00% 62 Missing ⚠️
bluemira/neutronics/openmc/material.py 0.00% 61 Missing ⚠️
bluemira/neutronics/openmc/solver.py 0.00% 30 Missing ⚠️
bluemira/neutronics/materials.py 0.00% 21 Missing ⚠️
bluemira/neutronics/params.py 0.00% 12 Missing ⚠️
bluemira/neutronics/slicing.py 0.00% 12 Missing ⚠️
bluemira/neutronics/radial_wall.py 0.00% 4 Missing ⚠️
bluemira/neutronics/make_pre_cell.py 0.00% 2 Missing ⚠️
... and 3 more
Additional details and impacted files
@@                  Coverage Diff                   @@
##           feature/neutronics    #3243      +/-   ##
======================================================
- Coverage               74.58%   74.48%   -0.10%     
======================================================
  Files                     239      241       +2     
  Lines                   26688    26722      +34     
======================================================
  Hits                    19904    19904              
- Misses                   6784     6818      +34     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link

sonarcloud bot commented May 7, 2024

Quality Gate Passed Quality Gate passed

Issues
31 New issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarCloud

@je-cook je-cook marked this pull request as ready for review May 9, 2024 09:57
@je-cook je-cook requested review from a team as code owners May 9, 2024 09:57
@je-cook je-cook merged commit c3dddd1 into feature/neutronics May 9, 2024
6 of 7 checks passed
@je-cook je-cook deleted the je-cook/csg_openmc_split branch May 9, 2024 09:57
je-cook added a commit that referenced this pull request May 14, 2024
* 2D Neutronics module  (#2344)

* Initial commit to repository

* Create basic README.md

* Editing README.md

* Code styling: Black, isort and whitespace/trailing new lines (#1)

* blacken and isort

* whitespace and new lines

* Rearrage and refactor (#2)

* Adding plasma source, DCLL and WCLL. Material defintions and geometries still need tweaking.

* Changing from toroidal first wall profile to match points and adding extra source geometry plots.

* Adding source code for parametric plasma source

* Adjusting point too close to plasma.

* Minor format tidy up. Moving function.

* Passing geometry_variables to get_fw_points

* Update make_materials.py

Changing tungsten isotopes and tidying export_materials()

* Update make_materials.py

W isotopes corrected.

* Made most of it OOP, especially the summary, so that the data can be recalled.

* Added vscode into gitignore

* Finished reformatting the Summary object so now it prints the entire run properly. Not documented yet, and kwargs not passed on yet.

* Finished some reformatting. Todo list is at the top.

* Some work done on load_fw_points, but incomplete. TODO list updated.

* Added some documentations, but found a lot of magic numbers and 'things that don't belong in this module'. I'll deal with them later.

* Changed the ordering and naming of the arguments to make_geometry in make_geometry.py, and added some docstring.

* Fxied the types of Blankets available using BlanketType in make_materials.py.

* Fixed the naming for cells in quick_tbr_heating.py - renamed them to cells_and_cell_lists

* Updated the todo list

* Cleaned up create_tallies, and in the process, created MaterialsLibrary in make_materials.py so that it becomes modular enough for testing.

* Formatted the 'print_df' booleans away into a decorator - can change into printing to bluemira log later.

* Added documentations to the rest of the important classes.

* Updated todo list

* one line change to make pandas print more prettily, before merge commit

* moved all relevant files into the neutronics directory.

* Moved files from the 2d-neutronics repo to here.

* restored comment style fix

* moved the neutronics files to the correct directory.

* changed the import relative path

* relocated files to the correct directory

* changed the import path

* minor changes before complete overhaul (the latter is for adhering to bluemira code style)

* moved some constants to constants.py

* Finished one task: placed the relevant constants and conversion units into constants.py

* updated to-do list

* Further broke down the make_materials.py file into materials_definition.py file

* Refactored all of materials.

* updated .gitignore

* Moved the results formatting functions to a separate file

* removed unused file

* Improved styling

* Broke functions down into appropriate modules

* Split into appropriate modules

* Added typing information

* Updated the import diagram to reflect the import relationships between modules.

* Fixed all fixable formatting issues according to flake8

* Fixed all flake8 messages!

* installs script

* cleaned up script

* added complete apt install deps

* Updated install script, removed pps_api

* Updated to-do list, improved result presentation workflow

* .npy requires conversion to BluemiraWire

* ➕ Use ninja and install libopenmpi-dev

* ➕ Add openmc to conda

* ✨ Start using wire as input

* 🚨 Some ruff fixes

* 🎨 Move ifmain to example

* 🚚 Move npy

* 🎨 Fix example

* 🎨 Get constants from base

* 🎨 Fix imports

* 🚨 Some ruff fixes

* added openmc version to install script, added pps-isotropic package import to quick tbr

* removed my path from config

* 🎨 Cleanup printing

* 🎨 Unit fix

* 🎨 Unit fix2

* 🎨 Unit fix3

* 🎨 Use openmc enum

* Preparing for unit changes

* quick commit before rebase, units half-done

* 🙈 Remove noise

* 🔥 Remove so file

* Removed the not-sensible default constants and placed thme into neutronics.ex.py instead.

* Added TODO comment

* 🎨 Cell filter cleanup

* 🎨 Cleanup tallies

* Changed all units

* minor fix of import statement

* Monkey patched successfully

* monkeypatched successfully, and separated plasma geometry variables from tokamak geometry variables. This is the commit BEFORE applying the DataclassUnitConverter pattern.

* Minor update to add comments.

* Removed the duplicate codes inside params.py. This is the commit AFTER applying the DataclassUnitConverter pattern.

* Bug fix - missing 'self,' argument fixed.

* Updated todos

* 🎨 Change raw_uc percent use and runtime var

* 🚧 Make geometry dataclass refactor

* 🚧 Slight cleanup of params

* 🚨 Ignores

* 📝 Docs

* 📝 Fixes and docs

* 📝 Fix documentation build

* Update neutronics.ex.py

* Update pyproject.toml

* 🐛 Fix volume calculation

* 🎨 Cleanup vol calc

* 🚨 Fix black

* 🎨 Small fixes

* 🚚 Move quick tbr to neutronics_axisymmetric

* 🎨 Add stochastic volume to output results

* Added comments on why only two quantities are excluded in the conversion

* pps-isotropic's API changed, making appropriate changes here to maintain usability

* Added markdown docs on neutronics.ex.py

* 💩 Hack for old version of openmc

* 👥 Add contributors

---------

Co-authored-by: jamesnha <92076761+jamesnha@users.noreply.github.com>
Co-authored-by: je-cook <81617086+je-cook@users.noreply.github.com>
Co-authored-by: Oliver Funk <oli.funk@gmail.com>

* ✨ OpenMC data downloader (#2618)

* ✨ OpenMC data downloader

* 🎨 Parse known args

* 🎨 Ifmain

* 🎨 Rename file

* 🎨 Write them all then delete all

* 🐛 Overindent

* 🚨 Cleanup and linting

* 🐛 No output

* 🐛 Fix neutronics json location

* 🐛 Hack to force data into a given directory

* 🎨 Spelling

* 🏷️ Typing fix

* 🚨 Ruff fixes

* 🙈 Add to gitignore

* Minor error fixes to the outputted tables (#2689)

* Fixed unit conversion error in photon heat flux; and turned off Bremsstrahlung heating by default

* Undo accidental indent

* Kept all statepoint files' units as openmc as cgs, so that the conversion to SI is done purely in python. Fixed misinterpretation of photon flux.

* added comments to explain tally score choice.

* Minor bug fix to pass code quality checks

* 🚨 Ruff fixes

* first move to BM materials, lots of refactoring needed but the example runs

* 🎨 Basic cleanup

* 🎨 Dataclassify

* 🐛 Undo Be12Ti density change

* 💡 Minor fixes

* 📄 Copyright fixes after rebase

* ✨ Allow '*' to extract all XS data

* ⬆️ Openmc 0.13.3

* temperature docstring.

* removed rounding

* calculate the DT energy more accurately using plasma physics.

* Simplified code to use n_DT_reactions instead.

* 1. extracted (major_r, minor_r, elong, triang) into a different class than TokamakGeometry, and named this class PlasmaGeometry. 2. Removed the 'CGS' and 'PPS' from the 3 classes in params.py, and instead appended their baseclasses with 'Base', so that it becomes clearer that these dataclasses store SI units unless the .csg or .plasma_physics_units property is accessed.

* (minor bug fix)

* Updated the Shafranov shift description.

* 🚨 Fix linter

* Minor updates to docstrings

* 🚨 Ruff & python3.10 fixes

* Increase CSG speed without compromising on flexibility (#3079)

* :Changed params.py according to Matti's suggestion

* Made temporary script

* Added json data to be loaded as test case bluemirawires

* Added post_init checks.

* Created basic script to translate from existing dataclass TokamakGeometry (make_csg)

* WIP: making pre-cell.

* WIP: making pre-cell.

* Bodging serializing issue - fix later.

* Deleted failed files.

* Test script in attempt to replace the magic numbers/magic procedure to something more generalizable

* quick commit

* Script to load the divertor.

* Added capability to automatically slice up the blanket according to the first wall panels

* Updated script for creating neutronics csg

* extended the functionality of signed distance to check points as well.

* Added function based on signed_distance to check for overlaps.

* Add tolerance to account for low sampling rate/ float errors.

* Adding module to optimally slice the neutronics model.

* Updated module that chooses better surfaces for faster neutronics runs.

* Made the volume optimization converge.

* Made a better approximation of the reactor. Added tools necessary to make such approximation

* Added better documentations. Formatting.

* Made a very rigorous structure to create openmc.Cells.

* removed unused code

* Updated test case

* Half-working state

* Finally finished the blanket bug fix.

* Updated docstrings

* Updated equations

* Updated comment

* Interited from collections.abc.Sequence to avoid having to make def __iter__().

* Cleaned up excess code

* minor changes to naming and docstring

* Updated the run modes into context managers.

* Enforced self.setup() to be ran before self.run() in the contextmanagers.

* Added ability to slice divertor wire

* Variable renaming

* Removed redundant checks

* Improved typing (Iterables vs Sequence), and added classes to prepare for tallying.

* Added tallying functionality

* Developing divertor cells automatic conversion into pre-cells...

* Added type hints for return types.

* Fixed import

* Successfully exported into DivertorPreCellArray.

* Updated script correspondingly

* split up WireInfo etc. into its own file.

* Made make_divertor_pre_cell_array more robust (able to straighten out the cell walls better before passing onto DivertorPreCell).

* Typing and docstring improvement

* Added function to flip a direction vector if it is pointing the wrong way; Moved plane functionalities to geometry/plane.py

* Removed plane creation functionality (migrated to bluemira.geometry.plane)

* Minor change to type hinting in make_csg.py

* Minor changes to type hints in radial_wall.py

* Slight change to variable name

* Added plan to make the divertor slicing more robust.

* Moved the warning to an appropriate place

* Improved the interior_wire_offset method

* Fixed minor mistake in direction

* Working version: produces pre-cell arrays for both divertor and blanket

* Pointed the chord in the correct direction again

* Removed unused data loading files.

* Improved file structure so each class has separate responsibility. Surfaces that aren't shared among different BlanketCell stacks won't be created in BlanketCellArray.

* Minor bug fixes related to types and WireInfo

* Moved constants into constants.py

* Docstring updates

* Simplified boolean expression; made plasma cell.

* Deleted unused statement.

* updated test script to plot better.

* Named file more sensibly.

* Fixed some ID control issues

* docstring rearrangement

* Fixed up the get_all_hollow_merged_cells method so the test script won't have to write something as long to plot the overall-cells.

* Fixed the thickness issue - now instead we have absolute thickness.

* Got as far as getting some segfaults out of openmc.

* Finally working. Tallies need fixing

* Fixed floating point issue

* Added missing conversion function

* Changed thickness.

* Modified to allow for a variable number of batches.

* Delete some of the obsolete classes

* Updated TODO tags in test script.

* Updated TODOs

* Added missing method back in

* Updated documentations slightly to make it more readable.

* Updated docstring to conform usage of anti- vs counter-

* Ensured backward (neutronics.ex.py) compatibility

* Calculated volumes without relying on openmc.

* Added function to support volume calculation of the openmc.Cell's .volumes.

* Optimized volume calculation (commented them out where they're not needed)

* Working version.

* Added TODO on reducing the number of negated regions.

* ruff fixes

* Some updates to how surfaces are get

* fixed ONE TODO tag.

* Updated zip strict = True almost everywhere, pairwise where applicable.

* Cleaned up code slightly at make_csg

* We can now control the thickness of the central solenoid from parameter frame directly.

* Attempting to use vacuum vessel wire as well.

* Further attempt at incorporating the vacuum vessel interior curve into the pre-cells

* VV now successfully sandwhiched between the two curvesgit add .

* Minor formatting updates

* Finished porting over the materials library

* Cleaned out all low-lying fruit TODO tags

* Made note about convexity.

* Neutronics Solver interface (#3231)

* 🚧 OpenMC designer

* 🚧 Working designer

* ✨ Openmc solver

* ✨ Fixup from upstream

* 🚚 Move stuff

* Neutronics old code removal and architectural adjustments (#3232)

* 🌐 Bye Z

* ♻️ Initial cleanup

* ♻️ More cleanup

* ♻️ More cleanup

* ♻️ More cleanup

* 🔥 Destroying Vertices pt1

* 🔥 Destroying Vertices pt2

* ♻️ More cleanup

* 🔥 Remove Sequence inheritance

* 🎨 Types

* 🚨 Remove ruff ignores

* ♻️ More cleanup

* ♻️ Remove global hangar variable

* ♻️ More cleanup

* ♻️ More cleanup

* 🚨 More cleanup

* 📝 Docs cleanup

* 📝 Docs cleanup

* 🐛 Fix double counting of divertor material

* 🐛 Fix 0 volumetric heating

* 🎨 Convert SingleNullTokamak to a function

* 🏷️ Typing and general cleanup

* ♻️ Cleanup dimensions

* 🎨 Order functions

* ✨ Split of Neutroics pre cell csg and openmc running (#3243)

* 🎨 Neutronics PreCell / openmc separation

* 🚚 Move stuff about

* 🎨 Reduce surface that requires openmc

* 🚚 Move materials about

* 🎨 Initial material rearrangement

* 🌐 More internationalisation

* ♻️ Neutronics material movement

* 🎨 More materials stuff

* ♻️ Cleanup

* 🎨 Materials cleanup

* Neutronics EUDEMO integration (#3239)

* inital go

* Saving

* hard part done

* pass vals to Solver

* Updated WireInfoList so it doesn't use horrible mixed types.

* expected div wire

* Fixed the issue of 'sometimes misordering wires', and used recursion to shorted the break_wire_into_convex_chunks method for better readability with no loss in speed.

* 🚧 Tmp get it working

* Fixed the .reverse() method, which didn't flip the sign of the tangent.

* Improved plotting in plot_2d and plot_surfaces (mainly used for debugging)

* 🐛 Fix inner panel point

* 🔥 Reduce interface

* ♻️ More cleanup

* 🎨 More cleanup

* 🎨 Remove while loop from break wire into convex chunks

* 🎨 Reduce interface

* 🎨 More cleanup

* 🔥 Remove readme

* 🐛 Typing and divertor start point fix

* 🎨 Fix extra error and cleanup some reactor mechanics

* 🎨 Improve file save location

* 🎨 Only pass in ivcshapes not divertor

* 🎨 Feed in correct blanket cut point

* 🎨 Cleanup runmode

* Fixed leaking plasma void.

* 🎨 Cleanup inputs

* Added the the half_bounding_box function to get the minimum positive r.

* 🔥 Remove old data files

* ♻️ Run through cleanup

* Fixed the final overlap issue at the bottom of the divertor

* 🚚 Move some geometry functions to geometry

* 🐛 Fix tfcoil size

* 🐛 Fix blanket test

* 🚨 Linter fix

* 🚚 Move some things about

* 🚚 Move openmc to codes

* 🎨 Isolate eudemo from openmc

* 🚚 Move neutronics under radiation_transport

* Added volume tag

* Added checks to ensure convexity.

* Forced the pair of first and last pre-cells in the blanket to mate with the first and last pre-cell pair of divertor.

* Fixed the convexity proble; but a different issue arose: floating point precision of the exterior points are all wrong.

* Removed debug statement

* Added tolerances back in

* Floating point precision issue FIXEDgit add make_pre_cell.py openmc/make_csg.py  Now we can use tighter tolerances.

* 🔥 Remove old examples

* integrated rad shield into the neutronics run

* move set_volumes to CellStage

---------

Co-authored-by: ocean <OceanWongUK@gmail.com>
Co-authored-by: james <james.cook1@ukaea.uk>

* 🎨 Radiation shield initial material

* 📝 Remove neutronics example reference

* 📝 Add notice for use and update environment

* Improve tallies (#3275)

* 🎨 Allow custom filter for tallies

* 🐛 Fix tally function for eudemo run

* 🐛 Fix remove reindex to avoid nans

* Changed tallies to get the required data (need to multiply by appropriate constants in output.py to finish the job)

* minor bug fix (missed a variable)

* 🐛 Fix filter creation

* 🐛 Fix output for temporary output

---------

Co-authored-by: ocean <OceanWongUK@gmail.com>

* ⬆️ Upgrade openmc

---------

Co-authored-by: Ocean <OceanWongUK@gmail.com>
Co-authored-by: jamesnha <92076761+jamesnha@users.noreply.github.com>
Co-authored-by: Oliver Funk <oli.funk@gmail.com>
Co-authored-by: Oliver Funk <oliverfunk@users.noreply.github.com>
@je-cook je-cook added the neutronics Tasks relating to the neutronics module label May 31, 2024
OceanNuclear added a commit that referenced this pull request Jun 17, 2024
* 2D Neutronics module  (#2344)

* Initial commit to repository

* Create basic README.md

* Editing README.md

* Code styling: Black, isort and whitespace/trailing new lines (#1)

* blacken and isort

* whitespace and new lines

* Rearrage and refactor (#2)

* Adding plasma source, DCLL and WCLL. Material defintions and geometries still need tweaking.

* Changing from toroidal first wall profile to match points and adding extra source geometry plots.

* Adding source code for parametric plasma source

* Adjusting point too close to plasma.

* Minor format tidy up. Moving function.

* Passing geometry_variables to get_fw_points

* Update make_materials.py

Changing tungsten isotopes and tidying export_materials()

* Update make_materials.py

W isotopes corrected.

* Made most of it OOP, especially the summary, so that the data can be recalled.

* Added vscode into gitignore

* Finished reformatting the Summary object so now it prints the entire run properly. Not documented yet, and kwargs not passed on yet.

* Finished some reformatting. Todo list is at the top.

* Some work done on load_fw_points, but incomplete. TODO list updated.

* Added some documentations, but found a lot of magic numbers and 'things that don't belong in this module'. I'll deal with them later.

* Changed the ordering and naming of the arguments to make_geometry in make_geometry.py, and added some docstring.

* Fxied the types of Blankets available using BlanketType in make_materials.py.

* Fixed the naming for cells in quick_tbr_heating.py - renamed them to cells_and_cell_lists

* Updated the todo list

* Cleaned up create_tallies, and in the process, created MaterialsLibrary in make_materials.py so that it becomes modular enough for testing.

* Formatted the 'print_df' booleans away into a decorator - can change into printing to bluemira log later.

* Added documentations to the rest of the important classes.

* Updated todo list

* one line change to make pandas print more prettily, before merge commit

* moved all relevant files into the neutronics directory.

* Moved files from the 2d-neutronics repo to here.

* restored comment style fix

* moved the neutronics files to the correct directory.

* changed the import relative path

* relocated files to the correct directory

* changed the import path

* minor changes before complete overhaul (the latter is for adhering to bluemira code style)

* moved some constants to constants.py

* Finished one task: placed the relevant constants and conversion units into constants.py

* updated to-do list

* Further broke down the make_materials.py file into materials_definition.py file

* Refactored all of materials.

* updated .gitignore

* Moved the results formatting functions to a separate file

* removed unused file

* Improved styling

* Broke functions down into appropriate modules

* Split into appropriate modules

* Added typing information

* Updated the import diagram to reflect the import relationships between modules.

* Fixed all fixable formatting issues according to flake8

* Fixed all flake8 messages!

* installs script

* cleaned up script

* added complete apt install deps

* Updated install script, removed pps_api

* Updated to-do list, improved result presentation workflow

* .npy requires conversion to BluemiraWire

* ➕ Use ninja and install libopenmpi-dev

* ➕ Add openmc to conda

* ✨ Start using wire as input

* 🚨 Some ruff fixes

* 🎨 Move ifmain to example

* 🚚 Move npy

* 🎨 Fix example

* 🎨 Get constants from base

* 🎨 Fix imports

* 🚨 Some ruff fixes

* added openmc version to install script, added pps-isotropic package import to quick tbr

* removed my path from config

* 🎨 Cleanup printing

* 🎨 Unit fix

* 🎨 Unit fix2

* 🎨 Unit fix3

* 🎨 Use openmc enum

* Preparing for unit changes

* quick commit before rebase, units half-done

* 🙈 Remove noise

* 🔥 Remove so file

* Removed the not-sensible default constants and placed thme into neutronics.ex.py instead.

* Added TODO comment

* 🎨 Cell filter cleanup

* 🎨 Cleanup tallies

* Changed all units

* minor fix of import statement

* Monkey patched successfully

* monkeypatched successfully, and separated plasma geometry variables from tokamak geometry variables. This is the commit BEFORE applying the DataclassUnitConverter pattern.

* Minor update to add comments.

* Removed the duplicate codes inside params.py. This is the commit AFTER applying the DataclassUnitConverter pattern.

* Bug fix - missing 'self,' argument fixed.

* Updated todos

* 🎨 Change raw_uc percent use and runtime var

* 🚧 Make geometry dataclass refactor

* 🚧 Slight cleanup of params

* 🚨 Ignores

* 📝 Docs

* 📝 Fixes and docs

* 📝 Fix documentation build

* Update neutronics.ex.py

* Update pyproject.toml

* 🐛 Fix volume calculation

* 🎨 Cleanup vol calc

* 🚨 Fix black

* 🎨 Small fixes

* 🚚 Move quick tbr to neutronics_axisymmetric

* 🎨 Add stochastic volume to output results

* Added comments on why only two quantities are excluded in the conversion

* pps-isotropic's API changed, making appropriate changes here to maintain usability

* Added markdown docs on neutronics.ex.py

* 💩 Hack for old version of openmc

* 👥 Add contributors

---------

Co-authored-by: jamesnha <92076761+jamesnha@users.noreply.github.com>
Co-authored-by: je-cook <81617086+je-cook@users.noreply.github.com>
Co-authored-by: Oliver Funk <oli.funk@gmail.com>

* ✨ OpenMC data downloader (#2618)

* ✨ OpenMC data downloader

* 🎨 Parse known args

* 🎨 Ifmain

* 🎨 Rename file

* 🎨 Write them all then delete all

* 🐛 Overindent

* 🚨 Cleanup and linting

* 🐛 No output

* 🐛 Fix neutronics json location

* 🐛 Hack to force data into a given directory

* 🎨 Spelling

* 🏷️ Typing fix

* 🚨 Ruff fixes

* 🙈 Add to gitignore

* Minor error fixes to the outputted tables (#2689)

* Fixed unit conversion error in photon heat flux; and turned off Bremsstrahlung heating by default

* Undo accidental indent

* Kept all statepoint files' units as openmc as cgs, so that the conversion to SI is done purely in python. Fixed misinterpretation of photon flux.

* added comments to explain tally score choice.

* Minor bug fix to pass code quality checks

* 🚨 Ruff fixes

* first move to BM materials, lots of refactoring needed but the example runs

* 🎨 Basic cleanup

* 🎨 Dataclassify

* 🐛 Undo Be12Ti density change

* 💡 Minor fixes

* 📄 Copyright fixes after rebase

* ✨ Allow '*' to extract all XS data

* ⬆️ Openmc 0.13.3

* temperature docstring.

* removed rounding

* calculate the DT energy more accurately using plasma physics.

* Simplified code to use n_DT_reactions instead.

* 1. extracted (major_r, minor_r, elong, triang) into a different class than TokamakGeometry, and named this class PlasmaGeometry. 2. Removed the 'CGS' and 'PPS' from the 3 classes in params.py, and instead appended their baseclasses with 'Base', so that it becomes clearer that these dataclasses store SI units unless the .csg or .plasma_physics_units property is accessed.

* (minor bug fix)

* Updated the Shafranov shift description.

* 🚨 Fix linter

* Minor updates to docstrings

* 🚨 Ruff & python3.10 fixes

* Increase CSG speed without compromising on flexibility (#3079)

* :Changed params.py according to Matti's suggestion

* Made temporary script

* Added json data to be loaded as test case bluemirawires

* Added post_init checks.

* Created basic script to translate from existing dataclass TokamakGeometry (make_csg)

* WIP: making pre-cell.

* WIP: making pre-cell.

* Bodging serializing issue - fix later.

* Deleted failed files.

* Test script in attempt to replace the magic numbers/magic procedure to something more generalizable

* quick commit

* Script to load the divertor.

* Added capability to automatically slice up the blanket according to the first wall panels

* Updated script for creating neutronics csg

* extended the functionality of signed distance to check points as well.

* Added function based on signed_distance to check for overlaps.

* Add tolerance to account for low sampling rate/ float errors.

* Adding module to optimally slice the neutronics model.

* Updated module that chooses better surfaces for faster neutronics runs.

* Made the volume optimization converge.

* Made a better approximation of the reactor. Added tools necessary to make such approximation

* Added better documentations. Formatting.

* Made a very rigorous structure to create openmc.Cells.

* removed unused code

* Updated test case

* Half-working state

* Finally finished the blanket bug fix.

* Updated docstrings

* Updated equations

* Updated comment

* Interited from collections.abc.Sequence to avoid having to make def __iter__().

* Cleaned up excess code

* minor changes to naming and docstring

* Updated the run modes into context managers.

* Enforced self.setup() to be ran before self.run() in the contextmanagers.

* Added ability to slice divertor wire

* Variable renaming

* Removed redundant checks

* Improved typing (Iterables vs Sequence), and added classes to prepare for tallying.

* Added tallying functionality

* Developing divertor cells automatic conversion into pre-cells...

* Added type hints for return types.

* Fixed import

* Successfully exported into DivertorPreCellArray.

* Updated script correspondingly

* split up WireInfo etc. into its own file.

* Made make_divertor_pre_cell_array more robust (able to straighten out the cell walls better before passing onto DivertorPreCell).

* Typing and docstring improvement

* Added function to flip a direction vector if it is pointing the wrong way; Moved plane functionalities to geometry/plane.py

* Removed plane creation functionality (migrated to bluemira.geometry.plane)

* Minor change to type hinting in make_csg.py

* Minor changes to type hints in radial_wall.py

* Slight change to variable name

* Added plan to make the divertor slicing more robust.

* Moved the warning to an appropriate place

* Improved the interior_wire_offset method

* Fixed minor mistake in direction

* Working version: produces pre-cell arrays for both divertor and blanket

* Pointed the chord in the correct direction again

* Removed unused data loading files.

* Improved file structure so each class has separate responsibility. Surfaces that aren't shared among different BlanketCell stacks won't be created in BlanketCellArray.

* Minor bug fixes related to types and WireInfo

* Moved constants into constants.py

* Docstring updates

* Simplified boolean expression; made plasma cell.

* Deleted unused statement.

* updated test script to plot better.

* Named file more sensibly.

* Fixed some ID control issues

* docstring rearrangement

* Fixed up the get_all_hollow_merged_cells method so the test script won't have to write something as long to plot the overall-cells.

* Fixed the thickness issue - now instead we have absolute thickness.

* Got as far as getting some segfaults out of openmc.

* Finally working. Tallies need fixing

* Fixed floating point issue

* Added missing conversion function

* Changed thickness.

* Modified to allow for a variable number of batches.

* Delete some of the obsolete classes

* Updated TODO tags in test script.

* Updated TODOs

* Added missing method back in

* Updated documentations slightly to make it more readable.

* Updated docstring to conform usage of anti- vs counter-

* Ensured backward (neutronics.ex.py) compatibility

* Calculated volumes without relying on openmc.

* Added function to support volume calculation of the openmc.Cell's .volumes.

* Optimized volume calculation (commented them out where they're not needed)

* Working version.

* Added TODO on reducing the number of negated regions.

* ruff fixes

* Some updates to how surfaces are get

* fixed ONE TODO tag.

* Updated zip strict = True almost everywhere, pairwise where applicable.

* Cleaned up code slightly at make_csg

* We can now control the thickness of the central solenoid from parameter frame directly.

* Attempting to use vacuum vessel wire as well.

* Further attempt at incorporating the vacuum vessel interior curve into the pre-cells

* VV now successfully sandwhiched between the two curvesgit add .

* Minor formatting updates

* Finished porting over the materials library

* Cleaned out all low-lying fruit TODO tags

* Made note about convexity.

* Neutronics Solver interface (#3231)

* 🚧 OpenMC designer

* 🚧 Working designer

* ✨ Openmc solver

* ✨ Fixup from upstream

* 🚚 Move stuff

* Neutronics old code removal and architectural adjustments (#3232)

* 🌐 Bye Z

* ♻️ Initial cleanup

* ♻️ More cleanup

* ♻️ More cleanup

* ♻️ More cleanup

* 🔥 Destroying Vertices pt1

* 🔥 Destroying Vertices pt2

* ♻️ More cleanup

* 🔥 Remove Sequence inheritance

* 🎨 Types

* 🚨 Remove ruff ignores

* ♻️ More cleanup

* ♻️ Remove global hangar variable

* ♻️ More cleanup

* ♻️ More cleanup

* 🚨 More cleanup

* 📝 Docs cleanup

* 📝 Docs cleanup

* 🐛 Fix double counting of divertor material

* 🐛 Fix 0 volumetric heating

* 🎨 Convert SingleNullTokamak to a function

* 🏷️ Typing and general cleanup

* ♻️ Cleanup dimensions

* 🎨 Order functions

* ✨ Split of Neutroics pre cell csg and openmc running (#3243)

* 🎨 Neutronics PreCell / openmc separation

* 🚚 Move stuff about

* 🎨 Reduce surface that requires openmc

* 🚚 Move materials about

* 🎨 Initial material rearrangement

* 🌐 More internationalisation

* ♻️ Neutronics material movement

* 🎨 More materials stuff

* ♻️ Cleanup

* 🎨 Materials cleanup

* Neutronics EUDEMO integration (#3239)

* inital go

* Saving

* hard part done

* pass vals to Solver

* Updated WireInfoList so it doesn't use horrible mixed types.

* expected div wire

* Fixed the issue of 'sometimes misordering wires', and used recursion to shorted the break_wire_into_convex_chunks method for better readability with no loss in speed.

* 🚧 Tmp get it working

* Fixed the .reverse() method, which didn't flip the sign of the tangent.

* Improved plotting in plot_2d and plot_surfaces (mainly used for debugging)

* 🐛 Fix inner panel point

* 🔥 Reduce interface

* ♻️ More cleanup

* 🎨 More cleanup

* 🎨 Remove while loop from break wire into convex chunks

* 🎨 Reduce interface

* 🎨 More cleanup

* 🔥 Remove readme

* 🐛 Typing and divertor start point fix

* 🎨 Fix extra error and cleanup some reactor mechanics

* 🎨 Improve file save location

* 🎨 Only pass in ivcshapes not divertor

* 🎨 Feed in correct blanket cut point

* 🎨 Cleanup runmode

* Fixed leaking plasma void.

* 🎨 Cleanup inputs

* Added the the half_bounding_box function to get the minimum positive r.

* 🔥 Remove old data files

* ♻️ Run through cleanup

* Fixed the final overlap issue at the bottom of the divertor

* 🚚 Move some geometry functions to geometry

* 🐛 Fix tfcoil size

* 🐛 Fix blanket test

* 🚨 Linter fix

* 🚚 Move some things about

* 🚚 Move openmc to codes

* 🎨 Isolate eudemo from openmc

* 🚚 Move neutronics under radiation_transport

* Added volume tag

* Added checks to ensure convexity.

* Forced the pair of first and last pre-cells in the blanket to mate with the first and last pre-cell pair of divertor.

* Fixed the convexity proble; but a different issue arose: floating point precision of the exterior points are all wrong.

* Removed debug statement

* Added tolerances back in

* Floating point precision issue FIXEDgit add make_pre_cell.py openmc/make_csg.py  Now we can use tighter tolerances.

* 🔥 Remove old examples

* integrated rad shield into the neutronics run

* move set_volumes to CellStage

---------

Co-authored-by: ocean <OceanWongUK@gmail.com>
Co-authored-by: james <james.cook1@ukaea.uk>

* 🎨 Radiation shield initial material

* 📝 Remove neutronics example reference

* 📝 Add notice for use and update environment

* Improve tallies (#3275)

* 🎨 Allow custom filter for tallies

* 🐛 Fix tally function for eudemo run

* 🐛 Fix remove reindex to avoid nans

* Changed tallies to get the required data (need to multiply by appropriate constants in output.py to finish the job)

* minor bug fix (missed a variable)

* 🐛 Fix filter creation

* 🐛 Fix output for temporary output

---------

Co-authored-by: ocean <OceanWongUK@gmail.com>

* ⬆️ Upgrade openmc

---------

Co-authored-by: Ocean <OceanWongUK@gmail.com>
Co-authored-by: jamesnha <92076761+jamesnha@users.noreply.github.com>
Co-authored-by: Oliver Funk <oli.funk@gmail.com>
Co-authored-by: Oliver Funk <oliverfunk@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
neutronics Tasks relating to the neutronics module
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant