gher-uliege / DIVAnd.jl

DIVAnd performs an n-dimensional variational analysis of arbitrarily located observations
GNU General Public License v2.0
70 stars 11 forks source link

partition of the cost function #49

Closed JianghuiDu closed 4 years ago

JianghuiDu commented 4 years ago

Is there a function to calculate the costs due to individual constrains, misfit, norm and advection etc. I assume it's buried in s but how to separate these constrains from it?

jmbeckers commented 4 years ago

You mean you want to know the final value of the different penalization terms for the final solution? I do not think we included that calculation yet.

JianghuiDu commented 4 years ago

Yes. That's what I mean. Would it be possible to divide the final H, R matrices into the components due to individual constrains? I thought the Hs and Rs were simply stacked but I'm not sure how to separate them.

jmbeckers commented 4 years ago

H and R and not changed, they are fixed by yourself. What you could calculate at the end is the misfit estimate (H x - y)' inv(R) (H x - y). With the DIVAnd_residual you can do that calculation yourself if you want. DIVAnd_residualobs works with real observations and DIVAnd_residual with all constraints merged.

jmbeckers commented 4 years ago

As far as I understand (also from the other discussion), what you would like is to have (H x - y)' inv(R) (H x - y) for real data and compare it to the misfit in the advection constraint.

DIVAnd_residualobs provides you with z= Hx-y for the real observations from where you easily have z'z/epsilon2.

In DIVAnd_residual , the first elements should be the same as in DIVAnd_residualobs (to check). So drop them and keep only the remaining values w. Since the advection constraint itself has no epsilon2 associated is implicitely is included in the residual. So simply calcule w'w and you should have the advection constraint misfit.

Untested on my side, so if it works out let us know.