Esempio n. 1
0
class Region(optplan.EmRegion):
    """Represents the area in which we want to consider the objective function

    Effectively just the epsilon value in the desired region.

    Attributes:
        center: Optimization area center
        extents: Width and height of the optimization region
        power: Multiplier for the effects of the objective function (default 1).
    """

    type = schema_utils.polymorphic_model_type("overlap.region")
    center = optplan.vec3d()
    extents = optplan.vec3d()
    power = types.FloatType()
Esempio n. 2
0
class KerrOverlap(optplan.EmOverlap):
    """Represents the area in which we want to have a strong Kerr nonlinearity

    Effectively just the epsilon value in the desired region.

    Attributes:
        center: Optimization area center
        extents: Width and height of the optimization region
        power: The transmission power of the mode.
    """

    type = schema_utils.polymorphic_model_type("overlap.kerr")
    center = optplan.vec3d()
    extents = optplan.vec3d()
    power = types.FloatType()
Esempio n. 3
0
class PlaneWaveSource(optplan.EmSource):
    """Represents a plane wave source.

    Attributes:
        type: Must be "source.plane_wave".
    """
    type = schema_utils.polymorphic_model_type("source.plane_wave")
    center = optplan.vec3d()
    extents = optplan.vec3d()
    normal = optplan.vec3d()
    theta = types.FloatType()
    psi = types.FloatType()
    polarization_angle = types.FloatType()
    overwrite_bloch_vector = types.BooleanType()
    border = types.ListType(types.FloatType())
    power = types.FloatType()
Esempio n. 4
0
class StoredEnergy(optplan.Function):
    """Defines an integral for calculating the stored energy in a resonator.

    Attributes:
        type: Must be "function.stored_energy".
        simulation: Simulation from which electric fields are obtained.
        center: Centre of integration region
        extents: Width and height of integration region.
        epsilon: Permittivity.
    """
    type = schema_utils.polymorphic_model_type("function.stored_energy")
    simulation = optplan.ReferenceType(optplan.Function)
    simulation_space = optplan.ReferenceType(optplan.SimulationSpaceBase)
    center = optplan.vec3d()
    extents = optplan.vec3d()
    epsilon = optplan.ReferenceType(optplan.Function)
Esempio n. 5
0
class BlochBoundary(schema_utils.Model):
    """Represents a Bloch boundary condition.

    Attributes:
        bloch_vector: 3D Bloch optplan.vector.
    """
    type = schema_utils.polymorphic_model_type("bloch")
    bloch_vector = optplan.vec3d(default=[0, 0, 0])
Esempio n. 6
0
class PowerTransmission(optplan.Function):
    """Defines a function that measures amount of power passing through plane.

    The amount of power is computed by summing the Poynting vector across
    the desired plane.

    Attributes:
        field: The simulation field to use.
        center: Center of plane to compute power.
        extents: Extents of the plane over which to compute power.
        normal: Normal direction of the plane. This determines the sign of the
            power flowing through the plane.
    """
    type = optplan.define_schema_type("function.poynting.plane_power")
    field = optplan.ReferenceType(optplan.FdfdSimulation)
    center = optplan.vec3d()
    extents = optplan.vec3d()
    normal = optplan.vec3d()
Esempio n. 7
0
class GaussianSource(optplan.EmSource):
    """Represents a gaussian source.

    Attributes:
        type: Must be "source.gaussian_beam".
        normalize_by_sim: If `True`, normalize the power by running a
            simulation.
    """
    type = schema_utils.polymorphic_model_type("source.gaussian_beam")
    w0 = types.FloatType()
    center = optplan.vec3d()
    extents = optplan.vec3d()
    normal = optplan.vec3d()
    theta = types.FloatType()
    psi = types.FloatType()
    polarization_angle = types.FloatType()
    overwrite_bloch_vector = types.BooleanType()
    power = types.FloatType()
    normalize_by_sim = types.BooleanType(default=False)
Esempio n. 8
0
class ImportOverlap(optplan.EmOverlap):
    """Represents a imported overlap vector.

    Attributes:
        file_name: .mat file containing the overlap vector.
        center: the center coordinate of the overlap, allows for translation
            of the overlap to the specified center.
    """
    type = schema_utils.polymorphic_model_type("overlap.import_field_vector")
    file_name = types.StringType()
    center = optplan.vec3d()
Esempio n. 9
0
class WaveguideMode(optplan.ProblemGraphNode):
    """Represents basic information for a waveguide mode.

    This class is not intended to be instantiable.

    Attributes:
        center: Waveguide center.
        extents: Width and height of waveguide mode region.
        normal: Normal direction of the waveguide. Note that this is also the
            mode propagation direction.
        mode_num: Mode number. The mode with largest propagation constant is
            mode 0, the mode with second largest propagation constant is mode 1,
            etc.
        power: The transmission power of the mode.
    """
    type = schema_utils.polymorphic_model_type("em.waveguide_mode")
    center = optplan.vec3d()
    extents = optplan.vec3d()
    normal = optplan.vec3d()
    mode_num = types.IntType()
    power = types.FloatType()
Esempio n. 10
0
class WaveguideModeOverlap(optplan.EmOverlap):
    """Represents a waveguide mode.

    The waveguide is assumed to be axis-aligned.

    Attributes:
        center: Waveguide center.
        extents: Width and height of waveguide mode region.
        normal: Normal direction of the waveguide. Note that this is also the
            mode propagation direction.
        mode_num: Mode number. The mode with largest propagation constant is
            mode 0, the mode with second largest propagation constant is mode 1,
            etc.
        power: The transmission power of the mode.
    """
    type = schema_utils.polymorphic_model_type("overlap.waveguide_mode")
    center = optplan.vec3d()
    extents = optplan.vec3d()
    normal = optplan.vec3d()
    mode_num = types.IntType()
    power = types.FloatType()
