HW4 Tutorial
GIthub: https://github.com/ShainaRudman/HONRPHYS
-After encountering some issues in the past with pushing files to github I was able to fix this problem, the error was that I was trying to push it using the https:// address for the github repository but since we are using SSH keys it should be different (discussion: gitpush failure)
-commit and push to github using the following:
echo # HONRPHYS >> file name here.cpp
ls
git init
git add file name here.cpp
git status
git commit -m "test command"
git remote set-url origin git@github.com:ShainaRudman/HONRPHYS.git
git push -u origin master
-we learned to compile and execute using these 2 commands:
g++
./a.out
-When typing the code in the sections for variables with numbers I am getting an error at the end saying that the parenthesis are mismatched
-To fix this I had to add " before the n that is in the line prior to the return line, this fixed the issue , see result below so ++ adds one to the variable and -- subtracts one from the variable
-Here is the result I got from the code using non-number variables (nonnumeric.cpp)
-I read this page on varables and types (http://www.cplusplus.com/doc/tutorial/variables/) but I don't quite understand what the significance is of char which is at least 8 bits as opposed to char16_t and char32_t
-Here is the result for the first loops code, using the while loop (loops.cpp)
-This loops starts from the integer 10 and subtracting 1 each time until it gets to 1 because the code contains "while(n>0)"
-It appears that the for loop is a more efficient way of doing what the while loop can do, it got the same result (forloop.cpp)
-At the last part of the tutorial I tried to log back onto putty/linux and I keep getting this error message as soon as it opens, with nowhere to put the login
-Update: If anyone has this problem in the future there are some forums that reccomend enabling TCPkeepalives and then changing the seconds between keepalives from 0 to 5. It worked when I changed it to 3. Hopefully this doesn't cause any unintended problems.
-The final part of the tutorial was difficult in my opinion- inner and outer loops using the "while" and "for" loops. First I put in the original while code (newloop.cpp) to understand the purpose of the 2 loops and what they outputted. I tried several different methods of coding translate the "while" code to "for" format- what i didn't realize is that for each "for" is an inner/outter loop and it can't all be put in one line with both variables within the for() at once (newloop2.cpp)
HW 5 Tutorial
-logic statements fulfill a statement if a condition is met
-the tutorial code just says n is 10
-can also say what will happen if the condition is not met
if (x > 0) cout << "x is positive"; else if (x < 0) cout << "x is negative"; else cout << "x is 0";
Pointers:
-each peice of data has a computer "address" where it is located
-can check where something is located using the & operator
cout << “The memory address of i is “ << &i;
cout << “The data stored at memory address “ << &i << “ is “ << i;
-a pointer is a variable that stores this address
to declare a point (use int)
int* p = &i;
cout << “The value of p is “ << p;
cout << “We say that p ‘points at’ the memory location referenced by address “ << &i;
-can use the * operator to tell the program to open up this location
cout << “The data stored at memory address “ << p << “ is “ << *p;
-pointer tell a location and are a value??
remember:
chmod +x to make a .tcsh script executable
then ./scriptname.tcsh to execute it
----------------------------------
Other Notes
-Spaces and lines don't affect the code they are just for organization
-writing endl; makes it so the result is printed on another line
-cin used so that user can input something
-void means the function does not return a value
-if function does not return a value then the return statement is not neccessary
-in c++ programs cannot be written within one another (called nesting)
---------------------------------
HW 6 Tutorial
-root program
exit using: .quit
-store multiple values in arrays
-begins with 0 index
-combing code from different files
this written at the top of the main file:
#include "nameoffile.cpp"
open the input file using the following 2 lines:
ifstream infile;
infile.open("nameoftxtfile.txt");
close the input file using this ending line:
infile.close();
after making it so that the information is incorporated in the code you have to inlcude the functions that are defined in the files that you #include "filename.cpp" at the top
Here is the main program:
/* MAIN */ #include <iostream> #include <fstream> #include"dotprod.cpp" #include"scalarmult.cpp" using namespace std; int main(){ double vector1[3]; double vector2[3]; double scalar[1]; ifstream infile; infile.open("vectors.txt"); infile>>vector1[0]>>vector1[1]>>vector1[2]; cout<<" Vector 1 is ("<<vector1[0]<<","<<vector1[1]<<","<<vector1[2]<<")"<<endl; infile>>vector2[0]>>vector2[1]>>vector2[2]; cout<<" Vector 2 is ("<<vector2[0]<<","<<vector2[1]<<","<<vector2[2]<<")"<<endl; infile>>scalar[0]; cout<<" Scalar is " <<scalar[0]<<endl;
infile.close();
dot_prod(vector1,vector2);
scalar_mult(scalar, vector1);
scalar_mult(scalar, vector2);
return 0;
}
Here is the dotproduct function file
/* DOTPROD.CPP */
#include <iostream>
using namespace std;
double dot_prod(double v1[3],double v2[3]) {
double dotdot;
dotdot = v1[0]*v2[0]+v1[1]*v2[1]+v1[2]*v2[2];
cout<<" The dot product is "<<dotdot<<endl;
return 0;
}
Here is the scalarmult function file
/* Scalarmult.cpp */
#include <iostream>
using namespace std;
double scalar_mult(double s1[1], double v1[3]) {
cout<<"the scalar multiple is ("<<s1[0]*v1[0]<<","<<s1[0]*v1[1]<<","<<s1[0]*v1[2]<<")"<<endl;
return 0;
}
-the input file is just a text file with 3 lines for the 2 vectors and the scalar
-getting a lot of errors for random program
-can use srand and rand functions from the <stdlib.h> library
-it's possible to make up your own variables called classes
whenever you log in)
cd to the CMSSW_5_3_30
cmsenv
cd to the testRoot subdirectory
We are ready to start the root executable.
root –nw (note: if you forgot the instructions about X11 or Xming, you will get an error “DISPLAY not set”)
exit root by typing
.quit (note the dot . before word quit )
Other notes:
-to execute a file on root it must end with .root, resolutions.c will not work
-execute by doing
.x filename.root
Fireworks notes:
-use cmsShow to open program
-------------------------
Homework 7
TH1F *histo1 = new TH1F("histo1","s",50,0.,50.)
-"s" is the title
-this creates 50 bins that go from a minimum of 0 and a max of 50
use arrow -> since histo1 is a pointer for line:
histo1->Draw("")
for (int i=0;i<500;i++)
-500 is the number of entries
TRandom r;
gRandom->SetSeed();
this is the random element
creation of a pointer with the name histo1, pointing to a variable called TH1F (custom variable made by root to store histogram)
-all classes have data members
-There are also 3D histograms
-all classes have a creator
-Fill data members
Root also provides many math libraries such as
TRandom r;
gRandom->SetSeed();
float p1=r.Gaus(10,2);
helpful root information: http://www-root.fnal.gov/root/GettingStarted/GS.htm
to save the root macro from a historgram from an outside source go to save as and save it as a .root or .C file
example root code (http://www.desy.de/~blist/summerstudents/root-intro-07-transp.pdf):
int main() {
// initialization here
//parameters
//event files
//book histograms
for( int i=0; i<events; i++){
//load event numbers
//event properties
}
}
//draw histogram
//write out historgram file
//write out info like number ofevents etc.
return 0;
}
"E0", "E1" error bars
the gRandom variable is a variable that points to a random number generator instance of the type TRandom3. Such a variable is useful to access in every point of a program the same random number generator, in order to achieve a good quality of the random sequence.
gStyle->SetOptTitle(0); // suppress title box
The following methods are provided to generate random numbers distributed according to some basic distributions:
Exp(tau)
Integer(imax)
Gaus(mean,sigma)
Uniform(x1)
Landau(mpv,sigma)
Poisson(mean)
Binomial(ntot,prob)
https://root.cern.ch/doc/master/classTRandom.html (info for random number gen)
Other helpful root links:
http://www.desy.de/~blist/summerstudents/root-intro-07-transp.pdf
https://root.cern.ch/root/html518/TGraph.html
https://root.cern.ch/working-macros
http://www.nevis.columbia.edu/~seligman/root-class/RootClass2011.pdf
https://root.cern.ch/doc/master/classTF1.html
http://www-ekp.physik.uni-karlsruhe.de/~quast/Skripte/diving_into_ROOT.pdf
When using a mac/xquartz, login using: (my computer is temporarily broken)
ssh -X -Y rudman@hepcms.umd.edu
use TF1 to plot function
TF1 *f1 = new TF1("name","function", xmin, xmax);
f1->Draw();
another class in tutorial: TPad
-a pad is contained in a canvas and can contain other pads
-can use pad to create multipe things at once
cd() (what does this do?)
use TFormula to define a function that can then be later references
https://root.cern.ch/doc/master/classTColor.html (this link has the colors that correspond with each number)
Graphs can be drawn with the following options:
for example
f1->Draw("ALP");
this will make it so each data point is connected by a line beacause of the L
When creating formulas or using TF1 must have x in all equations, even if the function is only one formula plus another, you need to add +0*x to include x
------------------------------------
HW 9
2 types of Monte Carlo we are looking at: event generator and detector simulation
what does root.exe do?
an “event” corresponds to a collision that was selected by a trigger, the data that was in the detectors at the time of the “trigger” was read out and stored together
This is the graph the appeared after doing .x toyMC.C
-writing code to analyze data in output.root
TFile (another class)
ls lists whats in the file, just like in normal linux
.h and .c files present after MakeClass("MyClass");
.L pulls .C file information into memory
this is the result after m.Loop()
Note the "+" sign at the end of the loading command would compile the code and would make the command run faster. It will also check your code for some obvious mistakes.
result after el1_eta_>Draw();
What is an MC???
What is a .h file
chain->Add(<file>.root) function allows us to chain together multiple files so that we are able to perform analysis on multiple files using one function
Not entirely clear on what chaining specifically does
Resulting graphs
step 3
.L ana.C+
ana t
t.Loop()
ls
Z_ee->Draw()
step 4
It is much faster to do root -l then just root, this way that screen doesn't pop up
--------------------------------------------------------
Pythia Tutorial
http://home.thep.lu.se/~torbjorn/pythia82html/Welcome.html
this website is important
go to cmssw area
git clone https://github.com/saraheno/honrpythia.git
cd honrpythia
source PYTHIA_setup.csh
make pythiaTree
./pythiaTree >& output.txt
here area the files created by donig this
emacs pythiaTree.cc to alter it
change this line
for (int iEvent = 0; iEvent < 10000; ++iEvent) {
so that it is 10000
alter the code so that the mass is stored in the tree
declare mass as a float
Float_t mass[10000]
then add as branch
t1->Branch("mass",mass,"mass/F");
how to compile after making changes
did make pythiaTree and got many errors saying everything is undefined
emacs output.txt to run
when i open it it says 1032 not 10000
to compile tried this
source PYTHIA_setup.csh
make pythiaTree
./pythiaTree >& output.txt
its taking a while to load...
after opening the output file there are only 1032 events although it says the events are created
remove the lines and left pythia pythia but then all the graphs were empty
after changed lines got nothing and got error in pythia
to create pT histograms
declare double pT1 and pT2 = 0
create histograms
TH1F *massSignal = new TH1F("massSignal", "Invariant mass of two highest pT electrons for signal events", 100, 0, 2000);
TH1F *massDY = new TH1F("massBackground", "Invariant mass of two highest pT electrons for background events", 100, 0 ,2000);
add the if statement to det highest and 2nd highest
(see code)
----------------------
Meeting #1 with Jimmy (2/16/2016)
-downloaded cygwin terminal
-atlassian copy laptop
-add path to cygwin terminal to what copies to computer (http://www.howtogeek.com/howto/41382/how-to-use-linux-commands-in-windows-with-cygwin/)
-Vlasov equations
-linear theory
-magnetic recconection
-instability
-tearing mode instability
Meeting #2 with Jimmy (2/23/2016)
-definition of plasma
statistical (N>>1, many particles when talk about plasma)
mobile(free to move, average KE>>PE, interparticle, particle to particle not plasma as a whole mean field)
charged(can be affected by EM forces F=q(E+vxB) )
-plasma collection behavior vs. individial plasma behavior
T(temp)=units of energy bc multiplied by k (J/k)
-Debye Length (scale that e field is screened out by plasma)
electron has an e field associated with it (can solve by gausses law) E(r)=e/(4piepsilonnot*r^2)
impact of having tons of particle? E e/ particle experiences?
rewrite gausses law in differential form
only consider particles standing still
(insert math from written notes)
system has come to an equilibrium, particles come into eq w themselves
electric force falls off faster in plasma bc "screen" eachothers charge
-Plasma Parameter (dimensionless)
(insert math from written notes)
cgs units used so can use c
-------------------------------------
Week 3: Problem
see powerpoint for solution- we are still working on part B2 and B3
-how to determine number of Euler timesteps use?
ongoing powerpoint can be found here: https://docs.google.com/presentation/d/1b_Mey4jTyaituSIRs-DHtyqb-YjgOXZnlGjkTHhAcpw/edit?usp=sharing
----------------------------
Meeting #3
-the problem
-concept of point operations
-get number from 3 equations
-expense comes from number of particles in a plasma
-one way: decrease the number of particles per debye cube
problem: introd. counting noise statistics- which is bad
if want to look at distribution, changes shape of distribution
-other way: Vlasov Equations (insert equation here)
-can derive by considering large number of particles and debye shielding
-Lioville's Theorem (ch. 6 of nicholson)- in xv phase space, if have volume, evolve under equations, then volume conserved
-assuming this gives a conservation equation (insert equation with weird D)
-this equation still easier than so many from the problem
-thinking more about distribution
-going to track the distribution of particles
-where in real and velocity space
-collision operator in code- so codes don't have collision C[f], just incl operator
-resistive tearing mode relies on having a collision operator
3 more parameters!
-parameters are relatable
1. Plasma frequency
(insert math from notes on paper)
these 2 parameters- when introduce a magnetic field!!!
2. Gyro frequency (Cyclotron frequency)
-velocity vector assumes harmonic motion
3. Gyro Radius (Larmor radius)
likewise
-relate to thermal speed & cyclo. freq.
also: thermal velocity!
used these instructions to download cygwin c++ compiler: stuck at part 8,4
https://netbeans.org/community/releases/72#cygwin
use set up to add packages to cygwin incl. c++ comiler
website with input code
http://ammar-hakim.org/sj//cpp-setup-instructions.html
.lua files
finite difference, volume, element
numerical methods resources:
http://www.cfm.brown.edu/people/jansh/resources/Publications/Lectures/RMMC08-I.pdf
https://en.wikipedia.org/wiki/Finite_volume_method
https://en.wikipedia.org/wiki/Finite_difference_method
https://en.wikipedia.org/wiki/Finite_element_method
http://www.math.uci.edu/~chenlong/226/FVM.pdf
http://crd.lbl.gov/assets/pubs_presos/AMCS/ANAG/A137.pdf
----------------------------
3/25 meeting
-log into xsede
-go to putty
-log in using xsede log in
-go to amar haakim bit bucket and clone gekyll all
-same thing for gekyll
-go to gekyll folder
-mkgkeall.sh and then it goes crazy
cd $WORK
-work directory
run code in scratch directory
cd $SCRATCH
work director where .exe file will be
output in scratch
in gekyll all, clone gekyll
gekyll directory where all the code is that solves everything
./mkgkeall.sh giant shell script
if close your computer to restart installation process do this:
go to work
go to gekyll all
do ./mkgkeall command
then it will restard
right click to paste
host name:
login.xsede.org
then user name and passwork from xsede
--------------------------
results after ./mkgkeall command:
then did the following commands:
cd $WORK
cd gkeyllall/gkeyll
hg pull
cd ..
hg pull
./mkgkeall.sh
--------------------------
look at this:
-https://en.wikipedia.org/wiki/Weibel_instability (look at this and papers)
-file:///C:/Users/SHR/Downloads/CalifanoWeibel.pdf (look at this paper)
----------------------------
Meeting 4/5/2016
-fixing computing stuff
go to gkeyllall
cd builds/gkeyll/par
make
result:
presentation: what the wybel instability is and why its an instability
Information about the Wybel stability:
http://scitation.aip.org/docserver/fulltext/aip/journal/pof1/2/3/1.1705933.pdf?expires=1459928542&id=id&accname=2091355&checksum=EBC1754243797D889521717125A82394
http://journals.aps.org/prl/pdf/10.1103/PhysRevLett.2.83
https://en.wikipedia.org/wiki/Weibel_instability
http://blog.sciencenet.cn/blog-1449970-813958.html
https://drive.google.com/file/d/0B6YOud__8EgKMHNQN3pNM1pISzEzTjROZFkzRFN6b3UyODJZ/view?usp=sharing
(paper that we will by replicating the analysis)
go to gkeyllall then did these commands:
tail -f -n 1000
on the .out file in gkeyllall
result:
this website:
https://portal.tacc.utexas.edu/password-reset/-/password/request-reset
put tacc number and then sent password request so that able to log in directly
tg833855
-------------------
4/12 meeting
-never change first line
-first line tells what the job is called (probably ddont have to change)
- -n with number
*request between 16 and 256 processors*
*dont ask for a prime number*
#SBATCH -t is the time 2:00:00
runs job faster if ask for less
#SBATCH --mail-user=jjuno@umd.edu (change this to your email)
long line
project directory
change end of long line
organize this in some fashion
directory weibel
mkdir
make a new folder for each simulationn
copy lewis script and this file into that folder
-dont have to change processors or time requested
most important thing to change is email and end of long line, so that its your input file
other file
speeds written in terms of speed of light
dont chane temperature mass charge
vary k0 to establish a spectrum of growth rates, between 0.01 and 10
a0sin(kx) (a0 called pertub)
give sinusoidal pertubation
dont change LX (size of box)
change resolution, time stepping
NX, resolution in x space (dont go lower than 64 or higher than 512)
nvx, etc is resolution in y space (dont go lower than 8 or higher than 64), if chnage velocity space values change all 3 not 1 at a time
change one, change other fixed
polynomial order- change
log(string...) all this stuff prints diagnostics (for example, can pick vl vu to be greater than 1 bc then thats greater than c)
vary phaseDecomp - tells how to do domain decomposition, dividing work amongst processors
cuts (1,1,1,1) when multiple all together this gives number of processors requestions, so 1 in this case
beyond that don't change anything
initial
fields
pertubations in bz
c++ the first entry is entry 0
gkeyllall/gkeyll/scripts/gkeplot.py
moodule list (to check)
then make sure there is a pyton there
after simulation is done
type
-y (name of script)_emEnergy
emEngery is basically integral B^2/2mu0 at every point in time
plots info for every timestep
plot that as a function of time
exponential growth , linear in log space
growth e^gamma t
find what gamma is!!!
--write-history (this writes everything to a textfile)
result will be (name of file)_emEnergy.txt
file will have 2 colums
first is time, second is integral B^2?2mu0
once you run a simulation
pull text file off of stampede
plot text file
write to array time
write to em energy
plot time vs. log of integral B^2/2mu0 then find the slope!
on thursday show a single plot or assortment of plots
on the y axis- the growth rate
on the x axis- some varying parameter (any that vary)
k0 will be dispersion relation (most interesting)
accumulate what gamma is when vary each paramter
converge to some value for some of parameters
error associated with descritization
weibel 1x3v
weibel 1x2v
retain or don't retain z velocity
pertubation in bz
sbatch to que simulation
squeue -u tgusername
gives status of the job
stampede.tacc.xsede.org
use tg username and new password
mkdir weibel (new directory in gkeyll)
check sbatch _______.pbs to make sure
------------------------------------------------------------------------
uploaded files to the cluster by copying from my github
git clone https://github.com/ShainaRudman/HONRPHYS.git
changed name to weibel
edit this file gkeyll_test_trunk.pbs
this file used to send jobs to the cluster
------------------------------------------------------
4/19/2016 meeting
change t=100 to t=50
plots of growth rates for varying parameters
format long
matlab
test=testread('nameoffile.txt')
time = test (:,1)
mEnergy = test (:,2)
semilogy(time,mEnergy)
didn't understand that the .lua and .pbs files need to be in the scratch directiory not in work directory
use cp to copy files to different directories (do this while in the directory of the file you want to copy)
cp (filename.lua) /path/want/to/copy/to
squeue -u yourusername
scancel jobnumber
input file changed
needed to change this line in the .lua original file
phaseDecomp = DecompRegionCalc3D.CartProd { cuts = {1,1,1} }
change cuts to 4 4 16 so the product is 256
do this command in the folder where the .lua and .pbs files are
/work/04086/tg833855/gkeyllall/gkeyll/scripts/gkeplot.py -y weibel_1X2V_Bz2 --write-history
this creates a graph and a text file
this is the graph created for the trial simulation where i didnt change anything, a text file is also created with 2 columns
need to create a folder for each simulation
copy original files to this directory
change the .lua file name
mv (old name) (new name)
to remove all log files:
rm -rf *.log
I was having problems with creating new folders and renaming so i just kept the same directory and changed the text file name each time to designate the parameter value, and deleting all the .log and .h5 files after each run
1. change parameter value in .lua file
2. run simulation using sbatch command
3. use -y command to get graph and text file
4. save graph
5.delete all log files and h5 files
6. rename txt file to have parameter value in name
7. repeat with more values
**make sure you have X11 enabled**
next need to pull files from the cluster onto my computer so that i can use matlab to make log graphs on matlab, and then find each of the slopes
10 slopes to find
To put file in my documents
scp tg833855@login3.stampede:/scratch/04086/tg833855/weibel/weibel_1X2V_Bz2_80.txt UserSHRDocuments
for some reason this command isnt working even though it says it is