Exemple #1
0
def single_layer(
    space, points, wavenumber, parameters=None, device_interface=None, precision=None
):
    """Return a Helmholtz single-layer potential operator."""
    from bempp.core.dense_potential_assembler import DensePotentialAssembler
    from bempp.api.operators import OperatorDescriptor
    from bempp.api.operators import _add_wavenumber
    from bempp.api.assembly.potential_operator import PotentialOperator

    options = {"KERNEL_FUNCTION": "helmholtz_single_layer"}
    _add_wavenumber(options, wavenumber)

    return PotentialOperator(
        DensePotentialAssembler(
            space,
            OperatorDescriptor(
                "helmholtz_single_layer_potential", options, "default_dense"
            ),
            points,
            1,
            True,
            device_interface,
            precision,
            parameters=parameters,
        )
    )
Exemple #2
0
def electric_field(
    domain,
    range_,
    dual_to_range,
    wavenumber,
    parameters=None,
    assembler="default_nonlocal",
    device_interface=None,
    precision=None,
):
    """Assemble the electric field boundary operator."""
    from bempp.api.operators import _add_wavenumber

    if not (domain.identifier == "rwg0" and dual_to_range.identifier == "snc0"):
        raise ValueError(
            "Operator only defined for domain = 'rwg' and 'dual_to_range = 'snc"
        )

    options = {"KERNEL_FUNCTION": "helmholtz_single_layer", "COMPLEX_KERNEL": None}

    _add_wavenumber(options, wavenumber)

    return _common.create_operator(
        "maxwell_electric_field_boundary",
        domain,
        range_,
        dual_to_range,
        parameters,
        assembler,
        options,
        "maxwell_electric_field",
        device_interface,
        precision,
    )
Exemple #3
0
def magnetic_field(space,
                   points,
                   wavenumber,
                   parameters=None,
                   device_interface=None,
                   precision=None):
    """Return a Maxwell magnetic far-field potential operator."""
    from bempp.core.dense_potential_assembler import DensePotentialAssembler
    from bempp.api.operators import OperatorDescriptor
    from bempp.api.operators import _add_wavenumber
    from bempp.api.assembly.potential_operator import PotentialOperator

    options = {}
    _add_wavenumber(options, wavenumber)

    return PotentialOperator(
        DensePotentialAssembler(
            space,
            OperatorDescriptor("maxwell_magnetic_far_field", options,
                               "maxwell_magnetic_far_field"),
            points,
            3,
            True,
            device_interface,
            precision,
            parameters=parameters,
        ))
Exemple #4
0
def adjoint_double_layer(
    domain,
    range_,
    dual_to_range,
    wavenumber,
    parameters=None,
    assembler="default_nonlocal",
    device_interface=None,
    precision=None,
):
    """Assemble the Helmholtz adj. double-layer boundary operator."""
    from bempp.api.operators import _add_wavenumber
    from .modified_helmholtz import (
        adjoint_double_layer as _modified_adjoint_double_layer,
    )

    if _np.real(wavenumber) == 0:
        return _modified_adjoint_double_layer(
            domain,
            range_,
            dual_to_range,
            _np.imag(wavenumber),
            parameters,
            assembler,
            device_interface,
            precision,
        )

    options = {
        "KERNEL_FUNCTION": "helmholtz_adjoint_double_layer",
        "COMPLEX_KERNEL": None,
    }

    _add_wavenumber(options, wavenumber)

    return _common.create_operator(
        "helmholtz_adjoint_double_layer_boundary",
        domain,
        range_,
        dual_to_range,
        parameters,
        assembler,
        options,
        "default_scalar",
        device_interface,
        precision,
    )