Skip to content

Fitch wind farm scheme bug fix: axial induction factor#2242

Merged
weiwangncar merged 4 commits intowrf-model:developfrom
FraunhoferIWES:dev_AIF_r471
Feb 13, 2026
Merged

Fitch wind farm scheme bug fix: axial induction factor#2242
weiwangncar merged 4 commits intowrf-model:developfrom
FraunhoferIWES:dev_AIF_r471

Conversation

@SengersB
Copy link

@SengersB SengersB commented Aug 29, 2025

Bug fix and very small dev in Fitch wind farm parameterization

TYPE: bug fix

KEYWORDS: fitch, wind farm parameterization, turbine, wind farm, wind energy

SOURCE: Balthazar Sengers, Fraunhofer IWES, Germany

DESCRIPTION OF CHANGES:
Problem:

  1. In the standard Fitch wind farm parameterization, the local (grid cell) wind speed is used to calculate power and thrust. This wind speed is however reduced because of induction. Power and thrust curves (look-up tables) are determined using free inflow wind speed.
  2. The turbine thrust is a relevant metric that is not outputted.

Solution:

  1. The axial induction factor is calculated and used to correct the local (grid cell) wind speed back to the free inflow wind speed. This is done in 2 iterations. Code becomes an additional option for 'windfarm_opt=1' called windfarm_induction = 1 (default on) where 0 is old version.
  2. The turbine thrust is calculated and passed through so it can be outputted now.

LIST OF MODIFIED FILES:
M Registry/Registry.EM_COMMON
M dyn_em/module_first_rk_step_part1.F
M phys/module_pbl_driver.F
M phys/module_wind_fitch.F
A doc/licenses/fraunhofer_license.txt

TESTS CONDUCTED:

  1. Yes, demonstrated in paper: https://doi.org/10.5194/wes-9-1689-2024
  2. The regression tests have passed.

RELEASE NOTE:
Fitch wind farm parameterization: correct local (grid cell) wind speed to free wind speed using axial induction correction proposed by Vollmer et al. (2024) https://doi.org/10.5194/wes-9-1689-2024

@SengersB SengersB requested review from a team as code owners August 29, 2025 08:16
@weiwangncar
Copy link
Collaborator

@SengersB Thank you very much for your contribution to the WRF model. Your code has many many differences from the develop branch in our repository. For example, your LICENSE.txt file is different from our version. There maybe many more modified files (out of 267 files) are not part of your bug fix. Please clone the latest WRF model code, and add only the code that pertaining to the bug fix to this PR.

@SengersB
Copy link
Author

SengersB commented Sep 3, 2025

@weiwangncar Thanks for the quick response. I used the branch release-v4.7.1 as a base. Is that not correct?

@weiwangncar
Copy link
Collaborator

@SengersB Starting from WRF v4.7.1 is good. But did you really changed 267 files to implement your Fitch fix? It is unlikely. You should identify the files changed in your original code, and add them to the new release. If you started with WRFv4.7.1, the changes that are already in that version should not show up as updates. See this page for information on how to make code changes.

@weiwangncar
Copy link
Collaborator

@SengersB Is your intention to contribute your modification to our repository? Or do you plan to maintain the code in your own branch?

@SengersB
Copy link
Author

SengersB commented Sep 4, 2025

@weiwangncar I have started over fresh from release-r4.7.1 made sure my modification were added. git diff --name-only dev_AIF_r471 other/release-v4.7.1 now only gives the 5 files listed above. Pending clarification on the LICENSE.txt, I hope this is what you need to review and merge.

My intention is to contribute the modification to your repository, so to be part of the next (bugfix) release. We are not maintaining the code ourselves.
Thanks!

@weiwangncar
Copy link
Collaborator

@SengersB It still says 'Files changed 278'. See the last item on top of your PR message.

@SengersB
Copy link
Author

SengersB commented Sep 5, 2025

@weiwangncar That is compared to your branch wrf-model:develop. Should I use this branch as a base?

@weiwangncar weiwangncar changed the base branch from develop to master September 5, 2025 08:54
@weiwangncar weiwangncar changed the base branch from master to develop September 5, 2025 08:54
@weiwangncar
Copy link
Collaborator

@SengersB Our master and develop branches are the same. You should first clone the WRF repository code (make sure that code is version 4.7.1 by checking the top level README file), and then add your changes in those five files to the cloned code. Please see the page I provided early for instructions.

@SengersB SengersB reopened this Sep 8, 2025
@SengersB
Copy link
Author

SengersB commented Sep 8, 2025

@weiwangncar Alright turns out I just had to rebase.
Apologies for the oversight and the mess of closing and reopening the pull request.
Anyway, now it shows that only 5 files are changes, as intended.

Pending clarification on the LICENSE.txt, I hope this is what you need to review and merge.

@weiwangncar
Copy link
Collaborator

@SengersB Thanks, and this is what we expect to see! The regression test has passed too:

Test Type              | Expected  | Received |  Failed
= = = = = = = = = = = = = = = = = = = = = = = =  = = = =
Number of Tests        : 23           24
Number of Builds       : 60           57
Number of Simulations  : 158           150        0
Number of Comparisons  : 95           86        0

Failed Simulations are: 
None
Which comparisons are not bit-for-bit: 
None

