Interested in particle astrophysics and plasma astrophysics. This blog is my research/private notebook.
Wednesday, June 7, 2023
Friday, December 30, 2022
Install Slurm on my personal Fedora laptop
Slurm (Simple Linux Utility for Resource Management) is a group utilities used for managing workloads on computer clusters. It can also be sued in your personal laptop.
$sudo dnf install slurm slurm-slurmd slurm-slumrctld $sudo -u munge /usr/sbin/mungekey -v $sudo systemctl start munge $sudo systemctl status munge $sudo systemctl enable munge $munge -n | unmunge // check munge works $hostname -f // find out hostname $sudo vi /etc/slurm/slurm.conf
ClusterName=localcluster
SlurmctldHost=localhost // or hostname
MpiDefault=pmix
ProctrackType=proctrack/cgroup
ReturnToService=1
SlurmctldPidFile=/var/run/slurm/slurmctld.pid
SlurmctldPort=6817
SlurmdPidFile=/var/run/slurm/slurmd.pid
SlurmdPort=6818
SlurmdSpoolDir=/var/spool/slurm/d
SlurmUser=root
StateSaveLocation=/var/spool/slurm/ctld
SwitchType=switch/none
InactiveLimit=0
KillWait=30
MinJobAge=300
SlurmctldTimeout=120
SlurmdTimeout=300
Waittime=0
SelectType=select/linear
AccountingStorageType=accounting_storage/none
AccountingStoreFlags=job_comment
JobAcctGatherType=jobacct_gather/none
SlurmctldDebug=info
SlurmctldLogFile=/var/log/slurm/slurmctld.log
SlurmdDebug=info
SlurmdLogFile=/var/log/slurm/slurmd.log
NodeName=localhost CPUs=12 Sockets=1 CoresPerSocket=6 ThreadsPerCore=2 RealMemory=10000 State=UNKNOWN
PartitionName=sbatch Nodes=ALL Default=YES MaxTime=INFINITE State=UP
Reference:
https://src.fedoraproject.org/rpms/munge
http://docs.nanomatch.de/technical/SimStackRequirements/SingleNodeSlurm.html
https://blog.llandsmeer.com/tech/2020/03/02/slurm-single-instance.html
Thursday, December 22, 2022
Collision Energy
The kinetic energy between two colliding particles can be expressed in terms of center of mass and relative velocity by
\[ E_k = \frac{1}{2} m_1 v_1^2 + \frac{1}{2} m_2v_2^2 = \frac{1}{2} M v_c^2 + \frac{1}{2} \mu v_r^2 , \]
a sum of a center-of-mass term and a relative momentum term.
where $M$, $v_c$, $\nu$, and $v_r$ are given by
\[ M = (m_1+m_2) ; \]
\[ \mathbf{v_c} = \frac{m_1 \mathbf{v_1} + m_2 \mathbf{v_2}}{m_1 +m_2} ;\]
\[ \mu = \frac{m_1 m_2}{m_1 + m_2} ;\]
\[ \mathbf{v_r} = \mathbf{v_1} - \mathbf{v_2} .\]
$\frac{1}{2} \mu v_r^2$ is called collision energy.
amu is short for atomic mass unit. Protons have a positive electrical charge of one (+1) and a mass of 1 atomic mass unit (amu), which is about 1.67×10−27 kilograms.
Reference:
https://web.chem.ox.ac.uk/teaching/Physics%20for%20CHemists/Mechanics/Collisions.html
https://www.angelo.edu/faculty/kboudrea/periodic/structure_mass.htm
Wednesday, December 21, 2022
Adiabatic Cooling
An adiabatic process is one in which no heat enters or leaves the system.
The thermdynamic first law takes the form
\[ dU=-PdV ,\]
since $dQ=0$.
Note that $C_v=(\partial U/ \partial T)_V$ , but the internal energy of an ideal gas depends only on the temperature and is independent of the volume (because there are no intermolecular forces). Thus for an ideal gas, we have
\[ dU=C_v dT = PdV \]
\[ PV= RT=(C_p-C_v)T \]
Then we have
\[ TV^{\gamma-1}=const \]
The bulk of particles lose energy by adiabatic cooling due to the work that protons exert on the expanding material. Particles (pressure ?) do (positive) work on the expanding medium cause their bulk energy reduce.
Reference:
https://github.com/bolverk/theoretical_physics_digest
Saturday, October 15, 2022
Friday, October 14, 2022
using matplotlib in C++
g++ -I/usr/include/python3.5/ -I/home/user/.local/lib/python3.5/site-packages/numpy/core/include/usr/lib/x86_64-linux-gnu/libpython3.5m.so
test.cc
// complie in a chromebook linux
#include "matplotlibcpp.h" #include <vector> namespace plt = matplotlibcpp; int main() { std::vector<double> y = {1, 3, 2, 4}; plt::plot(y); plt::savefig("minimal.pdf"); plt::show(); }
