Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updates related to electric module #25

Open
wants to merge 30 commits into
base: mit_period_path1_joule_fix
Choose a base branch
from

Conversation

AMortara
Copy link
Collaborator

  1. Updated the Class StackComponent, with the same idea behind the Class StrandMixedComponent.

  2. Fixed the lower limit for the bisection method in the method current_sharing_temperature_re123. This limit is now set to 0 to avoid error given by bisection method.

  3. Refactor of the method get_electric_resistance, both in Class StrandMixedComponent and in Class StackComponent. All the previous indices are eliminated and now there are only two cases:
    a) if critical_current = 0 the equivalent resistance is equal to the stabilizer resistance
    b) if critical_current is not = 0 then the current divider is used.

  4. Inside the Class Conductor many chages were made to permitt a constant value of the mutual inductance and the self inductance set by the user in the input file conductor_definition.xlsx, in sheet CONDUCTOR_operation.

  5. To avoid the ValueError that arises in the check on the voltage along stabilizer that must be equal to the voltage along superconductor, the tollerance in the method solve_current_divider, in the Class StrandMixedComponent, is modified when the minimum in the vector critical_current is below a certain value. This change have to be better verified.

Mortara Alessandro and others added 20 commits January 8, 2024 11:05
The class stack is implemented following the same structure of the strand mix class.
The only limit of the new class is related to the evaluations of the self and the mutual inductance, since the old method takes into account the radius of the strand.
In this method you must impose a self and mutual inductance.
For the future a general way to evaluate these parameters must be implemented.
That's the reason why also the conductor.py file has been changed.
The new class is able to represent 4 different materials inside the stack.
Homogenizes non-superconducting materials into a single stab material and performs the same electrical calculations present in the strand mix class.
	modified:   conductor.py
	modified:   stack_component.py
In function current_sharing_temperature_re123 bisection method is used to evaluate the current sharing temperature of the superconductor.
In specific cases occurs the error:
"r = _zeros._bisect(f, a, b, xtol, rtol, maxiter, args, full_output, disp)
ValueError: f(a) and f(b) must have different sign"
For this reson T_lower is changed from 3.5 to 0.5, to avoid this problem.

modified:   properties_of_materials/rare_earth_123.py
Inside properties_of_materials/rare_earth_123.py the formula:
TCSRE123[vv] = optimize.bisect(
        critical_current_density_bisection_re123,
        T_lower,
        T_upper,
        ex_args,
        xtol=1e-5,
        )
The formula gave errors related to the bisection formula.
In the interval [a, b] as it was chosen f(a) and f(b) had the same sign.
For this reason T_lower, i.e. a, was lowered to 0, so as to solve the problem on the bisection formula.

modified:   properties_of_materials/rare_earth_123.py
During the fix of the evaluation of the Joule power along the current carrier, two different approaches were used:

    * mod1 -> P_joule = R * I^2
    * mod2 -> P_joule = Delta_Phi * I

The approaches should be equivalent if the inducance is negligible, while mod2 is more general and conservative if the inductance is no longer negligible. After discussion with prof. Zach Hartwig and Dr. Nicolò Riva, we agreed to remove mod1 and keep mod2 for this evaluation.

List of changes:

    * removed key "integral_power_el_res_mod1" from dictionary obj.dict_Gauss_pt of current carrier objects.
    * renamed key "integral_power_el_res_mod2" into "integral_power_el_res" in dictionary obj.dict_Gauss_pt of current carrier objects.
    * removed equivalence checks
    * updated related comments
    * updated docstring

LList of modified methods in class SolidComponents:

  * initialize_electric_quantities
  * set_power_array_to_zeros
  * get_joule_power_along
  * get_joule_power_along_steady

List of modified methods in class Conductor:

  * __electric_method_steady
  * __build_heat_source_gauss_pt
  * eval_integral_joule_power

Class: SolidComponents, Conductor
modified:   conductor.py
modified:   solid_component.py
Improved the readability of the code and increased its simplicity by
removing the multiple indices and distinguishing only two cases:
that in which the critical current is =0 and that in which the critical
current is other than 0.
In the first case, the equivalent resistance will be set equal to the
equivalent resistance of the stabilizer part.
In the second case, the current divider will be calculated to derive
the current on the superconductor, from it with the power law the
resistivity of the superconductor will be estimated, and then the
equivalent resistance of the stabilizer and superconductor together
will be calculated