Esempio n. 11
0
class FieldMonitor(optplan.Monitor):
    """Defines a field monitor.

    A field monitor represents a 3D vector field, e.g. the electric field or
    permittivity distribution. The characteristic of a field monitor is that
    is unpacks the output of a function (which is a vector) into a 3-component,
    3D array, each of which represents a component of the field at a given point
    in space (or in technical terms, the vector is unvec'ed).

    Because 3D fields are expensive to store, a 2D slice can be specified
    by a point in the slice and a normal vector in the slice.

    Attributes:
        type: Must be "monitor.field"
        function: Name of function to monitor.
        center: A point in the monitored slice.
        normal: Normal of the slice plane (must be axis-aligned).
    """
    type = schema_utils.polymorphic_model_type("monitor.field")
    function = optplan.ReferenceType(optplan.Function)
    center = optplan.vec3d()
    normal = optplan.vec3d()
Esempio n. 12
0
class WaveguideInitializer(Initializer):
    """Initializes parametrization using with a rectangular epsilon shape.

    The two levels of the step function can optionally have uniformly random
    initialization.

    Attributes:
        lower_min: minimum value of the lower (background) permittivity
        lower_max: maximum value of the lower (background) permittivity
        upper_min: minimum value of the upper (waveguide) permittivity
        upper_max: maximum value of the upper (waveguide) permittivity
        region: optplan.Region object specifying the upper permittivity (waveguide) region
        sim_space: simulation object to use to generate the waveguide region
    """
    type = schema_utils.polymorphic_model_type("initializer.waveguide")
    lower_min = types.FloatType()
    lower_max = types.FloatType()
    upper_min = types.FloatType()
    upper_max = types.FloatType()
    center = optplan.vec3d()
    extents = optplan.vec3d()
    edge_coords = types.ListType(types.ListType(types.IntType))
Esempio n. 13
0
class WaveguideModeEigSource(optplan.EmSource):
    """Represents a photonic crystal waveguide mode.

    The waveguide does NOT have to be axis-aligned. The waveguide mode is
    computed as a 3D eigenmode solve.

    Attributes:
        center: Waveguide center.
        extents: Width and height of waveguide mode region.
        normal: Normal direction of the waveguide. Note that this is also the
            mode propagation direction.
        mode_num: Mode number. The mode with largest propagation constant is
            mode 0, the mode with second largest propagation constant is mode 1,
            etc.
        power: The transmission power of the mode.
    """
    type = schema_utils.polymorphic_model_type("source.waveguide_mode_eig")
    center = optplan.vec3d()
    extents = optplan.vec3d()
    normal = optplan.vec3d()
    mode_num = types.IntType()
    power = types.FloatType()
Esempio n. 14
0
class DipoleSource(optplan.EmSource):
    """Represents a dipole source.

    Attributes:
        position: Position of the dipole (will snap to grid).
        axis: Direction of the dipole (x:0, y:1, z:2).
        phase: Phase of the dipole source (in radian).
        power: Power assuming uniform dielectric space with the permittivity.
    """
    type = schema_utils.polymorphic_model_type("source.dipole_source")
    position = optplan.vec3d()
    axis = types.IntType()
    phase = types.FloatType()
    power = types.FloatType()
    normalize_by_sim = types.BooleanType(default=False)
Esempio n. 15
0
class GdsEps(EpsilonSpec):
    """Defines a permittivity distribution using a GDS file.

    The GDS file will be flattened so that each layer only contains polygons.
    TODO(logansu): Expand description.

    Attributes:
        type: Must be "gds_epsilon".
        gds: URI of GDS file.
        mat_stack: Description of each GDS layer permittivity values and
            thicknesses.
        stack_normal: Direction considered the normal to the stack.
    """
    type = schema_utils.polymorphic_model_type("gds")
    gds = types.StringType()
    mat_stack = types.ModelType(GdsMaterialStack)
    stack_normal = optplan.vec3d()
Esempio n. 16
0
class GdsMeshEps(EpsilonSpec):
    """Defines a permittivity distribution by a lits of meshes.

    The meshes are drawn in order of the list. Consequently, if meshes overlap,
    the mesh drawn later will take precedence.

    Attributes:
        gds: GDS file to use for `GdsMesh` types.
        background: Default background permittivity.
        mesh_list: List of meshes to draw.
        stack_normal: Direction considered the normal to the stack.
    """
    type = schema_utils.polymorphic_model_type("gds_mesh")
    gds = types.StringType()
    background = types.ModelType(Material)
    mesh_list = types.ListType(types.PolyModelType(Mesh))
    stack_normal = optplan.vec3d()
Esempio n. 17
0
class AnnulusOverlap(optplan.EmOverlap):
    """Represents the annulus mode.

    The waveguide is assumed to be axis-aligned.

    Attributes:
        normal: Normal direction of the annulus. Note that this is also the
            mode propagation direction.
        mode_num: Mode number. The mode with largest propagation constant is
            mode 0, the mode with second largest propagation constant is mode 1,
            etc.
        power: The transmission power of the mode.
    """
    type = schema_utils.polymorphic_model_type("overlap.annulus_mode")
    # May not need the normal, we'll see
    normal = optplan.vec3d()
    mode_num = types.IntType()
    power = types.FloatType()