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
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) dlp11 = blib.createModifiedHelmholtz3dDoubleLayerBoundaryOperator( context, sphere1_plc, sphere1_plc, sphere1_plc, w1) id11 = blib.createIdentityOperator(context, sphere1_plc, sphere1_plc, sphere1_plc) slp22_w1 = blib.createModifiedHelmholtz3dSingleLayerBoundaryOperator( context, sphere2_plc, sphere2_plc, sphere2_plc, w1) dlp22_w1 = blib.createModifiedHelmholtz3dDoubleLayerBoundaryOperator( context, sphere2_plc, sphere2_plc, sphere2_plc, w1)
# 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) dlp11 = blib.createModifiedHelmholtz3dDoubleLayerBoundaryOperator(context,sphere1_plc,sphere1_plc,sphere1_plc,w1) id11 = blib.createIdentityOperator(context,sphere1_plc,sphere1_plc,sphere1_plc) slp22_w1 = blib.createModifiedHelmholtz3dSingleLayerBoundaryOperator(context,sphere2_plc,sphere2_plc,sphere2_plc,w1) dlp22_w1 = blib.createModifiedHelmholtz3dDoubleLayerBoundaryOperator(context,sphere2_plc,sphere2_plc,sphere2_plc,w1) slp22_w2 = blib.createModifiedHelmholtz3dSingleLayerBoundaryOperator(context,sphere2_plc,sphere2_plc,sphere2_plc,w2) dlp22_w2 = blib.createModifiedHelmholtz3dDoubleLayerBoundaryOperator(context,sphere2_plc,sphere2_plc,sphere2_plc,w2) id22 = blib.createIdentityOperator(context,sphere2_plc,sphere2_plc,sphere2_plc) slp12 = blib.createModifiedHelmholtz3dSingleLayerBoundaryOperator(context,sphere2_plc,sphere1_plc,sphere1_plc,w1)