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

Factor the riesz map out into a separate object. #3662

Open
wants to merge 18 commits into
base: master
Choose a base branch
from
Open

Conversation

dham
Copy link
Member

@dham dham commented Jul 1, 2024

Description

@dham dham force-pushed the dham/RieszMap branch from 439e791 to a18ef57 Compare July 8, 2024 15:31
@dham dham marked this pull request as ready for review July 8, 2024 16:36
o.dat.data[:] = c.dat.data[:]
else:
solve, rhs, soln = self._solver
rhs.assign(value)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

check whether we need to explicitly zero BCs here.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Aparently we need to do that, #3498

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, so I think what that issue actually says is that solve is bugged. I think I should default the solver here to restrict=True (because that's the nice modern way of doing it) and anything else should be fixed in a separate fix to solve.

nbouziani
nbouziani previously approved these changes Jul 10, 2024
Copy link
Contributor

@nbouziani nbouziani left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good to me.

Comment on lines +48 to +52
def arguments(self):
return (self,)

def coefficients(self):
return ()
Copy link
Contributor

@nbouziani nbouziani Jul 10, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These two methods are part of the BaseForm interface. I suspect this is needed because it conveniently allows the use of arguments as if they were base forms in a few places in pyadjoint. I think this suggests that, in the long term, the right thing to do is probably to have ufl.Argument as BaseForm. It mathematically makes sense as arguments map V -> V, i.e. V x V* - > R.

Copy link

github-actions bot commented Dec 17, 2024

TestsPassed ✅Skipped ⏭️Failed ❌
Firedrake complex8137 ran6663 passed1474 skipped0 failed

Copy link

github-actions bot commented Dec 17, 2024

TestsPassed ✅Skipped ⏭️Failed ❌
Firedrake real0 ran0 passed0 skipped0 failed

1 similar comment
Copy link

TestsPassed ✅Skipped ⏭️Failed ❌
Firedrake real0 ran0 passed0 skipped0 failed

LinearVariationalProblem, Function, Cofunction)
rhs = Cofunction(self._function_space.dual())
soln = Function(self._function_space)
lvp = LinearVariationalProblem(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Given that the inner product form won't ever change, I think the LVP should have constant_jacobian=True to avoid refactoring every time.

@JHopeCollins
Copy link
Member

Is there enough information available at setup to cache the RieszMap object? Probably on the function space itself.

That way if the same riesz map is needed in different places where it would be cumbersome to share the RieszMap (maps in different libraries or in both library and user code) then we still get the advantage of reusing the solver and factorisations.

lvp = LinearVariationalProblem(
self._inner_product, rhs, soln, bcs=self._bcs, restrict=True,
form_compiler_parameters=self._form_compiler_parameters)
solver = LinearVariationalSolver(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we pass an optional options_prefix through to the LVS for command line options?

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.

4 participants