function: get_electric_resistance
modified:   strand_mixed_component.py
Improved the readability of the code and increased its simplicity by
removing the multiple indices and distinguishing only two cases: that
in which the critical current is =0 and that in which the critical
current is other than 0.
In the first case, the equivalent resistance will be set equal to the
equivalent resistance of the stabilizer part.
In the second case, the current divider will be calculated to derive
the current on the superconductor, from it with the power law the
resistivity of the superconductor will be estimated, and then the
equivalent resistance of the stabilizer and superconductor together
will be calculated.

fun: get_electric_resistance
modified:   strand_mixed_component.py
The inductance methods were commented and a constant value was imposed,
to confront the results with external references.
All the calculation of both the self and the mutual inductance are now
evaluated by the code.

modified:   conductor.py
Two new flags were added:
    * SELF_INDUCTANCE_MODE_0 = 0 is used to assign a constant value for
    the self inductance readed from input file conductor_definition.xlsx
    * CONSTANT_INDUCTANCE = 0 is used to assign a constant value for the
    mutual inductance readed from input file conductor_definition.xlsx

The flags related to mutual inductance were redefined as:
    * ANALYTICAL_INDUCTANCE = 1 Flag to evaluate inductance analytically
    * APPROXIMATE_INDUCTANCE = 2 Flag to evaluate inductance using an approximation

modified:   conductor_flags.py
News privates methods to deal with the inductance evaluation.

    *__constant_inductance: private method that assigns a constant value
    to the mutual inductance as defined by the user in variable
    MUTUAL_INDUCTANCE, in sheet CONDUCTOR_operation of the input file
    conductor_definition.xlsx.

    *__constant_self_inductance_evaluation: private method that assigns
    a constant value to the self inductance that is defined by the user
    in variable SELF_INDUCTANCE, in sheet CONDICTOR_operation in the
    input file conductor_definition.xlsx

Class: Conductor
modified:   conductor.py

BREAKING CHANGES
These methods are called respectively with the new values of flags
INDUCTANCE_MODE, SELF_INDUCTANCE_MODE, as follows:
    INDUCTANCE_MODE = 0 -> __constant_inductance
    SELF_INDUCTANCE_MODE = 0 -> __constant_self_inductance_evaluation
Modified functions:
*__inductance_analytical_calculation
    *added check on the new mode (value = 0)
    *added keyword SELF_INDUCTANCE_MODE_0=0 in self_inductance_switch

__inductance_approximate_calculation
    *added check on the new mode (value = 0)
    *added keyword SELF_INDUCTANCE_MODE_0=0 in self_inductance_switch

__build_electric_mass_matrix
    *added check on the new mode (value = 0)
    *added keyword CONSTANT_INDUCTANCE=0 in inductance_switch

NEED REFACTORING!!!

Class: Conductor
modified:   conductor.py
In the functions:
    *__mutual_inductance
    *__self_inductance_mode1
    *__self_inductance_mode2
The previous methods for the inductances evaluation are restored.
This process was already done in a previous commit, but the commit was
reverted by mistake.

Class: Conductor
modified:   conductor.py
The new variables are:
    *MUTUAL_INDUCTANCE -> Constant value for the mutual inductance used if flag INDUCTANCE_MODE is set to 0.
    *SELF_INDUCTANCE -> Constant value used if SELF_INDUCTANCE_MODE is set to 0.

New flag values:
    *INDUCTANCE_MODE = 0 -> constant value from variable MUTUAL_INDUCTANCE
    *SELF_INDUCTANCE_MODE = 0 -> constant value from variable SELF_INDUCTANCE

BREAKING CHANGES
    *New variables MUTUAL_INDUCTANCE, SELF_INDUCTANCE
    *SELF_INDUCTANCE_MODE flag is used whatever is the flag INDUCTANCE_MODE
    *Default value for flag SELF_INDUCTANCE_MODE is changed to 1

modified:   input_files/input_file_template/template_conductor_definition.xlsx
Updated the instruction that manages the odd behaviour while loading input
files (value set to 1 are converted in True) in method __init__.
To avoid that other values are converted unexpectedly, the explicit check
for value == True is added in this commit.

For instance this allows to avoid the conversion of variable INDUCTANCE_MODE = 2
into INDUCTANCE_MODE = 1 (because 2 is equivalent to true but is different from it).

Class: Conductor
modified:   conductor.py
ValueError: Voltage difference along superconductor and stabilizer must be the same.

