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

Add missing automatic_{profile,trend}_frequency parameter #252

Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions docs/source/alfacase/alfacase.example.rst
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,8 @@ and ``profiles``.
curve_names:
- oil mass flow rate

automatic_trend_frequency: true

trend_frequency:
value: 0.1
unit: s
Expand All @@ -283,6 +285,8 @@ and ``profiles``.
curve_names:
- pressure

automatic_profile_frequency: true

profile_frequency:
value: 0.1
unit: s
Expand Down Expand Up @@ -332,6 +336,8 @@ and imported by the application.
curve_names:
- oil mass flow rate

automatic_trend_frequency: true

trend_frequency:
value: 0.1
unit: s
Expand All @@ -342,6 +348,8 @@ and imported by the application.
curve_names:
- pressure

automatic_profile_frequency: true

profile_frequency:
value: 0.1
unit: s
Expand Down
4 changes: 4 additions & 0 deletions docs/source/alfacase/case_description.example.rst
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,7 @@ and ``profiles``.
)
]
),
automatic_trend_frequency=True,
trend_frequency=Scalar(0.1, "s"),
profiles=[
ProfileOutputDescription(
Expand All @@ -289,6 +290,7 @@ and ``profiles``.
location=OutputAttachmentLocation.Main,
)
],
automatic_profile_frequency=True,
profile_frequency=Scalar(0.1, "s"),
),
)
Expand Down Expand Up @@ -392,6 +394,7 @@ Description with a project configuration and being converted to a ``.alfacase``
)
]
),
automatic_trend_frequency=True,
trend_frequency=Scalar(0.1, "s"),
profiles=[
ProfileOutputDescription(
Expand All @@ -400,6 +403,7 @@ Description with a project configuration and being converted to a ``.alfacase``
location=OutputAttachmentLocation.Main,
)
],
automatic_profile_frequency=True,
profile_frequency=Scalar(0.1, "s"),
),
)
Expand Down
2 changes: 2 additions & 0 deletions src/alfasim_sdk/_internal/alfacase/alfacase_to_case.py
Original file line number Diff line number Diff line change
Expand Up @@ -1592,8 +1592,10 @@ def load_case_output_description(
) -> case_description.CaseOutputDescription:
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Should I add a unit test for this function somewhere?

Copy link
Member

Choose a reason for hiding this comment

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

I believe it is already tested since you just added those new parameters to the filled_case_description.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You'd think that, but the tests pass regardless of the two fields added to this dict.

Copy link
Member

Choose a reason for hiding this comment

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

I would say "don't add test for this" because I think all explicit loaders should die =) #216

alfacase_to_case_description = {
"profiles": load_profile_output_description,
"automatic_profile_frequency": load_value,
"profile_frequency": get_scalar_loader(from_unit="s"),
"trends": load_trends_output_description,
"automatic_trend_frequency": load_value,
"trend_frequency": get_scalar_loader(from_unit="s"),
}
case_values = to_case_values(document, alfacase_to_case_description)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -441,8 +441,10 @@
)
CASE_OUTPUT_DESCRIPTION = case_description.CaseOutputDescription(
trends=TRENDS_OUTPUT_DESCRIPTION,
automatic_trend_frequency=True,
Copy link
Member

Choose a reason for hiding this comment

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

What is the idea of these parameters? If they are True, the trend_frequency and profile_frequency are ignored?

Copy link
Contributor Author

@cauebs cauebs Jun 17, 2022

Choose a reason for hiding this comment

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

They already exist, but are missing in some places. If I understand them correctly, it's like what you said, automatic_... being True means the property will be derived automatically from some defaults.

From the application's tooltips:

Uses an automatically defined frequency to save profile output data.

The frequency used is the highest value between: default profile frequency, maximum timestep configured, and an estimate based on simulation time (1/10 of total time).

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!

Copy link
Member

Choose a reason for hiding this comment

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

It is also possible that the "case description"-"alfacase" round trip is saving the unused values. I remember to add that option with the multi inputs to test transient and constant in one go (but disabled on production).

But as he pointed out "... used is the highest value between: default profile frequency, maximum timestep configured, and an estimate ..."

trend_frequency=Scalar(0.1, "s"),
profiles=[PROFILE_OUTPUT_DESCRIPTION],
automatic_profile_frequency=True,
profile_frequency=Scalar(0.1, "s"),
)
CASING_DESCRIPTION = case_description.CasingDescription(
Expand Down