Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
f85c4a2
example correlation
RemDelaporteMathurin Apr 3, 2026
59797b3
removed correlation dict
RemDelaporteMathurin Apr 3, 2026
63ad812
removed example fiel
RemDelaporteMathurin Apr 3, 2026
948ffce
good progress!
RemDelaporteMathurin Apr 3, 2026
6c68a4e
fixed units
RemDelaporteMathurin Apr 3, 2026
0649414
"working" version
RemDelaporteMathurin Apr 6, 2026
9ec7856
removed old function
RemDelaporteMathurin Apr 6, 2026
48e0778
removed resolve
RemDelaporteMathurin Apr 6, 2026
3008b96
source_T from tbr, flow_g_vol from flow_g_mol, more realistic input
hmonroedd Apr 6, 2026
96c8a2a
to solve: use correlation.__call__
hmonroedd Apr 6, 2026
00607bb
more realistic input
hmonroedd Apr 7, 2026
7957b4d
avoid bug in pint.Quantity.check with "dimensionless", check output u…
hmonroedd Apr 7, 2026
ca16d0f
remove print
hmonroedd Apr 7, 2026
535be29
simplify from_parameters(), break down graph search algo in several f…
hmonroedd Apr 7, 2026
25b7a67
working input corresponding to Libra Pi
hmonroedd Apr 7, 2026
4ba8521
fixed Re and added nu_l correlation
hmonroedd Apr 7, 2026
7fa5658
working
hmonroedd Apr 7, 2026
83d4424
check all_correlations contains wanted correlation before fetching it
hmonroedd Apr 7, 2026
ab45b81
removed unnecessary code/imports
hmonroedd Apr 7, 2026
b6e2890
added __str__ to SimulationInput
hmonroedd Apr 7, 2026
861d590
use logger instead of VERBOSE, removed unnecessary code/imports
hmonroedd Apr 7, 2026
71fe9ed
test for graph search algo (uses inputs.find_in_graph(), input.check_…
hmonroedd Apr 7, 2026
9892f83
added .log files used in tests, commented broken tests
hmonroedd Apr 7, 2026
4224d50
tmp_path + remove log from vc
hmonroedd Apr 7, 2026
034f2f2
simplifiy test
hmonroedd Apr 7, 2026
6a05d71
added test
hmonroedd Apr 7, 2026
fa46fa6
Merge branch 'refactoring' of https://github.com/LIBRA-project/libra_…
hmonroedd Apr 7, 2026
b70a25b
added coverage
hmonroedd Apr 7, 2026
7580d32
added tests for inputs.check_input() and input.find_in_graph()
hmonroedd Apr 7, 2026
3ef61e2
returns in graph search algo are less condusing
hmonroedd Apr 7, 2026
48e11d5
made flow_g_mol and P_top mandatory quantities and fixed tests
hmonroedd Apr 7, 2026
60543ab
fixed circular dependency of flow_g_mol and flow_g_vol + adapted tests
hmonroedd Apr 7, 2026
30111ea
removed unused code
hmonroedd Apr 7, 2026
10867c6
tests for model.solve() and exclude animation.py from coverage
hmonroedd Apr 7, 2026
9e0ed4f
test building whole SimulationInput using from_parameters()
hmonroedd Apr 7, 2026
da8e654
test successful exports to yaml, json and csv
hmonroedd Apr 7, 2026
2ef1d31
made specifying input_units mandatory + tests for Correlation and Cor…
hmonroedd Apr 8, 2026
3aa8cbf
create Simulation object + adapted tests
hmonroedd Apr 8, 2026
ba31a4e
use @pytest.fixture to avoid modifications propagating to different t…
hmonroedd Apr 8, 2026
921d95e
can specify profile for source term
hmonroedd Apr 8, 2026
cab6436
added to_json() method to SimulationInput to be able to compare built…
hmonroedd Apr 8, 2026
01ed676
added to vc needed .json (for tests) + delete unused file
hmonroedd Apr 8, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@ jobs:
- name: Run tests
shell: bash -l {0}
run: |
python -m pytest test
python -m pytest test --cov src/sparging --cov-report xml

# - name: Upload to codecov
# uses: codecov/codecov-action@v4
# with:
# token: ${{ secrets.CODECOV_TOKEN }}
# files: ./coverage.xml
- name: Upload to codecov
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./coverage.xml
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ cover/
*.pot

# Django stuff:
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal
Expand Down Expand Up @@ -211,5 +210,6 @@ __marimo__/
*.csv
mwe.py
*.json
!standard_input.json
*.ipynb
*.code-workspace
77 changes: 77 additions & 0 deletions example2.py
Copy link
Copy Markdown
Member Author

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

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)
41 changes: 0 additions & 41 deletions main.py

This file was deleted.

6 changes: 6 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -50,3 +50,9 @@ addopts = "-v"

[tool.setuptools.package-data]
sparging = ["*.yaml", "*.yml"]

[tool.coverage.run]
source = ["src/sparging"]
omit = [
"src/sparging/animation.py"
]
6 changes: 2 additions & 4 deletions src/sparging/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,10 @@
libra_sparging: A finite element model for sparging processes using FEniCSx/DOLFINX.
"""

from .config import ureg, const_R, const_g, VERBOSE
from .config import ureg, const_R, const_g
from .model import SimulationResults
from .animation import ConcentrationAnimator
from .helpers import *
from .correlations import *
from .correlations import all_correlations, CorrelationGroup, Correlation

__all__ = [
"SimulationInput",
Expand All @@ -15,5 +14,4 @@
"ureg",
"const_R",
"const_g",
"VERBOSE",
]
2 changes: 0 additions & 2 deletions src/sparging/config.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
from pint import UnitRegistry
import scipy.constants as const

VERBOSE = False

ureg = UnitRegistry(
autoconvert_offset_to_baseunit=True
) # to deal with offset units (eg: degree celsius)
Expand Down
Loading
Loading