pro read_parameters, file_name, redshift=redshift, InitialTime=InitialTime, $ InitialRedshift=InitialRedshift, DataDumpNumber=DataDumpNumber, $ lengthunit=lengthunit, timeunit=timeunit, velocityunit=velocityunit, $ densityunit=densityunit, temperatureunit=temperatureunit, $ DomainLeftEdge=DomainLeftEdge, DomainRightEdge=DomainRightEdge, gamma=gamma fstring = read_ascii_file_return_list_of_strings(file_name, $ /verbose, nlines=nlines) InitialRedshift = 0.D InitialTime = 0.D ComovingBoxSize = 0 HubbleConstantNow = 0. OmegaNow = 0. Gamma=5./3. DataDumpNumber = 0 unitvalue = 0. unitlabel='' lengthunit = 1. timeunit = 1. temperatureunit = 1. densityunit = 1. DomainLeftEdge = [0.,0.,0.] DomainRightEdge = [1.,1.,1.] if N_elements(fstring) lt 2 then return redshift = -1.D whereRed = where(strmatch(fstring, 'CosmologyCurrentRedshift*') eq 1) whereIRed = where(strmatch(fstring, 'CosmologyInitialRedshift*') eq 1) whereCBS = where(strmatch(fstring, 'CosmologyComovingBoxSize*') eq 1) whereH0 = where(strmatch(fstring, 'CosmologyHubbleConstantNow*') eq 1) whereOmega0 = where(strmatch(fstring, 'CosmologyOmegaMatterNow*') eq 1) whereIt = where(strmatch(fstring, 'InitialTime*') eq 1) whereGamma = where(strmatch(fstring, 'Gamma*') eq 1) whereDDNum = where(strmatch(fstring, 'DataDumpNumber*') eq 1) whereLU = where(strmatch(fstring, 'LengthUnit*') eq 1) whereDU = where(strmatch(fstring, 'DensityUnit*') eq 1) whereTU = where(strmatch(fstring, 'TimeUnit*') eq 1) whereDL = where(strmatch(fstring, 'DomainLeftEdge*') eq 1) whereDR= where(strmatch(fstring, 'DomainRightEdge*') eq 1) if whereLU[0] ge 0 then begin hs = fstring[whereLU[0]] value = strmid(hs,strpos(hs, '=')+1) lengthunit = DOUBLE(value) endif if whereDU[0] ge 0 then begin hs = fstring[whereDU[0]] value = strmid(hs,strpos(hs, '=')+1) densityunit = DOUBLE(value) timeunit = 1.D/(sqrt(6.673e-8*densityunit)) ; this gets overidden if timeunit is in the file: endif if whereTU[0] ge 0 then begin hs = fstring[whereTU[0]] value = strmid(hs,strpos(hs, '=')+1) timeunit = DOUBLE(value) endif if whereRed[0] ge 0 then begin hs = fstring[whereRed[0]] value = strmid(hs,strpos(hs, '=')+1) redshift = DOUBLE(value) endif if whereH0[0] ge 0 then begin hs = fstring[whereH0[0]] value = strmid(hs,strpos(hs, '=')+1) HubbleConstantNow = DOUBLE(value) endif if whereOmega0[0] ge 0 then begin hs = fstring[whereOmega0[0]] value = strmid(hs,strpos(hs, '=')+1) OmegaNow = DOUBLE(value) endif if whereIRed[0] ge 0 then begin hs = fstring[whereIRed[0]] value = strmid(hs,strpos(hs, '=')+1) InitialRedshift = DOUBLE(value) endif if whereCBS[0] ge 0 then begin hs = fstring[whereCBS[0]] value = strmid(hs,strpos(hs, '=')+1) ComovingBoxSize = DOUBLE(value) mpc = 3.086d24 rho0 = 3.D*OmegaNow * HubbleConstantNow^2 * (1d7/Mpc)^2/(8.*!pi*6.673e-8) timeunit = 1d/sqrt(4.*!PI*6.673e-8*rho0 * (1.+InitialRedshift)^3) temperatureunit = 1.88d6*ComovingBoxSize^2*OmegaNow*(1.+InitialRedshift) ; densityunit = rho0*(1.+redshift)^3 ; leave these comoving so they are the same for every data dump densityunit = rho0 ; lengthunit = ; mpc*ComovingBoxSize/HubbleConstantNow/(1.+redshift) lengthunit = mpc*ComovingBoxSize/HubbleConstantNow velocityunit = lengthunit/timeunit/(1.+InitialRedshift) endif if whereIt[0] ge 0 then begin hs = fstring[whereIt[0]] value = strmid(hs,strpos(hs, '=')+1) InitialTime = DOUBLE(value) endif if whereGamma[0] ge 0 then begin hs = fstring[whereGamma[0]] value = strmid(hs,strpos(hs, '=')+1) Gamma = FLOAT(value) endif if whereDDNum[0] ge 0 then begin hs = fstring[whereDDNum[0]] value = strmid(hs,strpos(hs, '=')+1) DataDumpNumber = FIX(value) endif ;; if whereDCGS[0] ge 0 then begin ;; nun = N_ELEMENTS(whereDCGS) ;; unitvalue = fltarr(nun) ;; unitlabel = STRARR(nun) ;; unitfield = STRARR(nun) ;; for i=0, nun-1 do begin ;; hs = fstring[whereDCGS[i]] ;; values = str_sep(strtrim(strmid(hs,strpos(hs, '=')+1), 2), ' ') ;; unitvalue[i] = FLOAT(values[0]) ;; unitlabel[i] = values[1] ;; hs = fstring[whereDCGS[i]-1] ;; unitfield[i] = strmid(hs,strpos(hs, '= ')+1) ;; endfor ;; endif if (redshift eq -1) then begin ; redshift = -InitialTime print, 'Time:', InitialTime, ' from file:', file_name end else print, 'Redshift:', Redshift, ' from file:', file_name if whereDL[0] ge 0 then begin hs = fstring[whereDL[0]] value = strmid(hs,strpos(hs, '=')+1) str_to_flt_arr, value, DomainLeftEdge endif if whereDR[0] ge 0 then begin hs = fstring[whereDR[0]] value = strmid(hs,strpos(hs, '=')+1) str_to_flt_arr, value, DomainRightEdge endif if (InitialRedshift eq 0.) then velocityunit = lengthunit/timeunit end