pythonfipy_Python学习点滴

更新时间:2023-07-12 18:42:14 阅读: 评论:0

pythonfipy_Python学习点滴安装gmsh,并设置环境变量
Delaunay使⽤
import numpy as np
from scipy.spatial import Delaunay
points = np.random.rand(30, 2) # 30 points in 2-d
tri = Delaunay(points)
# Make a list of line gments:
# edge_points = [ ((x1_1, y1_1), (x2_1, y2_1)),
# ((x1_2, y1_2), (x2_2, y2_2)),
# ... ]
edge_points = []
edges = t()
def add_edge(i, j):
"""Add a line between the i-th and j-th points, if not in the list already"""
if (i, j) in edges or (j, i) in edges:
# already added
return
edges.add( (i, j) )
edge_points.append(points[ [i, j] ])
# loop over triangles:
# ia, ib, ic = indices of corner points of the triangle
for ia, ib, ic in tri.vertices:
add_edge(ia, ib)
add_edge(ib, ic)
add_edge(ic, ia)
# plot it: the LineCollection is just a (maybe) faster way to plot lots of
# lines at once
麟角凤嘴import matplotlib.pyplot as plt
llections import LineCollection
lines = LineCollection(edge_points)
plt.figure()
plt.title('Delaunay triangulation')
plt.plot(points[:,0], points[:,1], 'o', hold=1)
plt.xlim(-1, 2)
plt.ylim(-1, 2)
# -- the same stuff for the convex hull二月英文缩写
edges = t()
edge_points = []
for ia, ib vex_hull:
add_edge(ia, ib)
lines = LineCollection(edge_points)
plt.figure()
plt.title('Convex hull')
plt.plot(points[:,0], points[:,1], 'o', hold=1)
plt.xlim(-1, 2)
plt.ylim(-1, 2)
plt.show()
python程序打包Install PyInstaller from PyPI:
pip install pyinstaller
Go to your program’s directory and run:
pyinstaller yourprogram.py
This will generate the bundle in a subdirectory called dist. For a more detailed walkthrough, e the安装jupyter lab 清除cache C:\Urs\Administrator\AppData\Local\pip\cache
安装jupyter lab:
好久不见的朋友
conda install -c conda-forge jupyterlab安装sublime的anaconda插件
管理员权限启动sublime 3,continuesfepy demo测试
安装运⾏时需要的库
conda install mayavi wxpython
conda install traits traitsui
vtk
运⾏库mayavi安装不顺利:
(C:\Anaconda2) C:\wxPython-master>conda install mayavi
Fetching package metadata ...........
Solving package specifications: .
UnsatisfiableError: The following specifications were found to be in conflict:
-
mayavi
- sfepy
U "conda info " to e the dependencies for each package.
(C:\Anaconda2) C:\wxPython-master>conda install -c menpo mayavi=4.5.0
Fetching package metadata .............
Solving package specifications: .
Package plan for installation in environment C:\Anaconda2:
The following NEW packages will be INSTALLED:
apptools: 4.4.0-py27_0 menpo
envisage: 4.5.1-py27_0 menpo
mayavi: 4.5.0-py27_0 menpo
The following packages will be UPDATED:
vtk: 5.10.1-py27_0 --> 7.0.0-py27_0 menpo
Proceed ([y]/n)? y
vtk-7.0.0-py27 100% |>>>>>>#| Time: 0:00:31 787.75 kB/s
apptools-4.4.0 100% |>>>>>>#| Time: 0:00:05 72.23 kB/s
envisage-4.5.1 100% |>>>>>>#| Time: 0:00:02 117.34 kB/s
mayavi-4.5.0-p 100% |>>>>>>#| Time: 0:00:14 882.55 kB/s
PowerShell计算命令⾏:
PSC:\sfepy> python simple.py examples/diffusion/poisson_short_syntax.py
sfepy: left over: ['verbo', '__builtins__', 'absolute_import', '__file__', '__doc__', '__name__', 'data_dir', '__package__', '_filename'] sfepy: reading mesh [line2, tri3, quad4, tetra4, hexa8] (C:\Anaconda2\lib\site-packages\sfepy\meshes\sh)... sfepy: ...done in 0.11 s
sfepy:
sfepy: Gamma_Right
sfepy: Omega
sfepy: Gamma_Left
sfepy: ...done in 0.09 s
sfepy: equation "Temperature":
sfepy: dw_laplace.i.Omega( coef.val, s, t ) = 0
sow
sfepy: using solvers:
ts: no ts
nls: newton
actress
ls: lssfepy:
sfepy: tting up
sfepy: ...done in 0.00 s
sfepy: matrix shape: (300, 300)
sfepy: asmbling
sfepy: ...done in 0.00 s
sfepy: matrix structural nonzeros: 3538 (3.93e-02% fill)
sfepy:
sfepy: coef
sfepy: ...done in 0.05 s
sfepy: nls: iter: 0, residual: 1.176265e-01 (rel: 1.000000e+00)
sfepy: rezidual: 0.05 [s]
sfepy: solve: 0.09 [s]
sfepy: matrix: 0.00 [s]
sfepy: nls: iter: 1, residual: 1.784271e-16 (rel: 1.516895e-15)
PSC:\sfepy> python postproc.py cylinder.vtk
anaconda默认安装pyQt5,需要强制安装pyQt4:
英中翻译conda install -c anaconda pyqt=4.11.4
安装pandas
conda install pandas安装Fipy
1升级pip
python -m pip install --upgrade pip
2 安装Fipy
inexistence
pip install fipy
conda install fipy #error
3 Test:
from fipy import Variable, FaceVariable, CellVariable, Grid1D, ExplicitDiffusionTerm, TransientTerm, DiffusionTerm, Viewer ls import numerix
%matplotlib inline
二建考试科目都有哪些
nx = 50
dx = 1.
mesh = Grid1D(nx=nx, dx=dx)
D = 1.
知名留学机构
valueLeft = 1
phi = CellVariable(name="solution variable",mesh=mesh,value=0.) strain(valueRight, mesh.facesRight)
eqX = TransientTerm() == ExplicitDiffusionTerm(coeff=D) timeStepDuration = 0.9 * dx**2 / (2 * D)
steps = 100
for step in range(steps):
eqX.solve(var=phi,dt=timeStepDuration)
viewer = Viewer(vars=phi,datamin=0., datamax=1.)over the rainbow
viewer.plot()

本文发布于:2023-07-12 18:42:14,感谢您对本站的认可!

本文链接:https://www.wtabcd.cn/fanwen/fan/90/175340.html

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。

标签:安装   需要   管理员   知名
相关文章
留言与评论(共有 0 条评论)
   
验证码:
Copyright ©2019-2022 Comsenz Inc.Powered by © 专利检索| 网站地图