@weiwangncar
Copy link
Collaborator

@SengersB The remaining issue is the text for license which we will have to come out of way to deal with it.

@SengersB
Copy link
Author

@weiwangncar Just checking in: is there anything I need to do?

@weiwangncar
Copy link
Collaborator

@SengersB We would like to consult our lawyers to see where we can insert your proposed license.

dudhia
dudhia previously approved these changes Dec 16, 2025
Copy link
Collaborator

@dudhia dudhia left a comment

Choose a reason for hiding this comment

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

code looks safe to add - only adds a diagnostic

@dudhia
Copy link
Collaborator

dudhia commented Dec 16, 2025

@weiwangncar did we resolve what to do with the license?

@dudhia
Copy link
Collaborator

dudhia commented Jan 27, 2026

@islas Go ahead and make the change the developer agreed to.

@islas
Copy link
Collaborator

islas commented Jan 27, 2026

@SengersB I am unable to push the fixes we discussed. Could you make sure you have the following enabled?

Maintainers are allowed to edit this pull request.

@SengersB
Copy link
Author

SengersB commented Feb 2, 2026

@islas Hmm I cannot figure out how to give you access. Steps listed here don't work: checkbox is simply missing.. Could this be due to restrictions on our side?

@islas
Copy link
Collaborator

islas commented Feb 2, 2026

@SengersB I'm not sure. I've never encountered that issue. Perhaps we can try this:

Here is a patch file with the edits that I did. You can download the file and apply it to your branch. From there you can commit & push the changes.

pr_2242_diff.txt

You can apply using git apply <filename>

@SengersB
Copy link
Author

SengersB commented Feb 5, 2026

@islas Thanks, I'll make the changes.

@weiwangncar @dudhia The last days we were advertising to some other heavy users of the wind farm parameterizations that this bug fix will hopefully be in the next WRF release. They expressed the desire to keep the original formulation (without this proposed bugfix) also available. I therefore propose to implement the bugfix as an addition option (default) in windfarm_opt.
I can code this up, add the reference to the Fraunhofer licence and push these changes.
Would this be acceptable to do this still within this pull request? My apologies for the additional work this might cause.

@dudhia
Copy link
Collaborator

dudhia commented Feb 5, 2026

I enncourage keeping the previous code as an option. I had misread this as just providing a new diagnostic thrust, but now I see it alters results. It can be done within the same PR.

@SengersB
Copy link
Author

Hi @dudhia @weiwangncar,

I added the discussed changes and pushed the updated code. In short:

  • I added a new namelist parameter 'windfarm_induction'. If turned on (1 = default), the proposed bugfix is activated; if turned off (0) the original code is used
  • I added the licensing statement around all modified lines.

Again apologies for the mess with the licensing. Hope everything is fine now and we can merge this bugfix after your checks.

Thanks, Balthazar

@dudhia
Copy link
Collaborator

dudhia commented Feb 10, 2026

OK, we need to check which automated tests failed and get back to you.

package fitchscheme windfarm_opt==1 - state:power
# THE FOLLOWING LINES OF CODE ARE LICENSED UNDER doc/licenses/fraunhofer_license.txt
package fitchscheme windfarm_opt==1 - state:power,thrust
# END LICENSE
Copy link
Collaborator

Choose a reason for hiding this comment

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

@SengersB May need a separate package line just for the variable 'thrust', since 'power' is part of the original scheme.

Copy link
Author

Choose a reason for hiding this comment

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

Agreed. I don't know the syntax on how to do this here. If this is an issue, I'd be okay with removing the licensing statement here

@weiwangncar
Copy link
Collaborator

@SengersB Your latest changes have some compilation errors:

  115 |   REAL :: a_ind
      |               1
Error: Symbol 'a_ind' at (1) already has basic type of REAL
module_wind_fitch.f90:116:17:

  116 |   REAL :: thrust1
      |                 1
Error: Symbol 'thrust1' at (1) already has basic type of REAL

@SengersB
Copy link
Author

@weiwangncar Apologies, I fixed these compilation errors now.

Unfortunately I cannot run a full test on this code, as v4.7.1 does not want to compile on our cluster and we're currently without IT support. So I had to make these changes in v4.6.1 and transfer them, but apparently missed something during the merging. I apologize again

@weiwangncar
Copy link
Collaborator

@SengersB Thanks for the fix. Now the regression test results look good:

Test Type              | Expected  | Received |  Failed
= = = = = = = = = = = = = = = = = = = = = = = =  = = = =
Number of Tests        : 23           24
Number of Builds       : 60           57
Number of Simulations  : 158           150        0
Number of Comparisons  : 95           86        0

Failed Simulations are: 
None
Which comparisons are not bit-for-bit: 
None

@weiwangncar
Copy link
Collaborator

@SengersB Can you address my comment for your registry change?

@SengersB
Copy link
Author

@weiwangncar I have now removed the licensing statement around this one line

@weiwangncar weiwangncar changed the title Fitch bug fix: axial induction factor Fitch wind farm scheme bug fix: axial induction factor Feb 13, 2026
@weiwangncar weiwangncar merged commit 7f74ddd into wrf-model:develop Feb 13, 2026
4 checks passed
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.

4 participants