forked from rorni/mckit
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
dvp
committed
Nov 1, 2024
1 parent
bdd9293
commit f4c3bff
Showing
6 changed files
with
609 additions
and
51 deletions.
There are no files selected for viewing
This file contains 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 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 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,381 @@ | ||
{ | ||
"cells": [ | ||
{ | ||
"cell_type": "markdown", | ||
"id": "2199ef4c", | ||
"metadata": {}, | ||
"source": [ | ||
"# Compute composition of boron and polyethilen\n", | ||
"\n", | ||
"dvp 2024.10.31\n", | ||
"\n", | ||
" \n", | ||
"Create mix of wgt5% boron and polyethilen (remaining).\n", | ||
"\n" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"id": "9acb66ae-b96d-422e-a4f9-9bd7e119dc00", | ||
"metadata": {}, | ||
"source": [ | ||
"## Setup" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 14, | ||
"id": "93a9ee6a", | ||
"metadata": { | ||
"execution": { | ||
"iopub.execute_input": "2024-11-01T11:17:44.439473Z", | ||
"iopub.status.busy": "2024-11-01T11:17:44.439189Z", | ||
"iopub.status.idle": "2024-11-01T11:17:44.442035Z", | ||
"shell.execute_reply": "2024-11-01T11:17:44.441645Z", | ||
"shell.execute_reply.started": "2024-11-01T11:17:44.439453Z" | ||
} | ||
}, | ||
"outputs": [], | ||
"source": [ | ||
"import sys\n", | ||
"\n", | ||
"from pathlib import Path\n", | ||
"\n", | ||
"from mckit import Composition, Element, Material" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 2, | ||
"id": "d2c89220", | ||
"metadata": { | ||
"execution": { | ||
"iopub.execute_input": "2024-11-01T11:11:36.491719Z", | ||
"iopub.status.busy": "2024-11-01T11:11:36.491472Z", | ||
"iopub.status.idle": "2024-11-01T11:11:36.494581Z", | ||
"shell.execute_reply": "2024-11-01T11:11:36.494204Z", | ||
"shell.execute_reply.started": "2024-11-01T11:11:36.491700Z" | ||
} | ||
}, | ||
"outputs": [ | ||
{ | ||
"name": "stdout", | ||
"output_type": "stream", | ||
"text": [ | ||
"3.13.0 (main, Oct 22 2024, 11:20:55) [GCC 11.4.0]\n", | ||
"/home/dvp/.pyenv/versions/3.13.0/envs/mckit\n" | ||
] | ||
} | ||
], | ||
"source": [ | ||
"print(sys.version)\n", | ||
"print(sys.prefix)" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 3, | ||
"id": "b6e799cf", | ||
"metadata": { | ||
"execution": { | ||
"iopub.execute_input": "2024-11-01T11:11:39.169715Z", | ||
"iopub.status.busy": "2024-11-01T11:11:39.169421Z", | ||
"iopub.status.idle": "2024-11-01T11:11:39.175452Z", | ||
"shell.execute_reply": "2024-11-01T11:11:39.175011Z", | ||
"shell.execute_reply.started": "2024-11-01T11:11:39.169687Z" | ||
} | ||
}, | ||
"outputs": [], | ||
"source": [ | ||
"%config Completer.use_jedi = False" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 64, | ||
"id": "86c55b96-6b24-4403-8f11-34f708d098b3", | ||
"metadata": { | ||
"execution": { | ||
"iopub.execute_input": "2024-11-01T12:19:18.171350Z", | ||
"iopub.status.busy": "2024-11-01T12:19:18.171152Z", | ||
"iopub.status.idle": "2024-11-01T12:19:18.173916Z", | ||
"shell.execute_reply": "2024-11-01T12:19:18.173544Z", | ||
"shell.execute_reply.started": "2024-11-01T12:19:18.171333Z" | ||
} | ||
}, | ||
"outputs": [], | ||
"source": [ | ||
"HERE = Path.cwd()\n", | ||
"ROOT = HERE.parent.parent\n", | ||
"dst = ROOT / \"wrk/bpe5.txt\"" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 12, | ||
"id": "48d719c3-82f0-4ce5-b6f1-3215b94aefc5", | ||
"metadata": { | ||
"execution": { | ||
"iopub.execute_input": "2024-11-01T11:16:01.497728Z", | ||
"iopub.status.busy": "2024-11-01T11:16:01.497525Z", | ||
"iopub.status.idle": "2024-11-01T11:16:01.500488Z", | ||
"shell.execute_reply": "2024-11-01T11:16:01.500095Z", | ||
"shell.execute_reply.started": "2024-11-01T11:16:01.497711Z" | ||
} | ||
}, | ||
"outputs": [], | ||
"source": [ | ||
"dst.parent.mkdir(exist_ok = True)" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 58, | ||
"id": "2fca03f6-5032-4180-a840-3ff62b659fc8", | ||
"metadata": { | ||
"execution": { | ||
"iopub.execute_input": "2024-11-01T12:12:08.170758Z", | ||
"iopub.status.busy": "2024-11-01T12:12:08.170466Z", | ||
"iopub.status.idle": "2024-11-01T12:12:08.173334Z", | ||
"shell.execute_reply": "2024-11-01T12:12:08.172896Z", | ||
"shell.execute_reply.started": "2024-11-01T12:12:08.170730Z" | ||
} | ||
}, | ||
"outputs": [], | ||
"source": [ | ||
"boron_fraction = 0.05\n", | ||
"polyethylene_fraction = 1.0 - boron_fraction\n", | ||
"mix_number = 170023 # free slot in up-mi-24-08-27.xlsx material index for mapstp" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 34, | ||
"id": "0708361c-188c-4a6d-b7de-b95a3ba6d540", | ||
"metadata": { | ||
"execution": { | ||
"iopub.execute_input": "2024-11-01T11:43:37.455830Z", | ||
"iopub.status.busy": "2024-11-01T11:43:37.455625Z", | ||
"iopub.status.idle": "2024-11-01T11:43:37.458437Z", | ||
"shell.execute_reply": "2024-11-01T11:43:37.457995Z", | ||
"shell.execute_reply.started": "2024-11-01T11:43:37.455813Z" | ||
} | ||
}, | ||
"outputs": [], | ||
"source": [ | ||
"def mk_element(name: str):\n", | ||
" return Element(name, lib=\"31c\")" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"id": "3024af99-f644-4c28-a14b-f7dce073a921", | ||
"metadata": {}, | ||
"source": [ | ||
"## Computation" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 40, | ||
"id": "c699af3f-0349-479d-9af8-b65048d25991", | ||
"metadata": { | ||
"execution": { | ||
"iopub.execute_input": "2024-11-01T11:47:14.984400Z", | ||
"iopub.status.busy": "2024-11-01T11:47:14.983931Z", | ||
"iopub.status.idle": "2024-11-01T11:47:14.986922Z", | ||
"shell.execute_reply": "2024-11-01T11:47:14.986495Z", | ||
"shell.execute_reply.started": "2024-11-01T11:47:14.984381Z" | ||
} | ||
}, | ||
"outputs": [], | ||
"source": [ | ||
"boron = Composition(atomic=[(mk_element(\"B\"), 1.0)]).expand()" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 41, | ||
"id": "91e62c66-7423-47cb-9029-50c45e112f5a", | ||
"metadata": { | ||
"execution": { | ||
"iopub.execute_input": "2024-11-01T11:47:15.388349Z", | ||
"iopub.status.busy": "2024-11-01T11:47:15.388159Z", | ||
"iopub.status.idle": "2024-11-01T11:47:15.391899Z", | ||
"shell.execute_reply": "2024-11-01T11:47:15.391386Z", | ||
"shell.execute_reply.started": "2024-11-01T11:47:15.388333Z" | ||
} | ||
}, | ||
"outputs": [ | ||
{ | ||
"data": { | ||
"text/plain": [ | ||
"'MNone 5010.31c 1.990000e-01\\n 5011.31c 8.010000e-01'" | ||
] | ||
}, | ||
"execution_count": 41, | ||
"metadata": {}, | ||
"output_type": "execute_result" | ||
} | ||
], | ||
"source": [ | ||
"boron.mcnp_repr()" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 51, | ||
"id": "bd56919e-d2fe-4aa4-aaa0-6b2d1db50f11", | ||
"metadata": { | ||
"execution": { | ||
"iopub.execute_input": "2024-11-01T12:09:38.537013Z", | ||
"iopub.status.busy": "2024-11-01T12:09:38.536821Z", | ||
"iopub.status.idle": "2024-11-01T12:09:38.539707Z", | ||
"shell.execute_reply": "2024-11-01T12:09:38.539334Z", | ||
"shell.execute_reply.started": "2024-11-01T12:09:38.536997Z" | ||
} | ||
}, | ||
"outputs": [], | ||
"source": [ | ||
"polyethylene = Composition(atomic = [(mk_element(\"C\"), 1.0), (mk_element(\"H\"), 2.0)]).expand()" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 52, | ||
"id": "b33a1a5c-0d47-40a3-baef-f05f340419de", | ||
"metadata": { | ||
"execution": { | ||
"iopub.execute_input": "2024-11-01T12:09:38.921739Z", | ||
"iopub.status.busy": "2024-11-01T12:09:38.921544Z", | ||
"iopub.status.idle": "2024-11-01T12:09:38.925044Z", | ||
"shell.execute_reply": "2024-11-01T12:09:38.924632Z", | ||
"shell.execute_reply.started": "2024-11-01T12:09:38.921723Z" | ||
} | ||
}, | ||
"outputs": [ | ||
{ | ||
"data": { | ||
"text/plain": [ | ||
"'MNone 6012.31c 3.297667e-01\\n 6013.31c 3.566667e-03\\n 1001.31c 6.665900e-01\\n 1002.31c 7.666667e-05'" | ||
] | ||
}, | ||
"execution_count": 52, | ||
"metadata": {}, | ||
"output_type": "execute_result" | ||
} | ||
], | ||
"source": [ | ||
"polyethylene.mcnp_repr()" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 59, | ||
"id": "6fc43fa7-59f7-4c09-9f6f-c7db03e7da66", | ||
"metadata": { | ||
"execution": { | ||
"iopub.execute_input": "2024-11-01T12:12:23.534305Z", | ||
"iopub.status.busy": "2024-11-01T12:12:23.534109Z", | ||
"iopub.status.idle": "2024-11-01T12:12:23.537104Z", | ||
"shell.execute_reply": "2024-11-01T12:12:23.536651Z", | ||
"shell.execute_reply.started": "2024-11-01T12:12:23.534288Z" | ||
} | ||
}, | ||
"outputs": [], | ||
"source": [ | ||
"bpe5 = Composition.mixture(\n", | ||
" (boron, boron_fraction / boron.molar_mass),\n", | ||
" (polyethylene, polyethylene_fraction / polyethilen.molar_mass),\n", | ||
").rename(mix_number)" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 60, | ||
"id": "3bd9fd5a-d3d3-4d06-b50f-29eb3f4803a3", | ||
"metadata": { | ||
"execution": { | ||
"iopub.execute_input": "2024-11-01T12:12:24.485228Z", | ||
"iopub.status.busy": "2024-11-01T12:12:24.485037Z", | ||
"iopub.status.idle": "2024-11-01T12:12:24.488807Z", | ||
"shell.execute_reply": "2024-11-01T12:12:24.488238Z", | ||
"shell.execute_reply.started": "2024-11-01T12:12:24.485212Z" | ||
} | ||
}, | ||
"outputs": [ | ||
{ | ||
"data": { | ||
"text/plain": [ | ||
"'M170023 5010.31c 4.428836e-03\\n 5011.31c 1.782662e-02\\n 6012.31c 3.224276e-01\\n 6013.31c 3.487289e-03\\n 1001.31c 6.517547e-01\\n 1002.31c 7.496041e-05'" | ||
] | ||
}, | ||
"execution_count": 60, | ||
"metadata": {}, | ||
"output_type": "execute_result" | ||
} | ||
], | ||
"source": [ | ||
"bpe5.mcnp_repr()" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 66, | ||
"id": "38c768c5-1e9e-4444-aad7-582fbf13a207", | ||
"metadata": { | ||
"execution": { | ||
"iopub.execute_input": "2024-11-01T12:19:49.036802Z", | ||
"iopub.status.busy": "2024-11-01T12:19:49.036603Z", | ||
"iopub.status.idle": "2024-11-01T12:19:49.040748Z", | ||
"shell.execute_reply": "2024-11-01T12:19:49.040327Z", | ||
"shell.execute_reply.started": "2024-11-01T12:19:49.036786Z" | ||
} | ||
}, | ||
"outputs": [ | ||
{ | ||
"data": { | ||
"text/plain": [ | ||
"192" | ||
] | ||
}, | ||
"execution_count": 66, | ||
"metadata": {}, | ||
"output_type": "execute_result" | ||
} | ||
], | ||
"source": [ | ||
"dst.write_text(bpe5.mcnp_repr().replace(\"170023\", \"17023\\n \"))" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "904e1747-e9b0-44c5-854e-f87f3e610a1c", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [] | ||
} | ||
], | ||
"metadata": { | ||
"kernelspec": { | ||
"display_name": "Python 3 (ipykernel)", | ||
"language": "python", | ||
"name": "python3" | ||
}, | ||
"language_info": { | ||
"codemirror_mode": { | ||
"name": "ipython", | ||
"version": 3 | ||
}, | ||
"file_extension": ".py", | ||
"mimetype": "text/x-python", | ||
"name": "python", | ||
"nbconvert_exporter": "python", | ||
"pygments_lexer": "ipython3", | ||
"version": "3.13.0" | ||
} | ||
}, | ||
"nbformat": 4, | ||
"nbformat_minor": 5 | ||
} |
Oops, something went wrong.