CL-CORSIKA is still WIP, feel free to make issue, request functionalities or contribute to the repo
OOO O OOO OOO OOOO OOO OOO O O O O O O O O O O O O O O O O O O O | O O O O O O O O O O O O O ----|---- O O OOOO O O O O O OOO O OOO O O * O O O O O OOOO O O O O OOOOO /|\ O O O O O O O O O O O O O O O O /\|/\ OOO OOOOO OOO OOO O O OOO OOO O O O O =========
Ah, I was doing my Corsika simulation work while I happend to found that COAST does not compile on my poor machine, which brings me trouble while reading Corsika binary output files.
So at that time, I thought, that, why could not ME, MYSELF wrote a program that reads the binary output instead? So here it goes, the CL-CORSIKA package.
Right now, it’s mostly focus on Corsika 7.75 and dealing with the reading tasks.
BUT PLEASE NOTE THAT CL-CORSIKA does NOT intend to replace Corsika or rewrite Corsika, for those purpose, please refer to Corsika 8 for more details. CL-CORSIKA is kinda like an enhance interface in lisp for Corsika or more simpler, just an automation scripts for my Corsika simulation works.
The main package acts as a interface for lisp to work with Corsika.
TODO MEMO:
- cl-corsika/analyze (analyze functionalities? )
- cl-corsika/plot (output with gurafu? or cl-webview? )
- cl-corsika/physics physics constants, particle id, physics formulas, and so on
- cl-corsika/miscs
Package cl-corsika/physics
is for the physics part in Corsika,
which includes:
- particle id maps from name to corssponding id number in different
parts (in
particle-id.lisp
);
Package cl-corsika/input
is for generate Corsika input file
for simulation.
Currently it’s WIP. You could just load it to have a simple try:
(ql:quickload :cl-corsika/input)
(uiop:with-current-directory ("PATH/TO/CORSIKA/RUN/")
(uiop:run-program
"./corsikacorsika77500XXX_XXX"
:input (cl-corsika/input:with-corsika-input (:stream :debug t)
;;; Set the physics (the keywords are ignorable)
;; Fe (5626) with 1e5 GeV primary particle
(cl-corsika/input:setup-primary-particle 5626 1e5)
;; setup first interaction infomation
(cl-corsika/input:setup-first-interaction :target :Nitrogen)
;; setup the interaction model
(cl-corsika/input:setup-model :EPOS :GHEISHA
:muon-scattering :gauss
:scatter-step 1.0
;; if you want more ...
)
;; setup the observation pane
(cl-corsika/input:setup-observation-pane :altitude 0.0
:atmosphere :default)
;;; Set utils
(cl-corsika/input:setup-utils :dir "OUTPUT/PATH"
:debug t
:user "CL-CORSIKA")
;; or, you could use the low level methods
;; like (cl-corsika/input::runnr id)
)
:output t))
TODO:
- expose lowlevel method in different package (?)
- task manager and resource load monitor (GUI?)
- easier interface
DEV MEMO:
with-corsika-input
output to*standard-output*
(using closure to redirect)with-corsika-input
outputcl-corsika/input::exit
by the end
Package cl-corsika/binary
is for reading Corsika binary
output file structure.
You could just load it to have a simple try:
;; Make sure cl-corsika is under quicklisp load path
;; for example, `~/quicklisp/local-project'.
(ql:quickload '(cl-corsika/binary))
;;; High-level methods:
(cl-corsika/binary:with-open-corsika (corsika "PATH/TO/YOUR/OUTPUT")
(cl-corsika/binary:run-header corsika) ; -> get run-header of `corsika'
;; ...
)
;;; Low-level methods:
;; These functions are not exported.
;; (with-corsika-binary-output (corsika "PATH/TO/YOUR/OUTPUT")
;; (read-type :int corsika) ; -> 29932 if not thin
;; (read-type :run-header corsika) ; -> run-header
;; ;; ...
;; )
TODO MEMO:
- [DONE]
Add automated parser for structured reading output - [DONE]
Double check =corsika-defbin.lisp= - [DONE]
Add export functionality in =defbin.lisp= - Easier alias names for slots reading
- Speed improvment
DEV MEMO:
- the
cl-corsika/binary
treat the file stream as(unsigned-byte 32)
(see
with-corsika-binary-output
) - each
(unsigned-byte 32)
will be map to:float
,:int
,:str
for basic data type and the complex type(:array TYPE SIZE)
, the reader function for each type is stored in*corsika-binary-readers*
(see
read-type
) - the binary structure is defined by
defbin
, which would define a data structure - if changing the readed type, be sure to update
:export
indefpackage
too (this could be done by setting:export
tot
indefbin
and usingdo-external-symbols
)