function critical_current_density_nbti(c_pt,T,B,St,Tc0,Bc) result(critical_current_density) bind(C)
type(c_ptr), value :: c_pt
real(dp), value :: T,B,St,Tc0,Bc
real(dp) :: critical_current_density
real(dp) :: Blim,Tlim,tt,bb,h,fp,Blow,Tlow
type(nbti_cfg_t), pointer :: nbti_ptr
call c_f_pointer(c_pt,nbti_ptr)
! M.A. Green, Calculating the Jc, B, T Surface for Niobium Titanium
! Using a Reduced State Model, IEEE Trans. Mag., 25, 2, (1989).
! G. Morgan, A Comparison of Two Analytic Forms for the Jc(B,T)
! surface, SSC Magnet Division Notes, 310-1 (SSC-MD-218), (1989)
! L. Bottura, B. Bordini, Jc(B,T,e) Parameterization for the ITER
! Nb3Sn Production, IEEE Trans. Appl. Sup., 19(2), 1477-1480, 2009
Blow=1.0e-3_dp
Tlow=0.0_dp
Blim=max(abs(B),Blow)
Tlim=max(T,Tlow)
tt = Tlim/nbti_ptr%Tc0_p
if(tt>1.0_dp) then
critical_current_density=0.0_dp
return
endif
bb = Blim/Bc
if(bb>1.0_dp) then
critical_current_density=0.0_dp
return
endif
h = hNbTi(tt,nbti_ptr%nu)
fp = fpNbTi(bb,nbti_ptr%p,nbti_ptr%q)
critical_current_density = nbti_ptr%CC0/Blim * h**nbti_ptr%n * fp
end function critical_current_density_nbti