diff --git a/HySoP/hysop/operator/diffusion.py b/HySoP/hysop/operator/diffusion.py index 80f52a89c8b01409fda4d8ef93479302f14306d4..c1eb3ab8ec9a8f2119342ae1486fba1fe7b0eb23 100644 --- a/HySoP/hysop/operator/diffusion.py +++ b/HySoP/hysop/operator/diffusion.py @@ -9,6 +9,7 @@ from parmepy.operator.continuous import Operator from parmepy.f2py import fftw2py from parmepy.operator.discrete.diffusion_fft import DiffusionFFT from parmepy.constants import debug +from parmepy.methods_keys import SpaceDiscretisation, GhostUpdate import numpy as np @@ -35,7 +36,8 @@ class Diffusion(Operator): """ # The only available method at the time is fftw if method is None: - method = 'fftw' + method = {SpaceDiscretisation: 'fftw', GhostUpdate: True} + ## input/output field, solution of the problem self.vorticity = vorticity ## Global resolution for vorticity @@ -50,7 +52,7 @@ class Diffusion(Operator): def discretize(self): # The only available solver is fftw - if self.method is not 'fftw': + if self.method[SpaceDiscretisation] is not 'fftw': print self.method raise AttributeError("Method not yet implemented.") diff --git a/HySoP/hysop/operator/discrete/differential.py b/HySoP/hysop/operator/discrete/differential.py index 514a3d8077a6a92ba57dc01405e2c429f4fa9935..52a16ddee97f6b42d60f3f2d1441627f2d5f5582 100644 --- a/HySoP/hysop/operator/discrete/differential.py +++ b/HySoP/hysop/operator/discrete/differential.py @@ -24,8 +24,7 @@ class Differential(DiscreteOperator): ## return object.__new__(cls, *args, **kw) @debug - def __init__(self, invar, outvar, - method={SpaceDiscretisation: FD_C_4, GhostUpdate: True}): + def __init__(self, invar, outvar, method=None): """ @param[in] invar : input field @param[in,out] outvar : Grad of the input field. @@ -36,6 +35,8 @@ class Differential(DiscreteOperator): """ self.invar = invar self.outvar = outvar + if method is None: + method = {SpaceDiscretisation: FD_C_4, GhostUpdate: True} DiscreteOperator.__init__(self, [self.invar, self.outvar], method=method) self.input = [self.invar] diff --git a/HySoP/hysop/operator/discrete/discrete.py b/HySoP/hysop/operator/discrete/discrete.py index a752db902e728422419f6ccb33f1cb1fe4b6e96b..96fe01654db125aba97bc0cee186d5b105d6c581 100644 --- a/HySoP/hysop/operator/discrete/discrete.py +++ b/HySoP/hysop/operator/discrete/discrete.py @@ -5,6 +5,7 @@ Abstract interface for discrete operators. from abc import ABCMeta, abstractmethod from parmepy.constants import debug from parmepy.tools.timers import Timer, ManualFunctionTimer +from parmepy.methods_keys import GhostUpdate class DiscreteOperator(object): @@ -40,6 +41,8 @@ class DiscreteOperator(object): if method is None: method = {} self.method = method + if not GhostUpdate in method: + method[GhostUpdate] = True self.name = self.__class__.__name__ ## Object to store computational times of lower level functions self.timer = Timer(self)