Skip to content

Conversation

@RRiva
Copy link
Contributor

@RRiva RRiva commented Oct 3, 2025

Added run_solver flag to sample_flow_at_points and sample_ti_at_points

The functions sample_flow_at_points and sample_ti_at_points are fine when used independently. However, if the user needs both the wind speed and TI field for the same grid, then the solver is called twice. I've added a flag to prevent that.

Related issue

None.

Impacted areas of the software

  • FlorisModel
  • Core

Additional supporting information

Test results, if applicable

@misi9170
Copy link
Collaborator

Hi @RRiva ,

I think this makes sense, but it seems like we'll need some sort of error handling for the case where a user sets run_solver = False but a solve has not already happened? I think that should be possible, and I'm happy to put something in and write tests for it, but just wanted to see if you'd already thought of this.

@RRiva
Copy link
Contributor Author

RRiva commented Nov 27, 2025

Hi @misi9170, thanks for the feedback, I'll add some error handling 🙂

@misi9170
Copy link
Collaborator

misi9170 commented Nov 29, 2025

Hi @misi9170, thanks for the feedback, I'll add some error handling 🙂

Thanks @RRiva ! In case you hadn't already found it, I think you should be able to get most of what you need with something like if self.core.state is not State.USED: (where self is the FlorisModel), although you might also have to check that the output variables are the correct shape to be consistent with a solve_for_points-type solve, since self.core.state will also be State.USED under a normal run().

@misi9170 misi9170 added the enhancement An improvement of an existing feature label Dec 1, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement An improvement of an existing feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants