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_spaces(context,grid): """Initialize the spaces of piecewise linear and piecewise constant functions for a given grid Return a dictionary {'l': Piecewise linear continuous space 'c': Piecewise constant space 'ndofl': Number of dofs for lin space 'ndofc': Number of dofs for const space 'ndof': Number of total dofs (ndofc+ndofl) } """ res = {} res['l'] = lib.createPiecewiseLinearContinuousScalarSpace(context,grid) res['c'] = lib.createPiecewiseConstantScalarSpace(context,grid) res['ndofl'] = res['l'].globalDofCount() res['ndofc'] = res['c'].globalDofCount() res['ndof'] = res['ndofl']+res['ndofc'] return res
def initialize_spaces(context, grid): """Initialize the spaces of piecewise linear and piecewise constant functions for a given grid Return a dictionary {'l': Piecewise linear continuous space 'c': Piecewise constant space 'ndofl': Number of dofs for lin space 'ndofc': Number of dofs for const space 'ndof': Number of total dofs (ndofc+ndofl) } """ res = {} res['l'] = lib.createPiecewiseLinearContinuousScalarSpace(context, grid) res['c'] = lib.createPiecewiseConstantScalarSpace(context, grid) res['ndofl'] = res['l'].globalDofCount() res['ndofc'] = res['c'].globalDofCount() res['ndof'] = res['ndofl'] + res['ndofc'] return res
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") # Create a space of piecewise constant basis functions over the grid. pwiseConstants = lib.createPiecewiseConstantScalarSpace(context, grid) # We now initialize the boundary operators. # A boundary operator always takes three space arguments: a domain space, # a range space, and the test space (dual to the range). # Here, we just use L^2 projections. Hence, all spaces are identical. slpOp = lib.createHelmholtz3dSingleLayerBoundaryOperator( context, pwiseConstants, pwiseConstants, pwiseConstants, k) adlpOp = lib.createHelmholtz3dAdjointDoubleLayerBoundaryOperator( context, pwiseConstants, pwiseConstants, pwiseConstants, k) idOp = lib.createIdentityOperator( context, pwiseConstants, pwiseConstants, pwiseConstants) # Standard arithmetic operators can be used to create linear combinations of # boundary operators.
import scipy.special as sc import numpy.polynomial.legendre as leg import time accuracyOptions = lib.createAccuracyOptions() accuracyOptions.doubleRegular.setRelativeQuadratureOrder(2) accuracyOptions.singleRegular.setRelativeQuadratureOrder(2) quadStrategy = lib.createNumericalQuadratureStrategy("float64", "complex128", accuracyOptions) options = lib.createAssemblyOptions() options.switchToAca(lib.createAcaOptions()) context = lib.createContext(quadStrategy, options) grid = lib.createGridFactory().importGmshGrid("triangular", "airplane.msh") pconsts = lib.createPiecewiseConstantScalarSpace(context, grid) k = 16 #k = 64; #16; #0.16 # ansatz: direction of incident plane wave: assume x here lhsOp = lib.createHelmholtz3dSingleLayerBoundaryOperator( context, pconsts, pconsts, pconsts, k, "SLP") # Create a grid function representing the Dirichlet trace of the incident wave def uIncData(point): x, y, z = point return np.exp(1j * k * x)