Beispiel #1
0
def PotentialOfSimpleConductor2D():
    """
    Rectangle with 5V conducting plate at the bottom.

    Boundary conditions:

    * Left, right, top: default boundary condition 0V
    * bottom: Dirichlet BC, 5V
    """
    lapl = electrostatics.Laplacian2D2ndOrderWithMaterials(1e-9, 1e-9)
    breite = 400
    hoehe = 600
    rechteck = electrostatics.Rectangle(hoehe, breite, 1., lapl)

    for x in range(breite):
        rechteck[hoehe - 1, x].potential = 5

    for x in range(breite):
        for y in range(hoehe / 2, hoehe):
            rechteck[y, x].epsilon = 1.

    container = electrostatics.Container((rechteck, ))
    solver, inhomogeneity = container.lu_solver()
    sol = solver(inhomogeneity)
    pyplot.imshow(container.vector_to_datamatrix(sol)[0])
Beispiel #2
0
def SimpleElectrostaticProblem():
    """
    Calculates the electrostatic potential of a 1D stripe of 1nm width and
    30 nm height with a gridsize of 1 nm. At 11 nm, the potential is fixed
    to 8V.

    Boundary conditions:

    * left, right: Periodic boundary conditions (using PeriodicContainer).
    * top: Neumann boundary condition, slope=1e18
    * bottom: Dirichlet boundary condition, potential=0
    (default boundary condition)
    """
    breite = 1
    hoehe = 30
    gridsize = 1e-9
    lapl = electrostatics.Laplacian2D2ndOrderWithMaterials(gridsize, gridsize)
    rect = electrostatics.Rectangle(hoehe, breite, 1., lapl)
    rect[hoehe - 1, 0].neumannbc = (1e18, 'xb')
    rect[10, 0].potential = 8
    rect[0, 0].neumannbc = (0, 'xf')
    cont = electrostatics.PeriodicContainer(rect, 'y')
    solver, inhomogeneity = cont.lu_solver()
    sol = solver(inhomogeneity)
    pyplot.plot(sol)
    print sol
def PeriodicGraphenePatchWithGrapheneSidegatesSiO2Rectangle(
        breite,
        hoehe,
        temperature,
        graphenepos,
        graphenebreite=None,
        sidegatebreite=None):
    """
    Default potential for backgate + Graphene parts is 0V. If you want it
    differently, set it later using the returned references.
    """
    if (graphenebreite is None):
        graphenebreite = breite

    if (sidegatebreite is None):
        sidegatebreite = 0

    sio2 = 3.9
    gridsize = 1e-9
    lapl = electrostatics.Laplacian2D2ndOrderWithMaterials(gridsize, gridsize)
    periodicrect = electrostatics.Rectangle(hoehe, breite, 1., lapl)
    for y in range(breite):
        periodicrect[0, y].neumannbc = (0, 'xf')

    backgateelements = [periodicrect[hoehe - 1, y] for y in range(breite)]

    for element in backgateelements:
        element.potential = 0

    grapheneelements = [
        periodicrect[graphenepos, y]
        for y in range((breite - graphenebreite) /
                       2, (breite + graphenebreite) / 2)
    ]

    Ef_dependence_function = quantumcapacitance.BulkGrapheneWithTemperature(
        temperature, gridsize).Ef_interp
    for element in grapheneelements:
        element.potential = 0
        element.fermi_energy = 0
        element.fermi_energy_charge_dependence = Ef_dependence_function

    graphenesidegateelementsleft = [
        periodicrect[graphenepos, y] for y in range(sidegatebreite)
    ]
    graphenesidegateelementsright = [
        periodicrect[graphenepos, y]
        for y in range(breite - sidegatebreite, breite)
    ]
    for element in graphenesidegateelementsleft + graphenesidegateelementsright:
        element.potential = 0
        element.fermi_energy_charge_dependence = Ef_dependence_function

    for x in range(graphenepos, hoehe):
        for y in range(breite):
            periodicrect[x, y].epsilon = sio2

    return periodicrect, lapl, grapheneelements, graphenesidegateelementsleft,\
        graphenesidegateelementsright, backgateelements
Beispiel #4
0
def PotentialOfGluedRectangles2D():
    """
    Two rectangles with capacitor plates, glued together with Container.
    There are four capacitor plates. The boundary conditions
    are the default BC.

    The relative position of the two rectangles to each other is given by the
    parameters position and offset of the connect() function (see
    documentation).
    """
    lapl = electrostatics.Laplacian2D2ndOrder(1, 1)
    breite = 400
    hoehe = 200
    graphene_breite = 350
    abstand = 20
    rechteck = electrostatics.Rectangle(hoehe, breite, 1., lapl)
    rechteck2 = electrostatics.Rectangle(300, 300, 1, lapl)

    for x in range((breite - graphene_breite) / 2,
                   (breite + graphene_breite) / 2):
        rechteck[hoehe / 2 + 5, x].potential = 5
        rechteck[hoehe / 2 - 5, x].potential = -5
    for x in range(breite):
        for y in range(hoehe / 2 - 5, hoehe / 2 + 5):
            rechteck[y, x].epsilon = 1.

    for x in range(100, 200):
        rechteck2[x, 200].potential = 5

    for x in range(150, 250):
        rechteck2[x, 250].potential = 5

    container = electrostatics.Container((rechteck, rechteck2))
    container.connect(rechteck,
                      rechteck2,
                      align='left',
                      position='top',
                      offset=(0, 150))

    solver, inhomogeneity = container.lu_solver()
    sol = solver(inhomogeneity)
    pyplot.imshow(container.vector_to_datamatrix(sol)[0])
