Labels

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

SchedulerType=sched/backfill
SelectType=select/linear
AccountingStorageType=accounting_storage/none
AccountingStoreFlags=job_comment
JobCompType=jobcomp/none
JobAcctGatherFrequency=30
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


change the Node information (marked as red color) to your laptop configuration. 

$ sudo systemctl start slurmctld
$ sudo systemctl status slurmctld
$ sudo systemctl enable slurmctld
$ sudo systemctl status slurmd
$ sudo systemctl enable slurmd

// test the installation
$ srun ls 


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 unitProtons 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://chem.libretexts.org/Bookshelves/Physical_and_Theoretical_Chemistry_Textbook_Maps/Map%3A_Physical_Chemistry_for_the_Biosciences_(Chang)/02%3A_Properties_of_Gases/2.8%3A_Molecular_Collisions_and_the_Mean_Free_Path

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  \]

\[ \gamma = C_p/C_v \]

Then we have

\[ TV^{\gamma-1}=const  \]
\[ d\ln(T)/dt = -(\gamma-1) \nabla \cdot u\]
where we have use 
\[ \frac{1}{V} \frac{dV}{dt} = \nabla \cdot  u \]
where $u$ is the flow speed.

Since $K_B T \propto E$, here $E$ is thermal energy. We have 
\[ d\ln(E)/dt = -(\gamma-1) \nabla \cdot u \]

For non-relativistic particle, $\gamma=5/3$, $E=p^2/m$.
For relativistic particle, $\gamma=4/3$, $E=pc$,
we have 
\[ \frac{dp}{dt} = -\frac{p}{3} \nabla \cdot u \]

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

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();
}

Reference: 
https://matplotlib-cpp.readthedocs.io/en/latest/examples.html 
http://hilite.me/

Tuesday, September 6, 2022

Pick-up ions

Interstellar gas that approaches the Sun is ionized and accelerated by the convective electric field to solar wind speed, yielding interstellar pickup ions. These ions move with the solar wind bulk speed when averaged over a gyro orbit in the solar wind frame. Their instantaneous speed as they gyrate varies from zero to two times the solar wind speed, which is why their distribution function shows a cutoff at twice the bulk speed in the inertial frame.

The charge-exchange and photoionization process can ionize the interstellar neutral atoms in the inner heliosphere and form the pick-up ions.

\[  p^+(\mathbf v_{sw})  +H( \mathbf v_{ISM} \to H( \mathbf v_{sw}) + p^+(\mathbf v_{ISM}) \]

$\mathbf v_{ISM}$ has a magnitude of only 25 km/s. In the solar wind frame, a proton near zero velocity is suddenly replaced by a proton (from ionization) which is born with an initial velocity approximately equal to $-\mathbf v_{sw}$.

The new born proton gyrates around the magnetic field. In the case of solar wind flow perpendicular to $\mathbf B_{sw}$, the initial gyrospeed is $v_{sw}$ and so the picked-up proton moves on a circle. In the Sun's frame, the energy of the pick-up ion varies between zero and 4 times the solar wind proton energy. The extra energy comes from the convection electric field when it accelerates the pickup ion into its gyromotion. The consequence is that the solar wind flow must slow down to accommodate this energy flow into pickup ions.


Reference:

supra-thermal ions in the outer heliosphere

http://www.physics.usyd.edu.au/~cairns/teaching/lecture12/node6.html


 

Wednesday, August 31, 2022

Postdoc resources


https://www.nhfp-equity.org/resources-for-applicants

providing application resources that are accessible to early career astronomers around the world

cs-sop.org

a platform with statements of purpose generously shared by previous applicants to CS PhD programs

proposal 

https://static1.squarespace.com/static/6021c6e44248e2593056aa87/t/630f9b11b79af6224c4fe064/1661967123414/Griffith_NSF_Proposal.pdf


https://serinachang5.github.io/assets/files/research-statement.pdf


Monday, August 29, 2022

How to be a good reviewer for scientific journal

 Ask the following questions:

a) Do the abstract and introduction clearly identify the need for this research, and its relevance?

b) Are the results presented clearly and logically, and are results justified by the data by the data provided? Are the figures clear and fully described?

c) Does the conclusions justifiably respond to the main questions posed by the authors in the introductions?

Full peer-review document includes:

a) Introduction: Mirror the article, state your expertise and whether the paper is publishable or weather there are fatal flaws;

b) Major flaws;

c) Minor flaws;

d) suggestions and final comments.


Reference:

How to write a thorough peer review