# Path: gusto/configuration.py
# def set_log_handler(comm):
#     def __init__(self, **kwargs):
#     def __setattr__(self, name, value):
#     def name(self):
# class Configuration(object):
# class TimesteppingParameters(Configuration):
# class OutputParameters(Configuration):
# class CompressibleParameters(Configuration):
# class ShallowWaterParameters(Configuration):
# class EadyParameters(Configuration):
# class CompressibleEadyParameters(CompressibleParameters, EadyParameters):
# class AdvectionOptions(Configuration, metaclass=ABCMeta):
# class EmbeddedDGOptions(AdvectionOptions):
# class RecoveredOptions(AdvectionOptions):
# class SUPGOptions(AdvectionOptions):
#     N = 0.01  # Brunt-Vaisala frequency (1/s)
#     T_0 = 273.15  # ref. temperature
#     H = None  # mean depth
#     H = None
#     L = None
#     N = sqrt(EadyParameters.Nsq)


from firedrake import (split, LinearVariationalProblem, Constant,
                       LinearVariationalSolver, TestFunctions, TrialFunctions,
                       TestFunction, TrialFunction, lhs, rhs, FacetNormal,
                       div, dx, jump, avg, dS_v, dS_h, ds_v, ds_t, ds_b, ds_tb, inner,
                       dot, grad, Function, VectorSpaceBasis, BrokenElement,
                       FunctionSpace, MixedFunctionSpace, DirichletBC)
from firedrake.petsc import flatten_parameters
from firedrake.parloops import par_loop, READ, INC
from pyop2.profiling import timed_function, timed_region
from gusto.configuration import logger, DEBUG
from gusto import thermodynamics
from abc import ABCMeta, abstractmethod, abstractproperty
        import numpy as np
                         'pc_type': 'python',
                         'pc_python_type': 'firedrake.SCPC',
                         'pc_sc_eliminate_fields': '0, 1',
                         # The reduced operator is not symmetric
                         'condensed_field': {'ksp_type': 'fgmres',
                                             'ksp_rtol': 1.0e-8,
                                             'ksp_atol': 1.0e-8,
                                             'ksp_max_it': 100,
                                             'pc_type': 'gamg',
                                             'pc_gamg_sym_graph': None,
                                             'mg_levels': {'ksp_type': 'gmres',
                                                           'ksp_max_it': 5,
                                                           'pc_type': 'bjacobi',
                                                           'sub_pc_type': 'ilu'}}}

    def __init__(self, state, quadrature_degree=None, solver_parameters=None,
                 overwrite_solver_parameters=False, moisture=None):

        self.moisture = moisture

        self.state = state

        if quadrature_degree is not None:
            self.quadrature_degree = quadrature_degree
        else:
            dgspace = state.spaces("DG")
            if any(deg > 2 for deg in dgspace.ufl_element().degree()):
                logger.warning("default quadrature degree most likely not sufficient for this degree element")
            self.quadrature_degree = (5, 5)


# Path: gusto/configuration.py
# def set_log_handler(comm):
#     def __init__(self, **kwargs):
#     def __setattr__(self, name, value):
#     def name(self):
# class Configuration(object):
# class TimesteppingParameters(Configuration):
# class OutputParameters(Configuration):
# class CompressibleParameters(Configuration):
# class ShallowWaterParameters(Configuration):
# class EadyParameters(Configuration):
# class CompressibleEadyParameters(CompressibleParameters, EadyParameters):
# class AdvectionOptions(Configuration, metaclass=ABCMeta):
# class EmbeddedDGOptions(AdvectionOptions):
# class RecoveredOptions(AdvectionOptions):
# class SUPGOptions(AdvectionOptions):
#     N = 0.01  # Brunt-Vaisala frequency (1/s)
#     T_0 = 273.15  # ref. temperature
#     H = None  # mean depth
#     H = None
#     L = None
#     N = sqrt(EadyParameters.Nsq)


# Path: gusto/linear_solvers.py
from firedrake import (split, LinearVariationalProblem, Constant,
                       LinearVariationalSolver, TestFunctions, TrialFunctions,
                       TestFunction, TrialFunction, lhs, rhs, FacetNormal,
                       div, dx, jump, avg, dS_v, dS_h, ds_v, ds_t, ds_b, ds_tb, inner,
                       dot, grad, Function, VectorSpaceBasis, BrokenElement,
                       FunctionSpace, MixedFunctionSpace, DirichletBC)
from firedrake.petsc import flatten_parameters
from firedrake.parloops import par_loop, READ, INC
from pyop2.profiling import timed_function, timed_region
from gusto.configuration import logger, DEBUG
from gusto import thermodynamics
from abc import ABCMeta, abstractmethod, abstractproperty
        import numpy as np

                         'pc_type': 'python',
                         'pc_python_type': 'firedrake.SCPC',
                         'pc_sc_eliminate_fields': '0, 1',
                         # The reduced operator is not symmetric
                         'condensed_field': {'ksp_type': 'fgmres',
                                             'ksp_rtol': 1.0e-8,
                                             'ksp_atol': 1.0e-8,
                                             'ksp_max_it': 100,
                                             'pc_type': 'gamg',
                                             'pc_gamg_sym_graph': None,
                                             'mg_levels': {'ksp_type': 'gmres',
                                                           'ksp_max_it': 5,
                                                           'pc_type': 'bjacobi',
                                                           'sub_pc_type': 'ilu'}}}

    def __init__(self, state, quadrature_degree=None, solver_parameters=None,
                 overwrite_solver_parameters=False, moisture=None):

        self.moisture = moisture

        self.state = state

        if quadrature_degree is not None:
            self.quadrature_degree = quadrature_degree
        else:
            dgspace = state.spaces("DG")
            if any(deg > 2 for deg in dgspace.ufl_element().degree()):
                logger.warning("default quadrature degree most likely not sufficient for this degree element")
            self.quadrature_degree = (5, 5)


        if logger.isEnabledFor(DEBUG):