// SmpDirectorDeriv1 computes the first order derivative of the SMP director // Notes: Only non-zero components are returned; i.e. dNdL[i] := dNdL[i][i] func SmpDirectorDeriv1(dNdL []float64, L []float64, a, b, β, ϵ float64) { if SMPUSESRAMP { dNdL[0] = -b * fun.SrampD1(a*L[0], β) * math.Pow(ϵ+fun.Sramp(a*L[0], β), -b-1.0) dNdL[1] = -b * fun.SrampD1(a*L[1], β) * math.Pow(ϵ+fun.Sramp(a*L[1], β), -b-1.0) dNdL[2] = -b * fun.SrampD1(a*L[2], β) * math.Pow(ϵ+fun.Sramp(a*L[2], β), -b-1.0) } else { eps := β dNdL[0] = -b * fun.SabsD1(a*L[0], eps) * math.Pow(ϵ+fun.Sabs(a*L[0], eps), -b-1.0) dNdL[1] = -b * fun.SabsD1(a*L[1], eps) * math.Pow(ϵ+fun.Sabs(a*L[1], eps), -b-1.0) dNdL[2] = -b * fun.SabsD1(a*L[2], eps) * math.Pow(ϵ+fun.Sabs(a*L[2], eps), -b-1.0) } }
// SmpDirectorDeriv2 computes the second order derivative of the SMP director // Notes: Only the non-zero components are returned; i.e.: d²NdL2[i] := d²N[i]/dL[i]dL[i] func SmpDirectorDeriv2(d2NdL2 []float64, L []float64, a, b, β, ϵ float64) { var F_i, G_i, H_i float64 for i := 0; i < 3; i++ { if SMPUSESRAMP { F_i = fun.Sramp(a*L[i], β) G_i = fun.SrampD1(a*L[i], β) H_i = fun.SrampD2(a*L[i], β) } else { eps := β F_i = fun.Sabs(a*L[i], eps) G_i = fun.SabsD1(a*L[i], eps) H_i = fun.SabsD2(a*L[i], eps) } d2NdL2[i] = a * b * ((b+1.0)*G_i*G_i - (ϵ+F_i)*H_i) * math.Pow(ϵ+F_i, -b-2.0) } }