# Electric Field Dependence on Mobility

Dear DEVSIM Developer,

I want to add the electric field dependence on mobility in 1D diode example. I add a function to replace the definition of mu_n and mu_p in the initial example:

``````def CreateMobility(device, region):

NetDoping = 5.2e13
T = 300

n_alpha = 0.34
n_ulp = 124.0 * math.pow(T / 300.0, -2.0)
n_uminp = 15.9
n_Crefp = 1.76e19
n_betap = 1.213 * math.pow(T / 300.0, 0.17)
n_vsatp = 2e7 * math.pow(T / 300.0, 0.52)
n_lfm = n_uminp + n_ulp/(1.0 + math.pow(NetDoping / n_Crefp, n_alpha))
#n_hfm = n_lfm / (math.pow(1.0 + math.pow(n_lfm * E / n_vsatp, n_betap), 1.0 / n_betap))

p_alpha = 0.61
p_ulp = 947.0 * math.pow(T / 300.0, -2)
p_Crefp = 1.94e19
p_betap = 1.0 * math.pow(T / 300.0, 0.66)
p_vsatp = 2e7 * math.pow(T / 300.0, 0.87)
p_lfm = p_ulp/ (1.0 + math.pow(NetDoping / p_Crefp, p_alpha))
#p_hfm = p_lfm / (math.pow(1.0 + math.pow(p_lfm * E / p_vsatp, p_betap), 1.0/p_betap))

if not InEdgeModelList(device, region, "ElectricField"):
CreateEdgeModel(device, region, "ElectricField", "(Potential@n0-Potential@n1)*EdgeInverseLength")
CreateEdgeModelDerivatives(device, region, "ElectricField", "(Potential@n0-Potential@n1)*EdgeInverseLength", "Potential")

#default Mobility parameters
devsim.set_parameter(device=device, region=region, name="n_lfm",           value=n_lfm)
devsim.set_parameter(device=device, region=region, name="n_vsatp",         value=n_vsatp)
devsim.set_parameter(device=device, region=region, name="n_betap",         value=n_betap)
devsim.set_parameter(device=device, region=region, name="p_lfm",           value=p_lfm)
devsim.set_parameter(device=device, region=region, name="p_vsatp",         value=p_vsatp)
devsim.set_parameter(device=device, region=region, name="p_betap",         value=p_betap)

# debugE = devsim.get_edge_model_values(device, region, "ElectricField")
# print("\n\n*********************************\n")
# print(debugE)
# print("\n*********************************\n\n")

mu_n = "n_lfm / (pow(1.0 + pow(n_lfm * ElectricField / n_vsatp, n_betap), 1.0 / n_betap))"
mu_p = "p_lfm / (pow(1.0 + pow(p_lfm * ElectricField / p_vsatp, p_betap), 1.0/p_betap))"

CreateEdgeModel(device, region, "ElectronMobility", mu_n)
CreateEdgeModel(device, region, "HoleMobility", mu_p)

CreateEdgeModelDerivatives(device, region,"ElectronMobility", mu_n, "Potential")
CreateEdgeModelDerivatives(device, region, "HoleMobility", mu_p, "Potential")
``````

Then mobility definition in the continues equations:

``````Jn = "ElectronCharge*ElectronMobility*EdgeInverseLength*V_t*kahan3(Electrons@n1*Bern01,  Electrons@n1*vdiff,  -Electrons@n0*Bern01)"
Jp ="-ElectronCharge*HoleMobility*EdgeInverseLength*V_t*kahan3(Holes@n1*Bern01, -Holes@n0*Bern01, -Holes@n0*vdiff)"
``````

When I run the script, the error is listed below:

``````There was a Invalid floating point exception while evaluating pow(((n_lfm * ElectricField) * pow(n_vsatp,(-1))),n_betap)
Invalid argument while evaluating function pow
Invalid argument while evaluating function pow
while evaluating model ElectronMobility: expression (n_lfm * pow(pow((1 + pow(((n_lfm * ElectricField) * pow(n_vsatp,(-1))),n_betap)),(1 * pow(n_betap,(-1)))),(-1))) evaluates to invalid
Traceback (most recent call last):
File "/home/tao/git_repository/sicar/devsim/1d_nju_pin/solve_iv.py", line 45, in <module>
devsim.solve(type="dc", absolute_error=1e10, relative_error=1e-10, maximum_iterations=30)
devsim_py3.error: DEVSIM FATAL
``````

The values of ElectricField seem not effective, but if I replace the “ElectricField ” with a specific value, like

``````# When ElectricField = 50 V/cm
mu_n = "n_lfm / (pow(1.0 + pow(n_lfm * 50.0 / n_vsatp, n_betap), 1.0 / n_betap))"
mu_p = "p_lfm / (pow(1.0 + pow(p_lfm * 50.0 / p_vsatp, p_betap), 1.0/p_betap))"
``````

The script can work. So how could I use the EdgeNode value “ElectricField” correctly？

Hi @Tao
Invalid means a floating point exceptions due to things such as a negative argument to the `pow` function with a non even integer exponent. Please see an example for the Caughey Thomas model here:
https://github.com/devsim/devsim_bjt_example/blob/main/doc/devsim_bjt_example.pdf

in FIgure 9. It is also available in the source code for the project.