-
Notifications
You must be signed in to change notification settings - Fork 1
Refactoring #7
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
Draft
RemDelaporteMathurin
wants to merge
42
commits into
main
Choose a base branch
from
refactoring
base: main
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.
Draft
Refactoring #7
Changes from all commits
Commits
Show all changes
42 commits
Select commit
Hold shift + click to select a range
f85c4a2
example correlation
RemDelaporteMathurin 59797b3
removed correlation dict
RemDelaporteMathurin 63ad812
removed example fiel
RemDelaporteMathurin 948ffce
good progress!
RemDelaporteMathurin 6c68a4e
fixed units
RemDelaporteMathurin 0649414
"working" version
RemDelaporteMathurin 9ec7856
removed old function
RemDelaporteMathurin 48e0778
removed resolve
RemDelaporteMathurin 3008b96
source_T from tbr, flow_g_vol from flow_g_mol, more realistic input
hmonroedd 96c8a2a
to solve: use correlation.__call__
hmonroedd 00607bb
more realistic input
hmonroedd 7957b4d
avoid bug in pint.Quantity.check with "dimensionless", check output u…
hmonroedd ca16d0f
remove print
hmonroedd 535be29
simplify from_parameters(), break down graph search algo in several f…
hmonroedd 25b7a67
working input corresponding to Libra Pi
hmonroedd 4ba8521
fixed Re and added nu_l correlation
hmonroedd 7fa5658
working
hmonroedd 83d4424
check all_correlations contains wanted correlation before fetching it
hmonroedd ab45b81
removed unnecessary code/imports
hmonroedd b6e2890
added __str__ to SimulationInput
hmonroedd 861d590
use logger instead of VERBOSE, removed unnecessary code/imports
hmonroedd 71fe9ed
test for graph search algo (uses inputs.find_in_graph(), input.check_…
hmonroedd 9892f83
added .log files used in tests, commented broken tests
hmonroedd 4224d50
tmp_path + remove log from vc
hmonroedd 034f2f2
simplifiy test
hmonroedd 6a05d71
added test
hmonroedd fa46fa6
Merge branch 'refactoring' of https://github.com/LIBRA-project/libra_…
hmonroedd b70a25b
added coverage
hmonroedd 7580d32
added tests for inputs.check_input() and input.find_in_graph()
hmonroedd 3ef61e2
returns in graph search algo are less condusing
hmonroedd 48e11d5
made flow_g_mol and P_top mandatory quantities and fixed tests
hmonroedd 60543ab
fixed circular dependency of flow_g_mol and flow_g_vol + adapted tests
hmonroedd 30111ea
removed unused code
hmonroedd 10867c6
tests for model.solve() and exclude animation.py from coverage
hmonroedd 9e0ed4f
test building whole SimulationInput using from_parameters()
hmonroedd da8e654
test successful exports to yaml, json and csv
hmonroedd 2ef1d31
made specifying input_units mandatory + tests for Correlation and Cor…
hmonroedd 3aa8cbf
create Simulation object + adapted tests
hmonroedd ba31a4e
use @pytest.fixture to avoid modifications propagating to different t…
hmonroedd 921d95e
can specify profile for source term
hmonroedd cab6436
added to_json() method to SimulationInput to be able to compare built…
hmonroedd 01ed676
added to vc needed .json (for tests) + delete unused file
hmonroedd File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,77 @@ | ||
| from sparging.config import ureg | ||
| from sparging import all_correlations | ||
| from sparging import animation | ||
| from sparging.model import Simulation | ||
| from sparging.inputs import ( | ||
| ColumnGeometry, | ||
| BreederMaterial, | ||
| OperatingParameters, | ||
| SpargingParameters, | ||
| SimulationInput, | ||
| ) | ||
| import logging | ||
| from typing import TYPE_CHECKING | ||
|
|
||
| if TYPE_CHECKING: | ||
| import pint | ||
|
|
||
| logger = logging.getLogger(__name__) | ||
| logging.basicConfig(level=logging.WARNING) | ||
|
|
||
|
|
||
| geom = ColumnGeometry( | ||
| area=0.2 * ureg.m**2, | ||
| height=1.0 * ureg.m, | ||
| nozzle_diameter=0.001 * ureg.m, | ||
| nb_nozzle=10 * ureg.dimensionless, | ||
| ) | ||
|
|
||
| flibe = BreederMaterial( | ||
| name="FLiBe", | ||
| ) | ||
|
|
||
| operating_params = OperatingParameters( | ||
| temperature=600 * ureg.celsius, | ||
| P_top=1 * ureg.atm, | ||
| flow_g_mol=400 * ureg.sccm, | ||
| tbr=0.1 * ureg("triton / neutron"), | ||
| n_gen_rate=1e9 * ureg("neutron / s"), | ||
| ) | ||
|
|
||
| sparging_params = SpargingParameters( | ||
| h_l=all_correlations("h_l_briggs"), | ||
| ) | ||
|
|
||
|
|
||
| # class method from_parameters that takes in objects like ColumnGeometry, BreederMaterial, OperatingParameters and returns a SimulationInput object with the appropriate correlations for the given parameters. This method should be able to handle cases where some of the parameters are already provided as correlations and should not overwrite them. | ||
| my_input = SimulationInput.from_parameters( | ||
| geom, flibe, operating_params, sparging_params | ||
| ) | ||
| logger.info(my_input) | ||
|
|
||
|
|
||
| def profile_source_T(z: pint.Quantity): | ||
| import numpy as np | ||
|
|
||
| # return np.sin(np.pi / (1 * ureg.m) * z) | ||
| return 0.5 * (1 + np.cos(0.5 * np.pi / (1 * ureg.m) * z)) | ||
|
|
||
|
|
||
| my_simulation = Simulation( | ||
| my_input, | ||
| t_final=3 * ureg.days, | ||
| signal_irr=lambda t: 1 if t < 12 * ureg.hour else 0, | ||
| signal_sparging=lambda t: 1, | ||
| profile_source_T=profile_source_T, | ||
| ) | ||
| output = my_simulation.solve() | ||
|
|
||
| # # save output to file | ||
| # output.profiles_to_csv(f"output_{tank_height}m.csv") | ||
|
|
||
| # # plot results | ||
| # from sparging import plotting | ||
| # plotting.plot_animation(output) | ||
|
|
||
|
|
||
| animation.create_animation(output, show_activity=True) |
This file was deleted.
Oops, something went wrong.
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we should maybe move this file to an example folder and add it to the CI