-
Notifications
You must be signed in to change notification settings - Fork 104
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
Use the same enum for inversion type for both std_enkf and ies_enkf #2469
Conversation
test this please |
603af0f
to
e34f7dc
Compare
test this please |
e34f7dc
to
c9a79f2
Compare
test ert please |
Codecov Report
@@ Coverage Diff @@
## main #2469 +/- ##
==========================================
- Coverage 64.42% 60.51% -3.91%
==========================================
Files 645 335 -310
Lines 54302 37258 -17044
Branches 4537 4545 +8
==========================================
- Hits 34983 22548 -12435
+ Misses 17938 13325 -4613
- Partials 1381 1385 +4
Continue to review full report at Codecov.
|
c9a79f2
to
22f864f
Compare
test ert please |
@@ -96,10 +98,56 @@ static UTIL_SAFE_CAST_FUNCTION_CONST(std_enkf_data, STD_ENKF_TYPE_ID) | |||
return data->truncation; | |||
} | |||
|
|||
/* | |||
The std_enkf module originally used two boolean flags use_EE and use_GE to |
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.
For us newbies - what are EE
and GE
?
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.
Hehe - I am glad you that ask that question .... frankly don't know fully myself either.
It is about choosing the algorithm for (lowrank)inversion of the covariance matrix - which in general do not have. The use_EE
flag is whether we should use the approximation C = EE^T
. If the use_EE
flag is false the (pseudo)inversion is done using the S matrix - without ever constructing or using E
.
The difference between use_GE
is a formulation where E
is used - but not the covariance estimator EE^T
.
Would have been healthy to go properly through this again.
The purpose of this PR is alignment and code reuse between the old std_enkf
implementation and the newer ies_enkf
.
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.
That makes a little bit of sense, but I am not yet that comfortable with the math. Thanks!
I think what we want is to document the different types in ies_inversion_type
and link them to literature.
I have created an issue that I've called Questions for Geir Evensen and have now added this question as well.
libres/lib/analysis/std_enkf.cpp
Outdated
@@ -75,8 +76,9 @@ struct std_enkf_data_struct { | |||
double truncation; // Controlled by config key: ENKF_TRUNCATION_KEY | |||
int subspace_dimension; // Controlled by config key: ENKF_NCOMP_KEY (-1: use Truncation instead) | |||
long option_flags; | |||
bool use_EE; | |||
bool use_GE; | |||
bool __use_EE; |
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.
Perhaps add a comment to here that states that both __use_EE
and __use_GE
are deprecated and shall be removed.
I don't have a clear overview as to what has to be done in order for us to be able to remove them.
Is this something that can be done as part of the ies-refactoring you are doing now, or do we have to make bigger changes?
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.
Perhaps add a comment to here that states that both __use_EE and __use_GE are deprecated and shall be removed.
I will.
I don't have a clear overview as to what has to be done in order for us to be able to remove them.
The only thing which still keeps them around is the users current ability to set them in the config file - i.e. this works:
ANALYSIS_SET STD_ENKF USE_EE True
ANALYSIS_SET STD_ENKF USE_GE False
I assume the actual use of such settings is very limited; so after some brief investigation (log peeking?) I guess they can be removed.
Is this something that can be done as part of the ies-refactoring you are doing now
Absolutely - as explained it is more of a political than a technical question.
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.
Good stuff - I've created and issue here: #2534
return name_recognized; | ||
} | ||
} | ||
|
||
bool std_enkf_set_string(void *arg, const char *var_name, const char *value) { |
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.
Could we use std::string
for var_name
and value
instead of char *
?
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.
Ah, I think we can't because it is used as:
.set_string = std_enkf_set_string,
Is that right?
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 have not looked into it - but I think that would be a quite large change. The point is that the std_enkf_set_string
function is called through a function pointer embedded in: analysis_module - so those changes would ripple a bit here and there. But certainly I agree with the idea, and I am happy to investigate it in a separate PR
libres/tests/analysis/std_enkf.cpp
Outdated
@@ -0,0 +1,39 @@ | |||
#include <catch2/catch.hpp> | |||
|
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.
Consider changing the name of the test-file to test_std_enkf.cpp
.
We are basically following similar naming conventions as used in pytest
(not always perfectly though).
Whether or not this is a good idea can be discussed, but it's nice if we can be somewhat consistent I think.
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.
Will do
libres/tests/analysis/std_enkf.cpp
Outdated
|
||
#include <ert/analysis/std_enkf.hpp> | ||
|
||
TEST_CASE("std_enkf", "[analysis]") { |
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 think this is a nice candidate to use the GIVEN - WHEN - THEN pattern in catch2
as shown here:
https://github.com/catchorg/Catch2/blob/v2.x/docs/tutorial.md#bdd-style
It's a bit of a pain to get used to at first, but I think it's quite nice.
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 think this is a nice candidate to use the GIVEN - WHEN - THEN pattern in catch2 as shown here:
OK - I'll take the pill. Thank you for the pointer.
1af43b5
to
d2477a0
Compare
OK @dafeda - thank you for the review; I have tried to address all your comments. |
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.
LGTM 👍
d2477a0
to
17d72ae
Compare
That is true, just note that we need to check why it fails before we merge to know that it is not related. You should hopefully have access to check yourself soon. |
4a2f0ef
to
929f896
Compare
929f896
to
9550a25
Compare
Part of: #2412
With this PR some of the configuration for the
std_enkf
andies_enkf
modules are harmonized.