Skip to content

Commit f2d6557

Browse files
Mortara  AlessandroMortara  Alessandro
authored andcommitted
fix: ValueError in method get_electric_resistance
ValueError: Voltage difference along superconductor and stabilizer must be the same. Changes in method solve_current_divider. Class: StrandMixedComponent modified: strand_mixed_component.py
1 parent 8339b99 commit f2d6557

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

source_code/strand_mixed_component.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -641,13 +641,27 @@ def solve_current_divider(
641641
maxiter=10,
642642
disp=False,
643643
)
644+
645+
# Tolerance on newton halley increased in case I_critical is very small,
646+
# to avoid inaccuracies on the divider that could lead to potential
647+
# differences between sc and stab
648+
if min(critical_current)>1e-6:
649+
# Default tollerance in optimize.newton method
650+
tollerance = 1.48e-8
651+
else:
652+
# Value found trial and error iteration
653+
tollerance = 1e-12
654+
# Other possible solution for the correct tollerance
655+
# tollerance = min(critical_current)/1000
656+
644657
# Evaluate superconducting with Halley's method
645658
sc_current = optimize.newton(
646659
self.__sc_current_residual,
647660
sc_current_guess,
648661
args=(psi, current),
649662
fprime=self.__d_sc_current_residual,
650663
fprime2=self.__d2_sc_current_residual,
664+
tol = tollerance,
651665
maxiter=1000,
652666
)
653667

0 commit comments

Comments
 (0)