def __init__(self, mesh, solver_style='sparseLU', **kwargs):

        # A dictionary that holds the helmholtz operators as a function of nu
        self.linear_operators = ConstructableDict(self._build_helmholtz_operator)

        # A dictionary that holds the helmholtz solver as a function of nu
        solver_builder = self.__getattribute__(solver_style_map[solver_style])
        self.solvers = ConstructableDict(solver_builder)

        ConstantDensityAcousticBase.__init__(self,
                                             mesh,
                                             solver_style=solver_style,
                                             **kwargs)
Exemplo n.º 2
0
    def __init__(self,
                 truncated_mesh_collection,
                 sparse_greens_matrix,
                 petsc='mumps'):
        #The petsc argument takes the type petsc solver you want

        #Create the solver the normal way. This will not generate the correct constructabledict 'self.solvers'. So we need to overwrite that. Hacky...
        self.solver = ConstantDensityAcousticFrequencyScalar_2D_truncated_domain(
            truncated_mesh_collection, sparse_greens_matrix)
        self.solver.solvers = ConstructableDict(
            self.factorize_at_freq)  #This function will be used.
        self.petsc = petsc
    def __init__(self,
                 mesh,
                 spatial_shifted_differences=True,
                 spatial_accuracy_order=4,
                 petsc='mumps',
                 **kwargs):
        #The petsc argument takes the type petsc solver you want

        #Create the solver the normal way. This will not generate the correct constructabledict 'self.solvers'. So we need to overwrite that. Hacky...
        self.solver = ConstantDensityHelmholtz(
            mesh,
            spatial_shifted_differences=spatial_shifted_differences,
            spatial_accuracy_order=spatial_accuracy_order,
            **kwargs)
        self.solver.solvers = ConstructableDict(
            self.factorize_at_freq)  #This function will be used.
        self.petsc = petsc