imparter

85 Reputation

8 Badges

9 years, 0 days

MaplePrimes Activity


These are replies submitted by imparter

@Carl Love 

Excellent 

@Kitonum 

Sir in the file attached how we have to put line +symbol in plot 

@Carl Love 

Thanks a lot , excellent sir for quick response

@Carl Love 

Thanks for quick response but still error.

Sir still i am getting an error, may be some problem in  my codes. Please see the codes

restart:
with(plots):
n:=0.75:Eh:=100:mn:=1:t0:=0.2:
a1:=(mn/t0)^((n-1)/(n))*(tb)^(1/n):a3:=Eh/tb:a4:=(Eh)^2:
U1:=(a1/Eh)*(-1+(a3*r/Eh))^(1/n)*(n*a4/(1+n))*(1/a3-(r/Eh))-a1*(-1+(1/tb))^(1/n)*(n/(n+1)*(tb-1)):
plot([seq(seq(eval(U1,tb=j),j in[0.8,0.9,1.0]))],r=0..1,legend = [tb =0.8, tb=0.9,tb =1.0],  labels = ["z ", "U"], labeldirections = ["horizontal", "vertical"],  linestyle = [solid,dash,dot],color = [black, red,green]);
 

@Kitonum 

Thanks a lot

@tomleslie 

thanks a lot

@Carl Love 

still there is an error

restart:
with(plots): 
G:=1300: beta:=0.0075:epsilon:=4.9*10^(-6):Pa:= 100:alpha:=24:Pv:=97:phi:=0.4:

pde1 := G*(beta^2*u(r,z)*diff(u(r,z),z)+v(r,z)*diff(u(r,z),r)) = -diff(p(r,z),z) +beta^2*diff(u(r,z), z$2)+diff(u(r,z),r$2)+(1/r)*diff(u(r,z),r):


pde2 :=G*(beta^2*u(r,z)*diff(v(r,z),z)+v(r,z)*diff(v(r,z),r)) = -diff(p(r,z),r) +beta^2*diff(v(r,z), z$2)+diff(v(r,z),r$2)+(1/r)*diff(v(r,z),r)-(v(r,z)/r^2):


pde3:=beta^2*diff(u(r,z),z)+diff(v(r,z),r)+(v(r,z)/r)=0:

IBCu:={D[1](u)(0, z) = 0,phi*(D[1](u))(1, z)+u(1,z) = 0}:# IBC for u


IBCv:={v(0,z)=0,v(1,z)=epsilon*(p(1,z)+(Pa/alpha)-1)}:# IBC for v


IBCp:={p(r,-1)=0,p(1,z)=(Pv-Pa)/alpha}:# IBC for p

IBC := IBCu union IBCv union IBCp:
PDE:= [pde1,pde2,pde3]:


pdsolve({PDE, IBC}, u(r,z));  

    
num_sol := pdsolve(PDE, { IBC}, numeric);

 

@Carl Love 

As per your suggestion i have make some correction but still error is coming. Even i have seen your code also

https://www.mapleprimes.com/questions/200670-How-Do-I-Plot-Multiple-Pde-Numerical 

restart:
with(plots):
G:=1300: beta:=0.0075:epsilon:=4.9*10^(-6):Pa= 100:alpha:=24:Pv:=97:

pde1 := G*(beta^2*u(r,z)*diff(u(r,z),z)+v(r,z)*diff(u(r,z),r)) = -diff(p(r,z),z) +beta^2*diff(u(r,z), z$2)+diff(u(r,z),r$2)+(1/r)*diff(u(r,z),r):
pde2 :=G*(beta^2*u(r,z)*diff(v(r,z),z)+v(r,z)*diff(v(r,z),r)) = -diff(p(r,z),r) +beta^2*diff(v(r,z), z$2)+diff(v(r,z),r$2)+(1/r)*diff(v(r,z),r)-(v(r,z)/r^2):
pde3:=beta^2*diff(u(r,z),z)+diff(v(r,z),r)+(v(r,z)/r)=0:
PDE:= unapply({pde||(1..3)}, phi):

