Skip to content
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

Log function as Expression #77

Open
jaddoghman opened this issue Sep 3, 2021 · 1 comment
Open

Log function as Expression #77

jaddoghman opened this issue Sep 3, 2021 · 1 comment

Comments

@jaddoghman
Copy link

jaddoghman commented Sep 3, 2021

The log function is no longer functional in FEniCS.
For instance, f = Expression("log(x[0])", degree=2) yields the following error:

Moving new file over differing existing file:
src: /Users/jaddoghman/PycharmProjects/pythonProject/jitfailure-dolfin_expression_f60265c862d87700218c841a812dafcb/error.log.6ea03de6066b4b9d83ac2b8ded7b64d0
dst: /Users/jaddoghman/PycharmProjects/pythonProject/jitfailure-dolfin_expression_f60265c862d87700218c841a812dafcb/error.log
backup: /Users/jaddoghman/PycharmProjects/pythonProject/jitfailure-dolfin_expression_f60265c862d87700218c841a812dafcb/error.log.old
------------------- Start compiler output ------------------------
/var/folders/ss/zp8nt0fj6sq7cbyhdz9w52q40000gp/T/tmpi7ash_kk/dolfin_expression_f60265c862d87700218c841a812dafcb.cpp:61:23: error: no matching function for call to 'log'
values[0] = log(x[0]);
^~~
/Users/jaddoghman/opt/anaconda3/envs/fenics2018/include/dolfin/log/log.h:103:8: note: candidate function not viable: requires at least 2 arguments, but 1 was provided
void log(int debug_level, std::string msg, ...);
^
1 error generated.
------------------- End compiler output ------------------------
Compilation failed! Sources, command, and errors have been written to: /Users/jaddoghman/PycharmProjects/pythonProject/jitfailure-dolfin_expression_f60265c862d87700218c841a812dafcb
Traceback (most recent call last):
File "/Users/jaddoghman/opt/anaconda3/envs/fenics2018/lib/python3.7/site-packages/dolfin/jit/jit.py", line 167, in compile_class
mpi_comm=mpi_comm)
File "/Users/jaddoghman/opt/anaconda3/envs/fenics2018/lib/python3.7/site-packages/dolfin/jit/jit.py", line 47, in mpi_jit
return local_jit(*args, **kwargs)
File "/Users/jaddoghman/opt/anaconda3/envs/fenics2018/lib/python3.7/site-packages/dolfin/jit/jit.py", line 103, in dijitso_jit
return dijitso.jit(*args, **kwargs)
File "/Users/jaddoghman/opt/anaconda3/envs/fenics2018/lib/python3.7/site-packages/dijitso/jit.py", line 217, in jit
% err_info['fail_dir'], err_info)
dijitso.jit.DijitsoError: Dijitso JIT compilation failed, see '/Users/jaddoghman/PycharmProjects/pythonProject/jitfailure-dolfin_expression_f60265c862d87700218c841a812dafcb' for details
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "", line 1, in
File "/Applications/PyCharm.app/Contents/plugins/python/helpers/pydev/_pydev_bundle/pydev_umd.py", line 198, in runfile
pydev_imports.execfile(filename, global_vars, local_vars) # execute the script
File "/Applications/PyCharm.app/Contents/plugins/python/helpers/pydev/_pydev_imps/_pydev_execfile.py", line 18, in execfile
exec(compile(contents+"\n", file, 'exec'), glob, loc)
File "/Users/jaddoghman/PycharmProjects/pythonProject/Scratch2.py", line 8, in
f = Expression("log(x[0])", degree=2)
File "/Users/jaddoghman/opt/anaconda3/envs/fenics2018/lib/python3.7/site-packages/dolfin/function/expression.py", line 376, in init
self._cpp_object = jit.compile_expression(cpp_code, params)
File "/Users/jaddoghman/opt/anaconda3/envs/fenics2018/lib/python3.7/site-packages/dolfin/function/jit.py", line 158, in compile_expression
expression = compile_class(cpp_data, mpi_comm=mpi_comm)
File "/Users/jaddoghman/opt/anaconda3/envs/fenics2018/lib/python3.7/site-packages/dolfin/jit/jit.py", line 170, in compile_class
raise RuntimeError("Unable to compile C++ code with dijitso")
RuntimeError: Unable to compile C++ code with dijitso

Is there any alternative?
Thanks!

@jaddoghman
Copy link
Author

For whom it may concern, the function log1p may be a good alternative for log. For instance,
log1p(x) = log(x + 1), so it suffices to consider log1p(x - 1).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant