def getTimeUnifiedTables(*ttuple): """ principe : on envoie N tables dans la fonction, et on recupere N tables dont les instants sont l'union des instants de chacune des tables initiales """ tablist = toList(ttuple) glue = tuple([x.getColumn(0).tolist() for x in tablist]) if not len(glue): return temporary = glue[0] for element in glue[1:len(glue)]: for item in element: if item not in temporary: temporary.append(item) pass pass pass temporary.sort() new_tables = [] for tabl in tablist: extravalues = interpolate(temporary, tabl) colt = tabl.getColumnTitles() tnew = Table(tabl.getTitle()) tnew.addColumn(colt[0], temporary) tnew.addColumn(colt[1], extravalues) new_tables.append(tnew) pass return new_tables
#~~~~~~~~~~~~~~~~~~ K_unk = module.getOutput('KOutput') KX_unk = module.getOutput('KXOutput') T_unk = module.getOutput('TOutput') time = K_unk[-1][0] print "time",time KY = K_unk[-1][1] TY = T_unk[-1][1] XListe = KY.getColumn(0) dx0 = dx[1] dxListe = [dx0] * (len(XListe)) from posttables import Table tab1 = Table('KY') tab1.addColumn('X',XListe) tab1.addColumn('Y',KY.getColumn(1)) tab1.addColumn('K',KY.getColumn(2)) KY = tab1 tab2 = Table('KT') tab2.addColumn('X',XListe) tab2.addColumn('Y',TY.getColumn(1)) tab2.addColumn('K',TY.getColumn(2)) TY = tab2 from _erffunctions import * C0 = 1.00058350e-06 porosity = 0.3 darcy = 1.e-3/3600
print res_ph[-1][1].column_names print res_ph[-1][1].values[-1] NadeX = res_na[-1][-1] pHdeX = res_ph[-1][-1] tps = res_ph[-1][0] liste_X = NadeX.getColumn(0) dx0 = liste_X[0] liste_dx0 = [dx0] * (len(liste_X)) print len(liste_dx0) liste_decalX = subtractLists(liste_X,liste_dx0) print len(liste_decalX) from posttables import Table tab1 = Table(name='TabNa') tab1.addColumn('X',liste_decalX) print "dbg0 ",len(liste_decalX),len(NadeX.getColumn(1)) tab1.addColumn('Y',NadeX.getColumn(1)) print "dbg1 ",len(NadeX.getColumn(2)) tab1.addColumn('Na',NadeX.getColumn(3)) NadeX = tab1 tab2 = Table(name='TabpH') tab2.addColumn('X',liste_decalX) tab2.addColumn('Y',pHdeX.getColumn(1)) tab2.addColumn('pH',pHdeX.getColumn(3)) pHdeX = tab2 print 'Times = ',tps,' secondes' print ''
res_cs = module.getOutput('CsOutput') tab = [] CsdeX = res_cs[-1][1] #========================= # dx0 translation #========================= liste_X = CsdeX.getColumn(0) dx0 = dx [0] liste_dx0 = [dx0] * (len(liste_X)) liste_decalX = subtractLists(liste_X,liste_dx0) from posttables import Table resTable = Table(name="TabCs") resTable.addColumn("X",liste_decalX) resTable.addColumn("Y",CsdeX.getColumn(1)) resTable.addColumn("Cs",CsdeX.getColumn(2)) CsdeX = resTable print 'len(CsdeX.getColumn(2)) =',len(CsdeX.getColumn(2)) CsdeX. writeToFile('CsdeX_10j.tab') #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # Comparison to analytical concentration ~ #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ print "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" print " compared to analytical solution" print "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
#~~~~~~~~~~~~~~~~~~ res_ph = module.getOutput('pH_output') res_na = module.getOutput('Na_output') NadeX = res_na[-1][1] pHdeX = res_ph[-1][1] time = res_ph[-1][0] print "time:", time dx0 = dx[1] liste_X = NadeX.getColumn(0) liste_dx0 = [dx0] * (len(liste_X)) liste_decalX = subtractLists(liste_X,liste_dx0) from posttables import Table tab1 = Table(name = 'TabNa') tab1.addColumn('X',liste_decalX) tab1.addColumn('Y',NadeX.getColumn(1)) tab1.addColumn('Na',NadeX.getColumn(2)) NadeX = tab1 tab2 = Table(name = 'TabpH') tab2.addColumn('X',liste_decalX) tab2.addColumn('Y',pHdeX.getColumn(1)) tab2.addColumn('Na',pHdeX.getColumn(2)) pHdeX = tab2 pHdeX. writeToFile('pHdeX_10j.tab') NadeX. writeToFile('NadeX_10j.tab') #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
res_cs = module.getOutput('CsOutput') tab = [] CsdeX = res_cs[-1][1] print CsdeX.getColumn(0) print CsdeX.getColumn(1) print CsdeX.getColumn(2) print CsdeX.getColumn(3) #raw_input("column 3") #========================= # dx0 translation #========================= from posttables import Table resTable = Table(name="TabCs") resTable.addColumn("X",CsdeX.getColumn(0)) resTable.addColumn("Y",CsdeX.getColumn(1)) resTable.addColumn("Cs",CsdeX.getColumn(3)) CsdeX = resTable print 'len(CsdeX.getColumn(2)) =',len(CsdeX.getColumn(2)) CsdeX. writeToFile('CsdeX_10j.tab') # #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # Comparison to analytical concentration ~ #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # print "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" print " compared to analytical solution " print "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
#~~~~~~~~~~~~~~~~~~ K_unk = module.getOutput('KOutput') KX_unk = module.getOutput('KXOutput') T_unk = module.getOutput('TOutput') time = K_unk[-1][0] print "time", time KY = K_unk[-1][1] TY = T_unk[-1][1] XListe = KY.getColumn(0) dx0 = dx[1] dxListe = [dx0] * (len(XListe)) from posttables import Table tab1 = Table('KY') tab1.addColumn('X', XListe) tab1.addColumn('Y', KY.getColumn(1)) tab1.addColumn('K', KY.getColumn(2)) KY = tab1 tab2 = Table('KT') tab2.addColumn('X', XListe) tab2.addColumn('Y', TY.getColumn(1)) tab2.addColumn('K', TY.getColumn(2)) TY = tab2 from _erffunctions import * C0 = 1.00058350e-06 porosity = 0.3 darcy = 1.e-3 / 3600
KX_unk = module.getOutput("KX_output") print "KX =", KX_unk[-1][1].getColumn(3)[0:30] T_unk = module.getOutput("T_output") print "tracor =", T_unk[-1][1].getColumn(3)[0:30] time = K_unk[-1][0] print "time = ", time KY = K_unk[-1][1] TY = T_unk[-1][1] XListe = KY.getColumn(0) dx0 = 0.04 / 100 dxListe = [dx0] * 100 from posttables import Table tab1 = Table(name="KY") tab1.addColumn("X", XListe) tab1.addColumn("Y", KY.getColumn(1)) tab1.addColumn("K", KY.getColumn(3)) KY = tab1 tab2 = Table(name="KT") tab2.addColumn("X", XListe) tab2.addColumn("Y", TY.getColumn(1)) tab2.addColumn("K", TY.getColumn(3)) TY = tab2 from _erffunctions import * C0 = 1.0e-03 porosity = 1.0 darcy = 1.0e-3 / 3600