I am using fenics version 2019.2.0.dev0. Yes, I am able to finally install it, after lots of efforts! Some of my queries might be trivial to you, but it would be good, if I can resolve as I go along the way to read and practice the codes in the book.
I am using Spyder IDE and Python 3.8. My apology beforehand, if the queries are too basic.
1.) How to resolve the indentation problem in this code?
This works:
def u0_boundary(x, on_boundary):
tol = 1E-15
return abs(x[0]) < tol or \
abs(x[1])< tol or \
abs(x[0] - 1) < tol or \
abs(x[1] - 1) < tol
This does not work:
def u0_boundary(x, on_boundary):
return
for n in range(2):
tol = 1E-15
abs(x[n]) < tol or \
abs(x[n] - 1) < tol
2.) What would be the Matlab equivalent of clc, clear in a script
I searched online, but the few tips provided are roundabouts.
3.) It seems that the
interactive()
is deprecated in dolfin version 2019.2.0.dev0. What would be the equivalent command? What I read, it seems to be a good function for preliminary observation.
4.) Do I need to set the solver parameters, like linear algebra backend, linear solver etc. before I call the solve()? I am asking it, as I do not see the difference, if I call before and after the solve()
5.) It seems that the following function has no effect whether the parameter is True or False. What is the usefulness of it? It does not print anything.
info(parameters, True)
or
info(parameters, False)
6.) How to provide a colorbar in a plot function? In matlab, we can use plot(matrix), colorbar
7.) The following two linear algebra backends do not work
MTL4, PETSc
8.) How to print the solver parameters?
solve(a == L, u, bc, solver_parameters = {âlinear_solverâ: âcgâ, âpreconditionerâ: âiluâ})
print(solver_parameters[âlinear_solverâ])
The print gives me error
NameError: name âsolver_parametersâ is not defined
9.) It shows nothing command prompt. I used the canonical Poisson equation on a unit square problem in book or tutorial.
set_log_level(LogLevel.PROGRESS)
set_log_level(LogLevel.DEBUG)
For this I used the program d3_p2D.py of the fenics book and can be found in this URL
https://fenicsproject.org/pub/book/chapters/01/stationary/poisson/
10.) The variable explorer in Spyder looks weird, in comparison to what I have experienced in Matlab. All the variables in a fenics program are not listed there. I have seen some additional variables. What does the variable explorer mean in Spyder?