25 |
alpha=0.1 |
alpha=0.1 |
26 |
|
|
27 |
#############################################################################################################3 |
#############################################################################################################3 |
28 |
def solveVector(numDim, totalNumElem, len_x0, alpha, solver_method): |
def solveVector(numDim, totalNumElem, len_x0, alpha, solver_method,prec): |
29 |
|
|
30 |
print "Vector solver:" |
print "Vector solver:" |
31 |
recDim=array([len_x0,1.,1.]) |
recDim=array([len_x0,1.,1.]) |
77 |
mypde.setSolverMethod(solver_method) |
mypde.setSolverMethod(solver_method) |
78 |
|
|
79 |
# Solve for Approximate Solution |
# Solve for Approximate Solution |
80 |
u_approx = mypde.getSolution(iter_max=10000) |
u_approx = mypde.getSolution(preconditioner=prec,iter_max=10000) |
81 |
|
|
82 |
# Report Results |
# Report Results |
83 |
error=Lsup(u - u_approx)/Lsup(u) |
error=Lsup(u - u_approx)/Lsup(u) |
88 |
|
|
89 |
################################################################################################################# |
################################################################################################################# |
90 |
|
|
91 |
def solveScalar(numDim, totalNumElem, len_x0, alpha, solver_method): |
def solveScalar(numDim, totalNumElem, len_x0, alpha, solver_method,prec): |
92 |
|
|
93 |
print "Scalar solver:" |
print "Scalar solver:" |
94 |
recDim=array([len_x0,1.,1.]) |
recDim=array([len_x0,1.,1.]) |
131 |
mypde.setSolverMethod(solver_method) |
mypde.setSolverMethod(solver_method) |
132 |
|
|
133 |
# Solve for Approximate Solution |
# Solve for Approximate Solution |
134 |
u_approx = mypde.getSolution(iter_max=10000) |
u_approx = mypde.getSolution(preconditioner=prec,iter_max=10000) |
135 |
|
|
136 |
# Report Results |
# Report Results |
137 |
error=Lsup(u - u_approx)/Lsup(u) |
error=Lsup(u - u_approx)/Lsup(u) |
146 |
print "Test is started:" |
print "Test is started:" |
147 |
print "----------------" |
print "----------------" |
148 |
error=0. |
error=0. |
149 |
for numDim in [2,3]: |
# for numDim in [2,3]: |
150 |
for totalNumElem in [100, 200, 400, 800, 1600, 3200, 6400]: |
for numDim in [3]: |
151 |
# for totalNumElem in [100, 200, 400, 800, 1600, 3200, 6400, 12800, 25600, 51200, 102400]: |
for totalNumElem in [100, 200, 400, 800, 1600, 3200, 6400, 12800, 25600, 51200, 102400]: |
152 |
for problem in [solveScalar,solveVector]: |
# for problem in [solveScalar,solveVector]: |
153 |
|
for problem in [solveScalar]: |
154 |
# for solver_method in [ LinearPDE.PRES20, LinearPDE.PCG, LinearPDE.DIRECT, LinearPDE.BICGSTAB]: |
# for solver_method in [ LinearPDE.PRES20, LinearPDE.PCG, LinearPDE.DIRECT, LinearPDE.BICGSTAB]: |
155 |
for solver_method in [ LinearPDE.PCG ]: |
for solver_method in [ LinearPDE.PCG ]: |
156 |
error=max([problem(numDim, totalNumElem, len_x0, alpha, solver_method),error]) |
# for prec in [ LinearPDE.JACOBI, LinearPDE.ILU0 ]: |
157 |
|
for prec in [ LinearPDE.ILU0 ]: |
158 |
|
error=max([problem(numDim, totalNumElem, len_x0, alpha, solver_method,prec),error]) |
159 |
print "----------------" |
print "----------------" |
160 |
print "maximum error over all tests is ",error |
print "maximum error over all tests is ",error |
161 |
print "----------------" |
print "----------------" |