Sha256: 5a102c592c5740a718d8b27e952a519f890cf4b6412a4e4b45d82ba29aefbb71

Contents?: true

Size: 1.09 KB

Versions: 184

Compression:

Stored size: 1.09 KB

Contents

##########################################
# Calculations for AGK Code Runner Module
# (Only if they differ from GS2)
#
# This module contains any methods that
# begin with the word calculate. 
#
# These methods calculate results and 
# quantities that are not directly 
# obtainable from the GS2 output files.
#
##########################################


class CodeRunner
class Gs2::Astrogk 

	def read_transfers
		Dir.chdir(@directory) do
			raise "No ktrans file" unless FileTest.exist? "#@run_name.ktrans"
		file = File.open("#@run_name.ktrans", "r")
		wtr_hash = {}
		etr_hash = {}
		while line = file.gets
			#p line;
			arr =   line.split(/\s+/).map{|w| w.to_f}
			#p arr
			dud, t, kf, kt, w, e = arr
			next unless t 
			etr_hash[t] ||= {}
			etr_hash[t][kf] ||= {}
			etr_hash[t][kf][kt] = e

			wtr_hash[t] ||= {}
			wtr_hash[t][kf] ||= {}
			wtr_hash[t][kf][kt] = w




		end

		
		#p etr_hash

		File.open('energy_transfer.rb', 'w'){|file| file.puts etr_hash.pretty_inspect}
		File.open('w_transfer.rb', 'w'){|file| file.puts wtr_hash.pretty_inspect}

		end # Dir.chdir(@directory)

	end


end
end


Version data entries

184 entries across 184 versions & 1 rubygems

Version Path
gs2crmod-0.12.17 lib/gs2crmod/astrogk/calculations.rb
gs2crmod-0.12.16 lib/gs2crmod/astrogk/calculations.rb
gs2crmod-0.12.15 lib/gs2crmod/astrogk/calculations.rb
gs2crmod-0.12.14 lib/gs2crmod/astrogk/calculations.rb
gs2crmod-0.12.13 lib/gs2crmod/astrogk/calculations.rb
gs2crmod-0.12.12 lib/gs2crmod/astrogk/calculations.rb
gs2crmod-0.12.11 lib/gs2crmod/astrogk/calculations.rb
gs2crmod-0.12.10 lib/gs2crmod/astrogk/calculations.rb
gs2crmod-0.12.9 lib/gs2crmod/astrogk/calculations.rb
gs2crmod-0.12.8 lib/gs2crmod/astrogk/calculations.rb
gs2crmod-0.12.7 lib/gs2crmod/astrogk/calculations.rb
gs2crmod-0.12.6 lib/gs2crmod/astrogk/calculations.rb
gs2crmod-0.12.5 lib/gs2crmod/astrogk/calculations.rb
gs2crmod-0.12.4 lib/gs2crmod/astrogk/calculations.rb
gs2crmod-0.12.3 lib/gs2crmod/astrogk/calculations.rb
gs2crmod-0.12.2 lib/gs2crmod/astrogk/calculations.rb
gs2crmod-0.12.1 lib/gs2crmod/astrogk/calculations.rb
gs2crmod-0.12.0 lib/gs2crmod/astrogk/calculations.rb
gs2crmod-0.11.101 lib/gs2crmod/astrogk/calculations.rb
gs2crmod-0.11.100 lib/gs2crmod/astrogk/calculations.rb