<commit_before>from abc import ABCMeta, abstractmethod
from firedrake import Function, TestFunction, TrialFunction, \
    LinearVariationalProblem, LinearVariationalSolver, FacetNormal, \
    dx, dot, grad, jump, avg, dS_v, dS_h

class Advection(object):
    """
    Base class for advection schemes for dcore.

    :arg state: :class:`.State` object.
    """
    __metaclass__ = ABCMeta

    def __init__(self, state):
        self.state = state
    
    @abstractmethod
    def apply(self, x, x_out):
        """
        Function takes x as input, computes F(x) and returns x_out
        as output.

        :arg x: :class:`.Function` object, the input Function.
        :arg x_out: :class:`.Function` object, the output Function.
        """
        pass    

class NoAdvection(Advection):
    """
    An non-advection scheme that does nothing.
    """

    def __init__(self, state):
        self.state = state

        #create a ubar field even though we don't use it.
        self.ubar = Function(state.V[0])

    def apply(self, x_in, x_out):

        x_out.assign(x_in)

class LinearAdvection_Vt(Advection):
    """
    An advection scheme that uses the linearised background state 
    in evaluation of the advection term for the Vt temperature space.

    :arg state: :class:`.State` object.
    :arg qbar: :class:`.Function` object. The reference function that we 
    are linearising around.
    :arg options: a PETSc options dictionary
    """

    def __init__(self, state, V, qbar, options = None):
        self.state = state
        self.ubar = Function(state.V[0])

        p = TestFunction(state.V[2])
        q = TrialFunction(state.V[2])<commit_msg>calling the superclass constructor as recommended by wence<commit_after>from abc import ABCMeta, abstractmethod
from firedrake import Function, TestFunction, TrialFunction, \
    LinearVariationalProblem, LinearVariationalSolver, FacetNormal, \
    dx, dot, grad, jump, avg, dS_v, dS_h

class Advection(object):
    """
    Base class for advection schemes for dcore.

    :arg state: :class:`.State` object.
    """
    __metaclass__ = ABCMeta

    def __init__(self, state):
        self.state = state
    
    @abstractmethod
    def apply(self, x, x_out):
        """
        Function takes x as input, computes F(x) and returns x_out
        as output.

        :arg x: :class:`.Function` object, the input Function.
        :arg x_out: :class:`.Function` object, the output Function.
        """
        pass    

class NoAdvection(Advection):
    """
    An non-advection scheme that does nothing.
    """

    def __init__(self, state):

        super(NoAdvection, self).__init__(state)
        #create a ubar field even though we don't use it.
        self.ubar = Function(state.V[0])

    def apply(self, x_in, x_out):

        x_out.assign(x_in)

class LinearAdvection_Vt(Advection):
    """
    An advection scheme that uses the linearised background state 
    in evaluation of the advection term for the Vt temperature space.

    :arg state: :class:`.State` object.
    :arg qbar: :class:`.Function` object. The reference function that we 
    are linearising around.
    :arg options: a PETSc options dictionary
    """

    def __init__(self, state, V, qbar, options = None):
        super(LinearAdvection_Vt, self).__init__(state)
        self.ubar = Function(state.V[0])

        p = TestFunction(state.V[2])
        q = TrialFunction(state.V[2])
{'fraction_non_alphanumeric': 0.10133954571927781, 'fraction_numerical': 0.0023296447291788003, 'mean_word_length': 2.733695652173913, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1632466', 'n_tokens_mistral': 1088, 'n_tokens_neox': 1047, 'n_words': 330}