-
Notifications
You must be signed in to change notification settings - Fork 2
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
Fb asim 4672 missing emulsion models #247
Conversation
…g-emulsion-models # Conflicts: # docs/source/alfacase_definitions/PhysicsDescription.txt # src/alfasim_sdk/_internal/alfacase/alfacase_to_case.py # src/alfasim_sdk/_internal/alfacase/case_description.py # src/alfasim_sdk/_internal/alfacase/schema.py # tests/alfacase/test_generate_case_description_docstring/test_generate_case_description_docstring_PhysicsDescription_.txt # tests/alfacase/test_generate_case_schema/test_generate_schema_for_all_cases.txt
for more information, see https://pre-commit.ci
Codecov Report
@@ Coverage Diff @@
## master #247 +/- ##
=======================================
Coverage 99.95% 99.95%
=======================================
Files 41 41
Lines 4455 4457 +2
=======================================
+ Hits 4453 4455 +2
Misses 2 2 |
|
||
* Add emulsion constant inversion point model; | ||
|
||
* Add emulsion relative viscosity tuning factor; |
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.
Nice!
I forgot to ask you to add this entry in the previous PR.
@@ -115,6 +115,12 @@ class EmulsionRelativeViscosityModelType(Enum): | |||
Mooney1951a = "mooney1951a" | |||
Mooney1951b = "mooney1951b" | |||
FromPlugin = "from_plugin" |
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 prefer to put FromPlugin
option as the last one.
But I am not sure if it will break something with the Enum
.
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 would require some treatment when loading old cases. I don't know if it is worthy to do such modification
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.
We save the "string" not some auto index or some thing like that.
That being said, adding new values (any where in the enum) will not affect loading old cases.
Changing values (the strings) or removing the entries will affect old cases using the old values.
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.
Nice! Thanks for the explanation @prusse-martin!
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.
But I also prefer FromPlugin
kind placed apart from the others, like last or first.
Having it as first has the benefit of getting out of change sets, I will put as a possible problem with that that it will be the default value, but on case description no default is assumed for enums.
That will probably be an issue with alfasim, where every thing has defaults and possibly some enum use implicit defaults (the "first value") but that can be fixed without backward compatibility effects and easily detectable checking the status.
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.
You are right @prusse-martin.
- Replace plugin entry
@@ -1785,6 +1785,8 @@ def calculate_relative_emulsion_viscosity( | |||
mu_disp: "double", | |||
mu_cont: "double", | |||
alpha_disp_in_layer: "double", | |||
T: "double", |
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 that changing hook signatures will cause incompatibility with existing plugins.
And they will need to be updated (source code changed, not just recompiled).
Changelog entry about the breaking change?
Or we could go with creating an alternative version for the hook like calculate_relative_emulsion_viscosity_per_temperature
or some thing else in those lines (does T
stands for temperature?).
I also think you should update the docstring to properly document the signature, I think that is what goes to the online documentation.
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 will break the existing plugins indeed and I forgot to update changelog and the docstring.
- Update changelog and docstring
Or we could go with creating an alternative version for the hook like calculate_relative_emulsion_viscosity_per_temperature or some thing else in those lines (does T stands for temperature?
Yes, T is for temperature and creating another hook is not viable. Fortunately as far as I know there is nobody using this plugin, so this change probably won't bother anyone
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.
In fact I have updated the changelog. It was only the docstring that was missed
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.
... creating another hook is not viable ... there is nobody using this plugin...
OK... I will let it pass for now =P
@return An #error_code value. | ||
*/ | ||
DLL_EXPORT int get_relative_emulsion_viscosity( | ||
void* ctx, | ||
double* out, | ||
double mu_disp, | ||
double mu_cont, | ||
double alpha_disp_in_layer | ||
double alpha_disp_in_layer, |
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.
Related to {{comment on hook_specs.py}}.
@@ -90,7 +90,7 @@ typedef int (*get_tracer_partition_coefficient_func)(void* ctx, double* out, voi | |||
typedef int (*get_plugin_input_data_multiplereference_selected_size_func)(void* ctx, int* indexes_size, const char* plugin_id, const char* var_name); | |||
typedef int (*get_input_variable_func)(void* ctx, double* out, const char* var_name, int phase_id); | |||
typedef int (*get_ucm_fluid_geometrical_properties_func)(void* ctx, double* S_w, double* S_i, double* H, double alpha_G, double D); | |||
typedef int (*get_relative_emulsion_viscosity_func)(void* ctx, double* out, double mu_disp, double mu_cont, double alpha_disp_in_layer, int disp_field_id, int cont_field_id); | |||
typedef int (*get_relative_emulsion_viscosity_func)(void* ctx, double* out, double mu_disp, double mu_cont, double alpha_disp_in_layer, double T, bool water_in_oil); |
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.
Related to {{comment on hook_specs.py}}.
@@ -115,6 +115,12 @@ class EmulsionRelativeViscosityModelType(Enum): | |||
Mooney1951a = "mooney1951a" | |||
Mooney1951b = "mooney1951b" | |||
FromPlugin = "from_plugin" |
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.
But I also prefer FromPlugin
kind placed apart from the others, like last or first.
Having it as first has the benefit of getting out of change sets, I will put as a possible problem with that that it will be the default value, but on case description no default is assumed for enums.
That will probably be an issue with alfasim, where every thing has defaults and possibly some enum use implicit defaults (the "first value") but that can be fixed without backward compatibility effects and easily detectable checking the status.
Enum entry replaced Emulsion model docstring updated ASIM-4672
No description provided.