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

Fb asim 4672 missing emulsion models #247

Merged
merged 15 commits into from
May 20, 2022

Conversation

edersongrein
Copy link
Contributor

No description provided.

Ederson Augusto Grein and others added 7 commits May 11, 2022 15:12
…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
@codecov
Copy link

codecov bot commented May 18, 2022

Codecov Report

Merging #247 (0aaaa1d) into master (c56e8eb) will increase coverage by 0.00%.
The diff coverage is 100.00%.

@@           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;
Copy link
Member

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"
Copy link
Member

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.

Copy link
Contributor Author

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

Copy link
Member

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.

Copy link
Member

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!

Copy link
Member

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.

Copy link
Contributor Author

@edersongrein edersongrein May 20, 2022

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",
Copy link
Member

@prusse-martin prusse-martin May 19, 2022

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.

Copy link
Contributor Author

@edersongrein edersongrein May 20, 2022

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

Copy link
Contributor Author

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

Copy link
Member

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,
Copy link
Member

@prusse-martin prusse-martin May 19, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@@ -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);
Copy link
Member

@prusse-martin prusse-martin May 19, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@@ -115,6 +115,12 @@ class EmulsionRelativeViscosityModelType(Enum):
Mooney1951a = "mooney1951a"
Mooney1951b = "mooney1951b"
FromPlugin = "from_plugin"
Copy link
Member

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
@edersongrein edersongrein merged commit ee2fb88 into master May 20, 2022
@edersongrein edersongrein deleted the fb-ASIM-4672-missing-emulsion-models branch May 20, 2022 17:34
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

Successfully merging this pull request may close these issues.

3 participants