Open ErikM23 opened 4 years ago
Hi!
Incidentally, we'd be very happy to accept modifications to the current PCD implementation that better treat boundary conditions. I think the best unified explanation and treatment of how they should be implemented is in chapter 3 of Jan Blechta's thesis
How to transfer the boundary conditions from my program to pcd1.py (here, pcd1.py should be modified version of the origin pcd.py)
Your approach of sending them through context.appctx
is reasonable.
How to apply BC's (specially, how to apply BC's to PETCs vectors "a, b" in the function "apply(pc, x, y)" - when I use something like " self.bcs.apply(a)" it doesnt work).
You need to turn the PETSc Vec into a function, which necessitates some copying. If you have the space V
around then:
tmp = Function(V)
with tmp.dat.vec_wo as v:
x.copy(v)
# Now tmp contains the value from `x`
bc.apply(tmp)
with tmp.dat.vec_ro as v:
v.copy(x)
# Now x has the bcs applied.
Is it possible to apply DirichletBC to matrix and get '0' on the diagonal instead of '1' ?
This is not presently supported, but it would be easy. Right now we always set the diagonal to 1 in assemble
. We need a way of communicating what the value should be through the interface. Probably the best way is for DirichletBC
to gain an optional keyword argument that is used to provide the value that is put on the diagonal.
Dear Lawrence,
Thank you for the answer and hints.
Maybe one more question:
I am not sure where exactly in assemble
I can set the diagonal to 0 instead of 1.
Maybe one more question: I am not sure where exactly in
assemble
I can set the diagonal to 0 instead of 1.
For example here: https://github.com/firedrakeproject/firedrake/blob/master/firedrake/assemble.py#L447
You would provide the extra keyword argument diag_val=some_value
Dear all,
I am new in firedrake and I would like to ask you about applying of boundary conditions in PCD preconditioner pcd.py
I have got a 3 questions:
How to transfer the boundary conditions from my program to pcd1.py (here, pcd1.py should be modified version of the origin pcd.py)
How to apply BC's (specially, how to apply BC's to PETCs vectors "a, b" in the function "apply(pc, x, y)" - when I use something like " self.bcs.apply(a)" it doesnt work).
Is it possible to apply DirichletBC to matrix and get '0' on the diagonal instead of '1' ?
Thank you in advance.