Professional Documents
Culture Documents
Untitled2.ipynb - Colaboratory
Untitled2.ipynb - Colaboratory
ipynb - Colaboratory
!pip install calfem-python
!pip install pyqt5
Collecting calfem-python
Downloading https://files.pythonhosted.org/packages/d4/f2/72c5deb770e913ac7e009dcb9940
|████████████████████████████████| 71kB 3.5MB/s
Collecting pyqtwebengine
Downloading https://files.pythonhosted.org/packages/8a/4a/570f9544d872c27d4c71f72c81af
|████████████████████████████████| 235kB 8.7MB/s
Collecting pyvtk
Downloading https://files.pythonhosted.org/packages/6a/dc/d5ffc2cc50bdd7a2e7b435655ee5
Requirement already satisfied: numpy in /usr/local/lib/python3.7/dist-packages (from cal
Collecting pyqt5
Downloading https://files.pythonhosted.org/packages/ed/62/cd9f10702c75b242f82da858668f
|████████████████████████████████| 8.3MB 9.0MB/s
Collecting gmsh
Downloading https://files.pythonhosted.org/packages/2a/21/760f6f5eca6c9986ba2640fbae51
Requirement already satisfied: matplotlib in /usr/local/lib/python3.7/dist-packages (fro
Collecting visvis
Downloading https://files.pythonhosted.org/packages/02/4e/e175ada34cb13967ed8b6597ba39
|████████████████████████████████| 5.1MB 39.7MB/s
Downloading https://files.pythonhosted.org/packages/48/62/117c9c96837287b181fce6da4810
|████████████████████████████████| 67.5MB 97kB/s
Collecting PyQt5-sip<13,>=12.8
Downloading https://files.pythonhosted.org/packages/e5/07/129815a9eac86f67c9b8198d26b4
|████████████████████████████████| 317kB 32.7MB/s
Downloading https://files.pythonhosted.org/packages/83/d4/241a6a518d0bcf0a9fcdcbad5edf
|████████████████████████████████| 59.9MB 52kB/s
https://colab.research.google.com/drive/1bu-Ps9lpAMhluy1g-lKZGDZepYBolBl7?authuser=1#scrollTo=QRALHnglGke6&printMode=true 1/4
6/24/2021 Untitled2.ipynb - Colaboratory
import numpy as np
import calfem.core as cfc
import calfem.vis_mpl as cfv
import math
a=int(input("a="));
b=int(input("b="));
c=int(input("c="));
d=int(input("d="));
e=int(input("e="));
g=int(input("f1="));
h=int(input("f2="));
Edof = np.array([[1,2],[2,4],[2,4],[2,4],[3,4]])
K= np.zeros((4,4))
f= np.zeros((4,1));
f[1] = g
f[3] = h
Ke1 =cfc.spring1e(a)
Ke2 =cfc.spring1e(b)
Ke3 =cfc.spring1e(c)
Ke4 =cfc.spring1e(d)
Ke5 =cfc.spring1e(e)
print("")
print(Ke1)
print("")
print(Ke2)
print("")
print(Ke3)
print("")
print(Ke4)
print("")
print(Ke5)
cfc.assem(Edof[0,:],K,Ke1)
cfc.assem(Edof[1,:],K,Ke2)
cfc.assem(Edof[2,:],K,Ke3)
cfc.assem(Edof[3,:],K,Ke4)
cfc.assem(Edof[4,:],K,Ke5)
print("")
print(K)
bc=np.array([1,3])
U,F=cfc.solveq(K,f,bc)
print("")
print(U)
print("")
print(F)
a=69
https://colab.research.google.com/drive/1bu-Ps9lpAMhluy1g-lKZGDZepYBolBl7?authuser=1#scrollTo=QRALHnglGke6&printMode=true 2/4
6/24/2021 Untitled2.ipynb - Colaboratory
b=55
c=97
d=104
e=98
f1=-108
f2=154
[[ 69. -69.]
[-69. 69.]]
[[ 55. -55.]
[-55. 55.]]
[[ 97. -97.]
[-97. 97.]]
[[ 104. -104.]
[-104. 104.]]
[[ 98. -98.]
[-98. 98.]]
[ 0. 0. 98. -98.]
[[0. ]
[0.024074 ]
[0. ]
[0.45243769]]
[[ -1.66110595]
[ 0. ]
[-44.33889405]
[ 0. ]]
https://colab.research.google.com/drive/1bu-Ps9lpAMhluy1g-lKZGDZepYBolBl7?authuser=1#scrollTo=QRALHnglGke6&printMode=true 3/4
6/24/2021 Untitled2.ipynb - Colaboratory
https://colab.research.google.com/drive/1bu-Ps9lpAMhluy1g-lKZGDZepYBolBl7?authuser=1#scrollTo=QRALHnglGke6&printMode=true 4/4