diff --git a/Gtools/gscripts/gSetCosmoBox b/Gtools/gscripts/gSetCosmoBox new file mode 100755 index 0000000..64b3663 --- /dev/null +++ b/Gtools/gscripts/gSetCosmoBox @@ -0,0 +1,133 @@ +#!/usr/bin/env python + +from pNbody import units,io,ctes,cosmo +from numpy import * +import sys + +from optparse import OptionParser + + +def parse_options(): + + + usage = "usage: %prog [options] file" + parser = OptionParser(usage=usage) + + + parser.add_option("--Omega0", + action="store", + dest="Omega0", + type="float", + default = 0.315, + help="Omega0", + metavar=" FLOAT") + + parser.add_option("--OmegaLambda", + action="store", + dest="OmegaLambda", + type="float", + default = 0.685, + help="OmegaLambda", + metavar=" FLOAT") + + + parser.add_option("--OmegaBaryon", + action="store", + dest="OmegaBaryon", + type="float", + default = 0.0486, + help="OmegaBaryon", + metavar=" FLOAT") + + parser.add_option("--HubbleParam", + action="store", + dest="HubbleParam", + type="float", + default = 0.673, + help="HubbleParam", + metavar=" FLOAT") + + parser.add_option("--UnitLength_in_cm", + action="store", + dest="UnitLength_in_cm", + type="float", + default = 3.085678e21, + help="UnitLength_in_cm", + metavar=" FLOAT") + + parser.add_option("--UnitVelocity_in_cm_per_s", + action="store", + dest="UnitVelocity_in_cm_per_s", + type="float", + default = 1e5, + help="UnitVelocity_in_cm_per_s", + metavar=" FLOAT") + + parser.add_option("--UnitMass_in_g", + action="store", + dest="UnitMass_in_g", + type="float", + default = 1.989e43, + help="UnitMass_in_g", + metavar=" FLOAT") + + parser.add_option("--BoxSize", + action="store", + dest="BoxSize", + type="float", + default = 100, + help="boxsize in Mpc", + metavar=" FLOAT") + + parser.add_option("--level", + action="store", + dest="level", + type="int", + default = 9, + help="resolution level", + metavar=" INT") + + (options, args) = parser.parse_args() + + return options + + +opt = parse_options() + + +Omega0 = opt.Omega0 +OmegaLambda = opt.OmegaLambda +OmegaBaryon = opt.OmegaBaryon +HubbleParam = opt.HubbleParam + + +params = {} +params['UnitLength_in_cm'] = opt.UnitLength_in_cm +params['UnitVelocity_in_cm_per_s'] = opt.UnitVelocity_in_cm_per_s +params['UnitMass_in_g'] = opt.UnitMass_in_g + +system_of_units = units.Set_SystemUnits_From_Params(params) + +G=ctes.GRAVITY.into(system_of_units) +H = ctes.HUBBLE.into(system_of_units) + + +rhoc = pow(H,2)*3/(8*pi*G) +#print rhoc,"in code units, h not used" + + +out_units = units.UnitSystem('local',[units.Unit_kpc,units.Unit_Msol,units.Unit_s,units.Unit_K]) + + +L = opt.BoxSize*1000 +V = L**3 +M = V*rhoc*Omega0 + +n = 2**opt.level +N = n**3 + +MDM0 = M/N * system_of_units.convertionFactorTo(out_units.UnitMass) +print "%d particules in one side"%n +print "%d particules"%N +print "%g Msol"%MDM0 + diff --git a/Gtools/gscripts/ghelp b/Gtools/gscripts/ghelp index b7e7b20..394acba 100755 --- a/Gtools/gscripts/ghelp +++ b/Gtools/gscripts/ghelp @@ -1,277 +1,287 @@ #!/usr/bin/env python print """ ################################################ gscripts/ ################################################ ################################################ # utilities gatime2Myr --param params --a1 0.01 --a2 0.02 gatime2Myr --param params --a 0.1914 --da 7.56271e-09 gatime2Myr --param params --a 0.1914 --Dloga 3.95127e-08 ################################################ # run preparation +# determine the memory allocation for gadget -galloc : determine the memory allocation for gadget +galloc + + +# set output timesteps for cosmological simulations + +gmktimesteps -p 10 > outputtimesteps.txt -gmktimesteps : set output timesteps for cosmological simulations - - gmktimesteps -p 10 > outputtimesteps.txt +# set the number of particles and masses for a cosmological simulation -gread_header : return some info on the header (incomplete, actually return the atime) +gSetCosmoBox --level 8 --BoxSize 5 - gread_header snap.dat +# return some info on the header (incomplete, actually return the atime) -gheader : return some info on the header +gread_header snap.dat - gheader snap.dat +# return some info on the header -addgas : add gas to a cosmological box +gheader snap.dat + + +# add gas to a cosmological box + +addgas # setup initial redshift for (zoom-in) cosmological simulations + ggetZiforCosmoSims --N2 512 --N1 64 -L 3.442 ################################################ # global statitics on the run gcpu : plot cpu info gcpu cpu.txt gcpu -o budget --legend cpu.txt gcpu -o gravity --legend cpu.txt gcpu -o hydro --legend cpu.txt genergy : plot info relative to the energy genergy --relative energy.txt genergy -o EnergyKineticFeedback energy.txt gplot_energy : plot info relative to the energy budget gplot_energy --legend energy.txt gsteps : plot info relative to the steps gsteps info.txt gsteps -rf info.txt gsteps --param params --log y --rf 100 info.txt ################################################ pscripts/ ################################################ ################################################ # global output analysis # star formation rate and stellar mass (sfr.txt) pSfrvsTime --param params -o SFR sfr.txt pSfrvsTime --param params -o MSTARS sfr.txt pSfrvsTime --param params -o MNEWSTARS sfr.txt pSfrvsTime --param params -o sfr sfr.txt pSfrvsTime --param params -o mnewstars --integrate --derive --rf 100 sfr.txt pSfrvsTime --param params -o mstars sfr.txt # supernovae (chimie.txt) gSNvsTime -o NSNII,NSNIa --rf 1000 chimie.txt gSNvsTime -o EgySNThermal,EgySNKinetic --rf 1000 chimie.txt gSNvsTime -o EgySNThermal,EgySNKinetic --integrate chimie.txt gSNvsTime -o Nflag --rf 1000 chimie.txt gSNvsTime -o Nflag --integrate chimie.txt # accretion (accretion.txt) gAccretionvsTime -o MT accretion.txt gAccretionvsTime -o MT_th accretion.txt gAccretionvsTime -o DMDT accretion.txt gAccretionvsTime -o DMDT_th accretion.txt ################################################ # unit conversion # change units, including the little h (Hubble parameter) if it is different than 1 gchangeunits --param1 params --param2 params.dSph snap1.dat -o snap2.dat # correct from scaling factor (and add the correct time in code unit) gcosmo2giso --param1 params --param2 params.dSph snap2.dat -o snap3.dat ################################################ # Jeans Informations gJeans --Density 1e3 --Temperature 10 pJeansTemperature --xmin -7 --xmax 7 --ymin 1 --ymax 7 --ParticleMass 4000 --NJeans 10 ################################################ # snapshot analysis # luminosity pget_Luminosity --param params snap.dat pget_Luminosity --param params --tnow 3000 snap.dat # virial radius pget_VirialRadius --param params -dX 200 snap.dat # star formation rate pSFRvsTime --param params -o SFR --xmin=0 --xmax=14 snap.dat # mass vs time pSFRvsTime --param params -o MSTARS --xmin=0 --xmax=14 snap.dat pSFRvsTime --param params -o MSTARSz --xmin=0 --xmax=10 snap.dat pSFRvsTime --param params -o MSTARSa --xmin=0 --xmax=1 snap.dat # logRho - logT -pplot --param params --select=gas --x logrho --y logT --xmin -3 --xmax 0 --ymin 1 --ymax 5 snap.dat -pplot --param params --select=gas --x logrho --y logT --xmin -3 --xmax 0 --ymin 1 --ymax 5 --map snap.dat +pplot --param params --select=gas --x logrho --y logT --xmin -7 --xmax 7 --ymin 1 --ymax 7 snap.dat +pplot --param params --select=gas --x logrho --y logT --xmin -7 --xmax 7 --ymin 1 --ymax 7 --map snap.dat pplot --param params --select=gas --colorbar --log z --x logrho --y logT --z Tcool --xmin -3 --xmax 0 --ymin 1 --ymax 5 --zmin 1 --zmax 1e16 snap.dat # rho - T pplot --param params --select=gas --x rho --y T --log xy --xmin 1e-3 --xmax 1e0 --ymin 1e1 --ymax 1e5 snap.dat # R - T pplot --param params --select=gas --x R --y logT snap.dat # R - Fe pplot --param params --select=gas --x R --y Fe snap.dat # MgFe - Fe pplot --param params --select=stars1 --x Fe --y MgFe --xmin=-4 --xmax=0.5 --ymin=-1 --ymax=1.5 snap.dat pplot --param params --select=stars1 --x Fe --y MgFe --xmin=-4 --xmax=0.5 --ymin=-1 --ymax=1.5 --map snap.dat # Fe - Age pplot --param params --select=stars1 --x Age --y Fe --xmin=0 --xmax=14 --ymin=-4 --ymax=0.5 snap.dat # Tcool pplot --param params --select=gas --x logrho --y Tcool --xmin=-5 --xmax=2 --ymin 0 --ymax 1e16 --log y snap.dat ################################ # metallicite ################################ # MgFevsFe pMgFevsFe --select=stars1 --xmin=-4 --xmax=0.5 --ymin=-1 --ymax=1.5 --map snap.dat # BaFevsFe pBaFevsFe --select=stars1 --xmin=-4 --xmax=0.5 --ymin=-1 --ymax=1.5 --map snap.dat # [E1/E2] vs [E3/E4] pplot --select=stars1 --xmin=-4 --xmax=0.5 --ymin=-1 --ymax=1.5 --map --x Fe/H --y Ba/Fe snap.dat # NvsAge pNvsX --param params --select stars1 --x Age --nx 14 --xmin=0 --xmax=14 snap.dat # NvsFe pNvsX --param params --select stars1 --x Fe --nx 40 --xmin=-4 --xmax=0.5 --ymin=0 --ymax=0.15 snap.dat ################################ # profiles ################################ # grille spherique # density pSphericalProfile -o density --xmax 10 --rmax 10 --nr 64 --center histocenter --log xy --param params snap.dat # masse pSphericalProfile -o mass --xmax 10 --rmax 10 --nr 64 --center histocenter --log xy --param params snap.dat # integrated mass pSphericalProfile -o imass --xmax 10 --rmax 10 --nr 64 --center histocenter --log xy --param params snap.dat # velocity disp. in z pSphericalProfile -o sigmaz --xmax 10 --rmax 10 --nr 64 --center histocenter --param params snap.dat # circular velocity pSphericalProfile -o vcirc --xmax 10 --rmax 10 --nr 64 --center histocenter --param params --eps 0.1 snap.dat # grille cylindrique # density pCylindricalProfile -o sdens --xmax 10 --rmax 10 --nr 64 --center histocenter --log xy --param params snap.dat # masse pCylindricalProfile -o mass --xmax 10 --rmax 10 --nr 64 --center histocenter --log xy --param params snap.dat # integrated mass pCylindricalProfile -o imass --xmax 10 --rmax 10 --nr 64 --center histocenter --log xy --param params snap.dat # velocity disp. in z pCylindricalProfile -o sigmaz --xmax 10 --rmax 10 --nr 64 --center histocenter --param params snap.dat # circular velocity pCylindricalProfile -o vcirc --xmax 10 --rmax 10 --nr 64 --center histocenter --param params --eps 0.1 snap.dat # luminosity profile pCylindricalProfile -o Lum --xmax 10 --rmax 10 --nr 64 --center histocenter --select stars1 --param params snap.dat ############################################################ # velocities and velocity dispertions in cylindrical coords ############################################################ # extract all gExtractCylindrical --Rmax 10 --components="('gas','stars1','halo1')" --disk="('gas','stars1')" --nR 32 --eps=0.01 --nmin 3 --param params snap.dat # number of points per bins pplotdmp --mode=Numbers gas.dmp # circular velocity per component pplotdmp --mode=Velocities --legend gas.dmp stars1.dmp halo1.dmp # velocities and velocity disp pplotdmp --mode=Dispersions --legend gas.dmp # stability Toomre paramter Q pplotdmp --mode=Q gas.dmp """