コード例 #1
0
ファイル: simulate.py プロジェクト: xiaoshuailu/spins-b
class WaveguideModeOverlap(SimOutput):
    """Represents a waveguide mode.

    The waveguide is assumed to be axis-aligned.

    Attributes:
        center: Waveguide center.
        wavelength: Wavelength at which to evaluate overlap.
        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.
        normalize: If `True`, normalize the overlap by the square of the total
            power emitted at the `wavelength`.
    """
    type = goos.ModelNameType("overlap.waveguide_mode")
    wavelength = goos.types.FloatType()
    center = goos.Vec3d()
    extents = goos.Vec3d()
    normal = goos.Vec3d()
    mode_num = goos.types.IntType()
    power = goos.types.FloatType()
    normalize = goos.types.BooleanType(default=True)

    class Attributes:
        output_type = goos.Function
コード例 #2
0
class WaveguideModeSource(SimSource):
    """Represents a waveguide mode.

    The waveguide is assumed to be axis-aligned. The time-domain profile
    is assumed to be Gaussian centered at wavelength `wavelength` and
    width of `bandwidth`.

    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.
        wavelength: Center wavelength of the mode source.
        bandwidth: Bandwidth of the Gaussian pulse.
    """
    type = goos.ModelNameType("source.waveguide_mode")
    center = goos.Vec3d()
    extents = goos.Vec3d()
    normal = goos.Vec3d()
    mode_num = goos.types.IntType()
    power = goos.types.FloatType()

    wavelength = goos.types.FloatType()
    bandwidth = goos.types.FloatType()
コード例 #3
0
class SimulationSpace(goos.Model):
    """Defines a simulation space.

    A simulation space contains information regarding the permittivity
    distributions but not the fields, i.e. no information regarding sources
    and wavelengths.

    Attributes:
        name: Name to identify the simulation space. Must be unique.
        mesh: Meshing information. This describes how the simulation region
            should be meshed.
        sim_region: Rectangular prism simulation domain.
        reflection_symmetry: Three element list with symmetry values in every axis
                            - 0: no symmetry
                            - 1: electric anti-symmetry around the center
                            - 2: electric symmetry around the center
    """
    type = goos.ModelNameType("simulation_space")
    mesh = goos.types.PolyModelType(MeshModel)
    sim_region = goos.types.ModelType(goos.Box3d)
    pml_thickness = goos.types.ListType(goos.types.IntType(),
                                        min_size=6,
                                        max_size=6)
    reflection_symmetry = goos.types.ListType(goos.types.IntType(),
                                              min_size=3,
                                              max_size=3)
コード例 #4
0
class ElectricField(SimOutput):
    """Retrieves the electric field at a particular wavelength.

    Attributes:
        wavelength: Wavelength to retrieve fields.
    """
    type = goos.ModelNameType("output.electric_field")
    wavelength = goos.types.FloatType()
コード例 #5
0
class Epsilon(SimOutput):
    """Displays the permittivity distribution.

    Attributes:
        wavelength: Wavelength to show permittivity.
    """
    type = goos.ModelNameType("output.epsilon")
    wavelength = goos.types.FloatType()
コード例 #6
0
class EigenValue(SimOutput):
    """Retrieves an eigen value from an eigensimulation.

    Attributes:
        bloch_vector: Bloch_vector to retrieve eigenvalue.
    """
    type = goos.ModelNameType("output.eigen_value")
    bloch_vector = goos.types.FloatType()
コード例 #7
0
class DirectSolver(Solver):
    """Defines a direct solver.

    Attributes:
        multiprocessing: If `True`, uses a multiprocessing solver, which enables
            solves to happen concurrently.
    """
    type = goos.ModelNameType("solver.direct")
    multiprocessing = goos.types.BooleanType(default=True)
コード例 #8
0
class UniformMesh(MeshModel):
    """Defines a uniform mesh.

    Attributes:
        type: Must be "uniform".
        dx: Unit cell distance for EM grid (nm).
    """
    type = goos.ModelNameType("uniform")
    dx = goos.types.FloatType()
コード例 #9
0
ファイル: simulate.py プロジェクト: xiaoshuailu/spins-b
class DipoleSource(SimSource):
    """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 = goos.ModelNameType("source.dipole_source")
    position = goos.Vec3d()
    axis = goos.types.IntType()
    phase = goos.types.FloatType()
    power = goos.types.FloatType()
コード例 #10
0
ファイル: simulate.py プロジェクト: xiaoshuailu/spins-b
class GaussianSource(SimSource):
    """Represents a gaussian source.

    Attributes:
        type: Must be "source.gaussian_beam".
        normalize_by_sim: If `True`, normalize the power by running a
            simulation.
    """
    type = goos.ModelNameType("source.gaussian_beam")
    w0 = goos.types.FloatType()
    center = goos.Vec3d()
    beam_center = goos.Vec3d()
    extents = goos.Vec3d()
    normal = goos.Vec3d()
    theta = goos.types.FloatType()
    psi = goos.types.FloatType()
    polarization_angle = goos.types.FloatType()
    power = goos.types.FloatType()
    normalize_by_sim = goos.types.BooleanType(default=False)
コード例 #11
0
class MaxwellSolver(Solver):
    """Defines a GPU-accelerated Maxwell solver.

    The Maxwell solver uses a GPU-accelerated iterative algorithm to solve
    the matrix.

    Attributes:
        solver: The specific solver to use in Maxwell.
        server: Location of the Maxwell server.
        err_thresh: Error threshold to use for the solve.
        max_iters: Maximum number of iterations in iterative solve.
    """
    type = goos.ModelNameType("solver.maxwell")
    solver = goos.types.StringType(default="maxwell_cg",
                                   choices=("maxwell_cg", "maxwell_bicgstab",
                                            "maxwell_eig"))
    server = goos.types.StringType()
    err_thresh = goos.types.FloatType(default=1e-5)
    max_iters = goos.types.FloatType(default=20000)
コード例 #12
0
class SimulationSpace(goos.Model):
    """Defines a simulation space.

    A simulation space contains information regarding the permittivity
    distributions but not the fields, i.e. no information regarding sources
    and wavelengths.

    Attributes:
        name: Name to identify the simulation space. Must be unique.
        dx: Mesh spacing.
        sim_region: Simulation domain. PMLs are added into this region.
        pml_thickness: An array `[x_left, x_right, y_left, y_right, z_left,
            z_right]` where each entry corresponds to the length of the PML
            boundary layer in real units.
    """
    type = goos.ModelNameType("simulation_space")
    dx = goos.types.FloatType()
    sim_region = goos.types.ModelType(goos.Box3d)
    pml_thickness = goos.types.ListType(goos.types.FloatType(),
                                        min_size=6,
                                        max_size=6)
コード例 #13
0
class StopWhenFieldsDecayed(StopCondition):
    type = goos.ModelNameType("stop.stop_when_fields_decayed")
    time_increment = goos.types.IntType()
    component = goos.types.IntType()
    pos = goos.Vec3d()
    threshold = goos.types.FloatType()
コード例 #14
0
ファイル: generic.py プロジェクト: zizai/spins-b
class CastSchema(optplan.ProblemGraphNodeSchema, optplan.WildcardSchema):
    """Schema for `cast`."""
    type = goos.ModelNameType("goos.cast")
    node = goos.ReferenceType(optplan.ProblemGraphNodeSchema)
    target_type = goos.types.StringType()