Beispiel #5
0
def GrapheneQuantumCapacitance(equation='potential'):
    """
    Calculate the quantum capacitance of Graphene on SiO2, including
    temperature.

    equation: 'charge' or 'potential', see documentation of
    QuantumCapacitanceSolver.

    Boundary conditions:

    * left, right: periodic BC
    * top: Neumann BC, slope=0
    * bottom: backgate capacitor plate

    Please read the code comments for further documentation.

    Return:

    voltages: The voltages where the capacitance is calculated (x values)
    capacitance: the quantum capacitance (y(x) values)
    """
    # Set system parameters
    gridsize = 1e-9
    hoehe = 600
    breite = 1
    backgatevoltage = 0
    graphenepos = 299
    temperature = 300
    sio2 = 3.9

    vstart = -60
    vend = 60
    dv = 0.5

    # Finite difference operator
    lapl = electrostatics.Laplacian2D2ndOrderWithMaterials(gridsize, gridsize)
    # Create Rectangle
    periodicrect = electrostatics.Rectangle(hoehe, breite, 1., lapl)

    # Set boundary condition at the top
    for y in range(breite):
        periodicrect[0, y].neumannbc = (0, 'xf')

    # Create list of backgate and GNR elements
    backgateelements = [periodicrect[hoehe - 1, y] for y in range(breite)]
    grapheneelements = [periodicrect[graphenepos, y] for y in range(breite)]

    # Set initial backgate element boundary condition (not necessary)
    for element in backgateelements:
        element.potential = backgatevoltage

    # Create D(E,T) function.
    Ef_dependence_function = quantumcapacitance.BulkGrapheneWithTemperature(
        temperature, gridsize).Ef_interp
    Ef_dependence_function_2 = quantumcapacitance.BulkGrapheneWithTemperature(
        temperature, gridsize, interpolation=False).Q

    # Set electrochemical potential and D(E,T) for the GNR elements
    for element in grapheneelements:
        element.potential = 0
        element.fermi_energy = 0
        element.fermi_energy_charge_dependence = Ef_dependence_function
        element.charge_fermi_energy_dependence = Ef_dependence_function_2

    # Set dielectric material
    for x in range(graphenepos, hoehe):
        for y in range(breite):
            periodicrect[x, y].epsilon = sio2

    # Create periodic container
    percont = electrostatics.PeriodicContainer(periodicrect, 'y')

    # Invert discretization matrix
    solver, inhomogeneity = percont.lu_solver()

    classical_capacitance = ClassicalCapacitance(percont, lapl, solver,
                                                 backgateelements,
                                                 grapheneelements)

    # Create QuantumCapacitanceSolver object.
    # Depending on equation, either fermi_energy_charge_dependence or
    # charge_fermi_energy_dependence will be used.
    # You don't have to set the other one.
    qcsolver = quantumcapacitance.QuantumCapacitanceSolver(percont,
                                                           solver,
                                                           grapheneelements,
                                                           lapl,
                                                           equation=equation)

    # Refresh basisvectors for calculation. Necessary once at the beginning.
    qcsolver.refresh_basisvecs()

    # Create volgate list
    voltages = numpy.arange(vstart, vend, dv)

    charges = []

    # Loop over voltages
    for v in voltages:
        # print v
        # Set backgate elements to voltage
        for elem in backgateelements:
            elem.potential = v
        # Check change of environment
        qcsolver.refresh_environment_contrib()
        # Solve quantum capacitance problem & set potential property of
        # elements
        qcsolution = qcsolver.solve()
        # Create new inhomogeneity because potential has changed
        inhom = percont.createinhomogeneity()
        # Solve system with new inhomogeneity
        sol = solver(inhom)
        # Save the charge configuration in the GNR
        charges.append(percont.charge(sol, lapl, grapheneelements))
    # Sum over charge and take derivative = capacitance
    totalcharge = numpy.array([sum(x) for x in charges])
    capacitance = (totalcharge[2:] - totalcharge[:-2]
                   ) / len(grapheneelements) * gridsize / (2 * dv)

    # Plot result
    ax = pyplot.gca()
    ax.set_title('Quantum capacitance of Graphene on SiO2')
    ax.set_xlabel('Backgate voltage [V]')
    ax.set_ylabel('GNR capacitance [$10^{-6} F/m^2$]')
    pyplot.plot(voltages[1:-1], 1e6 * capacitance)

    return voltages[1:-1], capacitance, classical_capacitance