Download as pdf or txt
Download as pdf or txt
You are on page 1of 4

6/24/2021 Untitled2.

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

Requirement already satisfied: scipy in /usr/local/lib/python3.7/dist-packages (from cal


Collecting PyQtWebEngine-Qt5>=5.15

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

Requirement already satisfied: six in /usr/local/lib/python3.7/dist-packages (from pyvtk


Collecting PyQt5-Qt5>=5.15

Downloading https://files.pythonhosted.org/packages/83/d4/241a6a518d0bcf0a9fcdcbad5edf
|████████████████████████████████| 59.9MB 52kB/s

Requirement already satisfied: pyparsing!=2.0.4,!=2.1.2,!=2.1.6,>=2.0.1 in /usr/local/li


Requirement already satisfied: kiwisolver>=1.0.1 in /usr/local/lib/python3.7/dist-packag
Requirement already satisfied: cycler>=0.10 in /usr/local/lib/python3.7/dist-packages (f
Requirement already satisfied: python-dateutil>=2.1 in /usr/local/lib/python3.7/dist-pac
Requirement already satisfied: pyOpenGl in /usr/local/lib/python3.7/dist-packages (from
Building wheels for collected packages: pyvtk, gmsh, visvis

Building wheel for pyvtk (setup.py) ... done

Created wheel for pyvtk: filename=PyVTK-0.5.18-cp37-none-any.whl size=24735 sha256=67b


Stored in directory: /root/.cache/pip/wheels/7d/73/d6/4c3ce104624b4459b6dbc3329235f688
Building wheel for gmsh (setup.py) ... done

Created wheel for gmsh: filename=gmsh-4.8.4-cp37-none-any.whl size=112703007 sha256=7a


Stored in directory: /root/.cache/pip/wheels/93/fb/86/1154e077130293fa59e12589768eb91f
Building wheel for visvis (setup.py) ... done

Created wheel for visvis: filename=visvis-1.13.0-cp37-none-any.whl size=4905513 sha256


Stored in directory: /root/.cache/pip/wheels/30/c2/3e/d6ecf9ef400e03b84f3533211fa1a9cb
Successfully built pyvtk gmsh visvis

Installing collected packages: PyQtWebEngine-Qt5, PyQt5-sip, PyQt5-Qt5, pyqt5, pyqtweben


Successfully installed PyQt5-Qt5-5.15.2 PyQt5-sip-12.9.0 PyQtWebEngine-Qt5-5.15.2 calfem
Requirement already satisfied: pyqt5 in /usr/local/lib/python3.7/dist-packages (5.15.4)

https://colab.research.google.com/drive/1bu-Ps9lpAMhluy1g-lKZGDZepYBolBl7?authuser=1#scrollTo=QRALHnglGke6&printMode=true 1/4
6/24/2021 Untitled2.ipynb - Colaboratory

Requirement already satisfied: PyQt5-Qt5>=5.15 in /usr/local/lib/python3.7/dist-packages


Requirement already satisfied: PyQt5-sip<13,>=12.8 in /usr/local/lib/python3.7/dist-pack

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.]]

[[ 69. -69. 0. 0.]

[ -69. 325. 0. -256.]

[ 0. 0. 98. -98.]

[ 0. -256. -98. 354.]]

[[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

You might also like