• R/O
  • SSH

Commit

Tags
Keine Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

Commit MetaInfo

Revision14bab3c9776bff028afead1fb45e75b0fd83ac94 (tree)
Zeit2007-01-30 20:37:41
Autoriselllo
Commiteriselllo

Log Message

This time a major update of the code R-codes/plot-boundary.R. Now the
code is able to read a velocity profile and a concentration profile and
work out the axial flux considering separately the contributions of the
layer and of the core. Careful about the input data files: temperature
and velocities may be defined on different domains and have a different
number of non-zero elements.

Ändern Zusammenfassung

Diff

diff -r 9ae8f6008c65 -r 14bab3c9776b R-codes/plot-boundary.R
--- a/R-codes/plot-boundary.R Tue Jan 30 09:40:27 2007 +0000
+++ b/R-codes/plot-boundary.R Tue Jan 30 11:37:41 2007 +0000
@@ -2,17 +2,30 @@
22 solution<-read.table("boundary.txt",header=TRUE,nrow=20000)
33 solution<-as.matrix(solution)
44 delta<-abs(solution[300,1]-solution[299,1])
5-#zero<-which(solution[ ,2]==0)
6-#zero<-as.vector(zero)
7-#zero<-zero[1]
8-#end_sol<-zero-1
5+
6+
7+# routine for integration
8+def_integral<-function(integrand,h)
9+{
10+n<-length(integrand)
11+myseq<-seq(1,n-4,4)
12+integral<-0
13+for (i in myseq)
14+{
15+integral<- integral + h/45.0*(14.0*integrand[i]+64.0*integrand[i+1] +24.0*integrand[i+2]+64.0*integrand[i+3]+14.0*integrand[i+4])
16+
17+}
18+return(integral)
19+}
20+
21+
922 vecdim<-dim(solution)
1023 end_sol<-vecdim[1]
1124 solution<-solution[1:end_sol, ] # numerical solution up to the wall
1225 # where it is still non-zero and it has to be corrected
1326 r_wall<-0.15895
1427 layer_thickness<-2.5e-3
15-viscous_length<-2.5e-3/30 # either I first define the layer thickness and then I found out how many viscous lengths it amounts to, or I start from the viscous length times the number of lengths amounting to the layer thickness.
28+viscous_length<-2.5e-3/150 # either I first define the layer thickness and then I found out how many viscous lengths it amounts to, or I start from the viscous length times the number of lengths amounting to the layer thickness.
1629
1730
1831
@@ -30,7 +43,10 @@
3043 n_viscous<-as.integer(layer_thickness/viscous_length)
3144 n_delta<-as.integer(layer_thickness/delta)
3245
33-end_sol<-end_sol-n_delta
46+end_sol<-end_sol-n_delta-1 # I added a -1 for better compatibility wrt what I am doing below
47+
48+print("end_sol is")
49+print(end_sol)
3450
3551 solution<-solution[1:end_sol, ] # numerical solution up to the point where it is joined to
3652 # the analytical expression
@@ -46,20 +62,27 @@
4662
4763 wall_arr<-wall_fun()/norm_factor*solution[end_sol,2]
4864
65+
66+
4967 pdf("wall_profile.pdf")
5068 plot(y_plus,wall_arr,"l",lwd=2,col="blue",ylab="velocity profile",xlab="distance from wall in wall units")
5169 dev.off()
5270
71+
72+
5373 y_plus<-y_plus*viscous_length
5474 y_plus<-sort(y_plus,decreasing=FALSE)+solution[end_sol,1]
5575
5676
77+
78+
5779 pdf("wall_profile2.pdf")
5880 plot(y_plus ,wall_arr,"l",lwd=2,col="blue",ylab="velocity profile",xlab="distance from centre [m]")
5981
6082 dev.off()
6183
6284
85+
6386 extension<-cbind(y_plus,wall_arr)
6487
6588 new_sol<-rbind(solution[1:end_sol-1, ],extension)
@@ -75,4 +98,119 @@
7598 fn <- paste("layer_thickness",layer_thickness,".txt",sep="")
7699 write.table(new_sol,fn,row.names=FALSE)
77100
101+
102+#########################################################################
103+#########################################################################
104+#########################################################################
105+#########################################################################
106+#########################################################################
107+#########################################################################
108+
109+
110+
111+
112+# Now I try doing the same for the concentration. I have to use the same kind of correction
113+# close to the wall.
114+
115+solution2<-read.table("bound-conc.txt",header=TRUE,nrow=20000)
116+solution2<-as.matrix(solution2)
117+
118+# now I re-define the solution
119+
120+
121+#y_plus<-n_viscous
122+
123+#norm_factor<-wall_fun()
124+
125+#zero<-which(solution2[ ,2]==0)
126+#zero<-as.vector(zero)
127+#zero<-zero[1] #probably I can skip all this and keep
128+ # the previous definition of end_sol (which I decreased by 1 anyway ) these complications arise since the velocity is defined up to the wall (though it it wrong in the layer) whereas the concentration is not defined (so it is zero) in the layer; therefore I have to pick up the right value [last non-zero value] for the concentration othrwise the union with the analytical prolongment gets screwed up
129+#end_sol<-zero-1
130+
131+
132+solution2<-solution2[1:end_sol, ] # numerical solution up to the wall
133+ # where it is still non-zero and it has to be corrected
134+
135+
136+
137+rm(y_plus)
138+
139+y_plus<-seq(n_viscous,0,length=15000)
140+
141+wall_arr<-wall_fun()/norm_factor*solution2[end_sol,2]
142+
143+
144+
145+y_plus<-y_plus*viscous_length
146+y_plus<-sort(y_plus,decreasing=FALSE)+solution2[end_sol,1]
147+
148+
149+extension2<-cbind(y_plus,wall_arr)
150+
151+# the following is the new solution for the concentration up to the wall
152+new_sol2<-rbind(solution2[1:end_sol-1, ],extension2)
153+
154+pdf("new_solution_concentration.pdf")
155+plot(new_sol2[ ,1] ,new_sol2[ ,2],"l",lwd=2,col="blue",ylab="concentration profile",xlab="distance from centre [m]")
156+dev.off()
157+
158+# now I want to start working out the integrals providing the incoming/outcoming flux along z. I divide the job: part outside the layer and inside the layer
159+
160+rho_v_no_layer<-solution[ ,2]*solution2[ ,2]
161+
162+pdf("rho_v_outside_layer.pdf")
163+plot(solution[ ,1] ,rho_v_no_layer,"l",lwd=2,col="blue",ylab="rho*v",xlab="distance from centre [m]")
164+dev.off()
165+
166+ # Now I have to multiply times 2*pi*r to take the radial integral
167+
168+rho_v_no_layer<-rho_v_no_layer*2*pi*solution[ ,1]
169+
170+pdf("rho_v_outside_layer*2pi*r.pdf")
171+plot(solution[ ,1] ,rho_v_no_layer,"l",lwd=2,col="blue",ylab="rho*v times 2pi*r",xlab="distance from centre [m]")
172+dev.off()
173+
174+
175+flux_no_layer<-def_integral(rho_v_no_layer,delta)
176+print("the concentration flux outside the layer is")
177+print(flux_no_layer)
178+
179+
180+# Now I need to work out the same thing with the layer.
181+######################################
182+######################################
183+######################################
184+######################################
185+
186+
187+rho_v_layer<-extension[ ,2]*extension2[ ,2]
188+
189+
190+
191+pdf("rho_v_layer.pdf")
192+plot(extension[ ,1] ,rho_v_layer,"l",lwd=2,col="blue",ylab="rho*v_layer",xlab="distance from centre [m]")
193+dev.off()
194+
195+print("ok here1")
196+
197+ # Now I have to multiply times 2*pi*r to take the radial integral
198+
199+rho_v_layer<-rho_v_layer*2*pi*extension[ ,1]
200+
201+pdf("rho_v_outside_layer*2pi*r.pdf")
202+plot(extension[ ,1] ,rho_v_layer,"l",lwd=2,col="blue",ylab="rho*v_layer times 2pi*r",xlab="distance from centre [m]")
203+dev.off()
204+
205+# Now I redefine the parameter delta I need for the integration
206+
207+delta<-abs(extension[200,1]-extension[201,1])
208+
209+flux_no_layer<-def_integral(rho_v_layer,delta)
210+print("the concentration flux outside the layer is")
211+print(flux_no_layer)
212+
213+
214+
215+
78216 print("So far so good")
\ No newline at end of file