Commit f6b10e15 by Tilman Alemán

### csv output

parent 5dbd127b
 for ORDER in 2 3 4 for SCA in 2 do for C in 1 1.0005 1.001 for ORDER in 2 3 do for C in 1 1.1 1.001 do ./killing.py --refinements 5 -c \$C --order \$ORDER --plot --saveplot ./killing.py --refinements 5 -c \$C --order \$ORDER --plot --saveplot -l \$SCA done done for ORDER in 4 do for C in 1 1.1 1.001 do ./killing.py --refinements 4 -c \$C --order \$ORDER --plot --saveplot -l \$SCA done done done # ... ...
 ... ... @@ -98,7 +98,7 @@ def removekf(VhG, f, kvs, vlams, phi, mesh, maxk=3, tol=0, autofilter=True, inpl sca = l2sca(f.components[0], kvs[k], phi, mesh) f.components[0].vec.data += -sca * kvs[k].vec return def plot_errors(l2errs, l2errskf, geom, saveplot, order=2, refs=2, c=1): def plot_errors(l2errs, l2errskf, geom, saveplot, order=2, refs=2, c=1, sca=2): hvals = [] ... ... @@ -111,7 +111,7 @@ def plot_errors(l2errs, l2errskf, geom, saveplot, order=2, refs=2, c=1): hvals2.append((1 / 2 ** order) ** k) plt.semilogy(ticks,l2errs, label=geom+" with KF removal") # plt.semilogy(l2errskf, label=geom + " without KF removal") plt.semilogy(ticks, l2errskf, label=geom + " modulo discrete KF") plt.semilogy(ticks,hvals, label=r'\$O(h^'+ str(order+1)+r')\$') plt.semilogy(ticks,hvals2, label=r'\$O(h^'+ str(order)+r')\$') ... ... @@ -122,7 +122,7 @@ def plot_errors(l2errs, l2errskf, geom, saveplot, order=2, refs=2, c=1): plt.legend() plt.xticks(ticks) if saveplot: plt.savefig("convergence_plot_"+geom+"_c"+str(c)+"_order"+str(order)+"_refs"+str(refs)+".png") plt.savefig("convergence_plot_"+geom+"_c"+str(c)+"_order"+str(order)+"_refs"+str(refs)+"_sca"+str(sca)+".png") else: plt.show() ... ... @@ -137,7 +137,7 @@ def computeEV(phi, mesh, lset_approx, deformation, order=2, condense=True): else: precond = "direct" start=time.time() Vh = VectorH1(mesh, order=order, dirichlet=[], low_order_space=True) Vh = VectorH1(mesh, order=order, dirichlet=[], low_order_space=True, wb_fulledges=True) ci = CutInfo(mesh, lset_approx) ba_IF = ci.GetElementsOfType(IF) ... ... @@ -149,7 +149,7 @@ def computeEV(phi, mesh, lset_approx, deformation, order=2, condense=True): blocks = [] freedofs = VhG.FreeDofs() class SymmetricGS(BaseMatrix): def __init__ (self, smoother, inv): def __init__ (self, smoother): super(SymmetricGS, self).__init__() self.k=0 self.smoother = smoother ... ... @@ -184,12 +184,13 @@ def computeEV(phi, mesh, lset_approx, deformation, order=2, condense=True): if d>=0: vertexdofs[d] = True """ # blocks.append(vdofs) """ blocks = [set(d for el in mesh[v].elements for d in VhG.GetDofNrs(el) if freedofs[d]) for v in mesh.vertices] """ #blocks = [set(d for el in mesh[v].elements for d in VhG.GetDofNrs(el) if freedofs[d]) for v in mesh.vertices] """ # blocks = [reduce(lambda x,y: x or y,[set(d for d in VhG.GetDofNrs(el) if freedofs[d])for el in mesh[v].elements]) for v in mesh.vertices] """ n = VhG.ndof ... ... @@ -211,7 +212,7 @@ def computeEV(phi, mesh, lset_approx, deformation, order=2, condense=True): if freedofs[d]) # blocks = pool.map(partial(calcstuff, mesh=mesh), range(len(mesh.vertices))) vertexdofs &= VhG.FreeDofs() #vertexdofs &= VhG.FreeDofs() """ """ print("done with stuff for precond") ... ... @@ -250,20 +251,19 @@ def computeEV(phi, mesh, lset_approx, deformation, order=2, condense=True): a2 += (eta * ((u2 * ntilde) * (v2 * ntilde))).Compile() * ds pre1 = Preconditioner(a2, precond, inverse="pardiso") #pre1 = Preconditioner(a2, "bddc", inverse="pardiso") # prejac = Preconditioner(a2, "local", inverse="pardiso") # pre = Projector(VhG.FreeDofs(), True) # pre1 = SymmetricGS(a2.mat.CreateSmoother(VhG.FreeDofs())) # inv = a2.mat.Inverse(freedofs=VhG.FreeDofs(), inverse="sparsecholesky") # prejac = SymmetricGS(a2.mat.CreateBlockSmoother(blocks, parallel=True), inv) # if not condense: pre = pre1#+prejac else: pre=pre1 pre=pre1 b = BilinearForm(VhG, symmetric=True) b += InnerProduct(Pmat * u2, Pmat * v2).Compile() * ds ... ... @@ -272,15 +272,20 @@ def computeEV(phi, mesh, lset_approx, deformation, order=2, condense=True): b.Assemble() start = time.time() a2.Assemble() #coarsepre = a2.mat.Inverse(freedofs=vertexdofs, inverse="pardiso") #prejac = SymmetricGS(a2.mat.CreateBlockSmoother(blocks, parallel=True)) #prejac = SymmetricGS(a2.mat.CreateSmoother(VhG.FreeDofs())) #coarsepre = Preconditioner(a2, "multigrid", inverse="pardiso") #pre = pre + coarsepre # pre=a2.mat.Inverse(freedofs=VhG.FreeDofs(True), inverse="pardiso") + coarsepre print("assemble time: ", time.time()-start) if condense: ev, evecs = PINVIT2(a2, b.mat, pre, VhG, 4, GramSchmidt=True,maxit = 5) ev, evecs = PINVIT2(a2, b.mat, pre, VhG, 4, GramSchmidt=True,maxit = 10) else: ev, evecs =solvers.PINVIT(a2.mat, b.mat, pre, 4, GramSchmidt=True, maxit=5) ev, evecs =solvers.PINVIT(a2.mat, b.mat, pre, 4, GramSchmidt=True, maxit=10) return ev, evecs, VhG, a2, pre, ci, start def PINVIT2(a, matm, pre,fes, num=1, maxit=20, printrates=True, GramSchmidt=False): ... ...