-
Notifications
You must be signed in to change notification settings - Fork 172
RieszMap
fixes/suggestions
#4568
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
base: main
Are you sure you want to change the base?
RieszMap
fixes/suggestions
#4568
Conversation
ed5213a
to
c04f182
Compare
else: | ||
solve, rhs, soln = self._solver | ||
rhs.assign(value) | ||
soln.zero() |
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.
Doesn't PETSc always use a zero initial guess unless you pass -ksp_initial_guess_nonzero
?
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 might be ignored due to #4142. I'd need to check for this use case, but I think it's still safer to zero here.
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.
LinearSolver
inherits from NonlinearVariationalSolver
, which means that we are running a SNES, which gives a different behaivor from the plain KSP. Currently -ksp_initial_guess_nonzero False
zeros the update to whatever is prescribed as the initial guess.
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.
Setting the initial guess explicitly outside PETSc is the only way with SNES.
@pbrubeck I think this looks fine but could you cast a quick eye over it please? |
else: | ||
bcs = tuple(bcs) | ||
if len(bcs) > 0 and inner_product == "l2": | ||
raise ValueError("Cannot supply boundary conditions with an l2 Riesz map") |
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.
I'm curious here. Does this lead to the wrong results in optimization?
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.
Does "l2" here means that we are imposing the wrong inner-product between two primal objects, or does it mean that we are pairing a primal with a dual?
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.
I'm curious here. Does this lead to the wrong results in optimization?
For
Does "l2" here means that we are imposing the wrong inner-product between two primal objects, or does it mean that we are pairing a primal with a dual?
Yes, it's the basis dependent map defined by dof assignment. I'm not sure if there's a case to remove this now (Firedrake code at least doesn't seem to use it much?) but maybe not for this PR?
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.
I'm not sure if there's a case to remove this now (Firedrake code at least doesn't seem to use it much?) but maybe not for this PR?
This close to a major release I'd say lets keep this PR to fixes, then we can think about API changes after.
Fixes based on reading the code.
Minor fixes