示例#1
0
文件: plot.py 项目: wolfv/GooseFEM
E = f['/global/Epot'][:]
ax.plot(t, E, color='r', label=r'$E_\mathrm{pot}$')
E = f['/global/Ekin'][:]
ax.plot(t, E, color='b', label=r'$E_\mathrm{kin}$')

ax.legend(loc='lower right')

ax.set_xlabel(r'$t$')
ax.set_ylabel(r'$E$')

# --------------------------------------------------------------------------------------------------

ax = axes[1]

coor = f['/mesh/coor'][:]
conn = f['/mesh/conn'][:]
u = f['/mesh/disp'][:]

im = gplt.patch(coor=coor + u, conn=conn)

Lx = np.max(coor[:, 0]) - np.min(coor[:, 0])
Ly = np.max(coor[:, 1]) - np.min(coor[:, 1])

ax.set_xlim([-0.1 * Lx, 1.3 * Lx])
ax.set_ylim([-0.1 * Ly, 1.3 * Ly])

ax.set_aspect('equal')

# plt.savefig(re.sub(r'(.*)(\.hdf5)',r'\1.svg',name))
plt.show()
示例#2
0
import matplotlib.pylab as plt
import goosempl as gplt

plt.style.use(['goose', 'goose-latex'])

fig = plt.figure(figsize=(18, 6))
fig.set_tight_layout(True)

# --------------------------------------------------------------------------------------------------

ax = fig.add_subplot(1, 3, 1)

gplt.patch(coor=coor,
           conn=conn,
           cindex=orig,
           clim=[-0.5, 1.5],
           cmap='RdBu_r',
           alpha=.5)

gplt.patch(coor=coor - DX, conn=conn)
gplt.patch(coor=coor + DX, conn=conn)
gplt.patch(coor=coor + DX - DY, conn=conn)
gplt.patch(coor=coor + DX + DY, conn=conn)
gplt.patch(coor=coor - DX - DY, conn=conn)
gplt.patch(coor=coor - DX + DY, conn=conn)
gplt.patch(coor=coor - DY, conn=conn)
gplt.patch(coor=coor + DY, conn=conn)

plt.xlim([-0.15, 1.2])
plt.ylim([-0.15, 1.2])
示例#3
0
文件: example.py 项目: wolfv/GooseFEM
import goosempl as gplt
import numpy as np

plt.style.use(['goose'])

# --------------------------------------------------------------------------------------------------

mesh   = gf.Mesh.Quad4.FineLayer(6*9,51)
coor   = mesh.coor()
conn   = mesh.conn()
cindex = np.arange(conn.shape[0])

# --------------------------------------------------------------------------------------------------

fig,ax = plt.subplots(figsize=(10,10))

im = gplt.patch(coor=coor,conn=conn,cindex=cindex,cmap='jet')

ax.plot(coor[:                 ,0],coor[:                 ,1],marker='o',linestyle='none')
ax.plot(coor[mesh.nodesLeft  (),0],coor[mesh.nodesLeft  (),1],marker='o',linestyle='none',color='g')
ax.plot(coor[mesh.nodesRight (),0],coor[mesh.nodesRight (),1],marker='o',linestyle='none',color='b')
ax.plot(coor[mesh.nodesBottom(),0],coor[mesh.nodesBottom(),1],marker='o',linestyle='none',color='r')
ax.plot(coor[mesh.nodesTop   (),0],coor[mesh.nodesTop   (),1],marker='o',linestyle='none',color='y')

ax.set_aspect('equal')
ax.get_xaxis().set_visible(False)
ax.get_yaxis().set_visible(False)

plt.savefig('example.svg')
plt.show()
示例#4
0
import GooseFEM as gf
import matplotlib.pyplot as plt
import goosempl as gplt
import numpy as np

plt.style.use(['goose'])

# --------------------------------------------------------------------------------------------------

mesh = gf.Mesh.Quad4.FineLayer(6 * 9, 51)
coor = mesh.coor()
conn = mesh.conn()
cindex = np.zeros((conn.shape[0]))
cindex[mesh.elementsFine()] = np.linspace(1, 2, len(mesh.elementsFine()))

# --------------------------------------------------------------------------------------------------

fig, ax = plt.subplots(figsize=(10, 10))

im = gplt.patch(coor=coor, conn=conn, cindex=cindex, cmap='Reds')

ax.set_aspect('equal')
ax.get_xaxis().set_visible(False)
ax.get_yaxis().set_visible(False)

plt.savefig('example_elementsFine.svg')
plt.show()