레이블이 example인 게시물을 표시합니다. 모든 게시물 표시
레이블이 example인 게시물을 표시합니다. 모든 게시물 표시

2018년 10월 10일 수요일

[EPICs]Experimental Physics and Industrial Control System / Python / PAL-XFEL / 연습 로그

[EPICs]Experimental Physics and  Industrial Control System

Python을 다운받아 파일을 만들고 실행시키기


작업환경: Widows 10


1. Python 다운 파일: python-3.5.4-amd64.exe


2. Window 키를누른후 IDLE 검색 및 실행

Python Shell이 실행되면 설치 완료





3. Pyepics 다운 파일: pyepics-3.2.5.win32-py3.5.exe

파일을 실행하니 python 3.5를 요구해서
파이썬 3.5를 다운받았다.






Shell 안에서 코딩을 작성할 수 있지만
수정이 불가능하다.



그래서 우리는 파일을 작성하는데
Ctrl + N 혹은 File -> New File을 눌러 코딩을 할 수 있다.

완성된 파일을 실행하고자 하면
Run -> Run Module을 누르면 된다.
혹은 시작위치를 바꾼 후
Python shell에서 아래 명령어를 통해 파일을 실행

1
exec(open("epicex.py").read())
cs

참고로 저는 바탕화면에
Python_Script라는 폴더를 만들고
epicex.py라는 파일을 만들었습니다.





참고자료

2018년 4월 12일 목요일

[전자기학][Fundamentals of Engineering Electromagnetics]Electrostatic potential energy, Example 3-17 Cheng (P122)


[Fundamentals of Engineering Electromagnetics]
Electrostatic potential energy, Example 3-17 Cheng (P122)


전자공학 학생이 아래 질문을 가지고 질문한 사항에 대해 답변을 하고자 작성하였습니다. 틀렸으면 알려주세요. 제 자신도 공부하기 위함입니다. (I just upload the image from Cheng p122; if there is problem with the copyright please let me know. I am trying to discuss the question that student has)




Problem: Find the energy required to assemble a uniform sphere of charge of radius \(b\) and volume charge density \(\rho_v\)

In terms of total charge

\[\begin{aligned} Q= \frac{4\pi}{3}\rho_v b^3 \end{aligned}\]

Hence we have

\[\begin{aligned} W_e = \frac{3Q^2}{20 \pi \epsilon_0 b}\end{aligned}\]

By looking at the equation below, a lot of people asks why does the half goes away?

\[\begin{aligned} W&= \frac{1}{2}\int_v \rho_v V dv\end{aligned}\]

And the answer is it is not actually going away. Those who might have twice differece might solved problem as below ( used \(V =\frac{q}{4\pi \epsilon_0 r}\))

\[\begin{aligned} W&= \frac{1}{2}\int_v \rho_v V dv \\ &= \frac{1}{2}\int_v \frac{\rho_v^2 \frac{4}{3} \pi r^2}{4 \pi \epsilon_0} r^2 \sin \theta dr d\theta d\phi \\ &=\frac{2}{15}\frac{\rho_v^2 r^5}{\epsilon_0}\\ &=\frac{3}{40}\frac{Q^2}{\epsilon_0 r \pi}\end{aligned}\]

Notice that \(Q = \rho_v \frac{4}{3}\pi r^3\). So there is twice difference. The reason for this is that potential is different inside and outside the effective sphere.
Answer: Think we have sphere with radius R; charge exist in this region. For \(r<R\)

\[\begin{aligned} \oint_s \vec{E} \cdot d\vec{a} &= \frac{\rho}{\epsilon_0}\frac{4}{3}\pi r^3 \\ \vec{E} &= \frac{\rho}{3\epsilon_0} r \\ &=\frac{\rho r}{4\pi \epsilon_0 R^3}\end{aligned}\]

On the last step, we used the fact that charge is inside the \(\frac{4}{3}\pi R^3\). For \(r>R\),

\[\begin{aligned} \vec{E} = \frac{Q}{4\pi \epsilon_0 r^2}\end{aligned}\]

Finally \(E\) field and potential becomes

\[\begin{aligned} \vec{E}(r) = \frac{Q}{4\pi \epsilon_0} \times \begin{cases} \frac{r}{R^3} \quad (r<R) \\ \frac{1}{r^2} \quad (r>R) \end{cases}\end{aligned}\]

\[\begin{aligned} \vec{V}(r) = \frac{Q}{4\pi \epsilon_0} \times \begin{cases} -\frac{1}{2} \frac{r^2}{R^3} + \frac{3}{2R} \\ \frac{1}{r} \end{cases}\end{aligned}\]