Changes in method solve_current_divider.

Class: StrandMixedComponent
modified:   strand_mixed_component.py
…ara-main

Conflicts:
    source_code/input_files/input_file_template/template_conductor_definition.xlsx
Discharged these changes due to conflicts.
The new variables are:
    * MUTUAL_INDUCTANCE -> Constant value for the mutual inductance used if flag INDUCTANCE_MODE is set to 0.
    * SELF_INDUCTANCE -> Constant value used if SELF_INDUCTANCE_MODE is set to 0.

New flag values:
    * INDUCTANCE_MODE = 0 -> constant value from variable MUTUAL_INDUCTANCE
    * SELF_INDUCTANCE_MODE = 0 -> constant value from variable SELF_INDUCTANCE

This commit was already available in the pull request from Alessandro Mortara but gives conflict that was not trivial to resolve since it was not possible to visualize them with the text editor or with GitHub Desktop. So I add the same changes he proposed in this commit.

BREAKING CHANGES
    * New variables MUTUAL_INDUCTANCE, SELF_INDUCTANCE
    * SELF_INDUCTANCE_MODE flag is used whatever is the flag INDUCTANCE_MODE
    * Default value for flag SELF_INDUCTANCE_MODE is changed to 1

modified:
input_files/input_file_template/template_conductor_definition.xlsx
Updated the instruction that manages the odd behaviour while loading input
files (value set to 1 are converted in True) in method __init__.
To avoid that other values are converted unexpectedly, the explicit check
for value == True is added in this commit.

For instance this allows to avoid the conversion of variable INDUCTANCE_MODE = 2
into INDUCTANCE_MODE = 1 (because 2 is equivalent to true but is different from it).

Class: Conductor
modified:   conductor.py
ValueError: Voltage difference along superconductor and stabilizer must be the same.

Changes in method solve_current_divider.

Class: StrandMixedComponent
modified:   strand_mixed_component.py
DanielePlacidoPolito and others added 9 commits February 14, 2024 11:55
Updates related to electric module
Correction of the equation estimating the equivalent electrical
resistivity of the non-SC tape materials within the method
stack_electrical_resistivity_not_sc.
The parallel resistor equation:
rho_el_eq = A_not_sc * (sum(A_i/rho_el_i))^-1

modified:   stack_component.py
The previous method stack_electrical_resistivity_not_sc that was
commented during tests of the new method for the evaluation of the
electrical resistivity of the materials in parallel is now deleted.

modified:   stack_component.py
if isinstance(strand,StrandMixedComponent):
                    strand.dict_node_pt["electrical_resistivity_stabilizer"] = strand.strand_electrical_resistivity_not_sc(
                            strand.dict_node_pt
                        )
has been modified in
if isinstance(strand,StrandMixedComponent) or isinstance(strand,StackComponent):
                    strand.dict_node_pt["electrical_resistivity_stabilizer"] = strand.strand_electrical_resistivity_not_sc(
                            strand.dict_node_pt
                        )
to correctly update the electrical resistivity of the stabilizer in case
SC is modelled as a Stack and not as a StrandMixed
modified:   conductor.py
Assignment of current_along at t=0, considered initially set equal to
op_current for each I0_OP_MODE. The variable current_along represents
the current that actually flows in the strand_mix or stack component.

modified:   solid_component.py
In the previous bersion the jop was evaluated as:
jop = (
        np.abs(dict_dummy["op_current"])
        / (self.cross_section["sc"])
        )
where op_current is the current assigned by the input files.
This has been changed to:
jop = (
        np.abs(dict_dummy["current_along"])
        / (self.cross_section["sc"])
        )
where current along is the fraction of current flowing inside the stack
or strand component. For the calculation of T_cs, the current density
was evaluated in this way.

modified:   strand_component.py
Tolerance on newton halley increased in case I_critical is very small,
to avoid inaccuracies on the divider that could lead to potential
differences between the voltage of sc and stab.
method: solve_current_divider
modified:   stack_component.py
Inside method operating_conditions_em added:
elif isinstance(strand, StackComponent):
    strand.dict_Gauss_pt["electrical_resistivity_stabilizer"] = strand.stack_electrical_resistivity_not_sc(
        strand.dict_Gauss_pt
        )
to update only electrical resistivity (stabilizer) at each electric
time step also in presence of the StackComponent.

modified:   conductor.py
Inside method solve_current_divider.
Class: StackComponent
modified:   stack_component.py
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants