-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathplots.lisp
executable file
·101 lines (87 loc) · 3.59 KB
/
plots.lisp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
;; Mirko Vukovic
;; Time-stamp: <2011-11-18 15:54:26 plots.lisp>
;;
;; Copyright 2011 Mirko Vukovic
;; Distributed under the terms of the GNU General Public License
;;
;; This program is free software: you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
;; (at your option) any later version.
;;
;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;;
;; You should have received a copy of the GNU General Public License
;; along with this program. If not, see <http://www.gnu.org/licenses/>.
(in-package :gpm-user)
(defmacro plot-vs-X-Xe ((ng-deff Ti) &body body)
`(let* ((ng-deff ,ng-deff)
(Ti ,Ti)
(X-Xe (gseq 1d-3 0.999d0))
(X-Ar (gmap #'(lambda (X-Xe) (- 1d0 X-Xe)) X-Xe)))
(grid-bind (Te0 XI-Ar0 Xi-Xe0)
(gpmap (particle-balance-calculation0 ng-deff @!Xi-Xe) X-Xe)
(grid-bind (Te XI-Ar Xi-Xe)
(gpmap (particle-balance-calculation ng-deff @!Xi-Xe Ti) X-Xe)
(plot-xys X-Xe ,@body)))))
#|
(progn
(init-gnuplot)
(start-gnuplot))
(with-png-output ("electron-temperature.png"
#p"/home/977315/my-software-add-ons/my-lisp/modeling/global-plasma-model/")
(set-to ((title "T_e as function Xe fraction")
(xlabel "Xe fraction")
(ylabel "eV"))
(plot-vs-x-xe (1e20 .04)
(list (list Te0 :title "Classic")
(list Te :title "New")))))
;;(with-png-output ("ion-fraction.png" #p"/home/977315/my-software-add-ons/my-lisp/modeling/global-plasma-model/")
(let ((*iisi-coupling* nil))
(set-to ((title "Ar+/ne and Xe+/ne fraction as function of Xe fraction")
(xlabel "Xe fraction")
(yrange '(0 1)))
(plot-vs-x-xe (1e20 0.04)
(let ((XI-Xe0 (gpmap (XI-Ar0 ng-deff @!X-Ar @!Te) X-Ar Te0))
(XI-Ar0 (gpmap (XI-Xe0 ng-deff @!X-Xe @!Te) X-Xe Te0)))
(grid-bind (i Xi-Ar Xi-Xe Ub-Ar Ub-Xe)
(gpmap (calc-xi&ub ng-deff @!X-Ar @!X-Xe @!Te Ti 1e5 1e5)
X-Ar X-Xe Te)
(list (list Xi-Xe0 :title "Xe-classic")
(list Xi-Ar0 :title "Ar-classic")
(list Xi-xe :title "Xe-new")
(list Xi-Ar :title "Ar-new")))))))
;;)
(with-png-output ("bohm-velocities.png"
#p"/home/977315/my-software-add-ons/my-lisp/modeling/global-plasma-model/")
(set-to ((title "Bohm velocities as function of Xe fraction")
(ylabel "[m/s]")
(xlabel "Xe fraction"))
(plot-vs-x-xe (1e20 0.04)
(let ((UXe0 (gpmap (gpm::ub 132 @!Te0) Te0))
(UAr0 (gpmap (gpm::ub 40 @!Te0) Te0)))
(grid-bind (UAr UXe)
(gpmap (v1/2 @!XI-Ar @!XI-Xe 40 132 @!Te 0.04)
XI-Ar XI-Xe Te)
(list (list UXe0 :title "Xe-classic")
(list UAr0 :title "Ar-classic")
(list Uxe :title "Xe-new")
(list UAr :title "Ar-new")))))))
(with-png-output ("plasma-density.png"
#p"/home/977315/my-software-add-ons/my-lisp/modeling/global-plasma-model/")
(set-to ((title "Plasma density as function of Xe fraction")
(ylabel "n_e [m^-3]")
(xlabel "Xenon Fraction"))
(plot-vs-x-xe (1e21 0.04)
(let* ((XI-Ar0 (gpmap (XI-Ar0 ng-deff @!X-Ar @!Te) X-Ar Te0))
(XI-Xe0 (gpmap (XI-Xe0 ng-deff @!X-Xe @!Te) X-Xe Te0))
(ne0 (gpmap (calc-ne0 1e3 2e-2 10.0 @!Xi-Ar0 @!Xi-Xe0 @!Te0)
Xi-Ar0 Xi-Xe0 Te0)))
(let ((ne (gpmap (calc-ne ng-deff @!X-Ar @!X-Xe @!Te Ti 1e3 2e-2 10.0)
X-Ar X-Xe Te)))
(list (list ne0 :title "classic")
(list ne :title "new")))))))
|#