# Potential and electrical field definition

does anyone know why the equation of ElectricField is defined as below.
edge_model(device=device, region=region, name=“ElectricField”,
equation=“(Potential@n0 - Potential@n1)*EdgeInverseLength”)

But why not：edge_model(device=device, region=region, name=“ElectricField”,
equation=“(Potential@n0 - Potential@n1)/EdgeInverseLength”)
Since Electrical Field = Potential / distance.

\mathrm{EdgeInverseLength} = \frac{1}{\mathrm{EdgeLength}}

To simplify defining ElectricField, you can use:
https://devsim.net/CommandReference.html#devsim.edge_average_model

devsim.edge_average_model(device=device, region=region, node_model=”Potential”, edge_model=”ElecticField”, average_type=”negative_gradient”)
devsim.edge_average_model(device=device, region=region, node_model=”Potential”, edge_model=”ElecticField”, average_type=”negative_gradient”, derivative=”Potential”)


@Juan ，Thanks！It really helps . Hello，@Juan

I used edge_average_model to define the electric field，but why it occure some fatal error in 2D capacitor.

scripts as below

edge_average_model(device=device, region=region, node_model="Potential", edge_model="ElecticField", average_type="negative_gradient")
edge_average_model(device=device, region=region, node_model="Potential", edge_model="ElecticField", average_type="negative_gradient", derivative="Potential")

###
### Model the D Field
###
edge_model(device=device, region=region, name="DField",
equation="Permittivity*ElectricField")

edge_model(device=device, region=region, name="DField:Potential@n0",
equation="diff(Permittivity*ElectricField, Potential@n0)")

edge_model(device=device, region=region, name="DField:Potential@n1",
equation="-DField:Potential@n0")


errors as below：
number of equations 8281
while evaluating edge model DField on Device: MyDevice on Region: air
Value for “ElectricField” not available.
while evaluating model DField: expression (Permittivity * ElectricField) evaluates to invalid

Traceback (most recent call last):

File “D:\06 Devsim\projects\2d capacitor\2dcap.py”, line 130, in
solve(type=“dc”, absolute_error=1.0, relative_error=1e-10, maximum_iterations=100,

error: DEVSIM FATAL

Do you know why this happen ? Thanks a lot

Hi @caihng ,

Please make sure this command is before the edge_average_model command.

devsim.edge_from_node_model(device=device, region=region, node_model="Potential")


This will create the Potential@n0 and Potential@n1.
Please let me know whether this works.

I’m thinking this last suggestion may not fix the issue, and there may be a bug in the software.

I followed your suggestion and it did not work. So we still have to follow the electric field definition as below.

edge_from_node_model(device=device, region=region, node_model="Potential")

# ###
# ### Electric field on each edge, as well as its derivatives with respect to
# ### the potential at each node
# ###
edge_model(device=device, region=region, name="ElectricField",
equation="(Potential@n0 - Potential@n1)/EdgeLength")

edge_model(device=device, region=region, name="ElectricField:Potential@n0",
equation="EdgeInverseLength")

edge_model(device=device, region=region, name="ElectricField:Potential@n1",
equation="-EdgeInverseLength")


Hello @caihng

I see the issue now, it is a misspelling. Please change the model name from
ElecticField to
ElectricField in the edge_average_model command Thanks， It works now. Really great help ！

1 Like

Hello @Juan

Why we need

devsim.edge_average_model(device=device, region=region, node_model=”Potential”, edge_model=”ElecticField”, average_type=”negative_gradient”, derivative=”Potential”)


I don‘t understand why this model or variable has to be created

or why the “ElectricField:Potential@n0” is defined by equation “EdgeInverseLength”

# edge_model(device=device, region=region, name="ElectricField:Potential@n0", equation="EdgeInverseLength")


The simulator needs the derivatives with respect to the solution variables to converge upon a solution, as described here:

If you have an equation:

ElectricField = (Potential@n0 - Potential@n1)/EdgeLength


These edge models represent the derivative with respect to the Potential on each node of the edge:

ElectricField:Potenial@n0 = 1/EdgeLength
ElectricField:Potenial@n1 = -1/EdgeLength


So the edge_average_model command creates these derivative models for you.

Thanks again，@Juan. I will try to understand it by reading your paper 1 Like

@Juan, Could you please tell me where the PotentialEquation is defined in 2D capacitor example ?

equation(device=device, region=region, name="PotentialEquation",
variable_name="Potential", edge_model="DField",
variable_update="default")


edge_model=DField means that

\nabla \cdot \mathbf{DField} = 0

You can add additional terms by specifying node_model or element_model as well. Each term is added to the equation. For the capacitor example

\mathbf{DField} = \epsilon \cdot \mathbf{ElectricField}

@Juan
1、if we have some semicondor area where net carrier density is not zero, then we have to write the equation in some other expression.
2、for different area we can use different equation, and also need to consider the interface boundary condition. for semiconductor junction we need to use the SRH model equation but how about a inverse conducting layer? do we have some suggestion ?

Thanks!

Yes. That is correct. For the initial solution, the equilibrium Potential equation would require an expression for NetDoping, as well as Electrons and Holes based on the Potential.

For drift diffusion, the PotentialEquation would incorporate NetDoping and Electrons and Holes. The electron and hole continuity equations would also be added. Please see the examples in examples/diode for a simple diode simulation, with one region.

The inverse conducting area is a direct result of the other models. Please see the other topics in the forum concerning the interface and contact equations. Also the SRH model is available. A good overview is available here:
https://github.com/devsim/devsim_bjt_example

There is a document in the doc directory of this project.
https://github.com/devsim/devsim_bjt_example