示例#1
0
import scipy.sparse.linalg as splalg
import pyxel as px

f = px.Image('zoom-0053_1.tif').Load()
g = px.Image('zoom-0070_1.tif').Load()

m = px.ReadMeshINP('abaqus_q4_m.inp')

p = np.array(
    [1.05449047e+04, 5.12335842e-02, -9.63541211e-02, -4.17489457e-03])
cam = px.Camera(p)

m.Connectivity()
m.DICIntegration(cam, G=True)

U0 = px.MultiscaleInit(f, g, m, cam, scales=[3, 2, 1], l0=0.002)

#%% ICGN

dic = px.DICEngine()
U = U0.copy()
H = dic.ComputeLHS(f, m, cam)
H_LU = splalg.splu(H)
repx = np.arange(m.ndof // 2)
repy = np.arange(m.ndof // 2, m.ndof)
phi = m.phix[:, repx]
MM = np.dot(phi.T, phi)
MMLU = splalg.splu(MM.T)
dNdx = MMLU.solve(phi.T.dot(m.dphixdx[:, repx]).toarray())
dNdy = MMLU.solve(phi.T.dot(m.dphixdy[:, repx]).toarray())
for k in range(0, 60):
示例#2
0
    JC Passieux, INSA Toulouse, 2021

    Example 4 : 
    Use additional tikhonov regularization.

     """

import numpy as np
import pyxel as px

f = px.Image('zoom-0053_1.tif').Load()
g = px.Image('zoom-0070_1.tif').Load()

m = px.ReadMeshINP('abaqus_q4_m.inp')

p = np.array(
    [1.05449047e+04, 5.12335842e-02, -9.63541211e-02, -4.17489457e-03])
cam = px.Camera(p)

m.Connectivity()
m.DICIntegration(cam)

U = px.MultiscaleInit(f, g, m, cam, scales=[3, 2, 1])

l0 = 0.005
L = m.Tikhonov()
U, res = px.Correlate(f, g, m, cam, U0=U, L=L, l0=l0)

m.Plot(edgecolor='#CCCCCC')
m.Plot(U, 30)
示例#3
0
# Pre-processing  ==============================================================
# ==============================================================================

# Build the connectivity table
m.Connectivity()
# Build the quadrature rule; compute FE basis functions and derivatives
m.DICIntegration(cam)
# Plot Mesh on the reference image
px.PlotMeshImage(f,m,cam)

# Open reference image
imdef = imagefile % imnums[-2]
g = px.Image(imdef).Load()

# Multiscale initialization of the displacement
U0=px.MultiscaleInit(m,f,g,cam,3)
m.Plot(U0,30)

#%% ============================================================================
# Classic Modified Gauss Newton  ===============================================
# ==============================================================================
U=U0.copy()
dic=px.DICEngine()
H=dic.ComputeLHS(f,m,cam)
H_LU=splalg.splu(H)
for ik in range(0,30):
    [b,res]=dic.ComputeRHS(g,m,cam,U)
    dU=H_LU.solve(b)
    U+=dU
    err=np.linalg.norm(dU)/np.linalg.norm(U)
    print("Iter # %2d | disc/dyn=%2.2f %% | dU/U=%1.2e" % (ik+1,np.std(res)/dic.dyn*100,err))
示例#4
0
    Example 5:
        Other element types.

     """

import numpy as np
import pyxel as px
import matplotlib.pyplot as plt

f = px.Image('zoom-0053_1.tif').Load()
g = px.Image('zoom-0070_1.tif').Load()

# f.SelectROI()
roi = np.array([[537, 24], [850, 488]])
m = dict()
m[0], cam = px.MeshFromROI(roi, 50, f, typel=2)  # tri3
m[1], _ = px.MeshFromROI(roi, 50, f, typel=3)  # qua4
m[2], _ = px.MeshFromROI(roi, 50, f, typel=9)  # tri6
m[3], _ = px.MeshFromROI(roi, 50, f, typel=10)  # qua9
m[4], _ = px.MeshFromROI(roi, 50, f, typel=16)  # qua8

for k in m.keys():
    px.PlotMeshImage(f, m[k], cam)
    m[k].Connectivity()
    m[k].DICIntegration(cam)
    U = px.MultiscaleInit(f, g, m[k], cam, scales=[3, 2, 1], l0=30)
    U, res = px.Correlate(f, g, m[k], cam, U0=U)
    plt.figure()
    m[k].Plot(edgecolor='#CCCCCC')
    m[k].Plot(U, 30)