Skip to content

Commit

Permalink
Merge pull request #346 from ESSS/fb-ASIM-5231-allow-compositional-mo…
Browse files Browse the repository at this point in the history
…del-optimiz-choice

[ASIM-5231] Add field enable_fast_compositional to NumericalOptionsDescription
  • Loading branch information
ro-oliveira95 authored Dec 28, 2023
2 parents 7d5e57c + 17b1807 commit dd67729
Show file tree
Hide file tree
Showing 8 changed files with 11 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ CHANGELOG
===================

* Added support for user plugins have multiple python source files, the "user plugin entry point" logic is unchanged, but extra python code could be placed in `alfasim_sdk_plugins.<plugins_id>` and be imported at runtime;
* Added ``enable_fast_compositional`` attribute to ``NumericalOptionsDescription``.


0.18.0 (2023-10-13)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
caching_rtol: float = 0.01
caching_atol: float = 0.0001
always_repeat_timestep: bool = False
enable_fast_compositional: bool = True

.. tab:: Schema

Expand All @@ -36,3 +37,4 @@
caching_rtol: number # optional
caching_atol: number # optional
always_repeat_timestep: boolean # optional
enable_fast_compositional: boolean # optional
1 change: 1 addition & 0 deletions src/alfasim_sdk/_internal/alfacase/alfacase_to_case.py
Original file line number Diff line number Diff line change
Expand Up @@ -1930,6 +1930,7 @@ def load_numerical_options_description(document: DescriptionDocument) -> case_de
'caching_rtol': load_value,
'caching_atol': load_value,
'always_repeat_timestep': load_value,
'enable_fast_compositional': load_value
}
case_values = to_case_values(document, alfacase_to_case_description)
item_description = case_description.NumericalOptionsDescription(**case_values)
Expand Down
1 change: 1 addition & 0 deletions src/alfasim_sdk/_internal/alfacase/case_description.py
Original file line number Diff line number Diff line change
Expand Up @@ -3404,6 +3404,7 @@ class NumericalOptionsDescription:
caching_rtol: float = attr.ib(default=1e-2)
caching_atol: float = attr.ib(default=1e-4)
always_repeat_timestep: bool = attr.ib(default=False, validator=instance_of(bool))
enable_fast_compositional: bool = attr.ib(default=True, validator=instance_of(bool))


@attr.s()
Expand Down
3 changes: 2 additions & 1 deletion src/alfasim_sdk/_internal/alfacase/schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -377,6 +377,7 @@
Optional("caching_rtol"): Float(),
Optional("caching_atol"): Float(),
Optional("always_repeat_timestep"): Bool(),
Optional("enable_fast_compositional"): Bool(),
}
)
open_hole_description_schema = Map(
Expand Down Expand Up @@ -1187,4 +1188,4 @@
Optional("walls"): Seq(wall_description_schema),
}
)
# [[[end]]] (checksum: 03e5182a9b30c3759affd8fd4852c587)
# [[[end]]] (checksum: 1e7e310e1ec3e70295e333ccdf55e26e)
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
caching_rtol: float = 0.01
caching_atol: float = 0.0001
always_repeat_timestep: bool = False
enable_fast_compositional: bool = True

.. tab:: Schema

Expand All @@ -36,3 +37,4 @@
caching_rtol: number # optional
caching_atol: number # optional
always_repeat_timestep: boolean # optional
enable_fast_compositional: boolean # optional
Original file line number Diff line number Diff line change
Expand Up @@ -387,6 +387,7 @@ numerical_options_description_schema = Map(
Optional("caching_rtol"): Float(),
Optional("caching_atol"): Float(),
Optional("always_repeat_timestep"): Bool(),
Optional("enable_fast_compositional"): Bool(),
}
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -707,6 +707,7 @@
caching_rtol=3e-3,
caching_atol=4e-4,
always_repeat_timestep=False,
enable_fast_compositional=True,
)
TRACER_MODEL_CONSTANT_COEFFICIENTS_DESCRIPTION = (
case_description.TracerModelConstantCoefficientsDescription(
Expand Down

0 comments on commit dd67729

Please sign in to comment.