Skip to content

Commit fae5867

Browse files
committed
debugging............
1 parent 97207f9 commit fae5867

File tree

4 files changed

+20
-19
lines changed

4 files changed

+20
-19
lines changed

.travis.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@ before_install:
1616
- conda update --yes conda
1717

1818
install:
19-
- conda install --yes python=${TRAVIS_PYTHON_VERSION} pip numpy future scipy matplotlib nose pep8 coverage mpi4py sympy dill numba
20-
- conda install --yes sphinx
21-
- conda install --yes -c conda-forge petsc=3.9.0 petsc4py=3.9.0
19+
- conda install --yes python=${TRAVIS_PYTHON_VERSION} pip numpy future scipy matplotlib nose pep8 coverage mpi4py sympy dill numba sphinx
20+
# - conda install --yes sphinx
21+
- conda install --yes -c conda-forge petsc4py
2222
- conda list
2323
- pip install coloredlogs
2424
- pip install travis-sphinx

pySDC/implementations/problem_classes/HeatEquation_2D_PETSc_forced.py

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

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

3332
# these parameters will be used later, so assert their existence
3433

34+
from petsc4py import PETSc
35+
3536
if 'comm' not in problem_params:
3637
problem_params['comm'] = PETSc.COMM_WORLD
3738
if 'sol_tol' not in problem_params:
@@ -61,6 +62,9 @@ def __init__(self, problem_params, dtype_u, dtype_f):
6162
self.dy = 1.0 / (self.params.nvars[1] - 1)
6263
(self.xs, self.xe), (self.ys, self.ye) = self.init.getRanges()
6364

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

9296
# fill matrix
9397
A.zeroEntries()
94-
row = PETSc.Mat.Stencil()
95-
col = PETSc.Mat.Stencil()
9698
mx, my = self.init.getSizes()
9799
(xs, xe), (ys, ye) = self.init.getRanges()
98100
for j in range(ys, ye):
99101
for i in range(xs, xe):
100-
row.index = (i, j)
101-
row.field = 0
102+
self.row.index = (i, j)
103+
self.row.field = 0
102104
if i == 0 or j == 0 or i == mx - 1 or j == my - 1:
103-
A.setValueStencil(row, row, 1.0)
105+
A.setValueStencil(self.row, self.row, 1.0)
104106
else:
105107
diag = self.params.nu * (-2.0 / self.dx ** 2 - 2.0 / self.dy ** 2)
106108
for index, value in [
@@ -110,9 +112,9 @@ def __get_A(self):
110112
((i + 1, j), self.params.nu / self.dx ** 2),
111113
((i, j + 1), self.params.nu / self.dy ** 2),
112114
]:
113-
col.index = index
114-
col.field = 0
115-
A.setValueStencil(row, col, value)
115+
self.col.index = index
116+
self.col.field = 0
117+
A.setValueStencil(self.row, self.col, value)
116118
A.assemble()
117119

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

135137
# fill matrix
136138
Id.zeroEntries()
137-
row = PETSc.Mat.Stencil()
138139
(xs, xe), (ys, ye) = self.init.getRanges()
139140
for j in range(ys, ye):
140141
for i in range(xs, xe):
141-
row.index = (i, j)
142-
row.field = 0
143-
Id.setValueStencil(row, row, 1.0)
142+
self.row.index = (i, j)
143+
self.row.field = 0
144+
Id.setValueStencil(self.row, self.row, 1.0)
144145

145146
Id.assemble()
146147

pySDC/implementations/transfer_classes/TransferPETScDMDA.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
from __future__ import division
2-
from petsc4py import PETSc
32

43
from pySDC.core.SpaceTransfer import space_transfer
54
from pySDC.core.Errors import TransferError
@@ -26,7 +25,7 @@ def __init__(self, fine_prob, coarse_prob, params):
2625
super(mesh_to_mesh_petsc_dmda, self).__init__(fine_prob, coarse_prob, params)
2726

2827
# set interpolation type (no effect as far as I can tell)
29-
self.coarse_prob.init.setInterpolationType(PETSc.DMDA.InterpolationType.Q1)
28+
# self.coarse_prob.init.setInterpolationType(PETSc.DMDA.InterpolationType.Q1)
3029
# define interpolation (only accurate for constant functions)
3130
self.interp, _ = self.coarse_prob.init.createInterpolation(self.fine_prob.init)
3231
# define restriction as injection (tranpose of interpolation does not work)

pySDC/projects/AsympConv/conv_test_to0.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,8 @@ 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)))
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)))
6061

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

0 commit comments

Comments
 (0)