コード例 #1
0
#==============
if TEST_SUPG:
    supg = LinearSinglePDE(dom)
    supg.setValue(D=1.)
    supg.setSolverMethod(supg.LUMPING)
    dt_supg = 1. / (1. / inf(dom.getSize() / length(V)) +
                    1. / inf(dom.getSize()**2 / E)) * 0.3
    u_supg = u0 * 1.

c = 0
saveVTK("u.%s.vtu" % c, u=u0)
fc.setInitialSolution(u0)
t = T0
while t < T_END:
    print("time step t=", t + dt)
    u = fc.solve(dt)
    if TEST_SUPG:
        #========== supg tests ================
        nn = max(ceil(dt / dt_supg), 1.)
        dt2 = dt / nn
        nnn = 0
        while nnn < nn:
            supg.setValue(X=-dt2 / 2 * E * grad(u_supg),
                          Y=u_supg + dt2 / 2 * inner(V, grad(u_supg)))
            u2 = supg.getSolution()
            supg.setValue(X=-dt2 * E * grad(u2),
                          Y=u_supg + dt2 * inner(V, grad(u2)))
            u_supg = supg.getSolution()
            nnn += 1
    c += 1
    t += dt
コード例 #2
0
ファイル: FCT_test2.py プロジェクト: svn2github/Escript
fc.setValue(M=Scalar(1.,Function(dom)),C=V,A=-Scalar(E,Function(dom))*kronecker(dom))
#==============
if TEST_SUPG:
   supg=LinearSinglePDE(dom)
   supg.setValue(D=1.)
   supg.setSolverMethod(supg.LUMPING)
   dt_supg=1./(1./inf(dom.getSize()/length(V))+1./inf(dom.getSize()**2/E))*0.3
   u_supg=u0*1.

c=0
saveVTK("u.%s.vtu"%c,u=u0)
fc.setInitialSolution(u0)
t=T0
while t<T_END:
    print("time step t=",t+dt)
    u=fc.solve(dt)
    if TEST_SUPG:
        #========== supg tests ================
        nn=max(ceil(dt/dt_supg),1.)
        dt2=dt/nn
        nnn=0
        while nnn<nn :
            supg.setValue(X=-dt2/2*E*grad(u_supg),Y=u_supg+dt2/2*inner(V,grad(u_supg)))
            u2=supg.getSolution()
            supg.setValue(X=-dt2*E*grad(u2),Y=u_supg+dt2*inner(V,grad(u2)))
            u_supg=supg.getSolution()
            nnn+=1
    c+=1
    t+=dt
    print("QUALITY FCT: time = %s pi"%(t/pi),QUALITY(t,u), end=' ')
    if TEST_SUPG: 
コード例 #3
0
#==============
if TEST_SUPG:
    supg = LinearSinglePDE(dom)
    supg.setValue(D=1.)
    supg.setSolverMethod(supg.LUMPING)
    dt_supg = inf(dom.getSize() / length(V))
    u_supg = u0 * 1.

c = 0
# saveVTK("u.%s.vtu"%c,u=u0)
fc.setInitialSolution(u0)
t = T0
print("QUALITY FCT: time = %s pi" % (t / pi), inf(u0), sup(u0), integrate(u0))
while t < T_END:
    print("time step t=", t + dt)
    u = fc.solve(dt, verbose=True)
    print("QUALITY FCT: time = %s pi" % (t + dt / pi), inf(u), sup(u),
          integrate(u))
    if TEST_SUPG:
        #========== supg tests ================
        nn = max(ceil(dt / dt_supg), 1.)
        dt2 = dt / nn
        nnn = 0
        while nnn < nn:
            supg.setValue(Y=u_supg + dt2 / 2 * inner(V, grad(u_supg)))
            u2 = supg.getSolution()
            supg.setValue(Y=u_supg + dt2 * inner(V, grad(u2)))
            u_supg = supg.getSolution()
            nnn += 1
    c += 1
    t += dt
コード例 #4
0
ファイル: FCT_test1.py プロジェクト: svn2github/Escript
#==============
if TEST_SUPG:
   supg=LinearSinglePDE(dom)
   supg.setValue(D=1.)
   supg.setSolverMethod(supg.LUMPING)
   dt_supg=inf(dom.getSize()/length(V))
   u_supg=u0*1.

c=0
# saveVTK("u.%s.vtu"%c,u=u0)
fc.setInitialSolution(u0)
t=T0
print("QUALITY FCT: time = %s pi"%(t/pi),inf(u0),sup(u0),integrate(u0))
while t<T_END:
    print("time step t=",t+dt)
    u=fc.solve(dt, verbose=True)
    print("QUALITY FCT: time = %s pi"%(t+dt/pi),inf(u),sup(u),integrate(u))
    if TEST_SUPG:
        #========== supg tests ================
        nn=max(ceil(dt/dt_supg),1.)
        dt2=dt/nn
        nnn=0
        while nnn<nn :
            supg.setValue(Y=u_supg+dt2/2*inner(V,grad(u_supg)))
            u2=supg.getSolution()
            supg.setValue(Y=u_supg+dt2*inner(V,grad(u2)))
            u_supg=supg.getSolution()
            nnn+=1
    c+=1
    t+=dt
    if TEST_SUPG: