Skip to content

Commit

Permalink
Add species specific initialization. Bug fixes.
Browse files Browse the repository at this point in the history
  • Loading branch information
lucianogsilvestri committed Mar 25, 2024
1 parent c7c83ea commit 72ac984
Show file tree
Hide file tree
Showing 6 changed files with 273 additions and 96 deletions.
78 changes: 43 additions & 35 deletions docs/examples/Magnetized_OCP/Magnetized_Plasma.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -441,46 +441,29 @@
"\tsnapshot interval time = 5.5000e-17 [s] = 9.2153e-02 w_p = 1.4667e-02 plasma periods\n",
"\tTotal number of snapshots = 14000\n",
"\n",
"Bernu ran a simulation for 244 plasma periods. We decided to run for a time 5 times longer. This is because we want to show the time slicing option in the Postprocessing phase.\n",
"\n",
"The estimated times, on this machine, are \n",
"\n",
" ----------------------- Total Estimated Times ------------------------ \n",
"\n",
"\n",
" Equilibration Time: 0 hrs 2 min 20 sec\n",
"\n",
" Magnetization Time: 0 sec 0 msec 0 usec 0 nsec\n",
"\n",
" Production Time: 0 hrs 33 min 11 sec\n",
"\n",
" Total Run Time: 0 hrs 35 min 31 sec\n",
"\n",
"and the entire run requires\n",
"\n",
" Total minimum required space: 1 GB 43 MB 1009 KB 192 bytes\n",
"\n",
"We are ready to start the simulation."
"Bernu ran a simulation for 244 plasma periods. We decided to run for a time 5 times longer. This is because we want to show the time slicing option in the Postprocessing phase."
]
},
{
"cell_type": "code",
"execution_count": 3,
"execution_count": 1,
"id": "d585f2ca",
"metadata": {},
"metadata": {
"execution": {
"iopub.execute_input": "2024-03-22T20:31:15.612765Z",
"iopub.status.busy": "2024-03-22T20:31:15.611857Z",
"iopub.status.idle": "2024-03-22T20:31:15.632210Z",
"shell.execute_reply": "2024-03-22T20:31:15.630891Z",
"shell.execute_reply.started": "2024-03-22T20:31:15.612697Z"
}
},
"outputs": [
{
"data": {
"text/plain": [
"{'platform': 'Darwin',\n",
" 'platform-release': '22.6.0',\n",
" 'architecture': 'arm64',\n",
" 'processor': 'arm',\n",
" 'ram': '32 GB'}"
]
},
"metadata": {},
"output_type": "display_data"
"name": "stdout",
"output_type": "stream",
"text": [
"Running on an arm processor with 32 GB GB of RAM\n"
]
}
],
"source": [
Expand All @@ -493,7 +476,32 @@
"info['processor']=platform.processor()\n",
"info['ram']=str(round(psutil.virtual_memory().total / (1024.0 **3)))+\" GB\"\n",
"\n",
"display(info)\n"
"print(f\"Running on an {info['processor']} processor with {info['ram']} GB of RAM\")\n"
]
},
{
"cell_type": "markdown",
"id": "efabcbd6-07c6-43fc-8bf0-c2bd7dc34549",
"metadata": {},
"source": [
"The estimated times, on this machine, are \n",
"\n",
" ----------------------- Total Estimated Times ------------------------ \n",
"\n",
"\n",
" Equilibration Time: 0 hrs 2 min 20 sec\n",
"\n",
" Magnetization Time: 0 sec 0 msec 0 usec 0 nsec\n",
"\n",
" Production Time: 0 hrs 33 min 11 sec\n",
"\n",
" Total Run Time: 0 hrs 35 min 31 sec\n",
"\n",
"and the entire run requires\n",
"\n",
" Total minimum required space: 1 GB 43 MB 1009 KB 192 bytes\n",
"\n",
"We are ready to start the simulation."
]
},
{
Expand Down Expand Up @@ -1336,7 +1344,7 @@
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
Expand Down
5 changes: 5 additions & 0 deletions sarkas/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -769,6 +769,11 @@ def set_species_attributes(self, species: list):
List of :class:`sarkas.plasma.Species`.
"""

# DEV NOTE: This method could be defined in the Particles class, however, it is more convenient to have it here because it uses the correct unit system.
# If I were to move it to the Particles class, I would need to pass the units as an argument.
# TODO: It could be moved in the future.

# Loop over species and assign missing attributes
# Collect species properties in single arrays

Expand Down
Loading

0 comments on commit 72ac984

Please sign in to comment.