Пример #1
0
    def initialize(self,evaluation_points):

        accuracy_options = _bempplib.createAccuracyOptions()
        accuracy_options.doubleRegular.setRelativeQuadratureOrder(self._relative_regular_quadrature_order)
        accuracy_options.doubleSingular.setRelativeQuadratureOrder(self._relative_singular_quadrature_order)
        accuracy_options.singleRegular.setRelativeQuadratureOrder(self._relative_regular_quadrature_order)
        
        assembly_options = _bempplib.createAssemblyOptions()
        assembly_options.setVerbosityLevel('low')
        if self._use_aca:
            aca_options = _bempplib.createAcaOptions()
            aca_options.maximumBlockSize = 2000
            aca_options.maximumRank = 100
            aca_options.eps = self._aca_epsilon
            assembly_options.switchToAca(aca_options)
        quad_strategy = _bempplib.createNumericalQuadratureStrategy("float64","complex128",accuracy_options)
        
        
        self._quad_strategy = quad_strategy
        self._context = _bempplib.createContext(quad_strategy,assembly_options)
        pconsts = _bempplib.createPiecewiseConstantScalarSpace(self._context,self._mesh)
        self._spaces = [pconsts,pconsts,pconsts]        
        self._mass_matrix = _bempplib.createIdentityOperator(self._context,pconsts,pconsts,pconsts).weakForm()

        self._boundary_operator_cache = _tools.OperatorCache(self._operator_cache_tol)
        self._potential_operator_cache = _tools.OperatorCache(self._operator_cache_tol)
        self._residuals = {}
        self._evaluation_points = evaluation_points
def initialize_context():
    
    accuracyOptions = lib.createAccuracyOptions()
    accuracyOptions.doubleRegular.setRelativeQuadratureOrder(2)
    accuracyOptions.doubleSingular.setRelativeQuadratureOrder(1)
    quadStrategy = lib.createNumericalQuadratureStrategy("float64","complex128",accuracyOptions)
    options = lib.createAssemblyOptions()
    options.setVerbosityLevel("low")
    aca_ops = lib.createAcaOptions()
    aca_ops.eps=1E-6
    options.switchToAcaMode(aca_ops)
    context = lib.createContext(quadStrategy,options)
    return context
def initialize_context():

    accuracyOptions = lib.createAccuracyOptions()
    accuracyOptions.doubleRegular.setRelativeQuadratureOrder(2)
    accuracyOptions.doubleSingular.setRelativeQuadratureOrder(1)
    quadStrategy = lib.createNumericalQuadratureStrategy(
        "float64", "complex128", accuracyOptions)
    options = lib.createAssemblyOptions()
    options.setVerbosityLevel("low")
    aca_ops = lib.createAcaOptions()
    aca_ops.eps = 1E-6
    options.switchToAcaMode(aca_ops)
    context = lib.createContext(quadStrategy, options)
    return context
Пример #4
0
def rhsData(point, normal):
    return 2j * k * np.exp(1j * k * point[0]) * (normal[0] - 1)

# Set accuracy options. For regular integrals on pairs on elements,
# use quadrature of 2 orders higher than default, and for singular
# integrals, 1 order higher than default.

accuracyOptions = lib.createAccuracyOptions()
accuracyOptions.doubleRegular.setRelativeQuadratureOrder(2)
accuracyOptions.doubleSingular.setRelativeQuadratureOrder(1)

# The default strategy for numerical quadrature.
# "float64" is the basis function type and "complex128" is the result type".

quadStrategy = lib.createNumericalQuadratureStrategy(
    "float64", "complex128", accuracyOptions)

# Use ACA to accelerate the assembly

options = lib.createAssemblyOptions()
options.switchToAca(lib.createAcaOptions())

# The context object combines these settings

context = lib.createContext(quadStrategy, options)

# Load a grid approximating a unit sphere

grid_factory = lib.createGridFactory()
grid = grid_factory.importGmshGrid(
    "triangular", "../../meshes/sphere-h-0.1.msh")
Пример #5
0
os.remove(s1_geo_name)
os.remove(s2_geo_name)
os.remove(s3_geo_name)
os.remove(s1_msh_name)
os.remove(s2_msh_name)
os.remove(s3_msh_name)

# Create Context

