59 |
return self.__transport_problem.solve(self.__source,dt,{}) |
return self.__transport_problem.solve(self.__source,dt,{}) |
60 |
from esys.finley import Rectangle |
from esys.finley import Rectangle |
61 |
|
|
62 |
dom=Rectangle(10,10) |
dom=Rectangle(20,20) |
63 |
fc=TransportPDE(dom,num_equations=1,theta=0.0,dt_max=0.) |
fc=TransportPDE(dom,num_equations=1,theta=0.0,dt_max=0.) |
64 |
fc.setValue(M=Scalar(1.,Function(dom)),C=Scalar(1.,Function(dom))*[-1.,0.]) |
fc.setValue(M=Scalar(1.,Function(dom)),C=Scalar(1.,Function(dom))*[-1.,0]) |
65 |
x=dom.getX() |
x=dom.getX() |
66 |
u=whereNonPositive(abs(x[0]-0.3)-0.1)*whereNonPositive(abs(x[1]-0.3)-0.1) |
x_0=[0.3,0.3] |
67 |
|
sigma=0.08 |
68 |
|
u=1. |
69 |
|
for i in range(dom.getDim()): |
70 |
|
u=u*exp(-(x[i]-x_0[i])**2/sigma**2) |
71 |
|
u/=Lsup(u) |
72 |
|
|
73 |
|
u=whereNonPositive(abs(x[0]-0.3)-0.2)*whereNonPositive(abs(x[1]-0.5)-0.2) |
74 |
c=0 |
c=0 |
75 |
saveVTK("u.%s.xml"%c,u=u) |
saveVTK("u.%s.xml"%c,u=u) |
76 |
fc.setInitialSolution(u) |
fc.setInitialSolution(u) |
77 |
dt=0.301 |
|
78 |
|
dt=2.5e-2 |
79 |
t=0. |
t=0. |
80 |
while t<dt: |
while t<15*dt: |
81 |
print "time step t=",t+dt |
print "time step t=",t+dt |
82 |
u=fc.solve(dt) |
u=fc.solve(dt) |
83 |
print "range u",inf(u),sup(u) |
print "range u",inf(u),sup(u) |