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 #26

Merged
merged 13 commits into from
Feb 14, 2024

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 has been verified.

Mortara Alessandro added 11 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
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
Copy link
Collaborator

@DanielePlacidoPolito DanielePlacidoPolito left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This commit gives conflicts that are not trivial to resolve because they are not visible in the file text editor nor in GitHub Desktop. Thus it is ignored.

@DanielePlacidoPolito DanielePlacidoPolito marked this pull request as draft February 14, 2024 10:19
Copy link
Collaborator

@DanielePlacidoPolito DanielePlacidoPolito left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This commit gives conflicts that are not trivial to resolve because they are not visible in the file text editor nor in GitHub Desktop. Please, remove it from the pull request.

@AMortara AMortara marked this pull request as ready for review February 14, 2024 10:43
Mortara Alessandro added 2 commits February 14, 2024 11:53
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 DanielePlacidoPolito merged commit 8eac1e1 into MAHTEP:try_pr_el_module Feb 14, 2024
@DanielePlacidoPolito
Copy link
Collaborator

Recap of what is going on here (to try to clear up the mind and keep a reference)

  1. Master thesis student A. Mortara worked on his fork and when ready opens a pull request with his changes (14 commits) on a test branch called try_pr_el_module
  2. The pull request had a commit which gives conflicts that where not trivial to resolve because they where not visible in the file text editor nor in GitHub Desktop (related to new variables in input file conductor_definition.xlsx)
  3. on my local try_pr_el_module I tryed to solve manually the conflicts without any succes, so I discharged the changes related to this file
  4. Then I asked him to send me the input file template_conductor_definition.xlsx that gives conflict issues
  5. After checking that his file template_conductor_definition.xlsx has useful changes, I introduced this suggested changes into my local input file template_conductor_definition.xlsx and commited the changes
  6. In the meanwhile, I asked Mr Mortara to remove this commit from his pull request.
  7. He performed the rebase of his commits removing the one that gives conflicts (so now the commit are 13)
  8. The pull request updates and shows merge possibility without conflicts.
  9. I performed the merge on branch try_pr_el_module to close the pull request
  10. Now the branch has all the 14 commits he added in his first pull request but with a different commit history due to the strategy described above.
  11. Check that everything is working correctly is ongoing.

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