-
-
Notifications
You must be signed in to change notification settings - Fork 25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Expression Class #10
Comments
Hi, you need to specify what the values for test = fenics.Expression("A*sin(x[0]) + B*cos(x[1])", A=1.0, B=2.0, degree=1)
@assert test(0, 0) == 2.0 |
I'm afraid I still get the same error (with the updated Expression). How did you install your FEniCS? Via Conda or another way? |
I am using an ubuntu package. The entire script is as follows using PyCall
unshift!(PyVector(pyimport("sys")["path"]), "/usr/lib/python2.7/dist-packages/")
@pyimport fenics
test = fenics.Expression("A*sin(x[0]) + B*cos(x[1])", A=1., B=2.0, degree=1)
@assert test(0., 0,) == 2.0
println(test(1, 2.)) Make sure that instant can compile the expression by trying it first in dolfin. This was not the case with your original example. Btw, instant gave you a log where you would find the reason for failure,
See what happend e.g. by cat /home/ysimillides/.cache/instant/python2.7/error/dolfin_30bdf4cb51714b187b95e13cb07aeaf2529b443b/compile.log |
is from the log file. @ysimillides do you have cmake installed? |
Hello.
When attempting to import the https://fenicsproject.org/olddocs/dolfin/2016.2.0/python/programmers-reference/functions/expression/Expression.html , the error below can be shown. I've tried searching for the error message online, but have had no luck. I cannot also track down the log file. I believe (but cannot be sure) that it is a precompilation error in FEniCS, as the DOLFIN JIT compiler is being called with these commands.
EDIT: I have been informed that the expression class is written in C++, so maybe it needs a different wrapper?
Running these 3 lines of code should be enough to reproduce the error.
LoadError: PyError (ccall(@pysym(:PyObject_Call), PyPtr, (PyPtr, PyPtr, PyPtr), o, arg, C_NULL)) <type 'exceptions.RuntimeError'>
RuntimeError("In instant.recompile: The module did not compile with command 'cmake -DDEBUG=TRUE .', see '/home/ysimillides/.cache/instant/python2.7/error/dolfin_30bdf4cb51714b187b95e13cb07aeaf2529b443b/compile.log'",)
File "/home/ysimillides/.julia/v0.6/Conda/deps/usr/lib/python2.7/site-packages/dolfin/functions/expression.py", line 679, in new
mpi_comm=kwargs.get("mpi_comm"))
File "/home/ysimillides/.julia/v0.6/Conda/deps/usr/lib/python2.7/site-packages/dolfin/compilemodules/expressions.py", line 266, in compile_expressions
mpi_comm=mpi_comm)
File "/home/ysimillides/.julia/v0.6/Conda/deps/usr/lib/python2.7/site-packages/dolfin/compilemodules/expressions.py", line 183, in compile_expression_code
mpi_comm=mpi_comm)
File "/home/ysimillides/.julia/v0.6/Conda/deps/usr/lib/python2.7/site-packages/dolfin/compilemodules/jit.py", line 70, in mpi_jit
return local_jit(*args, **kwargs)
File "/home/ysimillides/.julia/v0.6/Conda/deps/usr/lib/python2.7/site-packages/dolfin/compilemodules/compilemodule.py", line 603, in compile_extension_module
**instant_kwargs)
File "/home/ysimillides/.julia/v0.6/Conda/deps/usr/lib/python2.7/site-packages/instant/build.py", line 577, in build_module
build_system)
File "/home/ysimillides/.julia/v0.6/Conda/deps/usr/lib/python2.7/site-packages/instant/build.py", line 158, in recompile
instant_error(msg % (cmd, compile_log_filename_dest))
File "/home/ysimillides/.julia/v0.6/Conda/deps/usr/lib/python2.7/site-packages/instant/output.py", line 96, in instant_error
raise RuntimeError(text)
while loading /home/ysimillides/FEniCS.jl/src/jfem.jl, in expression starting on line 40
pyerr_check at exception.jl:56 [inlined]
pyerr_check at exception.jl:61 [inlined]
macro expansion at exception.jl:81 [inlined]
#_pycall#66(::Array{Any,1}, ::Function, ::PyCall.PyObject, ::String, ::Vararg{String,N} where N) at PyCall.jl:620
_pycall(::PyCall.PyObject, ::String, ::Vararg{String,N} where N) at PyCall.jl:608
#pycall#70(::Array{Any,1}, ::Function, ::PyCall.PyObject, ::Type{PyCall.PyAny}, ::String, ::Vararg{String,N} where N) at PyCall.jl:642
pycall(::PyCall.PyObject, ::Type{PyCall.PyAny}, ::String, ::Vararg{String,N} where N) at PyCall.jl:642
#call#71(::Array{Any,1}, ::PyCall.PyObject, ::String, ::Vararg{String,N} where N) at PyCall.jl:645
FEniCS.Expression(::String) at jfem.jl:24
include_string(::String, ::String) at loading.jl:515
include_string(::Module, ::String, ::String) at Compat.jl:1492
(::Atom.##55#58{String,String})() at eval.jl:73
withpath(::Atom.##55#58{String,String}, ::String) at utils.jl:30
withpath(::Function, ::String) at eval.jl:38
macro expansion at eval.jl:71 [inlined]
(::Atom.##54#57{Dict{String,Any}})() at task.jl:80
The text was updated successfully, but these errors were encountered: