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

[restructure/plasma] Cleanup plasma assembly #2748

Merged
Merged
Show file tree
Hide file tree
Changes from 112 commits
Commits
Show all changes
115 commits
Select commit Hold shift + click to select a range
d583510
change numberdensity to input
wkerzendorf Apr 30, 2024
7aaba5d
fixed number density
wkerzendorf May 4, 2024
32b22ea
some fixes
wkerzendorf May 5, 2024
261bbad
removing density
wkerzendorf May 6, 2024
df3c406
remove atomic and isotope mass
wkerzendorf May 6, 2024
d05e819
add isotopic_number_density
wkerzendorf May 6, 2024
61f3db5
Merge remote-tracking branch 'upstream/master' into restructure/plasm…
wkerzendorf May 6, 2024
e804942
add opacities package
wkerzendorf May 6, 2024
e573f16
Update imports in property_collections.py, base.py, test_numba_interf…
wkerzendorf May 7, 2024
73f2ddc
Add calculate_transition_probabilities function to util.py in macro_a…
wkerzendorf May 7, 2024
52d5523
Add calculate_transition_probabilities function to util.py in macro_a…
wkerzendorf May 9, 2024
9530fee
Remove unused imports and update plasma properties
wkerzendorf May 9, 2024
2fb7f92
add __init__ to macroatom
wkerzendorf May 9, 2024
6ac3e88
blackify tardis
wkerzendorf May 10, 2024
801c92b
blackified
wkerzendorf May 10, 2024
ae0650d
chore: Update imports and remove unused code
wkerzendorf May 10, 2024
69dc1b5
chore: Add PlanckRadiationField and DilutePlanckRadiationField classes
wkerzendorf May 10, 2024
448d5c4
chore: Update imports and remove unused code
wkerzendorf May 10, 2024
c1dc52d
removed density
wkerzendorf May 13, 2024
f053967
Merge remote-tracking branch 'upstream/master' into restructure/plasm…
wkerzendorf May 20, 2024
17c033c
Merge branch 'restructure/plasma_prepare' into restructure/plasma_opa…
wkerzendorf May 23, 2024
5e02054
ruff output
wkerzendorf Jun 6, 2024
28c4348
cleanup and adding object mode
wkerzendorf Jun 6, 2024
cfffe5b
starting to make radiation_field a thing
wkerzendorf Jun 7, 2024
4e68723
Merge remote-tracking branch 'upstream/master' into restructure/plasm…
wkerzendorf Jun 7, 2024
41779e2
switched over to old tau_sobolev calculation
wkerzendorf Jun 9, 2024
0d1bc4d
renamed function to indicate numba use
wkerzendorf Jun 9, 2024
7cc84a2
Merge branch 'restructure/plasma_opacities' into restructure/plasma_r…
wkerzendorf Jun 9, 2024
c924749
address comments
wkerzendorf Jun 10, 2024
ad5a314
Merge branch 'restructure/plasma_opacities' into restructure/plasma_r…
wkerzendorf Jun 10, 2024
af7e39e
added dilute planckian radiation field
wkerzendorf Jun 11, 2024
36fa4b6
refactor: Convert species lists to proper format in assemble_plasma f…
wkerzendorf Jun 13, 2024
4bc0dd7
moved radiation field into plasma. Resulting in some renames
wkerzendorf Jun 14, 2024
863f281
Merge remote-tracking branch 'upstream/master' into restructure/plasm…
wkerzendorf Jun 19, 2024
2f042f2
some fixes
wkerzendorf Jun 19, 2024
d849f85
black montecarlo
wkerzendorf Jun 19, 2024
3379062
Merge remote-tracking branch 'upstream/master' into restructure/plasm…
wkerzendorf Jun 19, 2024
6feefbe
Merge branch 'restructure/plasma_opacities' into restructure/plasma_r…
wkerzendorf Jun 19, 2024
1786436
chore: Initialize atom data and simulation state in `initialization.py`
wkerzendorf Jun 19, 2024
5740708
updating the documentation
wkerzendorf Jun 19, 2024
92f4e90
feat: Add EstimatedRadiationFieldProperties class for Monte Carlo est…
wkerzendorf Jun 20, 2024
e3f1819
trying to get rid of j_blues in plasma with MC restructure
wkerzendorf Jun 21, 2024
a99fbb8
completely restructure j_blues. Estimators and all.
wkerzendorf Jun 22, 2024
2d7e1c5
cleanup for the restructure
wkerzendorf Jun 22, 2024
63e0e0c
Merge remote-tracking branch 'upstream/master' into restructure/plasm…
wkerzendorf Jul 23, 2024
818c6d4
remove parse_input.py
wkerzendorf Jul 23, 2024
3ec64f1
chore: Refactor radiation field configuration parsing and state creation
wkerzendorf Jul 23, 2024
f1f0cdd
revert astropy_helpers
wkerzendorf Jul 23, 2024
2a7d460
remove astropy_helpers
wkerzendorf Jul 23, 2024
dbc34ac
removed test.txt
wkerzendorf Jul 23, 2024
251d1cb
blackified code
wkerzendorf Jul 23, 2024
e80b15c
Merge branch 'restructure/plasma_radiation_field' into restructure/si…
wkerzendorf Jul 23, 2024
8581bed
Merge branch 'restructure/simulation_from_config_cleanup' into restru…
wkerzendorf Jul 23, 2024
d49a49c
cleanup simulation from merges
wkerzendorf Jul 23, 2024
adbaf7f
fix
wkerzendorf Jul 24, 2024
bb19fdb
remove unused Input
wkerzendorf Jul 24, 2024
aca1099
added description
wkerzendorf Jul 24, 2024
44ffcf9
Merge branch 'restructure/plasma_radiation_field' into restructure/si…
wkerzendorf Jul 24, 2024
54ffe68
blackiefied codebase
wkerzendorf Jul 24, 2024
71a2b13
Merge branch 'restructure/simulation_from_config_cleanup' into restru…
wkerzendorf Jul 24, 2024
2ea3122
cleanup of branch
wkerzendorf Jul 24, 2024
9800fc8
blackify code
wkerzendorf Jul 24, 2024
5914618
Merge branch 'restructure/plasma_radiation_field' into restructure/si…
wkerzendorf Jul 24, 2024
d19e423
chore: Refactor atom data parsing and simulation state initialization
wkerzendorf Jul 24, 2024
49b9819
Merge branch 'restructure/simulation_from_config_cleanup' into restru…
wkerzendorf Jul 24, 2024
b3bf356
restructure logger
wkerzendorf Jul 24, 2024
a22223e
Merge branch 'restructure/simulation_from_config_cleanup' into restru…
wkerzendorf Jul 24, 2024
734ffc8
working on continuum radfield properties
wkerzendorf Jul 24, 2024
d69533a
Refactor continuum processes module structure
wkerzendorf Jul 24, 2024
98f8340
Refactor opacities module structure
wkerzendorf Jul 24, 2024
84671ca
cleanup from restructure
wkerzendorf Jul 25, 2024
bf25313
Merge remote-tracking branch 'upstream/master' into restructure/base_…
wkerzendorf Jul 25, 2024
7782d07
cleanup
wkerzendorf Jul 25, 2024
cfc5078
clean up
wkerzendorf Jul 25, 2024
ee864bb
more cleanup
wkerzendorf Jul 25, 2024
ad4f1b1
Merge remote-tracking branch 'upstream/master' into restructure/base_…
wkerzendorf Jul 25, 2024
0ebcef8
cleanup standard_plasmas.py
wkerzendorf Jul 25, 2024
cf1396a
working nlte ionizations
wkerzendorf Jul 26, 2024
557dde9
Merge remote-tracking branch 'upstream/master' into restructure/base_…
wkerzendorf Jul 26, 2024
fcf2563
start of assemble plasma cleanup
wkerzendorf Jul 26, 2024
8324074
cleanup standard_plasmas.py
wkerzendorf Jul 26, 2024
60239f8
updated tests
wkerzendorf Jul 26, 2024
5e4902a
some more cleanup
wkerzendorf Jul 26, 2024
9f92256
fix benchmarks
wkerzendorf Jul 26, 2024
3c7ee67
cleanup assembly
wkerzendorf Jul 26, 2024
0890747
cleanup assembly
wkerzendorf Jul 26, 2024
cd1badc
Merge remote-tracking branch 'upstream/master' into restructure/base_…
wkerzendorf Jul 26, 2024
7540e55
working on the restructure
wkerzendorf Jul 26, 2024
bd04642
Merge remote-tracking branch 'upstream/master' into restructure/base_…
wkerzendorf Jul 26, 2024
e29ae22
slowly fixing the assembly module
wkerzendorf Jul 27, 2024
930462f
blackify
wkerzendorf Jul 27, 2024
9e47b81
reverse the import pygraphviz
wkerzendorf Jul 27, 2024
8d67db8
fix docstrings
wkerzendorf Jul 27, 2024
f6f3160
fixed all plasma
wkerzendorf Jul 27, 2024
7f1c301
slow fixes
wkerzendorf Jul 27, 2024
e05aeca
Refactor recomb_rate_coeff.py and test_continuum_property_solver.py
wkerzendorf Jul 27, 2024
efdb5b1
fixing assembly
wkerzendorf Jul 27, 2024
9078307
restructure the read in
wkerzendorf Jul 27, 2024
683e811
fixup plasma assemble to be clean
wkerzendorf Jul 27, 2024
d381f02
fix shell info widget
wkerzendorf Jul 27, 2024
fcce9e0
fix the widgets
wkerzendorf Jul 28, 2024
ac141ec
fixing hopefully last bugs
wkerzendorf Jul 28, 2024
01b4df7
slowly fix up assembly
wkerzendorf Jul 28, 2024
4ba4afb
working on getting the notebook running
wkerzendorf Jul 29, 2024
7d8e6e0
Refactor code to address comments
wkerzendorf Jul 29, 2024
03e1aae
Merge branch 'restructure/base_estimator_cleanup' into restructure/as…
wkerzendorf Jul 29, 2024
9f93d84
remove abundance
wkerzendorf Jul 30, 2024
b5839a6
Merge remote-tracking branch 'upstream/master' into restructure/assem…
wkerzendorf Jul 31, 2024
31bfec6
added pydantic
wkerzendorf Aug 6, 2024
88aff49
possible fix for test problem
wkerzendorf Aug 6, 2024
c4dec6f
Merge remote-tracking branch 'upstream/master' into restructure/assem…
wkerzendorf Aug 7, 2024
dcd157f
fix problem with opacity solver
wkerzendorf Aug 7, 2024
ed750c4
chore: Refactor plasma assembly base and notebook
wkerzendorf Aug 12, 2024
554fa7e
added docstrings
wkerzendorf Aug 12, 2024
573b5e5
Merge remote-tracking branch 'upstream/master' into restructure/assem…
wkerzendorf Aug 12, 2024
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
163 changes: 152 additions & 11 deletions docs/physics/plasma/construction_simple_plasma.ipynb
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this intended to be useful documentation? Not sure what "SCRUN MAGIC" is.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll remove it

Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"# Constructing a simple plasma"
"# Constructing a simple thermal plasma"
]
},
{
Expand All @@ -23,7 +23,7 @@
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "bbbd27367e48465696aa4e40f25b8496",
"model_id": "adc8142e04de4ac4ad9fb6d9eba83286",
"version_major": 2,
"version_minor": 0
},
Expand All @@ -37,7 +37,7 @@
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "6830a2c86f754397999e6801ccca1001",
"model_id": "36b88ed7168e46c8864e17b0107f8f71",
"version_major": 2,
"version_minor": 0
},
Expand All @@ -51,9 +51,20 @@
],
"source": [
"import numpy as np\n",
"import pandas as pd\n",
"from astropy import units as u\n",
"from tardis.radiation_field.planck_rad_field import DilutePlanckianRadiationField\n",
"#from tardis.plasma.properties.plasma_input import T"
"\n",
"from tardis.io.atom_data import AtomData\n",
"from tardis.plasma.assembly.base import PlasmaSolverFactory\n",
"from tardis.plasma.radiation_field import DilutePlanckianRadiationField\n",
"\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"In the default configuration the plasma solver assumes the conditions for a Local Thermodynamic Equilibrium meaning a planckian radiation field and a maxwellian electron velocity distribution at the same templerature"
]
},
{
Expand All @@ -62,8 +73,9 @@
"metadata": {},
"outputs": [],
"source": [
"temperatures_rad = np.ones(10) * 10000 * u.K\n",
"dilution_factor = np.ones(10) * 0.1"
"NO_OF_CELLS = 1000\n",
"temperatures_rad = np.ones(NO_OF_CELLS) * 10000 * u.K\n",
"dilution_factor = np.ones(NO_OF_CELLS) * 0.1"
]
},
{
Expand All @@ -77,12 +89,141 @@
},
{
"cell_type": "code",
"execution_count": 6,
"execution_count": 4,
"metadata": {},
"outputs": [],
"source": [
"base_density = 1e-15 * u.Unit('g/cm^3')\n",
"number_densities = pd.DataFrame(columns=range(NO_OF_CELLS), index=[1,26,28])\n",
"number_densities.values[:] = 0.5 * (base_density / u.u).to(1/u.cm**3).value\n"
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {},
"outputs": [],
"source": [
"test = DilutePlanckianRadFieldInput()\n",
"test.set_value(d_radfield)"
"atom_data = AtomData.from_hdf('kurucz_cd23_chianti_H_He.h5')\n",
"plasma_solver_factory = PlasmaSolverFactory(atom_data, selected_atomic_numbers=[1,26,28])\n",
"plasma_solver_factory.setup_factory()\n"
]
},
{
"cell_type": "code",
"execution_count": 7,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"SCRUN MAGIC\n"
]
},
{
"data": {
"text/html": [
"\n",
" <iframe\n",
" width=\"100%\"\n",
" height=\"400\"\n",
" src=\"http://localhost:8182\"\n",
" frameborder=\"0\"\n",
" allowfullscreen\n",
" \n",
" ></iframe>\n",
" "
],
"text/plain": [
"<IPython.lib.display.IFrame at 0x31e16f5c0>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": []
},
{
"cell_type": "code",
"execution_count": 36,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"<div>\n",
"<style scoped>\n",
" .dataframe tbody tr th:only-of-type {\n",
" vertical-align: middle;\n",
" }\n",
"\n",
" .dataframe tbody tr th {\n",
" vertical-align: top;\n",
" }\n",
"\n",
" .dataframe thead th {\n",
" text-align: right;\n",
" }\n",
"</style>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th></th>\n",
" <th>0</th>\n",
" </tr>\n",
" <tr>\n",
" <th>atomic_number</th>\n",
" <th>ion_number</th>\n",
" <th></th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th rowspan=\"2\" valign=\"top\">1</th>\n",
" <th>0</th>\n",
" <td>2.245918e-04</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1</th>\n",
" <td>3.011070e+08</td>\n",
" </tr>\n",
" <tr>\n",
" <th rowspan=\"3\" valign=\"top\">2</th>\n",
" <th>0</th>\n",
" <td>1.405189e-15</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1</th>\n",
" <td>2.206015e-03</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2</th>\n",
" <td>3.011070e+08</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" 0\n",
"atomic_number ion_number \n",
"1 0 2.245918e-04\n",
" 1 3.011070e+08\n",
"2 0 1.405189e-15\n",
" 1 2.206015e-03\n",
" 2 3.011070e+08"
]
},
"execution_count": 36,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"plasma_solver.ion_number_density"
]
},
{
Expand All @@ -107,7 +248,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.5"
"version": "3.12.4"
}
},
"nbformat": 4,
Expand Down
2 changes: 1 addition & 1 deletion tardis/io/configuration/tests/test_config_reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from astropy.units import Quantity
from tardis.io.configuration.config_reader import Configuration
from tardis.plasma.exceptions import PlasmaConfigError
from tardis.plasma.standard_plasmas import assemble_plasma
from tardis.plasma.assembly.legacy_assembly import assemble_plasma


def test_convergence_section_parser():
Expand Down
1 change: 1 addition & 0 deletions tardis/model/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ class SimulationState(HDFWriterMixin):
"density",
"r_inner",
"time_explosion",
"abundance",
]
hdf_name = "simulation_state"

Expand Down
4 changes: 3 additions & 1 deletion tardis/opacities/opacity_solver.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,9 @@ def solve(self, legacy_plasma) -> OpacityState:
legacy_plasma.atomic_data.lines.shape[
0
], # number of lines
legacy_plasma.abundance.shape[1], # number of shells
legacy_plasma.number_density.shape[
Rodot- marked this conversation as resolved.
Show resolved Hide resolved
1
], # number of shells
),
dtype=np.float64,
),
Expand Down
Empty file.
Loading
Loading