Skip to content

B field rect section v2 - #640

Open
t-atane wants to merge 3 commits into
hiddenSymmetries:masterfrom
t-atane:B_field_rect_section_v2
Open

B field rect section v2#640
t-atane wants to merge 3 commits into
hiddenSymmetries:masterfrom
t-atane:B_field_rect_section_v2

Conversation

@t-atane

@t-atane t-atane commented Jul 15, 2026

Copy link
Copy Markdown

I implemented the full B field for self-field in the winding pack according to the paper of Dr. Landreman
(https://iopscience.iop.org/article/10.1088/1741-4326/adb04e/meta).

Currently, the simsopt repository only includes B_regularized in src/simsopt/field/selffield.py (and also in the coil class in coil.py). I added B_0, B_kappa and B_b.

There are 3 main additions (the rest is due to autopep and ruff):
in selffield.py : the direct implementation of the different B field computation (from line 174)
in coil.py: the three B field contributions are added in the class "RectangularRegulaziedCoil" (from line 266)
in test_selffieldforces.py : added some assert to ensure that the tests pass for the new B fields (line 566 to 589)

This code has already been used by at IPP (Garching, Germany) for a paper about Ic-optimisation in the winding pack (currently in writing).

I remain available for any question.

Kind regards

@mbkumar
mbkumar requested a review from landreman July 26, 2026 20:04
@mbkumar

mbkumar commented Jul 26, 2026

Copy link
Copy Markdown
Collaborator

@t-atane Can you please fix the linter errors?

@t-atane

t-atane commented Jul 28, 2026

Copy link
Copy Markdown
Author

I mischanged the function coils_to_vtk in coil.py, which was not intentional. I thus restored the original function as it was. From all the unittests this was the only error I saw

@t-atane

t-atane commented Jul 28, 2026

Copy link
Copy Markdown
Author

Are there other problems you were talking about @mbkumar ?

@codecov

codecov Bot commented Jul 28, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 99.29577% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 90.47%. Comparing base (51b2245) to head (f4dd62e).
⚠️ Report is 4 commits behind head on master.

Files with missing lines Patch % Lines
src/simsopt/field/coil.py 98.70% 1 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #640      +/-   ##
==========================================
+ Coverage   90.23%   90.47%   +0.24%     
==========================================
  Files          84       84              
  Lines       17899    17984      +85     
==========================================
+ Hits        16151    16271     +120     
+ Misses       1748     1713      -35     
Flag Coverage Δ
unittests 90.47% <99.29%> (+0.24%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
src/simsopt/field/selffield.py 100.00% <100.00%> (ø)
src/simsopt/field/coil.py 97.78% <98.70%> (+0.21%) ⬆️

... and 3 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@t-atane

t-atane commented Jul 28, 2026

Copy link
Copy Markdown
Author

@mbkumar The pointed linting errors are not in the files I changed (I only changed src/simsopt/coil.py and selffield.py), so I am pretty confused. Do you want me to fix them anyway ?

@mbkumar

mbkumar commented Jul 28, 2026

Copy link
Copy Markdown
Collaborator

@t-atane No need. I realized the errors thrown by the linter could be due to new rule enforcements by ruff. I'll investigate it.

Comment thread src/simsopt/field/coil.py
RegularizedCoil.__init__(self, curve, current, regularization)
RegularizedCoil.__init__(self, curve, current, regularization)

def B_total(self, u, v, a, b):

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I may misunderstand, this can already be computed by building a BiotSavart object, not?

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.

3 participants