Skip to content

Commit

Permalink
remove whitespace
Browse files Browse the repository at this point in the history
  • Loading branch information
alexbrown1995 committed Aug 29, 2023
1 parent 1b77af5 commit c60c5a9
Showing 1 changed file with 22 additions and 22 deletions.
44 changes: 22 additions & 22 deletions gusto/time_discretisation.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
import numpy as np


__all__ = ["ForwardEuler", "BackwardEuler", "ExplicitMultistage", "SSPRK3", "RK4",
"Heun", "ThetaMethod", "TrapeziumRule", "BDF2", "TR_BDF2", "Leapfrog",
__all__ = ["ForwardEuler", "BackwardEuler", "ExplicitMultistage", "SSPRK3", "RK4",
"Heun", "ThetaMethod", "TrapeziumRule", "BDF2", "TR_BDF2", "Leapfrog",
"AdamsMoulton", "AdamsBashforth"]


Expand Down Expand Up @@ -168,7 +168,7 @@ def setup(self, equation, apply_bcs=True, *active_labels):
self.bcs = None
elif self.wrapper is not None:
# Transfer boundary conditions onto test function space
self.bcs = [DirichletBC(self.fs, bc.function_arg, bc.sub_domain)
self.bcs = [DirichletBC(self.fs, bc.function_arg, bc.sub_domain)
for bc in bcs]
else:
self.bcs = bcs
Expand Down Expand Up @@ -303,7 +303,7 @@ def solver(self):
problem = NonlinearVariationalProblem(self.lhs - self.rhs, self.x_out, bcs=self.bcs)
solver_name = self.field_name+self.__class__.__name__
# If snes_type not specified by user, set this to ksp only to avoid outer Newton iteration
return NonlinearVariationalSolver(problem, solver_parameters={'snes_type': 'ksponly'}
return NonlinearVariationalSolver(problem, solver_parameters={'snes_type': 'ksponly'}
| self.solver_parameters, options_prefix=solver_name)

@abstractmethod
Expand Down Expand Up @@ -337,7 +337,7 @@ def apply(self, x_out, x_in):

class ExplicitMultistage(ExplicitTimeDiscretisation):
"""
A class for implementing general explicit multistage (Runge-Kutta)
A class for implementing general explicit multistage (Runge-Kutta)
methods based on its Butcher tableau.
A Butcher tableau is formed in the following way for a s-th order explicit scheme:
Expand Down Expand Up @@ -372,7 +372,7 @@ class ExplicitMultistage(ExplicitTimeDiscretisation):
"""

def __init__(self, domain, field_name=None, subcycles=None, solver_parameters=None,
def __init__(self, domain, field_name=None, subcycles=None, solver_parameters=None,
limiter=None, options=None, butcher_matrix=None):
super().__init__(domain, field_name=field_name, subcycles=subcycles,
solver_parameters=solver_parameters,
Expand Down Expand Up @@ -463,7 +463,7 @@ class ForwardEuler(ExplicitMultistage):
k0 = F[y^n]
y^(n+1) = y^n + dt*k0
"""
def __init__(self, domain, field_name=None, subcycles=None, solver_parameters=None,
def __init__(self, domain, field_name=None, subcycles=None, solver_parameters=None,
limiter=None, options=None, butcher_matrix=None):
super().__init__(domain, field_name=field_name, subcycles=subcycles,
solver_parameters=solver_parameters,
Expand All @@ -482,7 +482,7 @@ class SSPRK3(ExplicitMultistage):
k2 = F[y^n + (1/4)*dt*(k0+k1)]
y^(n+1) = y^n + (1/6)*dt*(k0 + k1 + 4*k2)
"""
def __init__(self, domain, field_name=None, subcycles=None, solver_parameters=None,
def __init__(self, domain, field_name=None, subcycles=None, solver_parameters=None,
limiter=None, options=None, butcher_matrix=None):
super().__init__(domain, field_name=field_name, subcycles=subcycles,
solver_parameters=solver_parameters,
Expand All @@ -506,7 +506,7 @@ class RK4(ExplicitMultistage):
where superscripts indicate the time-level.
"""
def __init__(self, domain, field_name=None, subcycles=None, solver_parameters=None,
def __init__(self, domain, field_name=None, subcycles=None, solver_parameters=None,
limiter=None, options=None, butcher_matrix=None):
super().__init__(domain, field_name=field_name, subcycles=subcycles,
solver_parameters=solver_parameters,
Expand All @@ -528,7 +528,7 @@ class Heun(ExplicitMultistage):
where superscripts indicate the time-level and subscripts indicate the stage
number.
"""
def __init__(self, domain, field_name=None, subcycles=None, solver_parameters=None,
def __init__(self, domain, field_name=None, subcycles=None, solver_parameters=None,
limiter=None, options=None, butcher_matrix=None):
super().__init__(domain, field_name,
solver_parameters=solver_parameters,
Expand Down Expand Up @@ -826,7 +826,7 @@ def solver0(self):
# setup solver using lhs and rhs defined in derived class
problem = NonlinearVariationalProblem(self.lhs0-self.rhs0, self.x_out, bcs=self.bcs)
solver_name = self.field_name+self.__class__.__name__+"0"
return NonlinearVariationalSolver(problem, solver_parameters=self.solver_parameters,
return NonlinearVariationalSolver(problem, solver_parameters=self.solver_parameters,
options_prefix=solver_name)

@property
Expand All @@ -835,7 +835,7 @@ def solver(self):
# setup solver using lhs and rhs defined in derived class
problem = NonlinearVariationalProblem(self.lhs-self.rhs, self.x_out, bcs=self.bcs)
solver_name = self.field_name+self.__class__.__name__
return NonlinearVariationalSolver(problem, solver_parameters=self.solver_parameters,
return NonlinearVariationalSolver(problem, solver_parameters=self.solver_parameters,
options_prefix=solver_name)

def apply(self, x_out, *x_in):
Expand All @@ -860,7 +860,7 @@ def apply(self, x_out, *x_in):

class TR_BDF2(TimeDiscretisation):
"""
Implements the two stage implicit TR-BDF2 time stepping method, with a
Implements the two stage implicit TR-BDF2 time stepping method, with a
trapezoidal stage (TR) followed by a second order backwards difference stage (BDF2).
The TR-BDF2 time stepping method for operator F is written as
Expand Down Expand Up @@ -961,7 +961,7 @@ def solver_tr(self):
# setup solver using lhs and rhs defined in derived class
problem = NonlinearVariationalProblem(self.lhs-self.rhs, self.xnpg, bcs=self.bcs)
solver_name = self.field_name+self.__class__.__name__+"_tr"
return NonlinearVariationalSolver(problem, solver_parameters=self.solver_parameters,
return NonlinearVariationalSolver(problem, solver_parameters=self.solver_parameters,
options_prefix=solver_name)

@cached_property
Expand All @@ -970,7 +970,7 @@ def solver_bdf2(self):
# setup solver using lhs and rhs defined in derived class
problem = NonlinearVariationalProblem(self.lhs_bdf2-self.rhs_bdf2, self.x_out, bcs=self.bcs)
solver_name = self.field_name+self.__class__.__name__+"_bdf2"
return NonlinearVariationalSolver(problem, solver_parameters=self.solver_parameters,
return NonlinearVariationalSolver(problem, solver_parameters=self.solver_parameters,
options_prefix=solver_name)

def apply(self, x_out, x_in):
Expand Down Expand Up @@ -1032,7 +1032,7 @@ def solver0(self):
# setup solver using lhs and rhs defined in derived class
problem = NonlinearVariationalProblem(self.lhs-self.rhs0, self.x_out, bcs=self.bcs)
solver_name = self.field_name+self.__class__.__name__+"0"
return NonlinearVariationalSolver(problem, solver_parameters=self.solver_parameters,
return NonlinearVariationalSolver(problem, solver_parameters=self.solver_parameters,
options_prefix=solver_name)

@property
Expand All @@ -1041,7 +1041,7 @@ def solver(self):
# setup solver using lhs and rhs defined in derived class
problem = NonlinearVariationalProblem(self.lhs-self.rhs, self.x_out, bcs=self.bcs)
solver_name = self.field_name+self.__class__.__name__
return NonlinearVariationalSolver(problem, solver_parameters=self.solver_parameters,
return NonlinearVariationalSolver(problem, solver_parameters=self.solver_parameters,
options_prefix=solver_name)

def apply(self, x_out, *x_in):
Expand Down Expand Up @@ -1117,7 +1117,7 @@ def setup(self, equation, apply_bcs=True, *active_labels):
elif (self.order == 4):
self.b = [-(9.0)/(24.0), (37.0)/(24.0), -(59.0)/(24.0), (55.0)/(24.0)]
elif (self.order == 5):
self.b = [(251.0)/(720.0), -(1274.0)/(720.0), (2616.0)/(720.0),
self.b = [(251.0)/(720.0), -(1274.0)/(720.0), (2616.0)/(720.0),
-(2774.0)/(720.0), (2901.0)/(720.0)]

@property
Expand Down Expand Up @@ -1162,7 +1162,7 @@ def solver0(self):
# setup solver using lhs and rhs defined in derived class
problem = NonlinearVariationalProblem(self.lhs-self.rhs0, self.x_out, bcs=self.bcs)
solver_name = self.field_name+self.__class__.__name__+"0"
return NonlinearVariationalSolver(problem, solver_parameters=self.solver_parameters,
return NonlinearVariationalSolver(problem, solver_parameters=self.solver_parameters,
options_prefix=solver_name)

@property
Expand All @@ -1171,7 +1171,7 @@ def solver(self):
# setup solver using lhs and rhs defined in derived class
problem = NonlinearVariationalProblem(self.lhs-self.rhs, self.x_out, bcs=self.bcs)
solver_name = self.field_name+self.__class__.__name__
return NonlinearVariationalSolver(problem, solver_parameters=self.solver_parameters,
return NonlinearVariationalSolver(problem, solver_parameters=self.solver_parameters,
options_prefix=solver_name)

def apply(self, x_out, *x_in):
Expand Down Expand Up @@ -1310,7 +1310,7 @@ def solver0(self):
# setup solver using lhs and rhs defined in derived class
problem = NonlinearVariationalProblem(self.lhs0-self.rhs0, self.x_out, bcs=self.bcs)
solver_name = self.field_name+self.__class__.__name__+"0"
return NonlinearVariationalSolver(problem, solver_parameters=self.solver_parameters,
return NonlinearVariationalSolver(problem, solver_parameters=self.solver_parameters,
options_prefix=solver_name)

@property
Expand All @@ -1319,7 +1319,7 @@ def solver(self):
# setup solver using lhs and rhs defined in derived class
problem = NonlinearVariationalProblem(self.lhs-self.rhs, self.x_out, bcs=self.bcs)
solver_name = self.field_name+self.__class__.__name__
return NonlinearVariationalSolver(problem, solver_parameters=self.solver_parameters,
return NonlinearVariationalSolver(problem, solver_parameters=self.solver_parameters,
options_prefix=solver_name)

def apply(self, x_out, *x_in):
Expand Down

0 comments on commit c60c5a9

Please sign in to comment.