我刚刚尝试在Ubuntu16.04上安装FEniCS,当我尝试使用python3.5运行第一个示例代码时,我得到了以下两个错误: RuntimeError: Expecting a string or list of strings, not
{'slepc_real', 'sz', 'mpi', 'mpi_cxx', 'hdf5', 'boost_timer', 'm',
'boost_filesystem', 'z', 'dolfi
我现在安装了一个全新的Ubuntu 16.04。我首先安装的是Pycharm,并用Python3.6解释器创建了venv。我尝试安装并导入Fenics,这给出了一条消息:
ImportError: No module named 'fenics'
我用pip安装了Fenics,看起来还不错。有趣的是,当使用Python2.7解释器时,我能够导入Fenics。将Fenics添加到项目解释器会导致不可导入的包和相同的错误消息。我还在Docker上安装了Fenics,看起来还不错,但我想避免使用Docker存储库。如何在Pycharm与解释器Python3.6一起使用时导入Fenic
我正在尝试在Ubuntu 16.04.2,Python 2.7,Anaconda (带有IDE的Spyder )上运行Fenics (2016.2.0)的一个基本演示。演示是ft_01poisson.py。错误信息为:
RuntimeError: In instant.recompile: The module did not compile with command 'make VERBOSE=1', see '.../error/dolfin_6c..dc/compile.log'
好的,我们来看一看。一切都很好,直到...
.../anaconda2/in
我知道如何运行奇点:
singularity run /mn/sarpanitu/singularity/test/fenics-and-more.img
是否有方法执行一行(或多行)运行前面的命令,然后在奇点运行echo "hi there"?(当然,我会在生产中使用比hi更复杂的东西)。一旦完成了这一任务,我希望我的奇点仍然保持良好和活跃,以供交互使用。
所以像这样的意图:
singularity run /mn/sarpanitu/singularity/test/fenics-and-more.img -bash-command echo "hi there
设u是函数空间V上用FEniCS求解的给定问题的解
from fenics import *
...
u = Function(V)
solve(a==L, u, bcs)
x是一个Point对象。如何计算u在x上的梯度?
我试过了
g = grad(u)
g(x)
这将引发一个有关维度的错误:
UFLException: Expecting dim to match the geometric dimension, got dim=1 and gdim=2.
在函数空间上投影梯度也不能带来令人鼓舞的结果:
h = project(grad(u), V)
还会引发错误。
UFLExc
我编写了torch_fenics的子类。在这种情况下,输入是来自DG空间的向量。我在弱公式中使用这个输入,然后计算出解。此外,对于给定的输入,我需要解的梯度。
I get the following error log on running the same
~/miniconda3/envs/py37/lib/python3.7/site-packages/torch/autograd/function.py in apply(self,*args) 75 76 def应用(self,*args):--> 77返回self._forward_cls.backward(self,*arg
我正在遵循https://fenics.readthedocs.io/projects/containers/en/latest/introduction.html的指示。 我得到了: fenics@af86d2c8af46:~$ cd ~/demo/python/documented/poisson
fenics@af86d2c8af46:~/demo/python/documented/poisson$ python3 demo_poisson.py
Calling FFC just-in-time (JIT) compiler, this may take some time.
我需要存储昂贵的有限元计算的解决方案,以便在进一步的分析中使用它。浏览我到目前为止发现的教程,我可能会像这样存储我的结果: from fenics import *
mesh = Mesh('mesh/UnitSquare8x8.xml')
V = FunctionSpace(mesh, 'P', 1)
u = TrialFunction(V)
v = TestFunction(V)
f = Constant(-6.0)
a = dot(grad(u), grad(v))*dx
L = f*v*dx
u_D = Expression('1 + x
我正在遵循这个网站的指示,
!conda config --add channels conda-forge
!conda install fenics
但它说:
Solving environment: Failed with initial frozen solve. Retrying with flexible solve.
Solving enviroment: Failed with repodata from current_repodata.jason, will retry with next repodata source.
而且没有更多的进展。
我是fenics的初学者,我正在尝试用边界条件求解泊松方程,边界条件是由Python库opensimplex生成的珀林噪声。
我试着定义f,Expression()的边界条件。
我试过Expression('function(x[0],x[1],x[2])') where function (x,y,z)=opensimplex.tmp.noise3d(x,y,z))。但是,因为这个opensimplex函数不是由C++管理的,所以我得到了一个编译错误;Compilation failed!。
有什么解决方案可以克服这个错误吗?
我正在试着在服务器上安装替罪羊。但是我得到了错误。1)我安装了pip,python 2.66已经安装好了。2)然后我运行命令pip installed scapy
然后在终端中,当我输入scapy时,我得到:
[root@virgina02 alamin]# scapy
INFO: Can't import matplotlib. Won't be able to plot.
INFO: Can't import PyX. Won't be able to use psdump() or pdfdump().
INFO: No IPv6 support in k
我目前正在做一个项目,我们正在解决FEniCs中的PDE系统。我创建了以下代码来解决系统问题,但我在 a = a0 + a1 我的Python不是很好,而且我以前从来没有用过FEniCS。我还使用了一个windows子系统来运行它,这使得我很难理解我可能犯下的任何错误。我很感谢你的任何建议,如果我问了明显的问题,我提前道歉! from fenics import *
# Create mesh and define function space
mesh = Mesh (" circle.xml ")
# Construct the finite element spa
是否有一种“更好”的方式来写这句话:
raise RuntimeError if not radius.is_a? Numeric or radius == 0
我只想允许大于0的数字。
class Shape
def initialize(name)
@name = name
end
def to_s
"name: #{@name}"
end
end
class Circle < Shape
def initialize(name, radius = 0)
raise RuntimeError if not radius.
如果我有一份If声明
x = 2
y = 1
if x == nil || y == nil || z == nil
raise "RuntimeError: Argument is nil"
end
能不能做些类似的事
raise "RuntimeError: ${Argument} is nil"
参数在哪里是变量nil?或者,我必须分开条件才能让它起作用?
if x == nil
raise "RuntimeError: x is nil"
end
if y == nil
raise "RuntimeError: