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

objective function for gradient #72

Open
zhen0z opened this issue Oct 17, 2024 · 2 comments
Open

objective function for gradient #72

zhen0z opened this issue Oct 17, 2024 · 2 comments

Comments

@zhen0z
Copy link

zhen0z commented Oct 17, 2024

Hi,

I'm trying to compute the gradient by defining a objective function like this:

function objective_function(model, state, Δt, step_i, forces)
    dif1 = JutulDarcy.compute_well_qoi(model, state, forces, :Producer1, SurfaceLiquidRateTarget) - obs_pro1[step_i]
    dif2 = JutulDarcy.compute_well_qoi(model, state, forces, :Producer2, SurfaceLiquidRateTarget) - obs_pro2[step_i]
    loss = sum(dif1.^2 + dif2.^2)
    return loss
end 

my observation data is:
obs_pro1= ws[:Producer1, :lrat]
obs_pro2= ws[:Producer2, :lrat]

However, the gradient computed based on this objective function seems not working quite well.

Therefore:
Is the function JutulDarcy.compute_well_qoi specifically designed for coarse and fine scale reservoir history matching?
Is it possible for me to access ws[:Producer1, :lrat] and ws[:Producer2, :lrat] through state in the objective function? ( I think JutulDarcy.compute_well_qoi is trying to complete this task, but it isn't giving me the right answer until now)

Thanks for your assistance!

Best regards,
Zhen

@moyner
Copy link
Member

moyner commented Oct 18, 2024

Hi,

The QOI code should be computing the point-wise data that ends up in ws[...] after some post-processing. I'm a bit surprised that the gradients are not accurate - could you share a small test case?

There is also a numerical gradient that uses the same interface - if the model is small, that is one way to verify if the gradients are accurate.

Best regards,
Olav

@zhen0z
Copy link
Author

zhen0z commented Oct 20, 2024 via email

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

No branches or pull requests

2 participants