diff --git a/example/R/DefsTCAT.R b/example/R/DefsTCAT.R index dd712132..e62a5204 100644 --- a/example/R/DefsTCAT.R +++ b/example/R/DefsTCAT.R @@ -2,6 +2,7 @@ sw=expression(s^{bar(bar(w))}) ew=expression(epsilon^{bar(bar(w))}) en=expression(epsilon^{bar(bar(n))}) ewn=expression(epsilon^{bar(bar(wn))}) +ewnD=expression(epsilon^{bar(bar(wn))}~D) ews=expression(epsilon^{bar(bar(ws))}) ens=expression(epsilon^{bar(bar(ns))}) ewns=expression(epsilon^{bar(bar(wns))}) @@ -11,7 +12,7 @@ Jwn=expression(J[w]^{bar(bar(wn))}) JwnD=expression(J[w]^{bar(bar(wn))}~D) KNwns=expression(kappa[N]^{bar(bar(wns))}) KGwns=expression(kappa[G]^{bar(bar(wns))}) -cwns=expression(phi1^{bar(bar(wns))}) +cwns=expression(phi1^{bar(bar(wn.ws))}) vanx=expression(v[x]^{bar(n)}) vany=expression(v[y]^{bar(n)}) vanz=expression(v[z]^{bar(n)}) diff --git a/example/R/Piston.R b/example/R/Piston.R index a456aeb1..72248d08 100644 --- a/example/R/Piston.R +++ b/example/R/Piston.R @@ -3,11 +3,16 @@ library(extrafont) library(reshape2) library(pspline) +# additional definitions +dswdt=expression(L~frac(ds^{bar(bar(w))},dt)) +dawndt=expression(frac(d~epsilon^{bar(bar(wn))},dt)) +dansdt=expression(frac(V,2~pi~W)~frac(d~epsilon^{bar(bar(ws))},dt)) + # define the TCAT variables, length scale and IFT source("~/Programs/TCAT/R/DefsTCAT.R") gamma = 0.058 D=15.5 -volume=2e6 +volume=4e6 PI=3.14159265 tau = 1.0 @@ -16,6 +21,9 @@ C1 <- read.csv(file="~/Data/Multiphase/Piston/Case1/timelog.tcat",head=TRUE,sep= C1$label <- "A" C1$U <- predict(sm.spline(C1$time,C1$sw),C1$time,1)*400 C1$Ca<-C1$U*visc/gamma +C1$dawndt <-predict(sm.spline(C1$time,C1$awn),C1$time,1) +C1$dansdt <-predict(sm.spline(C1$time,C1$ans),C1$time,1)*volume/(2*PI*D) +C1$pc<-(C1$pn-C1$pw)*D/gamma tau = 0.9 visc = (tau-0.5)/3 @@ -23,6 +31,9 @@ C2<-read.csv(file="~/Data/Multiphase/Piston/Case2/timelog.tcat",head=TRUE,sep=" C2$label <- "B" C2$U <- predict(sm.spline(C2$time,C2$sw),C2$time,1)*400 C2$Ca<-C2$U*visc/gamma +C2$dawndt <-predict(sm.spline(C2$time,C2$awn),C2$time,1) +C2$dansdt <-predict(sm.spline(C2$time,C2$ans),C2$time,1)*volume/(2*PI*D) +C2$pc<-(C2$pn-C2$pw)*D/gamma tau = 0.8 visc = (tau-0.5)/3 @@ -30,6 +41,9 @@ C3 <- read.csv(file="~/Data/Multiphase/Piston/Case3/timelog.tcat",head=TRUE,sep= C3$label <- "C" C3$U <- predict(sm.spline(C3$time,C3$sw),C3$time,1)*400 C3$Ca<-C3$U*visc/gamma +C3$dawndt <-predict(sm.spline(C3$time,C3$awn),C3$time,1) +C3$dansdt <-predict(sm.spline(C3$time,C3$ans),C3$time,1)*volume/(2*PI*D) +C3$pc<-(C3$pn-C3$pw)*D/gamma tau = 1.0 visc = (tau-0.5)/3 @@ -37,6 +51,9 @@ C4 <- read.csv(file="~/Data/Multiphase/Piston/Case4/timelog.tcat",head=TRUE,sep= C4$label <- "D" C4$U <- predict(sm.spline(C4$time,C4$sw),C4$time,1)*400 C4$Ca<-C4$U*visc/gamma +C4$dawndt <-predict(sm.spline(C4$time,C4$awn),C4$time,1) +C4$dansdt <-predict(sm.spline(C4$time,C4$ans),C4$time,1)*volume/(2*PI*D) +C4$pc<-(C4$pn-C4$pw)*D/gamma tau = 0.9 visc = (tau-0.5)/3 @@ -44,6 +61,9 @@ C5 <- read.csv(file="~/Data/Multiphase/Piston/Case5/timelog.tcat",head=TRUE,sep= C5$label <- "E" C5$U <- predict(sm.spline(C5$time,C5$sw),C5$time,1)*400 C5$Ca<-C5$U*visc/gamma +C5$dawndt <-predict(sm.spline(C5$time,C5$awn),C5$time,1) +C5$dansdt <-predict(sm.spline(C5$time,C5$ans),C5$time,1)*volume/(2*PI*D) +C5$pc<-(C5$pn-C5$pw)*D/gamma tau = 0.8 visc = (tau-0.5)/3 @@ -51,6 +71,9 @@ C6 <- read.csv(file="~/Data/Multiphase/Piston/Case6/timelog.tcat",head=TRUE,sep= C6$label <- "F" C6$U <- predict(sm.spline(C6$time,C6$sw),C6$time,1)*400 C6$Ca<-C6$U*visc/gamma +C6$dawndt <-predict(sm.spline(C6$time,C6$awn),C6$time,1) +C6$dansdt <-predict(sm.spline(C6$time,C6$ans),C6$time,1)*volume/(2*PI*D) +C6$pc<-(C6$pn-C6$pw)*D/gamma #Bind all of the data into one frame for ggplot (combine as labeled rows) Full<-rbind(C1,C2,C3,C4,C5,C6) @@ -101,7 +124,9 @@ ggsave("~/Data/Multiphase/Piston/piston-ewns.eps",p,width=4.5,heigh=3.5) p<-ggplot(Full,aes(time,vawz,colour=label),coord_cartesian(xlim=c(0,25000)))+ geom_line() + xlab("time") + ylab(vawz) + theme_bw() + theme(text=element_text(family="Helvetica",size=rel(4))) + - theme(legend.text=element_text(size=rel(4))) + theme(legend.text=element_text(size=rel(4))) + + coord_cartesian(ylim=c(0,0.011)) + ggsave("~/Data/Multiphase/Piston/piston-vaw.eps",p,width=4.5,heigh=3.5) p<-ggplot(Full,aes(time,vanz,colour=label),coord_cartesian(xlim=c(0,25000)))+ @@ -142,10 +167,12 @@ p<-ggplot(Full,aes(time,KGwns,colour=label),coord_cartesian(xlim=c(0,25000)))+ ggsave("~/Data/Multiphase/Piston/piston-KGwns.eps",p,width=4.5,heigh=3.5) p<-ggplot(Full,aes(time,U,colour=label)) + - geom_line() + xlab("time") + ylab("U") + theme_bw() + + geom_line() + xlab("time") + ylab(dswdt) + theme_bw() + theme(text=element_text(family="Helvetica",size=rel(4))) + - theme(legend.text=element_text(size=rel(4))) -ggsave("~/Data/Multiphase/Piston/piston-U.eps",p,width=4.5,heigh=3.5) + theme(legend.text=element_text(size=rel(4))) + + coord_cartesian(ylim=c(0,0.011)) + +ggsave("~/Data/Multiphase/Piston/piston-dswdt.eps",p,width=4.5,heigh=3.5) p<-ggplot(Full,aes(time,Gwnxx,colour=label))+ geom_line() + xlab("time") + ylab(Gwnxx) + theme_bw() + @@ -167,3 +194,19 @@ p<-ggplot(Full,aes(time,trJwn,colour=label))+ theme(legend.text=element_text(size=rel(4))) ggsave("~/Data/Multiphase/Piston/piston-Jwn.eps",p,width=4.5,heigh=3.5) + +p<-ggplot(Full,aes(time,dansdt,colour=label))+ + geom_line() + xlab("time") + ylab(dansdt) + theme_bw() + + theme(text=element_text(family="Helvetica",size=rel(4))) + + theme(legend.text=element_text(size=rel(4))) + + coord_cartesian(ylim=c(0,0.011)) + +ggsave("~/Data/Multiphase/Piston/piston-dansdt.eps",p,width=4.5,heigh=3.5) + + +p<-ggplot(Full,aes(time,dawndt,colour=label))+ + geom_line() + xlab("time") + ylab(dawndt) + theme_bw() + + theme(text=element_text(family="Helvetica",size=rel(4))) + + theme(legend.text=element_text(size=rel(4))) + +ggsave("~/Data/Multiphase/Piston/piston-dawndt.eps",p,width=4.5,heigh=3.5) diff --git a/example/R/equil-pc-sw.R b/example/R/equil-pc-sw.R new file mode 100644 index 00000000..891d7848 --- /dev/null +++ b/example/R/equil-pc-sw.R @@ -0,0 +1,40 @@ +source("~/Programs/TCAT/R/DefsTCAT.R") +library(ggplot2) +library(extrafont) +library(reshape2) + +IFT=0.058 +D=66.933792 +Data <- read.csv(file="~/Data/Multiphase/PorousMedia/Sph1964/equil.tcat",head=TRUE,sep=" ") +Data$pc <- (Data$pn-Data$pw)*D/IFT + +p<-ggplot(Data,aes(sw,trJwn*D,colour=awn))+ +geom_point()+ xlab(sw) + ylab(JwnD) + theme_bw() + +scale_colour_gradient(name=ewnD,limits=c(0,0.8),low="red")+ +theme(text=element_text(family="Helvetica",size=rel(4))) + +theme(legend.text=element_text(size=rel(3))) + +theme(legend.title=element_text(size=rel(4))) + +ggsave("Jwn-sw-awn.pdf",p,width=4.5,height=3.5); + +p<-ggplot(Data,aes(sw,pc,colour=awn))+ +geom_point()+ xlab(sw) + ylab(JwnD) + theme_bw() + +scale_colour_gradient(name=ewnD,limits=c(0,0.8),low="red")+ +theme(text=element_text(family="Helvetica",size=rel(4))) + +theme(legend.text=element_text(size=rel(3))) + +theme(legend.title=element_text(size=rel(4))) + +ggsave("pc-sw-awn.pdf",p,width=4.5,height=3.5); + +p<-ggplot(Data,aes(sw,lwns))+ +geom_point()+ xlab(sw) + ylab(ewn) + theme_bw() + +theme(text=element_text(family="Helvetica",size=rel(4))) + +ggsave("ewns.pdf",p,width=4.5,height=3.5); + +p<-ggplot(Data,aes(sw,awn,colour=trJwn))+ +geom_point()+ xlab(sw) + ylab(ewn) + theme_bw() + +scale_colour_gradient(name=ewnD,limits=c(7,15),low="red")+ +theme(text=element_text(family="Helvetica",size=rel(4))) + +ggsave("awn-sw-pc.pdf",p,width=4.5,height=3.5);