Skip to content

Commit

Permalink
Merge pull request #224 from thetisproject/traitlets-fix
Browse files Browse the repository at this point in the history
Fix compatibility with traitlets 5
  • Loading branch information
stephankramer authored Sep 24, 2020
2 parents 3654bda + 139930b commit 0afc140
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 5 deletions.
5 changes: 2 additions & 3 deletions thetis/configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,6 @@ def default_value_repr(self):

class PETScSolverParameters(Dict):
"""PETSc solver options dictionary"""
default_value = None
info_text = 'a PETSc solver options dictionary'

def validate(self, obj, value):
Expand Down Expand Up @@ -331,8 +330,8 @@ def _default(self):
if hasattr(name_trait, 'default_value') and name_trait.default_value is not None:
return name_trait.paired_defaults[name_trait.default_value]()

obs_handler = ObserveHandler(name, type="change")
def_handler = DefaultHandler(name_trait.paired_name)
obs_handler = observe(name, type="change")
def_handler = default(name_trait.paired_name)

def update_class(cls):
"Programmatically update the class"
Expand Down
2 changes: 0 additions & 2 deletions thetis/options.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,13 +84,11 @@ class PressureProjectionTimestepperOptions2d(TimeStepperOptions):
'pc_python_type': 'thetis.AssembledSchurPC',
'schur_ksp_type': 'gmres',
'schur_ksp_max_it': 100,
'schur_ksp_converged_reason': False,
'schur_pc_type': 'gamg',
},
}).tag(config=True)
solver_parameters_momentum = PETScSolverParameters({
'ksp_type': 'gmres',
'ksp_converged_reason': False,
'pc_type': 'bjacobi',
'sub_ksp_type': 'preonly',
'sub_pc_type': 'sor',
Expand Down
2 changes: 2 additions & 0 deletions thetis/utility.py
Original file line number Diff line number Diff line change
Expand Up @@ -387,6 +387,8 @@ def __init__(self, solution, uv, bathymetry, boundary_funcs={},
solver_parameters.setdefault('pc_type', 'bjacobi')
solver_parameters.setdefault('sub_ksp_type', 'preonly')
solver_parameters.setdefault('sub_pc_type', 'ilu')
solver_parameters.setdefault('sub_pc_factor_shift_type', 'inblocks')

fs = solution.function_space()
mesh = fs.mesh()
test = TestFunction(fs)
Expand Down

0 comments on commit 0afc140

Please sign in to comment.