Skip to content

Commit

Permalink
Fix linting
Browse files Browse the repository at this point in the history
  • Loading branch information
Umberto Zerbinati committed Jun 24, 2024
1 parent 8bdf25c commit f7df3de
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 8 deletions.
4 changes: 2 additions & 2 deletions ngsPETSc/ksp.py
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ def solve(self, b, x, mapping=None):
mapping.petscVec(b, self.pscB)
self.ksp.solve(self.pscB, self.pscX)
mapping.ngsVec(self.pscX, x)

def operator(self):
"""
This function returns the operator of the KSP solver
Expand Down Expand Up @@ -289,4 +289,4 @@ def Mult(self, x, y):
"""
Matrix-vector product
"""
self.ksp.solve(x, y)
self.ksp.solve(x, y)
19 changes: 13 additions & 6 deletions ngsPETSc/ts.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,14 @@
from ngsPETSc import VectorMapping, Matrix

class TimeStepper:

def __init__(self, fes, info, G=None, F=None, residual=None, jacobian=None, solverParameters=None, optionsPrefix=None):
"""
This class wraps the PETSc TS time-stepping routines.
NOTE: Still a work in progress, need to add the connection with the
mass matrix for explicit time-stepping schemes and compute the
Jacobian using the variational form F.
"""
def __init__(self, fes, info, G=None, F=None, residual=None,
jacobian=None, solverParameters=None, optionsPrefix=None):
self.fes = fes
dofs = fes.ParallelDofs()
self.second_order = False
Expand Down Expand Up @@ -97,8 +103,11 @@ def setup(self, timeInfo):
self.ts.setMaxTime(self.tf)
self.ts.setMaxSteps(int((self.tf-self.t0)/self.dt))


def solve(self, x0):
"""
This method is used to solve the time-stepping problem
:arg x0: initial data as an NGSolve grid function
"""
pscx0 = self.vectorMapping.petscVec(x0.vec)
self.ts.solve(pscx0)
self.vectorMapping.ngsVec(pscx0, ngsVec=x0.vec)
Expand Down Expand Up @@ -160,9 +169,7 @@ def residual(t, x, xdot): #pylint: disable=E0102,E0213,E0202
'''
raise NotImplementedError("No residual has been implemented yet.")


def petscJacobian(self, ts, t, x, xdot, a, J,P):
#TODO: We are not using a!
def petscJacobian(self, ts, t, x, xdot, a, J,P): #pylint: disable=W0613
'''
This is method is used to wrap the callback to the Jacobian in
a PETSc compatible way
Expand Down

0 comments on commit f7df3de

Please sign in to comment.