- marked as blocker
Python 'assemble' function is missing an argument for nonlinear problems
The Python assembler
has the signature
def assemble(form,
tensor=None,
mesh=None,
coefficients=None,
function_spaces=None,
cell_domains=None,
exterior_facet_domains=None,
interior_facet_domains=None,
reset_sparsity=True,
add_values=False,
finalize_tensor=True,
keep_diagonal=False,
backend=None,
form_compiler_parameters=None,
bcs=None,
symmetric_mod=None):
which is missing an argument to pass a vector x
as is required inside a Newton loop.
Options are:
- Add an extra argument, as with assemble_system; or
- Remove the bc argument and let users apply the bcs (is there are compelling JIT-related issue why bcs should be applied inside
assemble
?
Comments (13)
-
reporter -
It looks like the
bcs
andsymmetric_mode
areleft over from the work of Joacim Haga wrt symmetric assemble. The commit message of 6c62604fed8b5274d7b5a2d1b7a683a2ffe54bb4 says that one can do:A, An = symmetric_assemble(a, bcs=bc) b = assemble(L, bcs=bc, symmetric_mod=An) solve(A, x, b)
With
symetric_assemble
out of the code we should be able to just remove this.It makes sense to have x0 in the
assemble_system
function but I am not sure it makes sense to introduce that toassemble
as it only (more or less) mirrors the C++ version, which lacks functionality to pass an additional vector. -
reporter -
reporter - changed version to dev
-
reporter - changed milestone to 1.3
- removed version
-
reporter @johanhake Sounds good - let's remove bcs, and symmetric flagsfrom
assemble
, and addx0
tosystem_assembler
. -
@garth.wells ok, will do. As this might potentially break some user code I suggest we add a deprecation message for the
bcs
arg.Btw
x0
is already present inassemble_system
. -
reporter If we leave
bcs
, even as deprecated, should we add anx0
argument? -
There should not be any point to do that as the
Assembler::assemble
, which the pythonassemble
use does not provide any interface for thex0
argument.bcs
is now just used for convenience. -
reporter But if we let the Python
assemble
interface apply bcs, we should probably pass inx0
too. -
Not sure how that could be done?
Assembler::assemble
does (naturally) not supportx0
and that is what the pythonassemble
use. Whenbcs
we introduced it was used to assemble symmetricrhs
together with thesymmetric_mod
argument, which was used to pass aMatrix
(not a flag), see syntax above.Now
bcs
can only be used as convenience. In my view there are no compelling reasons why that should be provided, as it diverge the C++ and Python interface. But some users might rely on it in their code so therefore I suggest we keep it with a deprecation message. There is no demo or test using it. -
- changed status to resolved
Fixed in: b13d8b6d6945524fcee5ae1db689d2bc6b63ef27
-
reporter - removed milestone
Removing milestone: 1.3 (automated comment)
- Log in to comment
Marker is blocker - to be fixed before release.