ukaea / PROCESS

PROCESS is a systems code at UKAEA that calculates in a self-consistent manner the parameters of a fusion power plant with a specified performance, ensuring that its operating limits are not violated, and with the option to optimise to a given function of these parameters.
https://ukaea.github.io/PROCESS/
MIT License
30 stars 11 forks source link

Handling bmax>bmaxcrit in critical current densities in superconductors.f90 #955

Closed jonmaddock closed 1 year ago

jonmaddock commented 4 years ago

In GitLab by @jlion on Nov 7, 2019, 14:17

I think the critical current density functions like itersc, bi2212, jcrit_nbti, wstsc etc. should return jcrit=0 (better some small numerical value) if bmax is larger than the critical b field.

Right now if I want to use these functions I need to compare the bfield to the returned bcrit field and handle it in my function. But then itersc has already thrown an unjustified report_error(161). Or, I need to compare the bfield I have to bcrit before I call the functions. But then I need to know bc20eps in beforehand and the respective material properties. This again then would be static coding and material properties should be handed in the functions imo.

Also I do not quite understand why bc20max and tc0max are not set in the functions themselves. I need hardcode them now externally in my code (which is static).

Would it be possible to change those functions to:

jonmaddock commented 4 years ago

In GitLab by @mkovari on Nov 29, 2019, 09:40

For reliable behaviour during optimisation one option is for the code to return a negative critical current density when Bmax > Bcrit, even though this is unphysical. Probably a better option is for the code to return a small positive value, tending to zero for very large values of Bmax. I recommend that all the critical current density routines are modified to ensure this. For example,

Define $B_{90}=0.9 B_c$.
If $B_{max} < B_{90}$, use regular scaling. Define $J_{90}=Jc(Bmax=B_{90})$.
If $B_{max} \ge B_{90}$, use special scaling:
$J_c=J_{90} \times B_{90}/B_{max}$

I agree, as you suggest, that the routine should return a flag showing when Bmax > Bcrit, instead of generating an error message.

At some point in the past we thought it would be useful to set bc20maxand tc0max in the input file. However, it seems that this was never implemented. Therefore it would make sense for the parameters to be set in the critical current density routine.

@schislet For info.
@jlion I am not sure what the best way is to manage these changes. Which branch are you using?

jonmaddock commented 4 years ago

In GitLab by @jlion on Nov 29, 2019, 10:35

I am using stellarator_update_jlion right now.
Your suggested change could potentially induce some deviations from the real value and even allow the returned $J>J_c$ if $J_c$ drops faster than $1/B$ right? (haven't checked if this is the case for the implemented formulas). I am using jcrit at 95% e.g. in the stellarator branch, which means I'd always get the artificial scaling then. I suggest either using:

If $B_{max}<B_c$: return regular $J$.
If $B_{max}\ge B_c$: return $J=10^{-6}*1/B$ (To get the scaling in B which you mentioned) This would be not continuous, so not sure if this causes any problems.

or ensure that the $\left(B_{90}​/B_{max}\right)^a$ ​​ drops faster than $J_c$ by using your suggestion at 98% maybe and chosing $a$ large enough.

jonmaddock commented 4 years ago

In GitLab by @mkovari on Nov 29, 2019, 10:51

Why are you loading the superconductor at 95% of the critical current? That's not normal practice in magnet manufacture.

I think a continuous function is desirable for the optimiser to work well. Of course the asymptotic continuation could be adjusted to make sure that it is never used in the operating region - for example using it over 98% of Bc instead of 90%. I don't think there is any benefit in using $\left(B_{90}​/B_{max}\right)^a$ - the idea is to let ​​$J_c(returned)$ tend to zero gradually as $B_{max} \rightarrow \infty$.

jonmaddock commented 4 years ago

In GitLab by @mkovari on Nov 29, 2019, 10:59

Are you interested in making these changes? If so I suggest that you always change one thing at a time - merge your branch into develop, then create a new branch issue-954-superconductors to make these changes.

That's unless you are interested in doing these changes, @schislet ?

jonmaddock commented 4 years ago

In GitLab by @schislet on Jan 6, 2020, 09:36

Apologies for being very late to the party. @jlion are you making these changes? I'm happy to lend a hand.

jonmaddock commented 4 years ago

In GitLab by @jlion on Jan 9, 2020, 12:37

Yes, I can do that..

jonmaddock commented 2 years ago

In GitLab by @wg7580 on Jul 21, 2022, 16:16

@jlion Did you implement this or has anything been done on it/is planned to be done on it? If not- I will close the issue

jonmaddock commented 2 years ago

In GitLab by @jlion on Jul 26, 2022, 10:54

nope I ran into several issues implementing this at that time (in other parts of the code which I was not familiar with). Let's close it for now and reopen if necessary...

jonmaddock commented 2 years ago

In GitLab by @jlion on Jul 26, 2022, 10:54

closed