#! /usr/bin/env ruby cfgfile = "DataFile.dat.orig" outfile = "DataFile.dat" #solar = [1, 5, 10] solar = 25 planet = "jupiter" temp_ini = 507.0 delt = 1.0 #== ファイルから初期圧力だけ抜き出す ifile = open(cfgfile, "r") while line = ifile.gets line.chomp! if line =~ /^\s+pres_ini\s+=\s*(\S+)\s*$/ pres = $1 p pres end end ##== 組成を変える #i = 0 #while i < solar.length #== 温度を変化させながら計算を行う. 10.times do |i| temp = temp_ini + delt * i p solar, temp outfile2 = outfile + '_x' + solar.to_s + '_' + temp.to_s ifile = open(cfgfile, "r") ofile = open(outfile2, "w" ) while line = ifile.gets line.chomp! if line =~ /^\s+temp_ini/ ofile.print ' temp_ini = '+temp.to_s+'d0', "\n" elsif line =~ /^\s+AdbtFile/ ofile.print ' AdbtFile = "./obradbt_' + planet + '_x' + solar.to_s + '_' + temp.to_s + 'K-' + pres + 'Pa.nc"', "\n" elsif line =~ /^\s+AtmosFile/ ofile.print ' AtmosFile = "./obratmos_' + planet + '_x' + solar.to_s + '_' + temp.to_s + 'K-' + pres + 'Pa.nc"', "\n" else ofile.print line, "\n" end end # system('/home/sugiyama/work/oboro/oboro1/obradbt/obradbt') # system('/home/sugiyama/work/oboro/oboro1/obratmos/obratmos') end # i += 1 #end