Posts in category script

Core mass script documentation

Toward the end of last week I worked on writing a script that would open, read and write the mass data in the sinks_*.okc files to a new .csv file (In particular for the CollidingFlows problem, see our data here: CollidingFlowsFigures). The purpose of this was to gain all of the sink data over time, so that we could visualize it, as you can see by the results I have posted below. These charts will allow us to observe how the sinks accumulate mass over the time of the simulation. Here I will document the development of my code, and discuss what else I would like to do with it.

Objectives

Editing code:

  • Write information of the density/mass of the cores to a .csv file
  • Convert the information from the .csv into solar masses and Myr.
  • Take converted .csv file and make graphs using matplotlib, or excel. Excel is quick, but a code that can do all of this and generate plots in one swoop would be super efficient for later uses.
  • Document and post concise and general form under the VisIt page as a script tab.

So far I have completed the first bullet~ (02-09-2015)

Editing charts:

  • Convert mass to solar masses.
  • Convert time to Myr.
  • Crop the x-axes to when the first sink forms. Get rid of the 0 values.
  • Fix x and y-axes to be the same for all the runs.

okc_to_csv.py v. 1

Screen capture of code Screen capture of .okc file
okc to csv v. 1 screencap screen cap of okc

The code reads the first line of the .okc file, splits the numbers into a list of ints. It then uses those numbers in order to access the data below that starts at the 34th line. The only parts that are hard coded are the headers for the columns of the csv file (L17) and the number of lines of data it has to read into the .csv (L27). Essentially you change this by the number of sinks that form by the end of the simulation. You can check this by counting the number of lines of data that are spit out by the final frame of the simulation.

Results 02-09-2015

Shear 0 chart of unconverted sink masses (s0)
Shear 15 chart of unconverted sink masses (s15)
Shear 30 chart of unconverted sink masses (s30)
Shear 60 chart of unconverted sink masses (s60)