Skip to content

Commit 7fb0f82

Browse files
committed
debugging.............
1 parent fae5867 commit 7fb0f82

File tree

3 files changed

+15
-17
lines changed

3 files changed

+15
-17
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
sudo: required
1+
sudo: false
22
dist: trusty
33

44
language: python

pySDC/implementations/problem_classes/HeatEquation_2D_PETSc_forced.py

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
from __future__ import division
22
import numpy as np
3+
from petsc4py import PETSc
34

45
from pySDC.core.Problem import ptype
56
from pySDC.core.Errors import ParameterError, ProblemError
@@ -31,8 +32,6 @@ def __init__(self, problem_params, dtype_u, dtype_f):
3132

3233
# these parameters will be used later, so assert their existence
3334

34-
from petsc4py import PETSc
35-
3635
if 'comm' not in problem_params:
3736
problem_params['comm'] = PETSc.COMM_WORLD
3837
if 'sol_tol' not in problem_params:
@@ -62,9 +61,6 @@ def __init__(self, problem_params, dtype_u, dtype_f):
6261
self.dy = 1.0 / (self.params.nvars[1] - 1)
6362
(self.xs, self.xe), (self.ys, self.ye) = self.init.getRanges()
6463

65-
self.row = PETSc.Mat.Stencil()
66-
self.col = PETSc.Mat.Stencil()
67-
6864
# compute discretization matrix A and identity
6965
self.A = self.__get_A()
7066
self.Id = self.__get_Id()
@@ -95,14 +91,16 @@ def __get_A(self):
9591

9692
# fill matrix
9793
A.zeroEntries()
94+
row = PETSc.Mat.Stencil()
95+
col = PETSc.Mat.Stencil()
9896
mx, my = self.init.getSizes()
9997
(xs, xe), (ys, ye) = self.init.getRanges()
10098
for j in range(ys, ye):
10199
for i in range(xs, xe):
102-
self.row.index = (i, j)
103-
self.row.field = 0
100+
row.index = (i, j)
101+
row.field = 0
104102
if i == 0 or j == 0 or i == mx - 1 or j == my - 1:
105-
A.setValueStencil(self.row, self.row, 1.0)
103+
A.setValueStencil(row, row, 1.0)
106104
else:
107105
diag = self.params.nu * (-2.0 / self.dx ** 2 - 2.0 / self.dy ** 2)
108106
for index, value in [
@@ -112,9 +110,9 @@ def __get_A(self):
112110
((i + 1, j), self.params.nu / self.dx ** 2),
113111
((i, j + 1), self.params.nu / self.dy ** 2),
114112
]:
115-
self.col.index = index
116-
self.col.field = 0
117-
A.setValueStencil(self.row, self.col, value)
113+
col.index = index
114+
col.field = 0
115+
A.setValueStencil(row, col, value)
118116
A.assemble()
119117

120118
return A
@@ -136,12 +134,13 @@ def __get_Id(self):
136134

137135
# fill matrix
138136
Id.zeroEntries()
137+
row = PETSc.Mat.Stencil()
139138
(xs, xe), (ys, ye) = self.init.getRanges()
140139
for j in range(ys, ye):
141140
for i in range(xs, xe):
142-
self.row.index = (i, j)
143-
self.row.field = 0
144-
Id.setValueStencil(self.row, self.row, 1.0)
141+
row.index = (i, j)
142+
row.field = 0
143+
Id.setValueStencil(row, row, 1.0)
145144

146145
Id.assemble()
147146

pySDC/projects/AsympConv/conv_test_to0.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,7 @@ def compute_and_plot_specrad(Nnodes, lam):
5656
x * lam * np.kron(np.eye(Nsteps), (Qmat - QDmat)) + np.kron(Emat, Nmat))
5757

5858
Prho_list.append(max(abs(np.linalg.eigvals(mat))))
59-
# predict_list.append((1 + x) ** (1.0 - 1.0 / (Nnodes * Nsteps)) * x ** (1.0 / (Nnodes * Nsteps)))
60-
predict_list.append(x ** (1.0 / (Nnodes * Nsteps)))
59+
predict_list.append((1 + x) ** (1.0 - 1.0 / (Nnodes * Nsteps)) * x ** (1.0 / (Nnodes * Nsteps)))
6160

6261
if len(predict_list) > 1:
6362
print(x, predict_list[-1], Prho_list[-1], Prho_list[-2] / Prho_list[-1],

0 commit comments

Comments
 (0)