IBC:=(D[1](u))(0, z) = 0,v(0,z)=0,phi*(D[1](u))(1, z)+u(1,z) = 0,v(1,z)=epsilon*(p(1,z)+(Pa/alpha)-1),p(r,-1)=0,p(1,z)=(Pv-Pa)/alpha:


phiList:= [0.0, 0.15, 0.4]:
Colours:= table(PrList =~ ["blue", "red", "green"]):
for phi in phiList do
     pds:= pdsolve(PDE(phi), IBC, numeric);
     Plots[phi]:= pds:-plot[display](
          u(z,r), r=0.5, linestyle= "solid", colour= Colours[phi],
          legend= sprintf("phi=%2.2f", phi),
          title= "Velocity Profile", labels= ["z", "u"]
     )
end do:
plots:-display([seq(Plots[phi], phi in phiList)]);

 

upload the worksheet

@Christian Wolinski 

I want to plot the curves for different values of m=0.1,0.2,0.3,0.4,0.5(where m is a parameter) 

@Rouben Rostamian  alpha is a parameter. every thing is ok simply how we can plot curves by changing alpha values on 2d plot.

@Rouben Rostamian   thanks 

can you help me to plot the curves for   different values of M = 0.1, 3.0 and 5.0.  in my earlier post where @ tomleslie 5348 helpme to solve the difference scheme . 

maple post link is:crank nicolson system of difference scheme error 

and i am attaching the file .

please help me to plot the curves as mentioned in the post.

bigSys_(2).mw

@Rouben Rostamian  

actually i want to plot the solution in my codes ( where i have used difference scheme) instead of surf data , how to plot those curves .

@Rouben Rostamian  thanks but i want to plot the solution at time t=0.2 for various values of alpha  instead of using surfdata(plotdata,axes=boxed, labels=[x,"u"]): 

in my codes .

 

 

@Rouben Rostamian  

with out adding a parameter  we can plot the graphs. the codes are mentioned below(codes refered from Ralph book) . But if we add a parameter "alpha=0.1,0.5,1,2,5" by taking t=0.2(suppose) how we can plot the graph for different values of alpha .0.1,0.5,1,2,5, the codes are mentioned in post obove

 

restart:
with(linalg):with(plots): 
ge[1]:=diff(u[1](x,t),t)=diff((u[2](x,t)-1)*diff(u[1](x,t),x),x)+(16*x*t-2*t-16*(u[2](x,t)-1))*(u[1](x,t)-1)+10*x*exp(-4*x):
ge[2]:=diff(u[2](x,t),t)=diff(u[2](x,t),x$2)+diff(u[1](x,t),x)+4*(u[1](x,t)-1)+x^2-2*t-10*t*exp(-4*x): 
bc1[1]:=u[1](x,t)-1: 
bc1[2]:=u[2](x,t)-1: 
bc2[1]:=3*u[1](x,t)+diff(u[1](x,t),x)-3:
bc2[2]:=5*diff(u[2](x,t),x)-evalf(exp(4))*(u[1](x,t)-1):
IC[1]:=u[1](x,0)=1: 
IC[2]:=u[2](x,0)=1: 
NN:=2: 
N:=2:
L:=1:
for i to NN do  
dydxf[i]:=1/2*(-u[2,i](t)-3*u[0,i](t)+4*u[1,i](t))/h: 
dydxb[i]:=1/2*(u[N-1,i](t)+3*u[N+1,i](t)-4*u[N,i](t))/h:
dydx[i]:=1/2/h*(u[m+1,i](t)-u[m-1,i](t)); 
d2ydx2[i]:=1/h^2*(u[m-1,i](t)-2*u[m,i](t)+u[m+1,i](t)):od:
 for i to NN do bc1[i]:=subs(diff(u[1](x,t),x)=dydxf[1],
diff(u[2](x,t),x)=dydxf[2],u[1](x,t) 
=u[0,1](t),u[2](x,t)=u[0,2](t),x=0,bc1[i]):od: 
for i to NN do bc2[i]:=subs(diff(u[1](x,t),x)=dydxb[1],
diff(u[2](x,t),x)=dydxb[2],u[1](x,t) 
=u[N+1,1](t),u[2](x,t)=u[N+1,2](t),x=L,bc2[i]):od:
for i to NN do eq[0,i]:=bc1[i];eq[N+1,i]:=bc2[i]:od: 
for i from 1 to N do eq[i,1]:=diff(u[i,1](t),t)= subs(diff(u[1](x,t),x$2) =
subs(m=i,d2ydx2[1]), 
diff(u[2](x,t),x$2) = subs(m=i,d2ydx2[2]),diff(u[1](x,t),x) =
subs(m=i,dydx[1]),diff(u[2](x,t),x) = subs(m=i,dydx[2]),u[1](x,t)=u[i,1](t), 
u[2](x,t)=u[i,2](t),x=i*h,rhs(ge[1])):od:

for i from 1 to N do eq[i,2]:=diff(u[i,2](t),t)= subs(diff(u[1](x,t),x$2) =
subs(m=i,d2ydx2[1]), 
diff(u[2](x,t),x$2) = subs(m=i,d2ydx2[2]),diff(u[1](x,t),x) =
subs(m=i,dydx[1]),diff(u[2](x,t),x) = subs(m=i,dydx[2]),u[1](x,t)=u[i,1](t),
u[2](x,t)=u[i,2](t),x=i*h,rhs(ge[2])):od: 

for i to NN do u[0,i](t):=(solve(eq[0,i],u[0,i](t))):od:

 for i to NN do u[N+1,i](t):=(solve(eq[N+1,i],u[N+1,i](t))):od:

 h:=L/(N+1): 

for i from 1 to N do eq[i,1]:=eval(eq[i,1]):od: 
 for i from 1 to N do eq[i,2]:=eval(eq[i,2]):od:

eqs:=seq(seq((eq[i,j]),i=1..N),j=1..NN): 
Y:=seq(seq(u[i,j](t),i=1..N),j=1..NN): 

 ICs:=seq(u[i,1](0)=rhs(IC[1]),i=1..N),seq(u[i,2](0)=rhs(IC[2]),i=1..N): 

sol:=dsolve({eqs,ICs},{Y},type=numeric,stiff=true,maxfun=1000000,abserr=1e-6,relerr=1e-5,output=listprocedure):

for j to NN do for i to N do U[i,j]:=subs(sol,u[i,j](t)):od:od: 

for i to NN do U[0,i]:=subs(u[1,1](t)=U[1,1],u[1,2](t)=U[1,2],
u[2,1](t)=U[2,1],u[2,2](t)=U[2,2],u[0,i](t)):od:
 for i to NN do U[N+1,i]:=eval(subs(u[N,1](t)=U[N,1],u[N,2](t)=U[N,2],
u[N-1,1](t)=U[N-1,1],u[N-1,2](t)=U[N-1,2],u[N+1,i](t))):od:
tf:=1.: 
M:=30: 
T1:=[seq(tf*i/M,i=0..M)]: 
PP:=matrix(N+2,M+1): 
for i from 1 to N+2 do PP[i,1]:=evalf(subs(x=(i-1)*h,rhs(IC[1]))):od: 
for i from 1 to N+2 do for j from 2 to M+1 do
PP[i,j]:=evalf(subs(t=T1[j],U[i-1,1](t))):od:od:
plotdata:=[seq([seq([(i-1)*h,T1[j],PP[i,j]],i=1..N+2)],j=1..M+1)]:
t:=0.2:
surfdata(plotdata,axes=boxed, labels=[x,"u"]):
 

1 2 3 4 5 6 7 Last Page 1 of 9