Beispiel #1
0
## Convert microstructure function to frequency space
M = np.zeros((ns, el, H), dtype="complex128")

mtest = m

for ii in range(ns):
    for jj in range(H):
        M[ii, :, jj] = sc.fft(np.squeeze(m[ii, :, jj]))


## FEM response of data points
femresp = np.zeros((ns, el))

for ii in range(ns):
    femresp[ii, :] = fem1d(mfi[ii, :])

fftresp = sc.fft(femresp)


## Perform the calibration itself
calibm = np.zeros((H, H, el)) + 0j * np.zeros((H, H, el))
respfd = np.zeros((H, el)) + 0j * np.zeros((H, el))
specinfc = np.zeros((el, H)) + 0j * np.zeros((el, H))

for ii in range(el):
    for jj in range(ns):

        mSQc = np.conjugate(M[jj, ii, :])
        mSQt = np.mat(M[jj, ii, :]).T
    r2=x*x+y*y+z*z
    r=sqrt(r2)    
    return eval(sbc)
# create quadratically scaled 1D grid 
t=linspace(0.0,1.0,nel1+1)
xi=t**2*xmax
xm=(-xi).tolist()
xm.reverse()
xel=array(xm[:-1]+xi.tolist())
ngl=12
# calculate matrices and eigen pairs for 1D finite element problem of particle 
# in box [-x_max ,x_max]. hm01 and um01 are the kinetic energy and overlap matrices
# between inside functions and the two  boundary functions. 
# only one set of matrices needed, since the grid is the same for x,y and z
t1=time()
nmat,evals,evmat,umat,hmat,xn,hm01,um01=fem1d(xel,no,ngl,0,bc=True)
t2=time()
print "Time for solution of 1D eigen problem=",t2-t1
evmatT=transpose(evmat)
nmat3=nmat**3
print "nmat3=",nmat3
# this function multiplies v  by tensor product of u_x,u_y, u_z, all equal to u
def umul3(v):
    u=v.copy()
    u.shape=nmat,nmat,nmat
    for i in range(nmat):
        for j in range(nmat):
            tmp=u[i,j].copy()
            u[i,j]=dot(umat,tmp)
    for i in range(nmat):
        for k in range(nmat):