accuracy_options = blib.createAccuracyOptions()
accuracy_options.doubleRegular.setRelativeQuadratureOrder(
    2)  # 2 orders higher than default accuracy for regular integrals
accuracy_options.doubleSingular.setRelativeQuadratureOrder(
    1)  # 1 order higher than default accuracy for singular integrals
strategy = blib.createNumericalQuadratureStrategy("float64", "complex128",
                                                  accuracy_options)
options = blib.createAssemblyOptions()
aca_options = blib.createAcaOptions()
aca_options.eps = 1E-5
options.switchToAca(aca_options)
context = blib.createContext(strategy, options)

# Create the spaces

sphere1_plc = blib.createPiecewiseLinearContinuousScalarSpace(context, sphere1)
sphere2_plc = blib.createPiecewiseLinearContinuousScalarSpace(context, sphere2)
sphere3_plc = blib.createPiecewiseLinearContinuousScalarSpace(context, sphere3)

# Now create the operators
slp11 = blib.createModifiedHelmholtz3dSingleLayerBoundaryOperator(
    context, sphere1_plc, sphere1_plc, sphere1_plc, w1)
Пример #6
0
def create_bempp_options(solver_use_aca = True,
                         evaluation_use_aca = True,
                         solver_aca_epsilon = 1E-6,
                         solver_aca_maximum_rank = 200,
                         solver_aca_maximum_block_size = 2000,
                         solver_aca_mode = 'hybrid_assembly',
                         solver_aca_eta = 1.2,
                         evaluation_aca_epsilon = 1E-3,
                         evaluation_aca_eta = 0.4,
                         evaluation_aca_maximum_rank = 30,
                         evaluation_aca_maximum_block_size = 2000,
                         evaluation_aca_mode = 'global_assembly',
                         relative_double_singular_quadrature_order = 2,
                         relative_double_regular_quadrature_order = 1,
                         relative_single_regular_quadrature_order = 1,
                         verbosity_level = 'low',
                         basis_function_type = 'float64',
                         result_type = 'complex128',
                         number_of_threads = None
                         ):
                         
    solver_assembly_options = _bempplib.createAssemblyOptions()
    
    if number_of_threads is not None:
        solver_assembly_options.setMaxThreadCount(number_of_threads)
    
        
    solver_assembly_options.setVerbosityLevel(verbosity_level)
    
    if solver_use_aca:
        solver_aca_options = _bempplib.createAcaOptions()
        solver_aca_options.mode = solver_aca_mode
        solver_aca_options.eps = solver_aca_epsilon
        solver_aca_options.eta = solver_aca_eta
        solver_aca_options.maximumBlockSize = solver_aca_maximum_block_size
        solver_aca_options.maximumRank = solver_aca_maximum_rank
        solver_assembly_options.switchToAca(solver_aca_options)
    
    
    solver_accuracy_options = _bempplib.createAccuracyOptions()
    solver_accuracy_options.doubleRegular.setRelativeQuadratureOrder(relative_double_regular_quadrature_order)
    solver_accuracy_options.doubleSingular.setRelativeQuadratureOrder(relative_double_singular_quadrature_order)
    
    quadrature_strategy = _bempplib.createNumericalQuadratureStrategy(basis_function_type,result_type,solver_accuracy_options)
    context = _bempplib.createContext(quadrature_strategy,solver_assembly_options)
    
    evaluation_options = _bempplib.createEvaluationOptions()
    evaluation_accuracy_options = _bempplib.createAccuracyOptions()
    evaluation_accuracy_options.singleRegular.setRelativeQuadratureOrder(relative_single_regular_quadrature_order)
    evaluation_quadrature_strategy = _bempplib.createNumericalQuadratureStrategy(basis_function_type,result_type,evaluation_accuracy_options)
    if evaluation_use_aca:
        evaluation_aca_options = _bempplib.createAcaOptions()
        evaluation_aca_options.eps = evaluation_aca_epsilon
        evaluation_aca_options.eta = evaluation_aca_eta
        evaluation_aca_options.mode = evaluation_aca_mode
        evaluation_aca_options.maximumBlockSize = evaluation_aca_maximum_block_size
        evaluation_aca_options.maximumRank = evaluation_aca_maximum_rank
        evaluation_options.switchToAcaMode(evaluation_aca_options)
    return (context,evaluation_options,evaluation_quadrature_strategy)