-
Notifications
You must be signed in to change notification settings - Fork 160
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
Apply Diriclet boundary on the Cofunction RHS. #3754
base: master
Are you sure you want to change the base?
Conversation
for coeff in coefficients: | ||
if isinstance(coeff, Cofunction): | ||
# Apply the DirichletBC to the right hand side of the equation. | ||
dbc.apply(coeff) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This does not look right. The residual form might contain many cofunctions in function spaces different from the one of the solution. This should be done before calling the solver, and only on the Cofunction RHS. Also it is likely that you need dbc.zero() instead of dbc.apply(). Also see the comment I left in #3662
u = Function(space, name="u") | ||
problem = LinearVariationalProblem( | ||
inner(trial, test) * dx, b, u, | ||
DirichletBC(space, 0.0, "on_boundary")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The test should have non-homogeneous bcs
for coeff in coefficients: | ||
if isinstance(coeff, Cofunction): | ||
# Apply the DirichletBC to the right hand side of the equation. | ||
dbc.apply(coeff) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will have side effects on Cofunction
s in the problem definition.
u = Function(space, name="u")
b = Cofunction(space.dual(), name="b")
...
problem = LinearVariationalProblem(
inner(trial, test) * dx, b, u, DirichletBC(space, 1, "on_boundary"))
assert b in problem.F.coefficients() # passes
To address #3498? |
Yes. It is just a starting point. I still do not know how to fix it. |
Description