idaholab / moose

Multiphysics Object Oriented Simulation Environment
https://www.mooseframework.org
GNU Lesser General Public License v2.1
1.77k stars 1.05k forks source link

Eigen kernel residual tagging is expected to include the eigenvalue #28984

Open YaqiWang opened 2 weeks ago

YaqiWang commented 2 weeks ago

Motivation

I need to evaluate residual into a tagged vector for an eigenvalue problem, which include contribution of non-eigen and eigen kernels. The global residual can be represented as Ax - Bx / k where x is the solution, k is the eigenvalue evaluated as a functional of x, which we denote it as |Bx|. A is the operation of non-eigen kernels and B is for eigen kernels. Thus, we would expect in a tagged residual vector, we have the 1/k factor in the eigen kernel contributions.

However, in our current implementation, Ax and Bx are always evaluated separately, when we do need the global residual, we combine the two vectors into one with |Bx|. For eigen kernel tagging, we do not have the factor included. Because in a tagging vector, we do not and do not want to have two vectors, we need to apply the factor inside TaggingInterface. One caveat in this case is that |Bx| must be made available during kernel evaluation, which is indeed the case when |Bx| is a postprocessor on linear, but not the case when |Bx| is for example the L2 norm of Bx.

Design

As described in the motivation, we need to improve TaggingInterface to handle the tagging differently for eigen kernels. We will need to detect whether a kernel is eigen kernel or not, if it is we do not apply the factor when it is tagged to the system Bx vector, otherwise apply the factor.

Impact

A capability has not been supported, thus will not create any impact to current applications.

lindsayad commented 2 weeks ago

I need to evaluate residual into a tagged vector

Why do you need to do this? The Newton residual casting of a generalized eigenvalue problem is just one solution algorithm. I think one could very reasonably argue the opposite of what you're arguing and say that it's weird to apply the eigenvalue factor to some vector tags and not to the eigen tag. It's inconsistent

lindsayad commented 2 weeks ago

We do not call these tags "residual" tags. We call them "vector" tags. They will not always represent a residual

YaqiWang commented 2 weeks ago

Yes, in general it is a vector tag. But here I am only considering using those tagged vectors as an output of residual evaluation, so I call them residual vectors. Yes, residual is only used by the Newton algorithm possibly in SLEPc (and in a Richardson iterative solver in Griffin), however, its definition should be the left minus the right with eigenvalue scaling. Residual is used by Griffin for evaluating reactivity with perturbation.

lindsayad commented 2 weeks ago

Yes, residual is only used by the Newton algorithm possibly in SLEPc (and in a Richardson iterative solver in Griffin), however, its definition should be the left minus the right with eigenvalue scaling.

That is the definition of the nonlinear residual for a Newton eigen problem, I agree. However, it does not have to be the definition of a given vector tag. An eigen tag has always meant the (Bx) vector. If the eigen tag has been applied to a kernel, I don't see a strong argument yet to treat any other tags applied to the kernel differently

lindsayad commented 2 weeks ago

In Griffin, can't you retrieve an (Ax) vector and (Bx) vector and perform the summation with coefficient scaling yourself?

YaqiWang commented 2 weeks ago

In Griffin, can't you retrieve an (Ax) vector and (Bx) vector and perform the summation with coefficient scaling yourself?

No because not all kernels tag to Ax or Bx vectors. To save memory, we only create one vector for tagging, which needs to have both non-eigen and eigen kernel contributions. I updated my PR, I think it looks better.