Notice that constant term from the potential comes from the Boundary Condition; \(at r=R\), \(V = \frac{Q}{4\pi \epsilon_0 R}\). Finally, let us calculate the energy.

\[\begin{aligned} W &= \frac{1}{2} \int_{0}^{R} \frac{Q}{4\pi \epsilon_0} \rho \left( -\frac{r^2}{2R^3} + \frac{3}{2R} \right) 4\pi r^2 dr \\ &=\frac{1}{2}\int_{0}^{R} \frac{Q \rho}{\epsilon_0}\left( -\frac{r^4}{2R^3} + \frac{3r^2}{2R} \right) dr \\ &= \frac{4}{20}\frac{Q \rho R^2}{\epsilon_0}\\ &= \frac{3}{20}\frac{Q^2}{\pi \epsilon_0 R}\end{aligned}\]

Hence, we get the same answer as David K. Cheng.

4차 산업혁명에 걸맞는 인터넷 기반 고등교육기관

이메일: ilkmooc@ilkmooc.kr

홈페이지주소: http://ilkmooc.kr

산동일크무크란? https://goo.gl/FnvqXd

2018년 4월 11일 수요일

[플라즈마 물리][Plasma Physics]Debye Shielding 디바이 차폐

Example Problem: Debye Shielding
Consider a positive point charge immersed in a plasma as we discussed in the class. Show that the net charge in the Debye shielding cloud exactly cancels the test charge. Assume that the ions are fixed and that \(e\phi << KT_e\). Note that we assumed that ion distribution is similar to that of the electrons in the class.

Answer:

While deriving, we assume potential to be

\[\begin{aligned} \frac{e\phi}{KT_e} << 1 \quad \quad \quad n_i \simeq n_e\\ \lambda_D = \sqrt{\frac{\epsilon KT}{ne^2}}\\ \phi(r) = \frac{e}{4\pi\epsilon_0 r }e^{-\frac{r}{\lambda_D}}\end{aligned}\]

Assume \(\frac{m_i}{m_e} \rightarrow \infty\) so that ions are fixed; \(n_i(r)=n\). Further assume electrons obey the Boltzmann distribution.

\[\begin{aligned} f(u) &= A e^{\frac{\frac{-1}{2}mv^2 + q\phi}{KT_e}}\\ n_e(r) &= ne^{\frac{e\phi(r)}{K_B T}}\end{aligned}\]

\[\begin{aligned} \rho &= -e(n_i - n_e) \\ &=-e \left(n - ne^{\frac{e\phi(r)}{K_BT}} \right)\\ &= ne \left(e^{\frac{e\phi(r)}{K_BT}} - 1 \right)\\\end{aligned}\]

for \(\frac{e\phi}{KT_e} << 1\),

\[\begin{aligned} e^{\frac{e\phi(r)}{K_B T}} = 1 + \frac{1}{2}\frac{e\phi(r)}{K_B T} + ...\end{aligned}\]

\[\begin{aligned} \rho &= ne(1+\frac{e\phi(r)}{K_B T} - 1) \\ &=\frac{ne^2 \phi(r)}{K_B T} \\ &= \frac{\epsilon_0}{\lambda_D^2}\phi(r)\end{aligned}\]

\[\begin{aligned} \int \rho dv &= Q \\ &= \int_V \frac{\epsilon_0}{\lambda_D^2}\frac{e}{4\pi\epsilon_0 r }e^{-\frac{r}{\lambda_D}} r^2 \sin\theta dr d\theta d\phi\\ &= \int \frac{4\pi \epsilon_0}{\lambda_D^2}\frac{e}{4\pi \epsilon_0} r e^{-\frac{r}{\lambda_D}}dr \\ &= \frac{e}{\lambda_D^2} \int_{0}^{\infty} r e^{-\frac{r}{\lambda_D}}dr \\ &= \frac{e}{\lambda_D^2} (\lambda_D^2 e^{-\frac{r}{\lambda_D}}-\lambda_D r e^{-\frac{r}{\lambda_D}}) =0\end{aligned}\]

On the last step, when \(r = \lambda_D\), charge becomes zero. Hence, the Debye sheilding cloud exactly cancels the test charge.

4차 산업혁명에 걸맞는 인터넷 기반 고등교육기관

이메일: ilkmooc@ilkmooc.kr

홈페이지주소: http://ilkmooc.kr

산동일크무크란? https://goo.gl/FnvqXd