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

Support initializing FLORIS with default values #1040

Open
wants to merge 4 commits into
base: develop
Choose a base branch
from

Conversation

rafmudaf
Copy link
Collaborator

Add an option to initialize FLORIS with default options for use as a library

When used as a library in third-party software, the calling-code typically must carry along a version of the FLORIS input files or require them as user input in order to initialize FLORIS. Often, the inputs are immediately changed by the calling-code such as in an optimization routine. This pattern leads to unnecessary complexity when integrating FLORIS in third-party software, and it could be avoided by providing an option to initialize FLORIS with default data with the understanding that much of it will be overwritten. See #1037.

This pull request modifies the initialization method of FlorisModel to load some set of default values when configuration="defaults". Additionally, a method to retrieve the default inputs as a Python dictionary is provided so that it can be retrieved and modified prior to initialization from the calling code. This is required, for example, if the calling code will change a value that isn't supported in FlorisModel.set(...) such as the wake model parameters. I've also added a documentation block in the Advanced Concepts section.

Design considerations

Another input file

I considered setting defaults through the attrs.field function, but decided against this since it would spread the set of default parameters over many source code files. Instead, they're all contained in one file, floris/default_inputs.py. It hurts my heart to add yet another input file to the FLORIS repository, and I apologize in advance to any future developer who has to update these 💔.

What are good defaults?

I chose the GCH example input file as the defaults. Is that reasonable?

Guessable

Is this confusing to users who use FLORIS directly rather than through another tool? If so, how can it be made more explicit?

@rafmudaf rafmudaf marked this pull request as ready for review January 6, 2025 19:39
@rafmudaf rafmudaf requested review from paulf81 and misi9170 January 6, 2025 19:39
Copy link
Collaborator

@paulf81 paulf81 left a comment

Choose a reason for hiding this comment

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

hi @rafmudaf this looks good to me. I checked the code changes and ran the tests. Thanks for adding additional documentation. Finally, just wanted to note I agree with GCH as default since that is also default in examples.

@rafmudaf
Copy link
Collaborator Author

TODO Add an option to print some or all default values

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.

2 participants