Skip to content

Division by zero in superconductor calculation #1871

@jonmaddock

Description

@jonmaddock

In GitLab by @mkovari on May 31, 2023, 15:19

We have had a non-fatal division by zero error in this line in function superconpf in pfcoil.py:

            rcv.copperaoh_m2 = ioheof / (pfv.awpoh * (1.0 - pfv.vfohc) * pfv.fcuohsu)

The variable awpoh is initialised to zero in pfcoil_variables.f90, and the line of code above is called before the correct value is calculated.

The correct calculation of awpoh is in function ohcalc in pfcoil.py:

        # Non-steel cross-sectional area
        pfv.awpoh = pfv.areaoh - areaspf

ohcalc is first called in line 732 inside function pfcoil:

        # Find Central Solenoid information
        if bv.iohcl != 0:
            self.ohcalc()

but superconpf is first called in line 627 inside the same function:

                # Allowable current density (for superconducting coils)

                if pfv.ipfres == 0:
                    bmax = max(abs(pfv.bpf[i]), abs(pf.bpf2[i]))
                    pfv.rjpfalw[i], jstrand, jsc, tmarg = self.superconpf(

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions