Imposing boundary conditions

Hi @Juan,

I’m trying to impose some current at a boundary conditions (to add some thermionic emission current, Jt) for which I thought it would suffice to add a node_current_model to my contact equation in a way similar to what is done here. So far, however, I haven’t been able to make it work. This model seems to be simply ignored (most likely because I’m doing something wrong).

Here’s what I have so far:

# let's add some Thermionic Emission current. 
Jte_n = f"{An}*{T0*T0}*exp(-{phi_B}/kT)"
Jte_p = f"{Ap}*{T0*T0}*exp(-({Si['Eg']*Q_e}-{phi_B})/kT)"
bias = sp.GetContactBiasName(contact)
Jtn = f"ifelse(NetDoping>0, -{Jte_n}*(exp(-{bias}*{Q_e}/kT)-1.0), 0)*ContactSurfaceArea"
Jtp = f"ifelse(NetDoping<0, {Jte_p}*(exp(-{bias}*{Q_e}/kT)-1.0), 0)*ContactSurfaceArea"
ds.contact_node_model(device="device", contact=contact, name=f"{contact}_TE_ElectronCurrent", equation=Jtn)
ds.contact_node_model(device="device", contact=contact, name=f"{contact}_TE_HoleCurrent", equation=Jtp)

and later, in the contact creation

ds.contact_equation(
            device="device",
            contact=contact,
            name="ElectronContinuityEquation",
            node_model=contact_electrons_name,
            node_current_model=f"{contact}_TE_ElectronCurrent",
            # edge_current_model="ElectronCurrent",
)

ds.contact_equation(
            device="device",
            contact=contact,
            name="HoleContinuityEquation",
            node_model=contact_holes_name,
            node_current_model=f"{contact}_TE_HoleCurrent",
            # edge_current_model="HoleCurrent",
)

What am I doing wrong? Am I interpreting node_current_model in the wrong way?

Thanks for all your help in advance,

Unfortunately, I am not readily available to provide a longer answer until this weekend. But I hope the following gives you a good start.

The following models setup the external current and charge measured by an external circuit

    node_charge_model : str, optional
       Name of the node model used to determine the charge at this contact
    node_current_model : str, optional
       Name of the node model used to determine the current flowing out of this contact
    edge_charge_model : str, optional
       Name of the edge model used to determine the charge at this contact
    edge_current_model : str, optional
       Name of the edge model used to determine the current flowing out of this contact
    element_charge_model : str, optional
       Name of the element edge model used to determine the charge at this contact
    element_current_model : str, optional
       Name of the element edge model used to determine the current flowing out of this contact

The models are the ones to enforce the boundary conditions

    edge_model : str, optional
       Name of the edge model being integrated at each edge at this contact
    edge_volume_model : str, optional
       Name of the edge model being integrated over the volume of each edge on the contact
    element_model : str, optional
       Name of the element edge model being integrated at each edge at this contact
    volume_node0_model : str, optional
       Name of the element model being integrated over the volume of node 0 of each edge on the contact
    volume_node1_model : str, optional
       Name of the element model being integrated over the volume of node 1 of each edge on the contact
    node_model : str, optional
       Name of the node model being integrated at each node at this contact

The models in the second category replace the bulk equations, but only when assembling the equations at the contact nodes.

To give you an idea of the mechanics, please checkout:
https://github.com/devsim/devsim/blob/main/src/AutoEquation/ExprContactEquation.cc#L57
and feel free to ask more questions.

Also if your currents are based on “node current”, you would want to scale them like this:

ContactSurfaceArea/NodeVolume

since the node base models are integrated with respect to NodeVolume.

Hi @Juan ,
Thanks for your reply. This is very useful, I appreciate it.