20Functions for building the semi-coherent metric for the piecewise model.
26from scipy
import integrate
28from .
import basis_functions
as bf
54 if i == l
or (i + 1 == l
and borc == 1):
73 basisfunc =
lambda t: bf.basisfunctionvalue(t, l, borc, s, coeffs)
77 phasederiv = 2 * np.pi * integrate.quad(basisfunc, ps, pe, epsabs=0)[0]
97 if l + 1 >= len(bf.knotslist):
102 return 1 / (pe - ps) * integrate.quad(phasederiv, ps, pe)[0]
141 if l + 1 >= len(bf.knotslist):
142 pe = bf.knotslist[-1]
146 doubleaverage =
lambda x: parta(x) * partb(x)
148 return 1 / (pe - ps) * integrate.quad(doubleaverage, ps, pe)[0]
157 l, i1, i2, borc1, borc2, s1, s2, coeffs
161 return doubleaverage - singleaveragedsquared
177 ints = len(bf.knotslist) - 1
178 for i
in range(-1, ints):
179 for thiss
in range(s):
180 coords.append([i, thiss])
199 for nnc
in newcoords:
201 l, nc[0], nnc[0], nc[1], nnc[1], nc[2], nnc[2], coeffs
204 thisrow.append(metelem)
206 thismet.append(thisrow)
208 return np.array(thismet)
213 coeffs = bf.allcoeffs(s)
217 ints = len(bf.knotslist) - 1
218 for l
in range(ints):
219 metsonints.append(
metriconl(l, coords, coeffs))
221 thismet = np.zeros(np.shape(metsonints[0]))
223 for met
in metsonints:
226 return 1 / ints * thismet
239 (5975 * p1**2 * Pi**2) / 63063.0,
240 (13859 * p1**3 * Pi**2) / 630630.0,
241 (475 * p1**4 * Pi**2) / 252252.0,
242 (9071 * p1**2 * Pi**2) / 126126.0,
243 (-23333 * p1**3 * Pi**2) / 1.26126e6,
244 (4259 * p1**4 * Pi**2) / 2.52252e6,
247 (13859 * p1**3 * Pi**2) / 630630.0,
248 (2764 * p1**4 * Pi**2) / 525525.0,
249 (321 * p1**5 * Pi**2) / 700700.0,
250 (23333 * p1**3 * Pi**2) / 1.26126e6,
251 (-29713 * p1**4 * Pi**2) / 6.3063e6,
252 (8077 * p1**5 * Pi**2) / 1.89189e7,
255 (475 * p1**4 * Pi**2) / 252252.0,
256 (321 * p1**5 * Pi**2) / 700700.0,
257 (127 * p1**6 * Pi**2) / 3.15315e6,
258 (4259 * p1**4 * Pi**2) / 2.52252e6,
259 (-8077 * p1**5 * Pi**2) / 1.89189e7,
260 (233 * p1**6 * Pi**2) / 6.054048e6,
263 (9071 * p1**2 * Pi**2) / 126126.0,
264 (23333 * p1**3 * Pi**2) / 1.26126e6,
265 (4259 * p1**4 * Pi**2) / 2.52252e6,
266 (5975 * p1**2 * Pi**2) / 63063.0,
267 (-13859 * p1**3 * Pi**2) / 630630.0,
268 (475 * p1**4 * Pi**2) / 252252.0,
271 (-23333 * p1**3 * Pi**2) / 1.26126e6,
272 (-29713 * p1**4 * Pi**2) / 6.3063e6,
273 (-8077 * p1**5 * Pi**2) / 1.89189e7,
274 (-13859 * p1**3 * Pi**2) / 630630.0,
275 (2764 * p1**4 * Pi**2) / 525525.0,
276 (-321 * p1**5 * Pi**2) / 700700.0,
279 (4259 * p1**4 * Pi**2) / 2.52252e6,
280 (8077 * p1**5 * Pi**2) / 1.89189e7,
281 (233 * p1**6 * Pi**2) / 6.054048e6,
282 (475 * p1**4 * Pi**2) / 252252.0,
283 (-321 * p1**5 * Pi**2) / 700700.0,
284 (127 * p1**6 * Pi**2) / 3.15315e6,
287 metric = [firstrow, secondrow, thirdrow, fourthrow, fifthrow, sixthrow]
292 (583 * p1**2 * Pi**2) / 6300.0,
293 (223 * p1**3 * Pi**2) / 12600.0,
294 (467 * p1**2 * Pi**2) / 6300.0,
295 (-197 * p1**3 * Pi**2) / 12600.0,
298 (223 * p1**3 * Pi**2) / 12600.0,
299 (11 * p1**4 * Pi**2) / 3150.0,
300 (197 * p1**3 * Pi**2) / 12600.0,
301 (-41 * p1**4 * Pi**2) / 12600.0,
304 (467 * p1**2 * Pi**2) / 6300.0,
305 (197 * p1**3 * Pi**2) / 12600.0,
306 (583 * p1**2 * Pi**2) / 6300.0,
307 (-223 * p1**3 * Pi**2) / 12600.0,
310 (-197 * p1**3 * Pi**2) / 12600.0,
311 (-41 * p1**4 * Pi**2) / 12600.0,
312 (-223 * p1**3 * Pi**2) / 12600.0,
313 (11 * p1**4 * Pi**2) / 3150.0,
316 return [firstrow, secondrow, thirdrow, fourthrow]
320 "Given value of S has not yet been accounted for. Value of S given: "
327 if s != 3
and s != 2:
329 "Given value of S has not yet been accounted for. Value of S given: "
334 segs = len(bf.knotslist) - 1
338 for seg
in range(segs):
339 Tseg = bf.knotslist[seg + 1] - bf.knotslist[seg]
343 segmentmetrics.append(thismetric)
345 metric = np.zeros((s * (segs + 1), s * (segs + 1)))
347 for i, thismetric
in enumerate(segmentmetrics):
349 prependzeros = [0
for j
in range(i * s)]
350 appendzeros = [0
for j
in range((segs - 1 - i) * s)]
351 zerorow = [0
for j
in range((segs + 1) * s)]
355 prependzerorows = i * s
356 appendzerorows = (segs - 1 - i) * s
358 for j
in range(prependzerorows):
359 submetric.append(zerorow)
361 for row
in thismetric:
364 thisrow = thisrow + prependzeros
365 thisrow = thisrow + row
366 thisrow = thisrow + appendzeros
368 submetric.append(thisrow)
370 for j
in range(appendzerorows):
371 submetric.append(zerorow)
373 metric += np.array(submetric)
375 return 1 / segs * metric
def doubleintegralzerocheck(i1, i2, borc1, borc2, l)
def PreCompSingleSegMetric(Tdata, s)
def metriconl(l, coords, coeffs)
def integralzerocheck(i, borc, l)
def singlephaseaveragesquaredonl(l, i1, i2, borc1, borc2, s1, s2, coeffs)
def twocoordstothreecoords(i, s)
def singlephaseaverageonl(l, i, borc, s, coeffs)
def doublephaseaverageonl(l, i1, i2, borc1, borc2, s1, s2, coeffs)
def integratebasisfunctiononl(pe, l, borc, s, coeffs)
def metricelementonl(l, i1, i2, borc1, borc2, s1, s2, coeffs)