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

Apply Diriclet boundary on the Cofunction RHS. #3754

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Ig-dolci
Copy link
Contributor

@Ig-dolci Ig-dolci commented Sep 2, 2024

Description

for coeff in coefficients:
if isinstance(coeff, Cofunction):
# Apply the DirichletBC to the right hand side of the equation.
dbc.apply(coeff)
Copy link
Contributor

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"))
Copy link
Contributor

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)
Copy link
Contributor

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 Cofunctions 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

@jrmaddison
Copy link
Contributor

To address #3498?

@Ig-dolci
Copy link
Contributor Author

Ig-dolci commented Sep 3, 2024

To address #3498?

Yes. It is just a starting point. I still do not know how to fix it.

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

Successfully merging this pull request may close these issues.

3 participants